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@xxxxxxxxx> > Reported-by: Arnd Bergmann <arnd@xxxxxxxxxx> > Closes: https://lore.kernel.org/oe-kbuild-all/202502232152.JC84YDLp-lkp@xxxxxxxxx/ > Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> 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