diff mbox series

[-next] crypto: curve25519 - Fix build error when CRYPTO_MANAGER_DISABLE_TESTS!=y && CRYPTO=m

Message ID 20220528013318.1621047-1-zhengbin13@huawei.com (mailing list archive)
State Changes Requested
Delegated to: Herbert Xu
Headers show
Series [-next] crypto: curve25519 - Fix build error when CRYPTO_MANAGER_DISABLE_TESTS!=y && CRYPTO=m | expand

Commit Message

Zheng Bin May 28, 2022, 1:33 a.m. UTC
If CRYPTO_MANAGER_DISABLE_TESTS!=y, CRYPTO=m, bulding fails:

lib/crypto/curve25519-selftest.o: In function `curve25519_selftest':
curve25519-selftest.c:(.init.text+0x60): undefined reference to `__crypto_memneq'
curve25519-selftest.c:(.init.text+0xec): undefined reference to `__crypto_memneq'
curve25519-selftest.c:(.init.text+0x114): undefined reference to `__crypto_memneq'
curve25519-selftest.c:(.init.text+0x154): undefined reference to `__crypto_memneq'

Add depends for CRYPTO_LIB_CURVE25519 to fix this.

Fixes: aa127963f1ca ("crypto: lib/curve25519 - re-add selftests")
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
---
 lib/crypto/Kconfig | 1 +
 1 file changed, 1 insertion(+)

--
2.31.1

Comments

Jason A. Donenfeld May 28, 2022, 6:19 a.m. UTC | #1
On 5/28/22, Zheng Bin <zhengbin13@huawei.com> wrote:
> If CRYPTO_MANAGER_DISABLE_TESTS!=y, CRYPTO=m, bulding fails:
>
> lib/crypto/curve25519-selftest.o: In function `curve25519_selftest':
> curve25519-selftest.c:(.init.text+0x60): undefined reference to
> `__crypto_memneq'
> curve25519-selftest.c:(.init.text+0xec): undefined reference to
> `__crypto_memneq'
> curve25519-selftest.c:(.init.text+0x114): undefined reference to
> `__crypto_memneq'
> curve25519-selftest.c:(.init.text+0x154): undefined reference to
> `__crypto_memneq'
>
> Add depends for CRYPTO_LIB_CURVE25519 to fix this.

In this case, the bug isn't caused by the tests exactly but by the
curve25519.h inline usage here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/crypto/curve25519.h#n43

Probably the solution for this one is to move crypto_memneq into lib/crypto.

Jason
diff mbox series

Patch

diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig
index 9856e291f414..f233bed9f214 100644
--- a/lib/crypto/Kconfig
+++ b/lib/crypto/Kconfig
@@ -70,6 +70,7 @@  config CRYPTO_LIB_CURVE25519_GENERIC
 config CRYPTO_LIB_CURVE25519
 	tristate "Curve25519 scalar multiplication library"
 	depends on CRYPTO_ARCH_HAVE_LIB_CURVE25519 || !CRYPTO_ARCH_HAVE_LIB_CURVE25519
+	depends on (CRYPTO && CRYPTO_MANAGER_DISABLE_TESTS!=y) || (CRYPTO_MANAGER_DISABLE_TESTS=y)
 	select CRYPTO_LIB_CURVE25519_GENERIC if CRYPTO_ARCH_HAVE_LIB_CURVE25519=n
 	help
 	  Enable the Curve25519 library interface. This interface may be