From patchwork Tue Jan 7 20:12:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11321713 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7292B6C1 for ; Tue, 7 Jan 2020 20:14:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5AA31208C4 for ; Tue, 7 Jan 2020 20:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728711AbgAGUO3 (ORCPT ); Tue, 7 Jan 2020 15:14:29 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:59605 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728379AbgAGUO3 (ORCPT ); Tue, 7 Jan 2020 15:14:29 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MTfgb-1jGb592rZl-00U0gY; Tue, 07 Jan 2020 21:13:34 +0100 From: Arnd Bergmann To: Herbert Xu , "David S. Miller" , "Jason A. Donenfeld" Cc: Arnd Bergmann , Russell King , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Ard Biesheuvel , Andy Polyakov , Samuel Neves , Ondrej Mosnacek , Eric Biggers , Vitaly Chikunov , 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 Message-Id: <20200107201327.3863345-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:pH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HgFlKjeJs9m7Ljj Urp5ZSnywq+FNozooUpaW/j2zFufIRrtkNpG4N3lDDlGhdEO1W5qCWR38VhXtov6MNnNNim3T 5zcMACR9nlBNHY2eU8KA== Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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 --- 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