From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DF6D3A00C2 for ; Wed, 2 Nov 2022 10:54:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D381E40A81; Wed, 2 Nov 2022 10:54:15 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 5156840223; Wed, 2 Nov 2022 10:54:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667382853; x=1698918853; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=A+tEdSDzEPg+uzYqGybVXU3Sp6YDsZ6+Ubm0m/tZdFk=; b=bgkDRlx6yi4nHvnW7eGEIK4NCuuVSoGeS6qRShnJTDx8gN3MAxS6Zqbj Mnonm/csqvPdMD9uHEHViwdS5ij6dIOUapLWN+aMrZKaBHb8I4+qRqSf+ MpjpfqcwT9ynuIvO6qpmncOf2Ctf3lsB1h5IX04hqt2cOOo0X8IcY128e vOvsiXptbvKjvie0r20ajO4uRlTk3cdbSuG0+3+hZl/SO2yGOb4sUxRjy 9R+o9f390JiBX/b9W3p191umos89Qs8+dLoVIznoWBycBVJxLsSSpCeN9 bg6Vb7jtH9eLDVnK0CIhuDjLxdgz+g4EyMY0bDib5ciXoFPHWpQJrmg6t w==; X-IronPort-AV: E=McAfee;i="6500,9779,10518"; a="311082030" X-IronPort-AV: E=Sophos;i="5.95,232,1661842800"; d="scan'208";a="311082030" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2022 02:54:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10518"; a="612177217" X-IronPort-AV: E=Sophos;i="5.95,232,1661842800"; d="scan'208";a="612177217" Received: from silpixa00400883.ir.intel.com ([10.243.23.148]) by orsmga006.jf.intel.com with ESMTP; 02 Nov 2022 02:54:10 -0700 From: Brian Dooley To: Kai Ji Cc: dev@dpdk.org, stable@dpdk.org, gakhil@marvell.com, david.coyle@intel.com, kevin.osullivan@intel.com, Brian Dooley Subject: [PATCH v2] crypto/qat: fix reallocate OpenSSL version check Date: Wed, 2 Nov 2022 09:54:08 +0000 Message-Id: <20221102095408.327440-1-brian.dooley@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221031174919.642522-1-brian.dooley@intel.com> References: <20221031174919.642522-1-brian.dooley@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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.ji@intel.com CC: stable@dpdk.org Signed-off-by: Brian Dooley --- v2: - Use ossl legacy provider helper functions - Cast session pointer to void --- drivers/crypto/qat/qat_sym_session.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index 71fa595031..0ebc66f89e 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -520,19 +520,7 @@ qat_sym_session_configure(struct rte_cryptodev *dev, int ret; #if (OPENSSL_VERSION_NUMBER >= 0x30000000L) - 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; - - deflt = OSSL_PROVIDER_load(NULL, "default"); - if (deflt == NULL) { - OSSL_PROVIDER_unload(legacy); - return -EINVAL; - } + ossl_legacy_provider_load(); #endif ret = qat_sym_session_set_parameters(dev, xform, CRYPTODEV_GET_SYM_SESS_PRIV(sess), @@ -545,8 +533,7 @@ qat_sym_session_configure(struct rte_cryptodev *dev, } # if (OPENSSL_VERSION_NUMBER >= 0x30000000L) - OSSL_PROVIDER_unload(legacy); - OSSL_PROVIDER_unload(deflt); + ossl_legacy_provider_unload(); # endif return 0; } @@ -2639,7 +2626,8 @@ qat_sec_session_set_docsis_parameters(struct rte_cryptodev *dev, return ret; qat_sym_session_finalize(session); - return qat_sym_gen_dev_ops[qat_dev_gen].set_session((void *)cdev, session); + return qat_sym_gen_dev_ops[qat_dev_gen].set_session((void *)cdev, + (void *)session); } int @@ -2668,6 +2656,9 @@ qat_security_session_create(void *dev, return ret; } +#if (OPENSSL_VERSION_NUMBER >= 0x30000000L) + ossl_legacy_provider_unload(); +#endif return 0; } @@ -2684,9 +2675,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