Re: [v3 PATCH] crypto: lib/Kconfig - Hide arch options from user

Arnd Bergmann
2025-02-28T17:11:12Z

On Fri, Feb 28, 2025, at 05:11, Herbert Xu wrote:
> On Thu, Feb 27, 2025 at 12:56:30PM +0100, Arnd Bergmann wrote:
>>
>> I've tried to undo that portion here and don't run into a
>> dependency loop so far with the patch below on top of yours
>> (around 100 randconfigs in). I'll keep testing and will let
>> you know when something goes wrong.
>
> That's because you removed 'select CRYPTO', which can cause the
> arch code to silently disappear just like my original patch.
>
> It's pretty much difficult to disable CRYPTO because so many
> random things select it. But I managed to turn CRYPTO off with
> some effort and indeed with your patch the arch code disappears.
>
> In the following config file, CONFIG_CRYPTO_LIB_CHACHA is modular but
> the X86 option for it is not selected, because CRYPTO itself is off.

I see. So the case of building lib/crypto code but not CONFIG_CRYPTO
is something I would normally expect to work, including the
architecture specific optimizations, and it's probably not
too hard to get there, but it's also unclear if there is really a
point in doing that.

For design purity, I think we would need to split the architecture
specific code the same way as the generic ones: library functions
that always get selected by their users to export functions and
the front-ends that are user-selectable and register the algorithm
with the crypto API.

Keeping the 'select CRYPTO' is clearly less effor if you prefer
that.

Arnd