]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: testmgr - enable CRYPTO_MANAGER when CRYPTO_SELFTESTS
authorEric Biggers <ebiggers@google.com>
Mon, 5 May 2025 20:33:45 +0000 (13:33 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 12 May 2025 05:34:04 +0000 (13:34 +0800)
crypto/testmgr.c is compiled only when CRYPTO_MANAGER is enabled.  To
make CRYPTO_SELFTESTS work as expected when CRYPTO_MANAGER doesn't get
enabled for another reason, automatically set CRYPTO_MANAGER to the
value of CRYPTO_ALGAPI when CRYPTO_SELFTESTS is enabled.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/Kconfig
crypto/algapi.c

index 50f6e285b92ab7bcbaa5267bc142822d0c718a74..e9fee7818e270652470ca3d3b1ad5d9f99048874 100644 (file)
@@ -149,10 +149,11 @@ config CRYPTO_HKDF
 
 config CRYPTO_MANAGER
        tristate
+       default CRYPTO_ALGAPI if CRYPTO_SELFTESTS
        select CRYPTO_MANAGER2
        help
-         Create default cryptographic template instantiations such as
-         cbc(aes).
+         This provides the support for instantiating templates such as
+         cbc(aes), and the support for the crypto self-tests.
 
 config CRYPTO_MANAGER2
        def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y)
index 9030a30c89e84aa02a4105d30aa87330c38edcac..25b5519e3b711545929a709964ab5036eb85608b 100644 (file)
@@ -274,8 +274,7 @@ static struct crypto_larval *crypto_alloc_test_larval(struct crypto_alg *alg)
 {
        struct crypto_larval *larval;
 
-       if (!IS_ENABLED(CONFIG_CRYPTO_MANAGER) ||
-           !IS_ENABLED(CONFIG_CRYPTO_SELFTESTS) ||
+       if (!IS_ENABLED(CONFIG_CRYPTO_SELFTESTS) ||
            (alg->cra_flags & CRYPTO_ALG_INTERNAL))
                return NULL; /* No self-test needed */