Skip to contentSkip to conversation

crypto/openssl: fix memory free issue

PATCH Applied Ciara Power 3 participants 3 messages May 11, 2023 – May 24, 2023 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/openssl: fix memory free issue

From: Saoirse O'Donovan <[email protected]>

Allocated memory was being freed using 'free' when it should have been freed using 'OPENSSL_free'. This has now been modified so that the correct method is used to free allocated memory.

Coverity issue: 384415

Fixes 4c7ae22f1f83 ("crypto/openssl: update DSA routine with 3.0 EVP API")
---
 drivers/crypto/openssl/rte_openssl_pmd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/openssl/rte_openssl_pmd.c +3 -3
index 384d262621..f65fbca300 100644
@@ -1927,7 +1927,7 @@ process_openssl_dsa_sign_op_evp(struct rte_crypto_op *cop,
 
 	if (EVP_PKEY_sign(dsa_ctx, dsa_sign_data, &outlen, op->message.data,
 						op->message.length) <= 0) {
-		free(dsa_sign_data);
+		OPENSSL_free(dsa_sign_data);
 		goto err_dsa_sign;
 	}
 
@@ -1935,7 +1935,7 @@ process_openssl_dsa_sign_op_evp(struct rte_crypto_op *cop,
 	DSA_SIG *sign = d2i_DSA_SIG(NULL, &dsa_sign_data_p, outlen);
 	if (!sign) {
 		OPENSSL_LOG(ERR, "%s:%d\n", __func__, __LINE__);
-		free(dsa_sign_data);
+		OPENSSL_free(dsa_sign_data);
 		goto err_dsa_sign;
 	} else {
 		const BIGNUM *r = NULL, *s = NULL;
@@ -1947,7 +1947,7 @@ process_openssl_dsa_sign_op_evp(struct rte_crypto_op *cop,
 	}
 
 	DSA_SIG_free(sign);
-	free(dsa_sign_data);
+	OPENSSL_free(dsa_sign_data);
 	return 0;
 
 err_dsa_sign:
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 22 lines

-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Thursday, May 11, 2023 3:00 PM
To: Ji, Kai <[email protected]>
Cc: [email protected]; O'Donovan, Saoirse <[email protected]>; [email protected]; Power, Ciara <[email protected]>
Subject: [PATCH] crypto/openssl: fix memory free issue

From: Saoirse O'Donovan <[email protected]>

Allocated memory was being freed using 'free' when it should have been freed using 'OPENSSL_free'. This has now been modified so that the correct method is used to free allocated memory.

Coverity issue: 384415

Fixes 4c7ae22f1f83 ("crypto/openssl: update DSA routine with 3.0 EVP API")

---

Applied
#2 lore raw
Quoted 18 lines
Quoted 16 lines

Subject: [PATCH] crypto/openssl: fix memory free issue

From: Saoirse O'Donovan <[email protected]>

Allocated memory was being freed using 'free' when it should have been freed using 'OPENSSL_free'. This has now been modified so that the correct method is used to free allocated memory.

Coverity issue: 384415

Fixes 4c7ae22f1f83 ("crypto/openssl: update DSA routine with 3.0 EVP API")

---

Applied to dpdk-next-crypto

Thanks.