Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 1047e21aecdf ("crypto: lib/Kconfig - Fix lib built-in failure when arch is modular")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Arnd Bergmann <arnd@kernel.org>
Closes: https://lore.kernel.org/oe-kbuild-all/202502232152.JC84YDLp-lkp@intel.com/
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+63 -45
+10 -6
arch/arm/crypto/Kconfig
··· 3 3 menu "Accelerated Cryptographic Algorithms for CPU (arm)" 4 4 5 5 config CRYPTO_CURVE25519_NEON 6 - tristate "Public key crypto: Curve25519 (NEON)" 6 + tristate 7 7 depends on KERNEL_MODE_NEON 8 + select CRYPTO_KPP 8 9 select CRYPTO_LIB_CURVE25519_GENERIC 9 - select CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519 10 + select CRYPTO_ARCH_HAVE_LIB_CURVE25519 11 + default CRYPTO_LIB_CURVE25519_INTERNAL 10 12 help 11 13 Curve25519 algorithm 12 14 ··· 47 45 - NEON (Advanced SIMD) extensions 48 46 49 47 config CRYPTO_POLY1305_ARM 50 - tristate "Hash functions: Poly1305 (NEON)" 48 + tristate 51 49 select CRYPTO_HASH 52 - select CRYPTO_ARCH_MAY_HAVE_LIB_POLY1305 50 + select CRYPTO_ARCH_HAVE_LIB_POLY1305 51 + default CRYPTO_LIB_POLY1305_INTERNAL 53 52 help 54 53 Poly1305 authenticator algorithm (RFC7539) 55 54 ··· 215 212 - ARMv8 Crypto Extensions 216 213 217 214 config CRYPTO_CHACHA20_NEON 218 - tristate "Ciphers: ChaCha20, XChaCha20, XChaCha12 (NEON)" 215 + tristate 219 216 select CRYPTO_SKCIPHER 220 - select CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA 217 + select CRYPTO_ARCH_HAVE_LIB_CHACHA 218 + default CRYPTO_LIB_CHACHA_INTERNAL 221 219 help 222 220 Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 223 221 stream cipher algorithms
+4 -2
arch/arm64/crypto/Kconfig
··· 26 26 - NEON (Advanced SIMD) extensions 27 27 28 28 config CRYPTO_POLY1305_NEON 29 - tristate "Hash functions: Poly1305 (NEON)" 29 + tristate 30 30 depends on KERNEL_MODE_NEON 31 31 select CRYPTO_HASH 32 32 select CRYPTO_ARCH_HAVE_LIB_POLY1305 33 + default CRYPTO_LIB_POLY1305_INTERNAL 33 34 help 34 35 Poly1305 authenticator algorithm (RFC7539) 35 36 ··· 187 186 - NEON (Advanced SIMD) extensions 188 187 189 188 config CRYPTO_CHACHA20_NEON 190 - tristate "Ciphers: ChaCha (NEON)" 189 + tristate 191 190 depends on KERNEL_MODE_NEON 192 191 select CRYPTO_SKCIPHER 193 192 select CRYPTO_LIB_CHACHA_GENERIC 194 193 select CRYPTO_ARCH_HAVE_LIB_CHACHA 194 + default CRYPTO_LIB_CHACHA_INTERNAL 195 195 help 196 196 Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 197 197 stream cipher algorithms
+5 -2
arch/mips/crypto/Kconfig
··· 3 3 menu "Accelerated Cryptographic Algorithms for CPU (mips)" 4 4 5 5 config CRYPTO_POLY1305_MIPS 6 - tristate "Hash functions: Poly1305" 6 + tristate 7 7 depends on MIPS 8 + select CRYPTO_HASH 8 9 select CRYPTO_ARCH_HAVE_LIB_POLY1305 10 + default CRYPTO_LIB_POLY1305_INTERNAL 9 11 help 10 12 Poly1305 authenticator algorithm (RFC7539) 11 13 ··· 54 52 Architecture: mips OCTEON using crypto instructions, when available 55 53 56 54 config CRYPTO_CHACHA_MIPS 57 - tristate "Ciphers: ChaCha20, XChaCha20, XChaCha12 (MIPS32r2)" 55 + tristate 58 56 depends on CPU_MIPS32_R2 59 57 select CRYPTO_SKCIPHER 60 58 select CRYPTO_ARCH_HAVE_LIB_CHACHA 59 + default CRYPTO_LIB_CHACHA_INTERNAL 61 60 help 62 61 Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 63 62 stream cipher algorithms
+7 -4
arch/powerpc/crypto/Kconfig
··· 3 3 menu "Accelerated Cryptographic Algorithms for CPU (powerpc)" 4 4 5 5 config CRYPTO_CURVE25519_PPC64 6 - tristate "Public key crypto: Curve25519 (PowerPC64)" 6 + tristate 7 7 depends on PPC64 && CPU_LITTLE_ENDIAN 8 + select CRYPTO_KPP 8 9 select CRYPTO_LIB_CURVE25519_GENERIC 9 - select CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519 10 + select CRYPTO_ARCH_HAVE_LIB_CURVE25519 11 + default CRYPTO_LIB_CURVE25519_INTERNAL 10 12 help 11 13 Curve25519 algorithm 12 14 ··· 93 91 later CPU. This module supports stitched acceleration for AES/GCM. 94 92 95 93 config CRYPTO_CHACHA20_P10 96 - tristate "Ciphers: ChaCha20, XChacha20, XChacha12 (P10 or later)" 94 + tristate 97 95 depends on PPC64 && CPU_LITTLE_ENDIAN && VSX 98 96 select CRYPTO_SKCIPHER 99 97 select CRYPTO_LIB_CHACHA_GENERIC 100 - select CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA 98 + select CRYPTO_ARCH_HAVE_LIB_CHACHA 99 + default CRYPTO_LIB_CHACHA_INTERNAL 101 100 help 102 101 Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 103 102 stream cipher algorithms
-1
arch/riscv/crypto/Kconfig
··· 22 22 tristate "Ciphers: ChaCha" 23 23 depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO 24 24 select CRYPTO_SKCIPHER 25 - select CRYPTO_LIB_CHACHA_GENERIC 26 25 help 27 26 Length-preserving ciphers: ChaCha20 stream cipher algorithm 28 27
+2 -1
arch/s390/crypto/Kconfig
··· 108 108 As of z196 the CTR mode is hardware accelerated. 109 109 110 110 config CRYPTO_CHACHA_S390 111 - tristate "Ciphers: ChaCha20" 111 + tristate 112 112 depends on S390 113 113 select CRYPTO_SKCIPHER 114 114 select CRYPTO_LIB_CHACHA_GENERIC 115 115 select CRYPTO_ARCH_HAVE_LIB_CHACHA 116 + default CRYPTO_LIB_CHACHA_INTERNAL 116 117 help 117 118 Length-preserving cipher: ChaCha20 stream cipher (RFC 7539) 118 119
+11 -6
arch/x86/crypto/Kconfig
··· 3 3 menu "Accelerated Cryptographic Algorithms for CPU (x86)" 4 4 5 5 config CRYPTO_CURVE25519_X86 6 - tristate "Public key crypto: Curve25519 (ADX)" 6 + tristate 7 7 depends on X86 && 64BIT 8 + select CRYPTO_KPP 8 9 select CRYPTO_LIB_CURVE25519_GENERIC 9 - select CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519 10 + select CRYPTO_ARCH_HAVE_LIB_CURVE25519 11 + default CRYPTO_LIB_CURVE25519_INTERNAL 10 12 help 11 13 Curve25519 algorithm 12 14 ··· 350 348 Processes 64 blocks in parallel. 351 349 352 350 config CRYPTO_CHACHA20_X86_64 353 - tristate "Ciphers: ChaCha20, XChaCha20, XChaCha12 (SSSE3/AVX2/AVX-512VL)" 351 + tristate 354 352 depends on X86 && 64BIT 355 353 select CRYPTO_SKCIPHER 356 354 select CRYPTO_LIB_CHACHA_GENERIC 357 - select CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA 355 + select CRYPTO_ARCH_HAVE_LIB_CHACHA 356 + default CRYPTO_LIB_CHACHA_INTERNAL 358 357 help 359 358 Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 360 359 stream cipher algorithms ··· 420 417 - CLMUL-NI (carry-less multiplication new instructions) 421 418 422 419 config CRYPTO_POLY1305_X86_64 423 - tristate "Hash functions: Poly1305 (SSE2/AVX2)" 420 + tristate 424 421 depends on X86 && 64BIT 422 + select CRYPTO_HASH 425 423 select CRYPTO_LIB_POLY1305_GENERIC 426 - select CRYPTO_ARCH_MAY_HAVE_LIB_POLY1305 424 + select CRYPTO_ARCH_HAVE_LIB_POLY1305 425 + default CRYPTO_LIB_POLY1305_INTERNAL 427 426 help 428 427 Poly1305 authenticator algorithm (RFC7539) 429 428
+3 -3
crypto/Kconfig
··· 317 317 config CRYPTO_CURVE25519 318 318 tristate "Curve25519" 319 319 select CRYPTO_KPP 320 - select CRYPTO_LIB_CURVE25519_GENERIC 320 + select CRYPTO_LIB_CURVE25519_INTERNAL 321 321 help 322 322 Curve25519 elliptic curve (RFC7748) 323 323 ··· 615 615 616 616 config CRYPTO_CHACHA20 617 617 tristate "ChaCha" 618 - select CRYPTO_LIB_CHACHA_GENERIC 618 + select CRYPTO_LIB_CHACHA_INTERNAL 619 619 select CRYPTO_SKCIPHER 620 620 help 621 621 The ChaCha20, XChaCha20, and XChaCha12 stream cipher algorithms ··· 936 936 config CRYPTO_POLY1305 937 937 tristate "Poly1305" 938 938 select CRYPTO_HASH 939 - select CRYPTO_LIB_POLY1305_GENERIC 939 + select CRYPTO_LIB_POLY1305_INTERNAL 940 940 help 941 941 Poly1305 authenticator algorithm (RFC7539) 942 942
+21 -20
lib/crypto/Kconfig
··· 48 48 accelerated implementation of the ChaCha library interface, 49 49 either builtin or as a module. 50 50 51 - config CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA 52 - tristate 53 - select CRYPTO_ARCH_HAVE_LIB_CHACHA if CRYPTO_LIB_CHACHA=m 54 - select CRYPTO_ARCH_HAVE_LIB_CHACHA if CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA=y 55 - 56 51 config CRYPTO_LIB_CHACHA_GENERIC 57 52 tristate 58 53 select CRYPTO_LIB_UTILS ··· 58 63 implementation is enabled, this implementation serves the users 59 64 of CRYPTO_LIB_CHACHA. 60 65 66 + config CRYPTO_LIB_CHACHA_INTERNAL 67 + tristate 68 + select CRYPTO_LIB_CHACHA_GENERIC if CRYPTO_ARCH_HAVE_LIB_CHACHA=n 69 + 61 70 config CRYPTO_LIB_CHACHA 62 71 tristate "ChaCha library interface" 63 - select CRYPTO_LIB_CHACHA_GENERIC if CRYPTO_ARCH_HAVE_LIB_CHACHA=n 72 + select CRYPTO 73 + select CRYPTO_LIB_CHACHA_INTERNAL 64 74 help 65 75 Enable the ChaCha library interface. This interface may be fulfilled 66 76 by either the generic implementation or an arch-specific one, if one ··· 78 78 accelerated implementation of the Curve25519 library interface, 79 79 either builtin or as a module. 80 80 81 - config CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519 82 - tristate 83 - select CRYPTO_ARCH_HAVE_LIB_CURVE25519 if CRYPTO_LIB_CURVE25519=m 84 - select CRYPTO_ARCH_HAVE_LIB_CURVE25519 if CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519=y 85 - 86 81 config CRYPTO_LIB_CURVE25519_GENERIC 87 82 tristate 83 + select CRYPTO_LIB_UTILS 88 84 help 89 85 This symbol can be depended upon by arch implementations of the 90 86 Curve25519 library interface that require the generic code as a ··· 88 92 implementation is enabled, this implementation serves the users 89 93 of CRYPTO_LIB_CURVE25519. 90 94 95 + config CRYPTO_LIB_CURVE25519_INTERNAL 96 + tristate 97 + select CRYPTO_LIB_CURVE25519_GENERIC if CRYPTO_ARCH_HAVE_LIB_CURVE25519=n 98 + 91 99 config CRYPTO_LIB_CURVE25519 92 100 tristate "Curve25519 scalar multiplication library" 93 - select CRYPTO_LIB_CURVE25519_GENERIC if CRYPTO_ARCH_HAVE_LIB_CURVE25519=n 94 - select CRYPTO_LIB_UTILS 101 + select CRYPTO 102 + select CRYPTO_LIB_CURVE25519_INTERNAL 95 103 help 96 104 Enable the Curve25519 library interface. This interface may be 97 105 fulfilled by either the generic implementation or an arch-specific ··· 118 118 accelerated implementation of the Poly1305 library interface, 119 119 either builtin or as a module. 120 120 121 - config CRYPTO_ARCH_MAY_HAVE_LIB_POLY1305 122 - tristate 123 - select CRYPTO_ARCH_HAVE_LIB_POLY1305 if CRYPTO_LIB_POLY1305=m 124 - select CRYPTO_ARCH_HAVE_LIB_POLY1305 if CRYPTO_ARCH_MAY_HAVE_LIB_POLY1305=y 125 - 126 121 config CRYPTO_LIB_POLY1305_GENERIC 127 122 tristate 128 123 help ··· 127 132 implementation is enabled, this implementation serves the users 128 133 of CRYPTO_LIB_POLY1305. 129 134 135 + config CRYPTO_LIB_POLY1305_INTERNAL 136 + tristate 137 + select CRYPTO_LIB_POLY1305_GENERIC if CRYPTO_ARCH_HAVE_LIB_POLY1305=n 138 + 130 139 config CRYPTO_LIB_POLY1305 131 140 tristate "Poly1305 library interface" 132 - select CRYPTO_LIB_POLY1305_GENERIC if CRYPTO_ARCH_HAVE_LIB_POLY1305=n 141 + select CRYPTO 142 + select CRYPTO_LIB_POLY1305_INTERNAL 133 143 help 134 144 Enable the Poly1305 library interface. This interface may be fulfilled 135 145 by either the generic implementation or an arch-specific one, if one ··· 142 142 143 143 config CRYPTO_LIB_CHACHA20POLY1305 144 144 tristate "ChaCha20-Poly1305 AEAD support (8-byte nonce library version)" 145 - depends on CRYPTO 145 + select CRYPTO 146 146 select CRYPTO_LIB_CHACHA 147 147 select CRYPTO_LIB_POLY1305 148 + select CRYPTO_LIB_UTILS 148 149 select CRYPTO_ALGAPI 149 150 150 151 config CRYPTO_LIB_SHA1