Re: [PATCH] xfrm: reject sub-32-bit or unaligned alg_trunc_len in attach_auth_trunc()
From: Sabrina Dubroca
Date: Mon Sep 21 2026 - 12:19:04 EST
I'm really confused here.
2026-09-19, 21:06:23 +0000, Hui Peng wrote:
> In attach_auth_trunc(), userspace supplies `ualg->alg_trunc_len` (in
> bits) via XFRMA_ALG_AUTH_TRUNC, and attach_auth_trunc() only checks that
> `ualg->alg_trunc_len <= algo->uinfo.auth.icv_fullbits`.
>
> However, ESP and AH convert `alg_trunc_len` to bytes via `esp_authsize =
> ALIGN(x->aalg->alg_trunc_len, 8) >> 3` or `ah_authsize =
> x->aalg->alg_trunc_len >> 3`, and pass `authsize` to
Did your LLM make this up? My kernel sources don't have any of this.
> `crypto_aead_setauthsize()` or `ah_init_state()`. If `alg_trunc_len` is
> not a multiple of 8 bits (or is between 1 and 31 bits), integer division
> by 8 truncates the requested bit length (for example, `alg_trunc_len ==
> 7` yields a 0-byte ICV in AH, or `alg_trunc_len` not divisible by 8
and what problem does that pose exactly, for each of those cases?
--
Sabrina