Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp855006imu; Tue, 20 Nov 2018 07:59:53 -0800 (PST) X-Google-Smtp-Source: AFSGD/VvcIRspkBkEKqINTxTV343V4a8OEjlb2d1UcFYMISFCSwhy3LQMhrFGQ1r9H+bT+j/DRre X-Received: by 2002:a17:902:aa84:: with SMTP id d4-v6mr2817102plr.25.1542729593543; Tue, 20 Nov 2018 07:59:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542729593; cv=none; d=google.com; s=arc-20160816; b=c0NpMzy7+K4YWZFPJk6HY7CJxgkNUDK7dpudj4UEBfHNDErZ6KB8Bt5vWseAelMvdq EukeqpVYNogtAEoiG0Rpq1d/vBmhGUAYy4Gd0LjXQlcgyEeeY3u/lgFwstj2LO1SE7gV 1RTsJfMcGq7yST9UURplWemNI2ykDmZO+FvGlkrOBtFaPPsk9oWm/zvSNmimKRepTM4I HtyTx9eghR+kMbT8Cj5BCkligMj+aEaEV3XZf0zHmOywBLjscO4mBDqY9qunY2tuiNi7 8EwPCVeK1tDg9x9JK9Tcf7RLpo7Agvk39QZlFs0xlsTEwyiHyM7f/4ZRG8rhFY7p3KzY 9IHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=DnCS1rs6b2H/3VHK6H3MQrXNsxUPLpLFhvXASv311qQ=; b=poEJbv/+JipyD8TAnFPdLz0LfCKO13d8srnDAodeEK6ryzjtghwniGHm7ejNiKnf+5 T9rt2YaICHOMXmVs9nKuk9cjd6pQpuVWQJp8e3PlWTDFh36B5NRB01o8xaUDNM2SSxJD gx3TRPklDE4Xo7XIyon4lI/Hlq1SeMR2qhOnMfTxxqT5xuGUnhlprsiudiChtK3gFTXj QwlmTOp/u2blsE9epSckmJ+j1Ys1WM+FPC6ddRQEA/9cpbin0BdrnnYySPTpfh8ZnxzA KPXA+C+Zh7S4XI4lckhMcRe3+8G+j80Xj+ylaB7gYAujtTKSxOX5/RxhQ29UJZ+8mJtx XZUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="D/VC5XpJ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12-v6si35237588pfi.286.2018.11.20.07.59.39; Tue, 20 Nov 2018 07:59:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="D/VC5XpJ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729595AbeKTXCU (ORCPT + 99 others); Tue, 20 Nov 2018 18:02:20 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:54203 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729574AbeKTXCT (ORCPT ); Tue, 20 Nov 2018 18:02:19 -0500 Received: by mail-wm1-f65.google.com with SMTP id g131so1947753wmg.3 for ; Tue, 20 Nov 2018 04:33:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DnCS1rs6b2H/3VHK6H3MQrXNsxUPLpLFhvXASv311qQ=; b=D/VC5XpJ5b6HBsD4n9YVXvC7VXA5kYe9cg8PzJeLH9siY76PyomDuEWM0dXS2Y3jqA URDRoDwFpOLKncWPuQV5hO/dHegHTBhBgwixVEzXU6Yp+3+9hQJX3APkicmLQOTpwrgv K58GlE2GqPwcLZcPhzKi/a3jfohyiqwoBPeokN8wNeFnUGTAVl6dAXQumEEBLlLGwWcw Ksy5em0QRhbmbh3jJk6virTFrEkaPsU1VRkqgwb2u4QiXwzXN2klFcapNxyddl9tp8ua nkrNCIzrwCqKTP//k8f60u6PYNLvx70KmuzLp0af5RzzmoT8eD3K2NqaprUQMBfQg7Y+ uUiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DnCS1rs6b2H/3VHK6H3MQrXNsxUPLpLFhvXASv311qQ=; b=jrLKM7aLJos2s0QoSC7QzCvZbSEZQX5yzlfS6ZOm2tNRMoFZCpTU1TNk6iF37ET+Q2 T4lsRG8sJV2os1gn8g0PPt56ZKLC2VQdFiRYhKHMiFdDkSAikPsJpMvezRm5SXbpULlm iY4wsyo9infgGWLgwcrSD32k1HDhdHY6khIBCoY5lTRykr2cmGFxxYXAYY2xH+IPLa06 9kbK2SP1AMkJc0mlgJyiKoq+svJFdb6t0DQVR3A/7A7bUZlaaFvtakommvNH9uL2WSwd WGHngEK1WQi3CaVjpw4vJzM4KkPLAxSWwzvgV7b9RnV1Tu5qusgQrGPscGGSx9SyZS2k p2MA== X-Gm-Message-State: AA+aEWbPoWXYzghcO2fXIj99FSGwQyw0cohtSpSlEIrBRdod/hCBSgX2 w4foO3NtGs5uiK4NfRNrok+0Jw== X-Received: by 2002:a1c:1c88:: with SMTP id c130-v6mr2024948wmc.115.1542717203545; Tue, 20 Nov 2018 04:33:23 -0800 (PST) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id x81sm2766951wmg.17.2018.11.20.04.33.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Nov 2018 04:33:22 -0800 (PST) From: Corentin Labbe To: davem@davemloft.net, ebiggers@kernel.org, herbert@gondor.apana.org.au, nhorman@tuxdriver.com Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Corentin Labbe Subject: [PATCH v3 04/10] crypto: crypto_user_stat: split user space crypto stat structures Date: Tue, 20 Nov 2018 12:32:20 +0000 Message-Id: <1542717146-34917-5-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542717146-34917-1-git-send-email-clabbe@baylibre.com> References: <1542717146-34917-1-git-send-email-clabbe@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is cleaner to have each stat in their own structures. Signed-off-by: Corentin Labbe --- crypto/crypto_user_stat.c | 20 +++---- include/uapi/linux/cryptouser.h | 100 ++++++++++++++++++++------------ 2 files changed, 72 insertions(+), 48 deletions(-) diff --git a/crypto/crypto_user_stat.c b/crypto/crypto_user_stat.c index 352569f378a0..3c14be2f7a1b 100644 --- a/crypto/crypto_user_stat.c +++ b/crypto/crypto_user_stat.c @@ -33,7 +33,7 @@ struct crypto_dump_info { static int crypto_report_aead(struct sk_buff *skb, struct crypto_alg *alg) { - struct crypto_stat raead; + struct crypto_stat_aead raead; u64 v64; memset(&raead, 0, sizeof(raead)); @@ -56,7 +56,7 @@ static int crypto_report_aead(struct sk_buff *skb, struct crypto_alg *alg) static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg) { - struct crypto_stat rcipher; + struct crypto_stat_cipher rcipher; u64 v64; memset(&rcipher, 0, sizeof(rcipher)); @@ -79,7 +79,7 @@ static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg) static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg) { - struct crypto_stat rcomp; + struct crypto_stat_compress rcomp; u64 v64; memset(&rcomp, 0, sizeof(rcomp)); @@ -101,7 +101,7 @@ static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg) static int crypto_report_acomp(struct sk_buff *skb, struct crypto_alg *alg) { - struct crypto_stat racomp; + struct crypto_stat_compress racomp; u64 v64; memset(&racomp, 0, sizeof(racomp)); @@ -123,7 +123,7 @@ static int crypto_report_acomp(struct sk_buff *skb, struct crypto_alg *alg) static int crypto_report_akcipher(struct sk_buff *skb, struct crypto_alg *alg) { - struct crypto_stat rakcipher; + struct crypto_stat_akcipher rakcipher; u64 v64; memset(&rakcipher, 0, sizeof(rakcipher)); @@ -150,7 +150,7 @@ static int crypto_report_akcipher(struct sk_buff *skb, struct crypto_alg *alg) static int crypto_report_kpp(struct sk_buff *skb, struct crypto_alg *alg) { - struct crypto_stat rkpp; + struct crypto_stat_kpp rkpp; u64 v; memset(&rkpp, 0, sizeof(rkpp)); @@ -171,7 +171,7 @@ static int crypto_report_kpp(struct sk_buff *skb, struct crypto_alg *alg) static int crypto_report_ahash(struct sk_buff *skb, struct crypto_alg *alg) { - struct crypto_stat rhash; + struct crypto_stat_hash rhash; u64 v64; memset(&rhash, 0, sizeof(rhash)); @@ -190,7 +190,7 @@ static int crypto_report_ahash(struct sk_buff *skb, struct crypto_alg *alg) static int crypto_report_shash(struct sk_buff *skb, struct crypto_alg *alg) { - struct crypto_stat rhash; + struct crypto_stat_hash rhash; u64 v64; memset(&rhash, 0, sizeof(rhash)); @@ -209,7 +209,7 @@ static int crypto_report_shash(struct sk_buff *skb, struct crypto_alg *alg) static int crypto_report_rng(struct sk_buff *skb, struct crypto_alg *alg) { - struct crypto_stat rrng; + struct crypto_stat_rng rrng; u64 v64; memset(&rrng, 0, sizeof(rrng)); @@ -248,7 +248,7 @@ static int crypto_reportstat_one(struct crypto_alg *alg, if (nla_put_u32(skb, CRYPTOCFGA_PRIORITY_VAL, alg->cra_priority)) goto nla_put_failure; if (alg->cra_flags & CRYPTO_ALG_LARVAL) { - struct crypto_stat rl; + struct crypto_stat_larval rl; memset(&rl, 0, sizeof(rl)); strscpy(rl.type, "larval", sizeof(rl.type)); diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h index 9f8187077ce4..3a70f025e27d 100644 --- a/include/uapi/linux/cryptouser.h +++ b/include/uapi/linux/cryptouser.h @@ -76,45 +76,69 @@ struct crypto_user_alg { __u32 cru_flags; }; -struct crypto_stat { - char type[CRYPTO_MAX_NAME]; - union { - __u64 stat_encrypt_cnt; - __u64 stat_compress_cnt; - __u64 stat_generate_cnt; - __u64 stat_hash_cnt; - __u64 stat_setsecret_cnt; - }; - union { - __u64 stat_encrypt_tlen; - __u64 stat_compress_tlen; - __u64 stat_generate_tlen; - __u64 stat_hash_tlen; - }; - union { - __u64 stat_akcipher_err_cnt; - __u64 stat_cipher_err_cnt; - __u64 stat_compress_err_cnt; - __u64 stat_aead_err_cnt; - __u64 stat_hash_err_cnt; - __u64 stat_rng_err_cnt; - __u64 stat_kpp_err_cnt; - }; - union { - __u64 stat_decrypt_cnt; - __u64 stat_decompress_cnt; - __u64 stat_seed_cnt; - __u64 stat_generate_public_key_cnt; - }; - union { - __u64 stat_decrypt_tlen; - __u64 stat_decompress_tlen; - }; - union { - __u64 stat_verify_cnt; - __u64 stat_compute_shared_secret_cnt; - }; +struct crypto_stat_aead { + char type[CRYPTO_MAX_NAME]; + __u64 stat_encrypt_cnt; + __u64 stat_encrypt_tlen; + __u64 stat_decrypt_cnt; + __u64 stat_decrypt_tlen; + __u64 stat_aead_err_cnt; +}; + +struct crypto_stat_akcipher { + char type[CRYPTO_MAX_NAME]; + __u64 stat_encrypt_cnt; + __u64 stat_encrypt_tlen; + __u64 stat_decrypt_cnt; + __u64 stat_decrypt_tlen; + __u64 stat_verify_cnt; __u64 stat_sign_cnt; + __u64 stat_akcipher_err_cnt; +}; + +struct crypto_stat_cipher { + char type[CRYPTO_MAX_NAME]; + __u64 stat_encrypt_cnt; + __u64 stat_encrypt_tlen; + __u64 stat_decrypt_cnt; + __u64 stat_decrypt_tlen; + __u64 stat_cipher_err_cnt; +}; + +struct crypto_stat_compress { + char type[CRYPTO_MAX_NAME]; + __u64 stat_compress_cnt; + __u64 stat_compress_tlen; + __u64 stat_decompress_cnt; + __u64 stat_decompress_tlen; + __u64 stat_compress_err_cnt; +}; + +struct crypto_stat_hash { + char type[CRYPTO_MAX_NAME]; + __u64 stat_hash_cnt; + __u64 stat_hash_tlen; + __u64 stat_hash_err_cnt; +}; + +struct crypto_stat_kpp { + char type[CRYPTO_MAX_NAME]; + __u64 stat_setsecret_cnt; + __u64 stat_generate_public_key_cnt; + __u64 stat_compute_shared_secret_cnt; + __u64 stat_kpp_err_cnt; +}; + +struct crypto_stat_rng { + char type[CRYPTO_MAX_NAME]; + __u64 stat_generate_cnt; + __u64 stat_generate_tlen; + __u64 stat_seed_cnt; + __u64 stat_rng_err_cnt; +}; + +struct crypto_stat_larval { + char type[CRYPTO_MAX_NAME]; }; struct crypto_report_larval { -- 2.18.1