Re: [PATCH v9 4/5] crypto: cmh - add AES skcipher/aead/cmac

From: Herbert Xu

Date: Thu Nov 26 2026 - 23:30:12 EST


On Wed, Nov 18, 2026 at 09:51:48AM -0800, Alex Ousherovitch via B4 Relay wrote:
>
> +/*
> + * Incremental operations and request-state export/import forward to the
> + * keyed generic cmac(aes) fallback allocated in cmh_aes_cmac_init_tfm().
> + * The AES core cannot save/restore intermediate CMAC state, so the
> + * fallback holds the request state; it is synchronous, was
> + * keyed by cmh_aes_cmac_setkey(), and handles both scatterlist and
> + * virtual (CRYPTO_AHASH_REQ_VIRT) input.
> + */
> +static int cmh_aes_cmac_init(struct ahash_request *req)
> +{
> + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
> + struct cmh_aes_cmac_tfm_ctx *tctx = crypto_ahash_ctx(tfm);
> + struct cmh_aes_cmac_reqctx *rctx = ahash_request_ctx(req);
> + struct ahash_request *fb_req = cmh_aes_cmac_fb_req(rctx);
> +
> + ahash_request_set_tfm(fb_req, tctx->fb);
> + ahash_request_set_callback(fb_req, 0, NULL, NULL);
> + return crypto_ahash_init(fb_req);

Please don't use embedded fallback requests. Put them on the stack
instead with HASH_FBREQ_ON_STACK.

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