Move the ossl_legacy_provider_unload() into the right place for secure protocol for QAT. Remove unnecessary unload from session destroy.
Fixes: 52d59b92b06d ("crypto/qat: enable OpenSSL legacy provider in session") Cc: kai...@intel.com CC: sta...@dpdk.org Signed-off-by: Brian Dooley <brian.doo...@intel.com> --- drivers/crypto/qat/qat_sym_session.c | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index 71fa595031..6872531d67 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -520,19 +520,19 @@ qat_sym_session_configure(struct rte_cryptodev *dev, int ret; #if (OPENSSL_VERSION_NUMBER >= 0x30000000L) - OSSL_PROVIDER * legacy; - OSSL_PROVIDER *deflt; + OSSL_PROVIDER * legacy; + OSSL_PROVIDER *deflt; - /* Load Multiple providers into the default (NULL) library context */ - legacy = OSSL_PROVIDER_load(NULL, "legacy"); - if (legacy == NULL) - return -EINVAL; + /* Load Multiple providers into the default (NULL) library context */ + legacy = OSSL_PROVIDER_load(NULL, "legacy"); + if (legacy == NULL) + return -EINVAL; - deflt = OSSL_PROVIDER_load(NULL, "default"); - if (deflt == NULL) { - OSSL_PROVIDER_unload(legacy); - return -EINVAL; - } + deflt = OSSL_PROVIDER_load(NULL, "default"); + if (deflt == NULL) { + OSSL_PROVIDER_unload(legacy); + return -EINVAL; + } #endif ret = qat_sym_session_set_parameters(dev, xform, CRYPTODEV_GET_SYM_SESS_PRIV(sess), @@ -545,8 +545,8 @@ qat_sym_session_configure(struct rte_cryptodev *dev, } # if (OPENSSL_VERSION_NUMBER >= 0x30000000L) - OSSL_PROVIDER_unload(legacy); - OSSL_PROVIDER_unload(deflt); + OSSL_PROVIDER_unload(legacy); + OSSL_PROVIDER_unload(deflt); # endif return 0; } @@ -2668,6 +2668,9 @@ qat_security_session_create(void *dev, return ret; } +#if (OPENSSL_VERSION_NUMBER >= 0x30000000L) + ossl_legacy_provider_unload(); +#endif return 0; } @@ -2684,9 +2687,6 @@ qat_security_session_destroy(void *dev __rte_unused, memset(s, 0, qat_sym_session_get_private_size(dev)); } -# if (OPENSSL_VERSION_NUMBER >= 0x30000000L) - ossl_legacy_provider_unload(); -# endif return 0; } -- 2.25.1