linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Subject: [PATCH v2 6/6] crypto: compile out test-related algboss code when tests disabled
Date: Thu, 10 Nov 2022 00:13:46 -0800	[thread overview]
Message-ID: <20221110081346.336046-7-ebiggers@kernel.org> (raw)
In-Reply-To: <20221110081346.336046-1-ebiggers@kernel.org>

From: Eric Biggers <ebiggers@google.com>

When CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is set, the code in algboss.c
that handles CRYPTO_MSG_ALG_REGISTER is unnecessary, so make it be
compiled out.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 crypto/algboss.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/crypto/algboss.c b/crypto/algboss.c
index 13d37320a66eb..f3c6c9fe133d5 100644
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -171,15 +171,17 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
 	return NOTIFY_OK;
 }
 
+#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
+static int cryptomgr_schedule_test(struct crypto_alg *alg)
+{
+	return NOTIFY_DONE;
+}
+#else
 static int cryptomgr_test(void *data)
 {
 	struct crypto_test_param *param = data;
 	u32 type = param->type;
-	int err = 0;
-
-#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
-	goto skiptest;
-#endif
+	int err;
 
 	err = alg_test(param->driver, param->alg, type, CRYPTO_ALG_TESTED);
 
@@ -218,6 +220,7 @@ static int cryptomgr_schedule_test(struct crypto_alg *alg)
 err:
 	return NOTIFY_OK;
 }
+#endif /* !CONFIG_CRYPTO_MANAGER_DISABLE_TESTS */
 
 static int cryptomgr_notify(struct notifier_block *this, unsigned long msg,
 			    void *data)
-- 
2.38.1


  parent reply	other threads:[~2022-11-10  8:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10  8:13 [PATCH v2 0/6] crypto: reduce overhead when self-tests disabled Eric Biggers
2022-11-10  8:13 ` [PATCH v2 1/6] crypto: optimize algorithm registration " Eric Biggers
2022-11-10 19:42   ` Eric Biggers
2022-11-11  4:06   ` Herbert Xu
2022-11-10  8:13 ` [PATCH v2 2/6] crypto: optimize registration of internal algorithms Eric Biggers
2022-11-10  8:13 ` [PATCH v2 3/6] crypto: compile out crypto_boot_test_finished when tests disabled Eric Biggers
2022-11-10  8:13 ` [PATCH v2 4/6] crypto: skip kdf_sp800108 self-test " Eric Biggers
2022-11-10  8:13 ` [PATCH v2 5/6] crypto: silence noisy kdf_sp800108 self-test Eric Biggers
2022-11-10  8:13 ` Eric Biggers [this message]
2022-11-11  4:14   ` [PATCH v2 6/6] crypto: compile out test-related algboss code when tests disabled Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221110081346.336046-7-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).