Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2549589imu; Thu, 29 Nov 2018 06:45:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vvq8OhnRuzwQR7s16a2QtlPbNEKqMzOGGcApFZR4iGflXXpMfNhX4RtMKk9s6nCa5akaXk X-Received: by 2002:a63:eb0e:: with SMTP id t14mr1467525pgh.445.1543502709420; Thu, 29 Nov 2018 06:45:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543502709; cv=none; d=google.com; s=arc-20160816; b=VQdffdh7r+WpfiOAZGhp1KixXepXIptqnwK/maMfdJf2WEFsSpYNtBHonPZ5loifhf vhlwXd+hbp0DeASF6tSvCUyKPM7Ilb/EY9pol6yQdIPV0yrW0ku4IUOH/TTJQlaLqdjA gu0ZSjbmuuwL1Tl6JPZG6CiI7VcyncY6C7InPn0tFCOnuz/r0AAQ5mqO+CfKRqRV7qFR ithPueOYPsD1WViVOSv57VZYc35fgBH79ENqs6EAFsbJCJnSIv0uU3oLaj++HNafmMzK T4oUuzFWC6RasruEi1XOsuKFhRqoob3XQFihSfANNK8sRals64Omxe6HH43jRNwlhzc2 FPfQ== 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=q3QS62MIFQUBTNlO2qw4Vk0ELQhTshDx1aMv2RLYuQY=; b=GkVTVzL8EcucvB1NNLJjcIsTH51ip8Jp1kSvpicGYX/Wdbwa720mOXEcCSdiS0dZs/ 4/W13elMgxIA+nZo41atPiAKZeBfXIUGa7fuoDd6CkcIdnPaoqJ3jmyxgrnAkvr6BKIY XokhvuJEim2/AEKey42DttWzEHNQ3FGWA7gibjZZPF5zqKwSF68rHukn1/3kkmeytqf9 8kD85czFi3bcjJoGwlw0Tt7jeaoErnDoJvpPG/OMsZmvjd1O+8/ShXanh7KOu1OX5SYU GCy4T7dgpippPtDHnvyULtquz7DziLbTlG//5b4vqL+njvJbqKNTkuwn1O45YyDvAyS1 0r1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=IyJ3205x; 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 l12si2565662plc.0.2018.11.29.06.44.54; Thu, 29 Nov 2018 06:45:09 -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=IyJ3205x; 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 S2388257AbeK3BsO (ORCPT + 99 others); Thu, 29 Nov 2018 20:48:14 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45409 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387897AbeK3BsL (ORCPT ); Thu, 29 Nov 2018 20:48:11 -0500 Received: by mail-wr1-f65.google.com with SMTP id v6so2135727wrr.12 for ; Thu, 29 Nov 2018 06:42:35 -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=q3QS62MIFQUBTNlO2qw4Vk0ELQhTshDx1aMv2RLYuQY=; b=IyJ3205xUDfFNU3DlmFXPimwCE2QVSZBSqX2XTXIInIrw8uVZ8zr3SLPoJdqjTBzq5 BYuJyuSru64u4HLrY/t3nF9/UHKJGSnfYnL1K/5MZlPa7J77FWJu/79701CU9fWq+l3Z 3tLizTyqOwucUiVyp7Ak/WaE+72gCRJ5iHegwkrqpiIP2YBp/W+iPaKx1rXWO4zaObw0 YQMLsTqWhS6u8Mp1kQAbbK7DMsg0AyuTiniRfjO7w8TfdmyXXxLfkeXS0AIXo0cxgtGJ JuZuZofT7kySqlR94fmrdH6Qtzbyqj+w8eJbezpIgCE11SUQ5WjMLzoUxUgmMzm7DLei /zKw== 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=q3QS62MIFQUBTNlO2qw4Vk0ELQhTshDx1aMv2RLYuQY=; b=AtO142wAoKBF8VevvySldMdpgdYwesH3EhH+Yqb9NhZqjRX+vstjrLcEiYb6FEJHlu TnlKd5GRMbjZA2JE5i7WckQSsH05x+KJ28AqPUioFhvCOZKmRYrh9P3tHEzFAG1EKoOh 9HGBfmgC09yI/OddE0gsC/hc3b/HeS0WL5QpZCLGMfLE2wMR/4lD0Xb9076loLAKl+h+ 6p6RLYrXahe2fOd7feK46rW5BzEdBL4H5OSySCA/e3mNhSSphj4TpwjjMqE4FXYUoZJp APmNbSaRRL826WDD3Cc+Clqa6uWfnkiAmr14IEFc0XUCv2ECDv/OL9bTqY+GLF85RkuS OBdA== X-Gm-Message-State: AA+aEWZnFkFI7uCShw4dosoQtKAibG8Jmo4MAllwtjnWKmEyq8r4lG0C P7czbaUi/1fhLL19OIp03xmagw== X-Received: by 2002:adf:a28d:: with SMTP id s13mr1782539wra.100.1543502555033; Thu, 29 Nov 2018 06:42:35 -0800 (PST) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id t131sm875406wmt.1.2018.11.29.06.42.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Nov 2018 06:42:34 -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 v5 01/11] crypto: crypto_user_stat: made crypto_user_stat optional Date: Thu, 29 Nov 2018 14:42:16 +0000 Message-Id: <1543502546-23870-2-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543502546-23870-1-git-send-email-clabbe@baylibre.com> References: <1543502546-23870-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 Even if CRYPTO_STATS is set to n, some part of CRYPTO_STATS are compiled. This patch made all part of crypto_user_stat uncompiled in that case. Signed-off-by: Corentin Labbe --- crypto/Makefile | 3 ++- crypto/algapi.c | 2 ++ include/crypto/internal/cryptouser.h | 17 +++++++++++++++++ include/linux/crypto.h | 2 ++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/crypto/Makefile b/crypto/Makefile index 5e789dc2d4fd..799ed5e94606 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -54,7 +54,8 @@ cryptomgr-y := algboss.o testmgr.o obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o obj-$(CONFIG_CRYPTO_USER) += crypto_user.o -crypto_user-y := crypto_user_base.o crypto_user_stat.o +crypto_user-y := crypto_user_base.o +crypto_user-$(CONFIG_CRYPTO_STATS) += crypto_user_stat.o obj-$(CONFIG_CRYPTO_CMAC) += cmac.o obj-$(CONFIG_CRYPTO_HMAC) += hmac.o obj-$(CONFIG_CRYPTO_VMAC) += vmac.o diff --git a/crypto/algapi.c b/crypto/algapi.c index 2545c5f89c4c..f5396c88e8cd 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -258,6 +258,7 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg) list_add(&alg->cra_list, &crypto_alg_list); list_add(&larval->alg.cra_list, &crypto_alg_list); +#ifdef CONFIG_CRYPTO_STATS atomic_set(&alg->encrypt_cnt, 0); atomic_set(&alg->decrypt_cnt, 0); atomic64_set(&alg->encrypt_tlen, 0); @@ -265,6 +266,7 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg) atomic_set(&alg->verify_cnt, 0); atomic_set(&alg->cipher_err_cnt, 0); atomic_set(&alg->sign_cnt, 0); +#endif out: return larval; diff --git a/include/crypto/internal/cryptouser.h b/include/crypto/internal/cryptouser.h index 8db299c25566..3492ab42eefb 100644 --- a/include/crypto/internal/cryptouser.h +++ b/include/crypto/internal/cryptouser.h @@ -3,6 +3,23 @@ struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact); +#ifdef CONFIG_CRYPTO_STATS int crypto_dump_reportstat(struct sk_buff *skb, struct netlink_callback *cb); int crypto_reportstat(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, struct nlattr **attrs); int crypto_dump_reportstat_done(struct netlink_callback *cb); +#else +static int crypto_dump_reportstat(struct sk_buff *skb, struct netlink_callback *cb) +{ + return -ENOTSUPP; +} + +static int crypto_reportstat(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, struct nlattr **attrs) +{ + return -ENOTSUPP; +} + +static int crypto_dump_reportstat_done(struct netlink_callback *cb) +{ + return -ENOTSUPP; +} +#endif diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 3634ad6fe202..3e05053b8d57 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -515,6 +515,7 @@ struct crypto_alg { struct module *cra_module; +#ifdef CONFIG_CRYPTO_STATS union { atomic_t encrypt_cnt; atomic_t compress_cnt; @@ -552,6 +553,7 @@ struct crypto_alg { atomic_t compute_shared_secret_cnt; }; atomic_t sign_cnt; +#endif /* CONFIG_CRYPTO_STATS */ } CRYPTO_MINALIGN_ATTR; -- 2.18.1