On Thu, Mar 12, 2026 at 07:29:05PM -0400, Mimi Zohar wrote:
> On Wed, 2026-03-11 at 22:39 -0700, Eric Biggers wrote:
> > IMA computes hashes using the crypto_shash or crypto_ahash API.  The
> > latter is used only when ima.ahash_minsize is set on the command line,
> > and its purpose is ostensibly to make the hash computation faster.
> > 
> > However, going off the CPU to a crypto engine and back again is actually
> > quite slow, especially compared with the acceleration that is built into
> > modern CPUs and the kernel now enables by default for most algorithms.
> > Typical performance results for SHA-256 on a modern platform can be
> > found at https://lore.kernel.org/linux-crypto/20250615184638.GA1480@sol/
> > 
> > Partly for this reason, several other kernel subsystems have already
> > dropped support for the crypto_ahash API.
> 
> The performance benefit was the ability of reading and filling a buffer from 
> disk, which was slow, while the other buffer was sent to the crypto engine.

On normal filesystems, sequential reads from a file already kick off
async readahead.  So the hashing and disk reads can already happen
concurrently anyway.

- Eric

Reply via email to