From patchwork Mon Nov 19 19:53:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 10689375 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2C30C6C5 for ; Mon, 19 Nov 2018 19:54:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C9962A2E8 for ; Mon, 19 Nov 2018 19:54:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10F4F2A32C; Mon, 19 Nov 2018 19:54:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B49E2A2E8 for ; Mon, 19 Nov 2018 19:54:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730116AbeKTGSw (ORCPT ); Tue, 20 Nov 2018 01:18:52 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:40379 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726397AbeKTGSu (ORCPT ); Tue, 20 Nov 2018 01:18:50 -0500 Received: by mail-wm1-f65.google.com with SMTP id q26so6461288wmf.5 for ; Mon, 19 Nov 2018 11:53:39 -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=Jnh3ZNR/Fcg+7gTBnx75uTTp6wDqPloHA9MJBWzeT3M=; b=wS5UPwp8aX0dDRTEokwMnx6RKskiZEysjBl7k9qWiIPj3jzEnZd0dtFRqQ4DJsDq3T /02NXB37XYCsooWnx3Vdc/2imjcfeG83eeu/A78AclgghT1MArAwNkskK8yq1+l/TmmC XhVpx/m4xCVDbzdklQNImOKnxeGtn28iK2PFHRUy9Ao0mLcgD9YwR/NxDAGZaSE7DbrX vUbEW+Xt1FgUQU8KrCqfKQdN1crBpIH+wabGWKb7OutU1id4H7CtNK/y5ty0daXs2jKs JERpiXXLTySxFX7p7QB9ns5tuF4aBzJg51Yi9Sq3nHottaKCNM+6EtoGMGd2f8hGpWZ8 FoSg== 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=Jnh3ZNR/Fcg+7gTBnx75uTTp6wDqPloHA9MJBWzeT3M=; b=g9JJt9It0wgKq1mUsD/i7+/O5727u6bpXYMv0gl7TOCWx6uHVomJfLK0dU+fyWLuUt WCKD+2Qu76sUH9BsUz5CFui9cOSx1wQDg2+iWI4PEL6ioKqaD5FlYNjUdpQrCseOC6jW D8CVShSj2xyjjYMoA59BvoUYThdNN7Bi55Rrjmsp4ptXknZkN+ee9bMKQlq9ZmXdhbMh s3+3ZSR7abb7SjkkRDVFxnZqzmh0DxY52FM0f/vqkhm0RxCFkVpZt9f8BW56CcWqb6JL zZXt4lHM3WeG7x0UL2b+w25uUyOtIhnJRrMVg+t3EUBTTZLL600+AGsihw4C0U8h8G3e mZvA== X-Gm-Message-State: AA+aEWZFT/oPvTXQ/yDN7GNhAZwSIP33si81vXPrwYG7lurh/0NT0vaP LicliEpQm5vxqea3Pgo8DU3vKg== X-Google-Smtp-Source: AJdET5es0eUjkSB08eugl2wCxgB8mmEwRdfRMha8bUwiqRvPlkGZq3/WoXsd7R9UYmvHyJVYhru95A== X-Received: by 2002:a1c:ca02:: with SMTP id a2mr8298468wmg.139.1542657218501; Mon, 19 Nov 2018 11:53:38 -0800 (PST) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id i16sm22954132wmd.28.2018.11.19.11.53.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Nov 2018 11:53:37 -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 v2 02/11] crypto: crypto_user_stat: made crypto_user_stat optional Date: Mon, 19 Nov 2018 19:53:21 +0000 Message-Id: <1542657210-37739-3-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542657210-37739-1-git-send-email-clabbe@baylibre.com> References: <1542657210-37739-1-git-send-email-clabbe@baylibre.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 abbd86fdbad2..22f9f84f961d 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 ac8f4168a831..9dc8d50dc578 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;