Re: Need some clarification about CRYPTO_AHASH_ALG_BLOCK_ONLY

From: Paul Louvel

Date: Wed Mar 25 2026 - 08:27:31 EST


Hello,

I forgot to include the maintainers in the initial e-mail.

Additional link to the source code :
https://elixir.bootlin.com/linux/v7.0-rc1/source/crypto/ahash.c#L467

Thank you,
Paul.

On 3/20/26 10:42 AM, Paul Louvel wrote:
Hello,

I have stumbled across a flag defined in include/crypto/internal/hash.h : CRYPTO_AHASH_ALG_BLOCK_ONLY.
To get more information about what exact behavior this flag do, I read the crypto_ahash_update function.
From the looks of it, it seems that the API will call the tfm update if there is enough bytes (and by enough I mean at least a block size), from the internal buffer and the incoming ahash_request.
In this case, I find the BLOCK_ONLY naming a bit of a misnomer, since it only guarantee you than req->nbytes will be at least a block size.
I initially though that the API would only give a request that are a multiple of the block size.

This flag, among others, are relatively recent.
I think adding documentation about these flags would be a great idea.

Regards,
Paul.

--
Paul Louvel, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com