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 <gmuthukri...@marvell.com>
---
 drivers/crypto/openssl/rte_openssl_pmd_ops.c | 5 +++++
 1 file changed, 5 insertions(+)

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

Reply via email to