Re: [PATCH v5 1/7] crypto: qce - Fix HMAC self-test failures for empty messages
From: Herbert Xu
Date: Fri Jul 17 2026 - 03:49:29 EST
On Mon, Jul 06, 2026 at 03:53:52PM +0200, Bartosz Golaszewski wrote:
>
> @@ -280,6 +299,8 @@ static int qce_ahash_final(struct ahash_request *req)
> if (tmpl->hash_zero)
> memcpy(req->result, tmpl->hash_zero,
> tmpl->alg.ahash.halg.digestsize);
> + else if (IS_SHA_HMAC(rctx->flags))
> + return qce_ahash_hmac_zero(req);
> return 0;
> }
This is still broken because the user can import a non-zero partial
hash state with no buffer held for your hardware. So you need to make
the driver able to handle the case of finalization with no extra
data.
The easiest is to re-import the partial hash state into the fallback
and finalize that instead.
IOW change this so that it handles all zero-length finalizations and
not just the empty hash case.
Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt