Commit 17ec3e71 authored by Herbert Xu's avatar Herbert Xu
Browse files

crypto: lib/Kconfig - Hide arch options from user



The ARCH_MAY_HAVE patch missed arm64, mips and s390.  But it may
also lead to arch options being enabled but ineffective because
of modular/built-in conflicts.

As the primary user of all these options wireguard is selecting
the arch options anyway, make the same selections at the lib/crypto
option level and hide the arch options from the user.

Instead of selecting them centrally from lib/crypto, simply set
the default of each arch option as suggested by Eric Biggers.

Change the Crypto API generic algorithms to select the top-level
lib/crypto options instead of the generic one as otherwise there
is no way to enable the arch options (Eric Biggers).  Introduce a
set of INTERNAL options to work around dependency cycles on the
CONFIG_CRYPTO symbol.

Fixes: 1047e21a ("crypto: lib/Kconfig - Fix lib built-in failure when arch is modular")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarArnd Bergmann <arnd@kernel.org>
Closes: https://lore.kernel.org/oe-kbuild-all/202502232152.JC84YDLp-lkp@intel.com/


Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent f79d2d28
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -3,10 +3,12 @@
menu "Accelerated Cryptographic Algorithms for CPU (arm)"

config CRYPTO_CURVE25519_NEON
	tristate "Public key crypto: Curve25519 (NEON)"
	tristate
	depends on KERNEL_MODE_NEON
	select CRYPTO_KPP
	select CRYPTO_LIB_CURVE25519_GENERIC
	select CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519
	select CRYPTO_ARCH_HAVE_LIB_CURVE25519
	default CRYPTO_LIB_CURVE25519_INTERNAL
	help
	  Curve25519 algorithm

@@ -45,9 +47,10 @@ config CRYPTO_NHPOLY1305_NEON
	  - NEON (Advanced SIMD) extensions

config CRYPTO_POLY1305_ARM
	tristate "Hash functions: Poly1305 (NEON)"
	tristate
	select CRYPTO_HASH
	select CRYPTO_ARCH_MAY_HAVE_LIB_POLY1305
	select CRYPTO_ARCH_HAVE_LIB_POLY1305
	default CRYPTO_LIB_POLY1305_INTERNAL
	help
	  Poly1305 authenticator algorithm (RFC7539)

@@ -212,9 +215,10 @@ config CRYPTO_AES_ARM_CE
	  - ARMv8 Crypto Extensions

config CRYPTO_CHACHA20_NEON
	tristate "Ciphers: ChaCha20, XChaCha20, XChaCha12 (NEON)"
	tristate
	select CRYPTO_SKCIPHER
	select CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA
	select CRYPTO_ARCH_HAVE_LIB_CHACHA
	default CRYPTO_LIB_CHACHA_INTERNAL
	help
	  Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12
	  stream cipher algorithms
+4 −2
Original line number Diff line number Diff line
@@ -26,10 +26,11 @@ config CRYPTO_NHPOLY1305_NEON
	  - NEON (Advanced SIMD) extensions

config CRYPTO_POLY1305_NEON
	tristate "Hash functions: Poly1305 (NEON)"
	tristate
	depends on KERNEL_MODE_NEON
	select CRYPTO_HASH
	select CRYPTO_ARCH_HAVE_LIB_POLY1305
	default CRYPTO_LIB_POLY1305_INTERNAL
	help
	  Poly1305 authenticator algorithm (RFC7539)

@@ -186,11 +187,12 @@ config CRYPTO_AES_ARM64_NEON_BLK
	  - NEON (Advanced SIMD) extensions

config CRYPTO_CHACHA20_NEON
	tristate "Ciphers: ChaCha (NEON)"
	tristate
	depends on KERNEL_MODE_NEON
	select CRYPTO_SKCIPHER
	select CRYPTO_LIB_CHACHA_GENERIC
	select CRYPTO_ARCH_HAVE_LIB_CHACHA
	default CRYPTO_LIB_CHACHA_INTERNAL
	help
	  Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12
	  stream cipher algorithms
+5 −2
Original line number Diff line number Diff line
@@ -3,9 +3,11 @@
menu "Accelerated Cryptographic Algorithms for CPU (mips)"

config CRYPTO_POLY1305_MIPS
	tristate "Hash functions: Poly1305"
	tristate
	depends on MIPS
	select CRYPTO_HASH
	select CRYPTO_ARCH_HAVE_LIB_POLY1305
	default CRYPTO_LIB_POLY1305_INTERNAL
	help
	  Poly1305 authenticator algorithm (RFC7539)

@@ -52,10 +54,11 @@ config CRYPTO_SHA512_OCTEON
	  Architecture: mips OCTEON using crypto instructions, when available

config CRYPTO_CHACHA_MIPS
	tristate "Ciphers: ChaCha20, XChaCha20, XChaCha12 (MIPS32r2)"
	tristate
	depends on CPU_MIPS32_R2
	select CRYPTO_SKCIPHER
	select CRYPTO_ARCH_HAVE_LIB_CHACHA
	default CRYPTO_LIB_CHACHA_INTERNAL
	help
	  Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12
	  stream cipher algorithms
+7 −4
Original line number Diff line number Diff line
@@ -3,10 +3,12 @@
menu "Accelerated Cryptographic Algorithms for CPU (powerpc)"

config CRYPTO_CURVE25519_PPC64
	tristate "Public key crypto: Curve25519 (PowerPC64)"
	tristate
	depends on PPC64 && CPU_LITTLE_ENDIAN
	select CRYPTO_KPP
	select CRYPTO_LIB_CURVE25519_GENERIC
	select CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519
	select CRYPTO_ARCH_HAVE_LIB_CURVE25519
	default CRYPTO_LIB_CURVE25519_INTERNAL
	help
	  Curve25519 algorithm

@@ -91,11 +93,12 @@ config CRYPTO_AES_GCM_P10
	  later CPU. This module supports stitched acceleration for AES/GCM.

config CRYPTO_CHACHA20_P10
	tristate "Ciphers: ChaCha20, XChacha20, XChacha12 (P10 or later)"
	tristate
	depends on PPC64 && CPU_LITTLE_ENDIAN && VSX
	select CRYPTO_SKCIPHER
	select CRYPTO_LIB_CHACHA_GENERIC
	select CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA
	select CRYPTO_ARCH_HAVE_LIB_CHACHA
	default CRYPTO_LIB_CHACHA_INTERNAL
	help
	  Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12
	  stream cipher algorithms
+0 −1
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ config CRYPTO_CHACHA_RISCV64
	tristate "Ciphers: ChaCha"
	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
	select CRYPTO_SKCIPHER
	select CRYPTO_LIB_CHACHA_GENERIC
	help
	  Length-preserving ciphers: ChaCha20 stream cipher algorithm

Loading