public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: gaochao <gaochao49@huawei.com>
To: <herbert@gondor.apana.org.au>, <davem@davemloft.net>,
	<tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
	<dave.hansen@linux.intel.com>, <x86@kernel.org>
Cc: <hpa@zytor.com>, <ebiggers@google.com>,
	<linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH -next] crypto: Fix build error when CRYPTO_BLAKE2S_X86=m && CRYPTO_ALGAPI2=m && CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y
Date: Tue, 17 May 2022 11:36:30 +0800	[thread overview]
Message-ID: <20220517033630.1182-1-gaochao49@huawei.com> (raw)

If CRYPTO=m, CRYPTO_ALGAPI=m, CRYPTO_ALGAPI2=m, CRYPTO_BLAKE2S_X86=m,
CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y
bulding fails:

arch/x86/crypto/blake2s-glue.o: In function `blake2s_compress':
(.text+0x5a): undefined reference to `crypto_simd_disabled_for_test'
make: *** [vmlinux] Error 1

When CRYPTO_MANAGER_EXTRA_TESTS=y, blake2s_compress will call
crypto_simd_disabled_for_test.
When CRYPTO_ALGAPI2=m, crypto_algapi build as a module,
but if CONFIG_CRYPTO_BLAKE2S_X86=m at the same time,
libblake2s-x86_64.o build with obj-y, this will accuse the above error.

To fix this error:
1 Choose CRYPTO_ALGAPI2 for CRYPTO_BLAKE2S_X86
when CRYPTO_MANAGER_EXTRA_TESTS=y.
2 build libblake2s-x86_64.o as a module when CONFIG_CRYPTO_BLAKE2S_X86=y

Fixes: 8fc5f2ad896b ("crypto: testmgr - Move crypto_simd_disabled_for_test out")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: gaochao <gaochao49@huawei.com>
---
 arch/x86/crypto/Makefile | 2 +-
 crypto/Kconfig           | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index 2831685adf6f..54b2469fa49a 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -63,7 +63,7 @@ sha512-ssse3-y := sha512-ssse3-asm.o sha512-avx-asm.o sha512-avx2-asm.o sha512_s

 obj-$(CONFIG_CRYPTO_BLAKE2S_X86) += blake2s-x86_64.o
 blake2s-x86_64-y := blake2s-shash.o
-obj-$(if $(CONFIG_CRYPTO_BLAKE2S_X86),y) += libblake2s-x86_64.o
+obj-$(CONFIG_CRYPTO_BLAKE2S_X86) += libblake2s-x86_64.o
 libblake2s-x86_64-y := blake2s-core.o blake2s-glue.o

 obj-$(CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL) += ghash-clmulni-intel.o
diff --git a/crypto/Kconfig b/crypto/Kconfig
index 19197469cfab..e61598f8f8c5 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -714,6 +714,7 @@ config CRYPTO_BLAKE2S_X86
 	depends on X86 && 64BIT
 	select CRYPTO_LIB_BLAKE2S_GENERIC
 	select CRYPTO_ARCH_HAVE_LIB_BLAKE2S
+	select CRYPTO_ALGAPI2 if CRYPTO_MANAGER_EXTRA_TESTS

 config CRYPTO_CRCT10DIF
 	tristate "CRCT10DIF algorithm"
--
2.17.1


             reply	other threads:[~2022-05-17  3:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17  3:36 gaochao [this message]
2022-05-24  0:56 ` [PATCH -next] crypto: Fix build error when CRYPTO_BLAKE2S_X86=m && CRYPTO_ALGAPI2=m && CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y gaochao (L)
2022-05-26  7:25 ` Eric Biggers
2022-05-26  7:30   ` Jason A. Donenfeld
2022-05-26  8:26   ` Herbert Xu
2022-05-26  8:52     ` Jason A. Donenfeld

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=20220517033630.1182-1-gaochao49@huawei.com \
    --to=gaochao49@huawei.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=ebiggers@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --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