From: Eric Biggers <ebiggers@kernel.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Arnd Bergmann <arnd@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Will Deacon <will@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Catalin Marinas <catalin.marinas@arm.com>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Harald Freudenberger <freude@linux.ibm.com>,
Holger Dengler <dengler@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Ard Biesheuvel <ardb@kernel.org>,
"James E . J . Bottomley" <James.Bottomley@hansenpartnership.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
linux-crypto@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org,
linux-s390@vger.kernel.org
Subject: Re: [PATCH] crypto: lib/Kconfig - Select and hide arch options
Date: Tue, 25 Feb 2025 22:07:25 -0800 [thread overview]
Message-ID: <20250226060725.GA41090@sol.localdomain> (raw)
In-Reply-To: <Z76aUfPIbhPAsHbv@gondor.apana.org.au>
On Wed, Feb 26, 2025 at 12:36:33PM +0800, Herbert Xu wrote:
> The ARCH_MAY_HAVE patch missed arm64, mips and s390. But it may
> also lead to arch options being enabled but ineffective because
> of modular/built-in conflicts.
>
> As the primary user of all these options wireguard is selecting
> the arch options anyway, make the same selections at the lib/crypto
> option level and hide the arch options from the user.
>
> Fixes: 1047e21aecdf ("crypto: lib/Kconfig - Fix lib built-in failure when arch is modular")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Arnd Bergmann <arnd@kernel.org>
> Closes: https://lore.kernel.org/oe-kbuild-all/202502232152.JC84YDLp-lkp@intel.com/
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
As I said earlier, fixing the arch-optimized code to be enabled automatically is
the right way to do it. There are still some issues with this patch, though:
> config CRYPTO_LIB_CHACHA
> tristate "ChaCha library interface"
> + select CRYPTO
> select CRYPTO_LIB_CHACHA_GENERIC if CRYPTO_ARCH_HAVE_LIB_CHACHA=n
> + select CRYPTO_CHACHA20_X86_64 if X86 && 64BIT
> + select CRYPTO_CHACHA20_NEON if ARM || (ARM64 && KERNEL_MODE_NEON)
> + select CRYPTO_CHACHA_MIPS if CPU_MIPS32_R2
> + select CRYPTO_CHACHA_S390 if S390
> + select CRYPTO_CHACHA20_P10 if PPC64 && CPU_LITTLE_ENDIAN && VSX
There's no need to have a select for every architecture, with the dependencies
redundantly listed. Instead just 'default' each of the arch-optimized options
to CRYPTO_LIB_CHACHA.
> config CRYPTO_CHACHA20_X86_64
> tristate
> depends on X86 && 64BIT
> default CRYPTO_CHACHA20
> select CRYPTO_ARCH_HAVE_LIB_CHACHA
[...]
>
> config CRYPTO_CHACHA20
> tristate "ChaCha"
> select CRYPTO_LIB_CHACHA_GENERIC
> select CRYPTO_SKCIPHER
This introduces a problem where to enable optimized ChaCha in the crypto API
users will now need to enable CRYPTO_LIB_CHACHA, instead of
CRYPTO_CHACHA20_X86_64 etc. as was needed before. LIB symbols should never be
user-selectable, so that makes no sense.
The way it should work is that CRYPTO_CHACHA20 should just select
CRYPTO_LIB_CHACHA (and thus also the optimized code).
And similarly for the other algorithms, which should be in their patches.
- Eric
next prev parent reply other threads:[~2025-02-26 6:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 16:42 [PATCH] crypto: lib/Kconfig - fix chacha/poly1305 dependencies more more Arnd Bergmann
2025-02-25 21:33 ` Will Deacon
2025-02-25 21:40 ` Arnd Bergmann
2025-02-25 21:50 ` Arnd Bergmann
2025-02-26 1:40 ` Herbert Xu
2025-02-26 4:36 ` [PATCH] crypto: lib/Kconfig - Select and hide arch options Herbert Xu
2025-02-26 6:07 ` Eric Biggers [this message]
2025-02-26 8:31 ` Herbert Xu
2025-02-26 9:08 ` [v2 PATCH] crypto: lib/Kconfig - Hide arch options from user Herbert Xu
2025-02-27 7:48 ` [v3 " Herbert Xu
2025-02-27 8:32 ` Arnd Bergmann
2025-02-27 8:43 ` Herbert Xu
2025-02-27 11:56 ` Arnd Bergmann
2025-02-27 12:04 ` Ard Biesheuvel
[not found] ` <Z8E3gjfvG3eFoLxR@gondor.apana.org.au>
2025-02-28 17:10 ` Arnd Bergmann
2025-02-27 5:57 ` [PATCH] crypto: lib/Kconfig - Select and hide arch options kernel test robot
2025-02-27 6:29 ` kernel test robot
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=20250226060725.GA41090@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=agordeev@linux.ibm.com \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=borntraeger@linux.ibm.com \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=dengler@linux.ibm.com \
--cc=freude@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=jarkko@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=svens@linux.ibm.com \
--cc=tsbogend@alpha.franken.de \
--cc=will@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;
as well as URLs for NNTP newsgroup(s).