crypto/openssl: fix CCM processing 0 length source
authorCiara Power <ciara.power@intel.com>
Mon, 23 Aug 2021 12:47:14 +0000 (12:47 +0000)
committerAkhil Goyal <gakhil@marvell.com>
Mon, 6 Sep 2021 19:54:57 +0000 (21:54 +0200)
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")
Cc: stable@dpdk.org
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
drivers/crypto/openssl/rte_openssl_pmd.c

index 4700433..37b969b 100644 (file)
@@ -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;