crypto/openssl: check for SM2 support in openssl 3.x lib

Message ID 05107292989669d527273e1efba6ef5427bf323c.1689100661.git.gmuthukrishn@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series crypto/openssl: check for SM2 support in openssl 3.x lib |

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-unit-testing fail Testing issues
ci/iol-aarch64-compile-testing success Testing PASS
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-intel-Functional success Functional Testing PASS
ci/iol-broadcom-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:49 p.m. UTC
  In some version of openSSL 3 lib (for an instance, in linux
distribution), if SM2 is not supported, driver should return
error.

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

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 drivers/crypto/openssl/rte_openssl_pmd_ops.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Anoob Joseph July 12, 2023, 5:33 a.m. UTC | #1
> 
> In some version of openSSL 3 lib (for an instance, in linux distribution), if SM2
> is not supported, driver should return error.
> 
> 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:50 p.m. UTC | #2
> Subject: RE: [PATCH] crypto/openssl: check for SM2 support in openssl 3.x lib
> 
> >
> > In some version of openSSL 3 lib (for an instance, in linux distribution), if SM2
> > is not supported, driver should return error.
> >
> > 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>

openSSL -> OpenSSL
Bugzilla ID should be before Fixes tag.

Applied to dpdk-next-crypto
Will be part of RC4.

Thanks.
  

Patch

diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index 9497da41ef..85a4fa3e55 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -1285,6 +1285,7 @@  static int openssl_set_asym_session_parameters(
 	case RTE_CRYPTO_ASYM_XFORM_SM2:
 	{
 #if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
+#ifndef OPENSSL_NO_SM2
 		OSSL_PARAM_BLD *param_bld = NULL;
 		OSSL_PARAM *params = NULL;
 		int ret = -1;
@@ -1324,6 +1325,10 @@  static int openssl_set_asym_session_parameters(
 			OSSL_PARAM_free(asym_session->u.sm2.params);
 
 		return -1;
+#else
+		OPENSSL_LOG(WARNING, "SM2 unsupported in current OpenSSL Version");
+		return -ENOTSUP;
+#endif
 #else
 		OPENSSL_LOG(WARNING, "SM2 unsupported for OpenSSL Version < 3.0");
 		return -ENOTSUP;