Re: [PATCH] crypto: lib/chachapoly - Drop dependency on CRYPTO_ALGAPI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 27, 2025, at 13:33, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@xxxxxxxxxx>
>
> The ChaCha20-Poly1305 library code uses the sg_miter API to process
> input presented via scatterlists, except for the special case where the
> digest buffer is not covered entirely by the same scatterlist entry as
> the last byte of input. In that case, it uses scatterwalk_map_and_copy()
> to access the memory in the input scatterlist where the digest is stored.
>
> This results in a dependency on crypto/scatterwalk.c and therefore on
> CONFIG_CRYPTO_ALGAPI, which is unnecessary, as the sg_miter API already
> provides this functionality via sg_copy_to_buffer(). So use that
> instead, and drop the CRYPTO_ALGAPI dependency.
>
> Reported-by: Arnd Bergmann <arnd@xxxxxxxx>
> Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>

Thanks for the fixup!

> ---
>  lib/crypto/Kconfig            | 1 -
>  lib/crypto/chacha20poly1305.c | 5 ++---
>  2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig
> index b01253cac70a..a759e6f6a939 100644
> --- a/lib/crypto/Kconfig
> +++ b/lib/crypto/Kconfig
> @@ -135,7 +135,6 @@ config CRYPTO_LIB_CHACHA20POLY1305
>  	depends on CRYPTO
>  	select CRYPTO_LIB_CHACHA
>  	select CRYPTO_LIB_POLY1305
> -	select CRYPTO_ALGAPI

I think importantly, dropping the 'select CRYPTO_ALGAPI'
means that the 'depends on CRYPTO' here can also be dropped:
CRYPTO_LIB_CHACHA20POLY1305 needs nothing else from the
crypto subsystem. Moreover, CONFIG_WIREGUARD can now drop the
'select CRYPTO' because it seems to only need this in
order to 'select CRYPTO_LIB_CHACHA20POLY1305'.

    Arnd




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux