From: Daniel Palmer <daniel@0x0f.com>
To: herbert@gondor.apana.org.au, davem@davemloft.net,
Jason@zx2c4.com, linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Daniel Palmer <daniel@thingy.jp>
Subject: [PATCH] lib/crypto: blake2s: Disable self test if CONFIG_CRYPTO isn't enabled
Date: Fri, 18 Apr 2025 21:02:16 +0900 [thread overview]
Message-ID: <20250418120216.2968994-1-daniel@0x0f.com> (raw)
From: Daniel Palmer <daniel@thingy.jp>
Currently CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is used to remove
the self test code. CONFIG_CRYPTO_MANAGER_DISABLE_TESTS depends on
CONFIG_CRYPTO so its impossible to disable the self test without
enabling CONFIG_CRYPTO.
If you don't want CONFIG_CRYPTO you probably don't want self tests
so remove the self tests in that case too.
Fixes: 66d7fb94e4ff ("crypto: blake2s - generic C library implementation and selftest")
Signed-off-by: Daniel Palmer <daniel@thingy.jp>
---
lib/crypto/blake2s.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/crypto/blake2s.c b/lib/crypto/blake2s.c
index 71a316552cc5..89d54e462fb5 100644
--- a/lib/crypto/blake2s.c
+++ b/lib/crypto/blake2s.c
@@ -60,7 +60,8 @@ EXPORT_SYMBOL(blake2s_final);
static int __init blake2s_mod_init(void)
{
- if (!IS_ENABLED(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS) &&
+ if (IS_ENABLED(CONFIG_CRYPTO) &&
+ !IS_ENABLED(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS) &&
WARN_ON(!blake2s_selftest()))
return -ENODEV;
return 0;
--
2.47.2
next reply other threads:[~2025-04-18 12:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-18 12:02 Daniel Palmer [this message]
2025-04-18 14:59 ` [PATCH] lib/crypto: blake2s: Disable self test if CONFIG_CRYPTO isn't enabled Eric Biggers
2025-04-20 19:56 ` Eric Biggers
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=20250418120216.2968994-1-daniel@0x0f.com \
--to=daniel@0x0f.com \
--cc=Jason@zx2c4.com \
--cc=daniel@thingy.jp \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@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