linux/drivers/crypto/hisilicon
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
..
hpre crypto: hisilicon - mask all error type when removing driver 2026-05-29 13:54:43 +08:00
sec crypto: hisilicon/sec - use devm_platform_ioremap_resource in sec_map_io 2026-07-27 10:29:26 +10:00
sec2 crypto: hisilicon/sec2 - fix CCM algorithm long packet failure 2026-08-15 11:24:10 +10:00
zip crypto: hisilicon - mask all error type when removing driver 2026-05-29 13:54:43 +08:00
debugfs.c crypto: hisilicon/qm - add const qualifier to info_name in struct qm_cmd_dump_item 2026-04-12 16:46:28 +08:00
Kconfig hwrng: hisi-trng - Move hisi-trng into drivers/char/hw_random/ 2026-06-11 14:02:58 +08:00
Makefile hwrng: hisi-trng - Move hisi-trng into drivers/char/hw_random/ 2026-06-11 14:02:58 +08:00
qm_common.h crypto: hisilicon/qm - simplify the status of qm 2023-12-01 18:03:26 +08:00
qm.c crypto: hisilicon - use 2-arg strscpy where destination size is known 2026-07-05 13:19:52 +08:00
sgl.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00