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/sec2 - fix for aead auth key length

According to the HMAC RFC, the authentication key
can be 0 bytes, and the hardware can handle this
scenario. Therefore, remove the incorrect validation
for this case.

Fixes: 2f072d75d1ab ("crypto: hisilicon - Add aead support on SEC2")
Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Wenkai Lin and committed by
Herbert Xu
1b284ffc d4548747

+2 -6
+2 -6
drivers/crypto/hisilicon/sec2/sec_crypto.c
··· 1090 1090 struct crypto_shash *hash_tfm = ctx->hash_tfm; 1091 1091 int blocksize, digestsize, ret; 1092 1092 1093 - if (!keys->authkeylen) { 1094 - pr_err("hisi_sec2: aead auth key error!\n"); 1095 - return -EINVAL; 1096 - } 1097 - 1098 1093 blocksize = crypto_shash_blocksize(hash_tfm); 1099 1094 digestsize = crypto_shash_digestsize(hash_tfm); 1100 1095 if (keys->authkeylen > blocksize) { ··· 1101 1106 } 1102 1107 ctx->a_key_len = digestsize; 1103 1108 } else { 1104 - memcpy(ctx->a_key, keys->authkey, keys->authkeylen); 1109 + if (keys->authkeylen) 1110 + memcpy(ctx->a_key, keys->authkey, keys->authkeylen); 1105 1111 ctx->a_key_len = keys->authkeylen; 1106 1112 } 1107 1113