Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: hisilicon/sec - fix the max length of AAD for the CCM mode

Fix the maximum length of AAD for the CCM mode due to the hardware limited.

Signed-off-by: Kai Ye <yekai13@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Kai Ye and committed by
Herbert Xu
5e340558 e764d81d

+5
+5
drivers/crypto/hisilicon/sec2/sec_crypto.c
··· 63 63 #define SEC_AUTH_CIPHER 0x1 64 64 #define SEC_MAX_MAC_LEN 64 65 65 #define SEC_MAX_AAD_LEN 65535 66 + #define SEC_MAX_CCM_AAD_LEN 65279 66 67 #define SEC_TOTAL_MAC_SZ (SEC_MAX_MAC_LEN * QM_Q_DEPTH) 67 68 68 69 #define SEC_PBUF_SZ 512 ··· 2221 2220 } 2222 2221 2223 2222 if (c_mode == SEC_CMODE_CCM) { 2223 + if (unlikely(req->assoclen > SEC_MAX_CCM_AAD_LEN)) { 2224 + dev_err_ratelimited(dev, "CCM input aad parameter is too long!\n"); 2225 + return -EINVAL; 2226 + } 2224 2227 ret = aead_iv_demension_check(req); 2225 2228 if (ret) { 2226 2229 dev_err(dev, "aead input iv param error!\n");