[PATCH] crypto/openssl: fix segfault due to uninitialized var

Gowrishankar Muthukrishnan gmuthukrishn at marvell.com
Tue Jul 11 20:48:57 CEST 2023


In some openSSL 3 libraries, uninitialized output variable
cause segfault. It is always nice to initialize it.

Fixes: 3b7d638fb11f ("crypto/openssl: support asymmetric SM2")
Bugzilla ID: 1250

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn at marvell.com>
---
 drivers/crypto/openssl/rte_openssl_pmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 4569c5e62f..5e8624cebe 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -2734,7 +2734,7 @@ process_openssl_sm2_op_evp(struct rte_crypto_op *cop,
 	case RTE_CRYPTO_ASYM_OP_ENCRYPT:
 		{
 			OSSL_PARAM *eparams = sess->u.sm2.params;
-			size_t output_len;
+			size_t output_len = 0;
 
 			kctx = EVP_PKEY_CTX_new_id(EVP_PKEY_SM2, NULL);
 			if (kctx == NULL || EVP_PKEY_fromdata_init(kctx) <= 0 ||
-- 
2.25.1



More information about the dev mailing list