From 11678a147176e9c126fc6f6eac82aea08e706340 Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Mon, 24 Jun 2019 16:40:52 +0100 Subject: [PATCH] crypto/aesni_mb: fix out-of-bounds access This patch fixes the out-of-bounds coverity issue by adding missed algorithms to the array. Coverity issue: 337683 Fixes: c68d7aa354f6 ("crypto/aesni_mb: use architecture independent macros") Cc: stable@dpdk.org Signed-off-by: Fan Zhang --- .../crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h index 4d439360f5..b794d4bc1a 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h @@ -33,6 +33,7 @@ int aesni_mb_logtype_driver; /* Maximum length for digest */ #define DIGEST_LENGTH_MAX 64 static const unsigned auth_blocksize[] = { + [NULL_HASH] = 0, [MD5] = 64, [SHA1] = 64, [SHA_224] = 64, @@ -41,6 +42,13 @@ static const unsigned auth_blocksize[] = { [SHA_512] = 128, [AES_XCBC] = 16, [AES_CCM] = 16, + [AES_CMAC] = 16, + [AES_GMAC] = 16, + [PLAIN_SHA1] = 64, + [PLAIN_SHA_224] = 64, + [PLAIN_SHA_256] = 64, + [PLAIN_SHA_384] = 128, + [PLAIN_SHA_512] = 128 }; /** @@ -65,7 +73,13 @@ static const unsigned auth_truncated_digest_byte_lengths[] = { [AES_XCBC] = 12, [AES_CMAC] = 12, [AES_CCM] = 8, - [NULL_HASH] = 0 + [NULL_HASH] = 0, + [AES_GMAC] = 16, + [PLAIN_SHA1] = 20, + [PLAIN_SHA_224] = 28, + [PLAIN_SHA_256] = 32, + [PLAIN_SHA_384] = 48, + [PLAIN_SHA_512] = 64 }; /** @@ -90,6 +104,7 @@ static const unsigned auth_digest_byte_lengths[] = { [SHA_512] = 64, [AES_XCBC] = 16, [AES_CMAC] = 16, + [AES_CCM] = 16, [AES_GMAC] = 12, [NULL_HASH] = 0, [PLAIN_SHA1] = 20, -- 2.20.1