diff mbox series

[1/2] crypto: fix dependencies on lib/crypto modules

Message ID 20250310132647.3256818-1-arnd@kernel.org
State New
Headers show
Series [1/2] crypto: fix dependencies on lib/crypto modules | expand

Commit Message

Arnd Bergmann March 10, 2025, 1:26 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

The crypto subsystem helpers for chacha, poly1305 and curve25519 were
changed to select the 'INTERNAL' Kconfig symbols, but the code references
the generic implementation instead, which leads to a link failure when
nothing else selects it.

ld.lld-21: error: undefined symbol: chacha_crypt_generic
>>> referenced by chacha_generic.c
>>>               crypto/chacha_generic.o:(chacha_stream_xor) in archive vmlinux.a

ld.lld-21: error: undefined symbol: poly1305_final_generic
>>> referenced by poly1305_generic.c
>>>               crypto/poly1305_generic.o:(crypto_poly1305_final) in archive vmlinux.a

The INTERNAL version turns on the architecture specific optimized cipher,
which normally usually also enables the generic version, but this is not
the case on all architectures. Selecting only the GENERIC version here is
not sufficient since the architecture specific ones are now hidden symbols
and are only built when the INTERNAL symbol is also available.

Fixes: 17ec3e71ba79 ("crypto: lib/Kconfig - Hide arch options from user")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 crypto/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

Comments

Eric Biggers March 10, 2025, 5:24 p.m. UTC | #1
On Mon, Mar 10, 2025 at 02:26:39PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The crypto subsystem helpers for chacha, poly1305 and curve25519 were
> changed to select the 'INTERNAL' Kconfig symbols, but the code references
> the generic implementation instead, which leads to a link failure when
> nothing else selects it.
> 
> ld.lld-21: error: undefined symbol: chacha_crypt_generic
> >>> referenced by chacha_generic.c
> >>>               crypto/chacha_generic.o:(chacha_stream_xor) in archive vmlinux.a
> 
> ld.lld-21: error: undefined symbol: poly1305_final_generic
> >>> referenced by poly1305_generic.c
> >>>               crypto/poly1305_generic.o:(crypto_poly1305_final) in archive vmlinux.a
> 
> The INTERNAL version turns on the architecture specific optimized cipher,
> which normally usually also enables the generic version, but this is not
> the case on all architectures. Selecting only the GENERIC version here is
> not sufficient since the architecture specific ones are now hidden symbols
> and are only built when the INTERNAL symbol is also available.
> 
> Fixes: 17ec3e71ba79 ("crypto: lib/Kconfig - Hide arch options from user")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  crypto/Kconfig | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/crypto/Kconfig b/crypto/Kconfig
> index aac27a4668fd..76693e3edff8 100644
> --- a/crypto/Kconfig
> +++ b/crypto/Kconfig
> @@ -317,6 +317,7 @@ config CRYPTO_ECRDSA
>  config CRYPTO_CURVE25519
>  	tristate "Curve25519"
>  	select CRYPTO_KPP
> +	select CRYPTO_LIB_CURVE25519_GENERIC
>  	select CRYPTO_LIB_CURVE25519_INTERNAL
>  	help
>  	  Curve25519 elliptic curve (RFC7748)
> @@ -615,6 +616,7 @@ config CRYPTO_ARC4
>  
>  config CRYPTO_CHACHA20
>  	tristate "ChaCha"
> +	select CRYPTO_LIB_CHACHA_GENERIC
>  	select CRYPTO_LIB_CHACHA_INTERNAL
>  	select CRYPTO_SKCIPHER
>  	help
> @@ -936,6 +938,7 @@ config CRYPTO_POLYVAL
>  config CRYPTO_POLY1305
>  	tristate "Poly1305"
>  	select CRYPTO_HASH
> +	select CRYPTO_LIB_POLY1305_GENERIC
>  	select CRYPTO_LIB_POLY1305_INTERNAL
>  	help
>  	  Poly1305 authenticator algorithm (RFC7539)

Looks the same as
https://lore.kernel.org/linux-crypto/Z8UdUoaKtDKzgPph@gondor.apana.org.au/ which
was already applied.

- Eric
diff mbox series

Patch

diff --git a/crypto/Kconfig b/crypto/Kconfig
index aac27a4668fd..76693e3edff8 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -317,6 +317,7 @@  config CRYPTO_ECRDSA
 config CRYPTO_CURVE25519
 	tristate "Curve25519"
 	select CRYPTO_KPP
+	select CRYPTO_LIB_CURVE25519_GENERIC
 	select CRYPTO_LIB_CURVE25519_INTERNAL
 	help
 	  Curve25519 elliptic curve (RFC7748)
@@ -615,6 +616,7 @@  config CRYPTO_ARC4
 
 config CRYPTO_CHACHA20
 	tristate "ChaCha"
+	select CRYPTO_LIB_CHACHA_GENERIC
 	select CRYPTO_LIB_CHACHA_INTERNAL
 	select CRYPTO_SKCIPHER
 	help
@@ -936,6 +938,7 @@  config CRYPTO_POLYVAL
 config CRYPTO_POLY1305
 	tristate "Poly1305"
 	select CRYPTO_HASH
+	select CRYPTO_LIB_POLY1305_GENERIC
 	select CRYPTO_LIB_POLY1305_INTERNAL
 	help
 	  Poly1305 authenticator algorithm (RFC7539)