crypto: cryptomgr - Select algorithm types only when CRYPTO_SELFTESTS
PATCH v3 1/1 crypto: cryptomgr - Select algorithm types only when CRYPTO_SELFTESTS
Enabling any template selects CRYPTO_MANAGER, which causes CRYPTO_MANAGER2 to enable itself, which selects every algorithm type option. However, pulling in all algorithm types is needed only when the self-tests are enabled. So condition the selections accordingly.
To make this possible, also add the missing selections to various symbols that were relying on transitive selections via CRYPTO_MANAGER.
---
This patch is targeting cryptodev/master
v3: addressed more transitive selections
v2: add selections to options that were relying on transitive selection
crypto/Kconfig | 26 ++++++++++++++++++-------- drivers/crypto/Kconfig | 1 + drivers/crypto/allwinner/Kconfig | 2 ++ drivers/crypto/intel/qat/Kconfig | 1 + 4 files changed, 22 insertions(+), 8 deletions(-)
crypto/Kconfig +18 -8
@@ -155,18 +155,18 @@ config CRYPTO_MANAGER 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) - select CRYPTO_ACOMP2 - select CRYPTO_AEAD2 - select CRYPTO_AKCIPHER2 - select CRYPTO_SIG2 - select CRYPTO_HASH2 - select CRYPTO_KPP2 - select CRYPTO_RNG2 - select CRYPTO_SKCIPHER2 + select CRYPTO_ACOMP2 if CRYPTO_SELFTESTS + select CRYPTO_AEAD2 if CRYPTO_SELFTESTS + select CRYPTO_AKCIPHER2 if CRYPTO_SELFTESTS + select CRYPTO_SIG2 if CRYPTO_SELFTESTS + select CRYPTO_HASH2 if CRYPTO_SELFTESTS + select CRYPTO_KPP2 if CRYPTO_SELFTESTS + select CRYPTO_RNG2 if CRYPTO_SELFTESTS + select CRYPTO_SKCIPHER2 if CRYPTO_SELFTESTS config CRYPTO_USER tristate "Userspace cryptographic algorithm configuration" depends on NET select CRYPTO_MANAGER
@@ -222,10 +222,11 @@ config CRYPTO_PCRYPT This converts an arbitrary crypto algorithm into a parallel algorithm that executes in kernel threads. config CRYPTO_CRYPTD tristate "Software async crypto daemon" + select CRYPTO_AEAD select CRYPTO_SKCIPHER select CRYPTO_HASH select CRYPTO_MANAGER help This is a generic software asynchronous crypto daemon that
@@ -255,24 +256,33 @@ config CRYPTO_KRB5ENC sunrpc/NFS and rxrpc/AFS. config CRYPTO_BENCHMARK tristate "Crypto benchmarking module" depends on m || EXPERT + select CRYPTO_AEAD + select CRYPTO_HASH select CRYPTO_MANAGER + select CRYPTO_SKCIPHER help Quick & dirty crypto benchmarking module. This is mainly intended for use by people developing cryptographic algorithms in the kernel. It should not be enabled in production kernels. config CRYPTO_SIMD tristate + select CRYPTO_AEAD select CRYPTO_CRYPTD config CRYPTO_ENGINE tristate + select CRYPTO_AEAD + select CRYPTO_AKCIPHER + select CRYPTO_HASH + select CRYPTO_KPP + select CRYPTO_SKCIPHER endmenu menu "Public-key cryptography"
drivers/crypto/Kconfig +1 -0
@@ -299,10 +299,11 @@ config CRYPTO_DEV_PPC4XX select CRYPTO_AES select CRYPTO_LIB_AES select CRYPTO_CCM select CRYPTO_CTR select CRYPTO_GCM + select CRYPTO_RNG select CRYPTO_SKCIPHER help This option allows you to have support for AMCC crypto acceleration. config HW_RANDOM_PPC4XX
drivers/crypto/allwinner/Kconfig +2 -0
@@ -12,10 +12,11 @@ config CRYPTO_DEV_SUN4I_SS depends on CRYPTO_DEV_ALLWINNER select CRYPTO_MD5 select CRYPTO_SHA1 select CRYPTO_AES select CRYPTO_LIB_DES + select CRYPTO_RNG select CRYPTO_SKCIPHER help Some Allwinner SoC have a crypto accelerator named Security System. Select this if you want to use it. The Security System handle AES/DES/3DES ciphers in CBC mode
@@ -47,10 +48,11 @@ config CRYPTO_DEV_SUN8I_CE select CRYPTO_ENGINE select CRYPTO_ECB select CRYPTO_CBC select CRYPTO_AES select CRYPTO_DES + select CRYPTO_RNG depends on CRYPTO_DEV_ALLWINNER depends on PM help Select y here to have support for the crypto Engine available on Allwinner SoC H2+, H3, H5, H6, R40 and A64.
drivers/crypto/intel/qat/Kconfig +1 -0
@@ -1,8 +1,9 @@ # SPDX-License-Identifier: GPL-2.0-only config CRYPTO_DEV_QAT tristate + select CRYPTO_ACOMP select CRYPTO_AEAD select CRYPTO_AUTHENC select CRYPTO_SKCIPHER select CRYPTO_AKCIPHER select CRYPTO_DH
base-commit: f9bbd547cfb98b1c5e535aab9b0671a2ff22453a
Signature · 1 line
2.53.0
Quoted 8 lines · Eric Biggers
Enabling any template selects
CRYPTO_MANAGER, which causesCRYPTO_MANAGER2to enable itself, which selects every algorithm type option. However, pulling in all algorithm types is needed only when the self-tests are enabled. So condition the selections accordingly.To make this possible, also add the missing selections to various symbols that were relying on transitive selections via
CRYPTO_MANAGER.
Quoted 7 lines
Signed-off-by Eric Biggers <[email protected]>---
This patch is targeting cryptodev/master
v3: addressed more transitive selections
v2: add selections to options that were relying on transitive selection
Looks like CRYPTO_USER needs 'select CRYPTO_RNG' too, since otherwise CRYPTO_RNG=m && CRYPTO_USER=y && CRYPTO_SELFTESTS=n breaks the build.
Though oddly enough crypto_del_default_rng() has an unused stub, which implies that it may have been intended to be optional.
- Eric