Re: [PATCH] crypto: hisilicon/sec2: fix CCM algorithm long packet failure

Herbert Xu <[email protected]>
Newsgroups org.kernel.vger.linux-crypto,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Tue, Aug 04, 2026 at 10:22:07AM +0800, Chenghai Huang wrote:
> From: Zhushuai Yin <[email protected]>
> 
> In the CCM B0 block the message-length field Q spans L bytes, where
> L (cl in the driver) is derived from the cipher IV flags byte as
> c_ivin[0] + 1. set_aead_auth_iv() hardcoded writing only the last 2
> bytes of a_ivin with cryptlen, implicitly assuming cl = 2.
> 
> When cl = 3 (a shorter nonce yielding a 3-byte length field) and the
> packet is longer than 65535 bytes, cryptlen no longer fits in 2 bytes.
> The dropped high byte made the auth IV built by the driver differ from
> the one consumed by the hardware, so the software/hardware comparison
> failed and the CCM request errored out.
> 
> Write the last cl bytes of a_ivin in a loop driven by the IV's CL
> value, so the length-field width always matches the algorithm
> configuration instead of assuming a fixed 2-byte field.
> 
> Fixes: c16a70c1f253 ("crypto: hisilicon/sec - add new algorithm mode for AEAD")
> Signed-off-by: Zhushuai Yin <[email protected]>
> Signed-off-by: Chenghai Huang <[email protected]>
> ---
>  drivers/crypto/hisilicon/sec2/sec_crypto.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.