Skip to contentSkip to conversation

crypto/openssl: fix CCM processing 0 length source

PATCH Applied Ciara Power 3 participants 3 messages Aug 23, 2021 – Sep 6, 2021 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/openssl: fix CCM processing 0 length source

When given a source length 0 for CCM, the encryption and decryption functions did not call the EVP_ENCRYPTUPDATE/EVP_DECRYPTUPDATE functions with a src and dst, causing some FIPS validation failures for testcases with PLen=0:

process_openssl_auth_encryption_ccm() line 1131:
Process openssl auth encryption ccm failed

Fixes 1a4998dc4d94 ("crypto/openssl: support AES-CCM")
---
 drivers/crypto/openssl/rte_openssl_pmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/openssl/rte_openssl_pmd.c +2 -2
index 47004337d5..37b969b916 100644
@@ -1114,7 +1114,7 @@ process_openssl_auth_encryption_ccm(struct rte_mbuf *mbuf_src, int offset,
 		if (EVP_EncryptUpdate(ctx, NULL, &len, aad + 18, aadlen) <= 0)
 			goto process_auth_encryption_ccm_err;
 
-	if (srclen > 0)
+	if (srclen >= 0)
 		if (process_openssl_encryption_update(mbuf_src, offset, &dst,
 				srclen, ctx, 0))
 			goto process_auth_encryption_ccm_err;
@@ -1197,7 +1197,7 @@ process_openssl_auth_decryption_ccm(struct rte_mbuf *mbuf_src, int offset,
 		if (EVP_DecryptUpdate(ctx, NULL, &len, aad + 18, aadlen) <= 0)
 			goto process_auth_decryption_ccm_err;
 
-	if (srclen > 0)
+	if (srclen >= 0)
 		if (process_openssl_decryption_update(mbuf_src, offset, &dst,
 				srclen, ctx, 0))
 			return -EFAULT;
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 58 lines

-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Monday, August 23, 2021 1:47 PM
To: [email protected]
Cc: [email protected]; Zhang, Roy Fan <[email protected]>; Power, Ciara <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Doherty, Declan <[email protected]>
Subject: [PATCH] crypto/openssl: fix CCM processing 0 length source

When given a source length 0 for CCM, the encryption and decryption functions did not call the EVP_ENCRYPTUPDATE/EVP_DECRYPTUPDATE functions
with a src and dst, causing some FIPS validation failures for testcases with PLen=0:

process_openssl_auth_encryption_ccm() line 1131:
Process openssl auth encryption ccm failed

Fixes 1a4998dc4d94 ("crypto/openssl: support AES-CCM")
---
 drivers/crypto/openssl/rte_openssl_pmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/openssl/rte_openssl_pmd.c +1 -1
index 47004337d5..37b969b916 100644
@@ -1114,7 +1114,7 @@ process_openssl_auth_encryption_ccm(struct
 rte_mbuf *mbuf_src, int offset,
 		if (EVP_EncryptUpdate(ctx, NULL, &len, aad + 18, aadlen) <=
 0)
 			goto process_auth_encryption_ccm_err;
 
-	if (srclen > 0)
+	if (srclen >= 0)
 		if (process_openssl_encryption_update(mbuf_src, offset,

&dst,

drivers/crypto/openssl/rte_openssl_pmd.c +1 -1
 				srclen, ctx, 0))
 			goto process_auth_encryption_ccm_err;
@@ -1197,7 +1197,7 @@ process_openssl_auth_decryption_ccm(struct
 rte_mbuf *mbuf_src, int offset,
 		if (EVP_DecryptUpdate(ctx, NULL, &len, aad + 18, aadlen) <=
 0)
 			goto process_auth_decryption_ccm_err;
 
-	if (srclen > 0)
+	if (srclen >= 0)
 		if (process_openssl_decryption_update(mbuf_src, offset,

&dst,

drivers/crypto/openssl/rte_openssl_pmd.c +0 -1
 				srclen, ctx, 0))
 			return -EFAULT;
--
Quoted 1 line

2.25.1

Applied
#2 lore raw
Quoted 10 lines
Quoted 10 lines

When given a source length 0 for CCM, the encryption and decryption functions did not call the EVP_ENCRYPTUPDATE/EVP_DECRYPTUPDATE functions
with a src and dst, causing some FIPS validation failures for testcases with PLen=0:

process_openssl_auth_encryption_ccm() line 1131:
Process openssl auth encryption ccm failed

Quoted 7 lines
Quoted 5 lines
Fixes 1a4998dc4d94 ("crypto/openssl: support AES-CCM")

Applied to dpdk-next-crypto

Thanks.