linux/drivers/crypto/hisilicon/sec2
Zhushuai Yin b82f60be50 crypto: hisilicon/sec2 - fix CCM algorithm long packet failure
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: c16a70c1f2 ("crypto: hisilicon/sec - add new algorithm mode for AEAD")
Signed-off-by: Zhushuai Yin <yinzhushuai@huawei.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-15 11:24:10 +10:00
..
Makefile
sec_crypto.c crypto: hisilicon/sec2 - fix CCM algorithm long packet failure 2026-08-15 11:24:10 +10:00
sec_crypto.h crypto: hisilicon/sec2 - fix for aead icv error 2024-12-21 22:46:24 +08:00
sec_main.c crypto: hisilicon - mask all error type when removing driver 2026-05-29 13:54:43 +08:00
sec.h crypto: hisilicon/sec2 - remove unused sec_ctx.hlf_q_num 2026-07-27 10:29:27 +10:00