crypto/openssl: fix segfault due to uninitialized var

Message ID 0ce047dd9078d486ab7a317185fa1e0118c79299.1689100664.git.gmuthukrishn@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series crypto/openssl: fix segfault due to uninitialized var |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-unit-testing fail Testing issues
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Gowrishankar Muthukrishnan July 11, 2023, 6:48 p.m. UTC
  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@marvell.com>
---
 drivers/crypto/openssl/rte_openssl_pmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Anoob Joseph July 12, 2023, 5:30 a.m. UTC | #1
> 
> 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@marvell.com>

Acked-by: Anoob Joseph <anoobj@marvell.com>
  
Akhil Goyal July 12, 2023, 4:48 p.m. UTC | #2
> Subject: RE: [PATCH] crypto/openssl: fix segfault due to uninitialized var
> 
> >
> > 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@marvell.com>
> 
> Acked-by: Anoob Joseph <anoobj@marvell.com>

Applied to dpdk-next-crypto

Thanks. Will be part of RC4, as RC3 is already tagged.
  

Patch

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 ||