public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/crypto: blake2s: Disable self test if CONFIG_CRYPTO isn't enabled
@ 2025-04-18 12:02 Daniel Palmer
  2025-04-18 14:59 ` Eric Biggers
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Palmer @ 2025-04-18 12:02 UTC (permalink / raw)
  To: herbert, davem, Jason, linux-crypto; +Cc: linux-kernel, Daniel Palmer

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-20 19:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-18 12:02 [PATCH] lib/crypto: blake2s: Disable self test if CONFIG_CRYPTO isn't enabled Daniel Palmer
2025-04-18 14:59 ` Eric Biggers
2025-04-20 19:56   ` Eric Biggers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox