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

Herbert Xu posted 1 patch 5 days, 1 hour ago
[PATCH] crypto: ccm - Set rfc4309 maxauthsize from child
Posted by Herbert Xu 5 days, 1 hour ago
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@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

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@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt