Re: [PATCH v6 1/8] crypto: qce - Fix HMAC self-test failures for empty messages

From: Eric Biggers

Date: Thu Jul 23 2026 - 15:31:55 EST


On Fri, Jul 17, 2026 at 05:53:30PM +0200, Bartosz Golaszewski wrote:
> +/*
> + * BAM DMA cannot handle zero-length transfers, so the driver always holds
> + * back at least one byte to submit to the engine. A zero rctx->buflen at
> + * finalization time does not necessarily mean the message is empty: the
> + * caller may have imported a state that already reflects some hashed data
> + * with nothing currently buffered. Handle both cases through the software
> + * fallback: reconstruct the running state when there is one instead of
> + * assuming the message is empty.
> + */
> +static int qce_ahash_finalize_zero(struct ahash_request *req)
> +{
> + struct qce_sha_reqctx *rctx = ahash_request_ctx_dma(req);
> + HASH_FBREQ_ON_STACK(fbreq, req);

I'm trying to understand how this is intended to work. This uses
crypto_tfm::fb. But this driver doesn't set CRYPTO_ALG_NEED_FALLBACK,
so crypto_tfm::fb is actually just a pointer to the same crypto_tfm.
(See crypto_create_tfm_node() and crypto_ahash_init_tfm().) Doesn't
this just result in an infinite recursive loop and a crash?

- Eric