Re: [PATCH v5 04/15] crypto: x86/sha256-ni - add support for finup_mb

Herbert Xu
2024-06-12T09:42:23Z

On Mon, Jun 10, 2024 at 08:48:11PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> Add an implementation of finup_mb to sha256-ni, using an interleaving
> factor of 2. It interleaves a finup operation for two equal-length
> messages that share a common prefix. dm-verity and fs-verity will take

I think the limitation on equal length is artificial. There is
no reason why the code couldn't handle two messages with different
lengths. Simply execute in dual mode up until the shorter message
runs out. Then carry on as if you have a single message.

In fact, there is no reason why the two hashes have to start from
the same initial state either. It has no bearing on the performance
of the actual hashing as far as I can see.

Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt