[PATCH] crypto: ccm - Set rfc4309 maxauthsize from child

From: Herbert Xu

Date: Sun Jul 19 2026 - 21:34:44 EST


On Sun, Jul 19, 2026 at 03:01:25AM +0900, Seohyeon Maeng wrote:
>
> Summary
> -------
>
> crypto_rfc4309_init_tfm() spawns its child AEAD but does not synchronize the
> child's initial authsize with the RFC4309 parent's initial authsize.

Thanks for the report. It should do the same thing as GCM and use
the child's maxauthsize.

---8<---
Set the maxauthsize of rfc4309 using that of the child algorithm.

Fixes: 4a49b499dfa0 ("[CRYPTO] ccm: Added CCM mode")
Reported-by: Seohyeon Maeng <bioloidgp@xxxxxxxxx>
Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

diff --git a/crypto/ccm.c b/crypto/ccm.c
index 2ae929ffdef8..916441e4f2b8 100644
--- a/crypto/ccm.c
+++ b/crypto/ccm.c
@@ -747,7 +747,7 @@ static int crypto_rfc4309_create(struct crypto_template *tmpl,

inst->alg.ivsize = 8;
inst->alg.chunksize = crypto_aead_alg_chunksize(alg);
- inst->alg.maxauthsize = 16;
+ inst->alg.maxauthsize = crypto_aead_alg_maxauthsize(alg);

inst->alg.base.cra_ctxsize = sizeof(struct crypto_rfc4309_ctx);

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