From: Arnd Bergmann <arnd@arndb.de>
To: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
"Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Russell King <linux@armlinux.org.uk>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Ard Biesheuvel <ardb@kernel.org>,
Andy Polyakov <appro@cryptogams.org>,
Samuel Neves <sneves@dei.uc.pt>,
Ondrej Mosnacek <omosnace@redhat.com>,
Eric Biggers <ebiggers@google.com>,
Vitaly Chikunov <vt@altlinux.org>,
linux-crypto@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] crypto: curve25519 - Work around link failure
Date: Tue, 7 Jan 2020 21:12:52 +0100 [thread overview]
Message-ID: <20200107201327.3863345-1-arnd@arndb.de> (raw)
The curve25519 selftest causes a link failure when one of the two
implementations is built-in and the other one is a loadable module,
as then the library gets built in as well but cannot call into the
module:
lib/crypto/curve25519-selftest.o: In function `curve25519_selftest':
curve25519-selftest.c:(.init.text+0x5c): undefined reference to `curve25519_arch'
curve25519-selftest.c:(.init.text+0xfd): undefined reference to `curve25519_base_arch'
curve25519-selftest.c:(.init.text+0x15a): undefined reference to `curve25519_arch'
There is probably a better fix, but this is the local workaround
that I used to get a clean randconfig build again, using Makefile
tricks to make all the curve25519 code built-in if any of the
implementations are.
Fixes: aa127963f1ca ("crypto: lib/curve25519 - re-add selftests")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm/crypto/Makefile | 4 +++-
arch/x86/crypto/Makefile | 4 +++-
crypto/Makefile | 5 ++++-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile
index b745c17d356f..a7b3957aca58 100644
--- a/arch/arm/crypto/Makefile
+++ b/arch/arm/crypto/Makefile
@@ -12,7 +12,9 @@ obj-$(CONFIG_CRYPTO_SHA512_ARM) += sha512-arm.o
obj-$(CONFIG_CRYPTO_CHACHA20_NEON) += chacha-neon.o
obj-$(CONFIG_CRYPTO_POLY1305_ARM) += poly1305-arm.o
obj-$(CONFIG_CRYPTO_NHPOLY1305_NEON) += nhpoly1305-neon.o
-obj-$(CONFIG_CRYPTO_CURVE25519_NEON) += curve25519-neon.o
+ifdef CONFIG_CRYPTO_CURVE25519_NEON
+obj-$(CONFIG_CRYPTO_LIB_CURVE25519_GENERIC) += curve25519-neon.o
+endif
obj-$(CONFIG_CRYPTO_AES_ARM_CE) += aes-arm-ce.o
obj-$(CONFIG_CRYPTO_SHA1_ARM_CE) += sha1-arm-ce.o
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index 958440eae27e..7546c276e2f0 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -39,7 +39,9 @@ obj-$(CONFIG_CRYPTO_AEGIS128_AESNI_SSE2) += aegis128-aesni.o
obj-$(CONFIG_CRYPTO_NHPOLY1305_SSE2) += nhpoly1305-sse2.o
obj-$(CONFIG_CRYPTO_NHPOLY1305_AVX2) += nhpoly1305-avx2.o
-obj-$(CONFIG_CRYPTO_CURVE25519_X86) += curve25519-x86_64.o
+ifdef CONFIG_CRYPTO_CURVE25519_X86
+obj-$(CONFIG_CRYPTO_LIB_CURVE25519_GENERIC) += curve25519-x86_64.o
+endif
# These modules require assembler to support AVX.
ifeq ($(avx_supported),yes)
diff --git a/crypto/Makefile b/crypto/Makefile
index 4ca12b6044f7..93ecbfe50285 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -166,7 +166,10 @@ obj-$(CONFIG_CRYPTO_ZSTD) += zstd.o
obj-$(CONFIG_CRYPTO_OFB) += ofb.o
obj-$(CONFIG_CRYPTO_ECC) += ecc.o
obj-$(CONFIG_CRYPTO_ESSIV) += essiv.o
-obj-$(CONFIG_CRYPTO_CURVE25519) += curve25519-generic.o
+
+ifdef CONFIG_CRYPTO_CURVE25519
+obj-$(CONFIG_CRYPTO_LIB_CURVE25519_GENERIC) += curve25519-generic.o
+endif
ecdh_generic-y += ecdh.o
ecdh_generic-y += ecdh_helper.o
--
2.20.0
next reply other threads:[~2020-01-07 20:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-07 20:12 Arnd Bergmann [this message]
2020-01-07 20:21 ` Jason A. Donenfeld
2020-01-07 21:21 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200107201327.3863345-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=Jason@zx2c4.com \
--cc=appro@cryptogams.org \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=davem@davemloft.net \
--cc=ebiggers@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=hpa@zytor.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mingo@redhat.com \
--cc=omosnace@redhat.com \
--cc=sneves@dei.uc.pt \
--cc=tglx@linutronix.de \
--cc=vt@altlinux.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®