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 439E2A04FD for ; Mon, 3 Oct 2022 17:27:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F78C40DFB; Mon, 3 Oct 2022 17:27:00 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 8D53440695; Mon, 3 Oct 2022 17:26:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664810818; x=1696346818; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=og+0u/PB+5sJE8m0eBt/VPWGPZh+ynYPd8bzzpBb0Ys=; b=cbbRBibWBf8bFATyBX5o8/xMXO2odyZ9QYMqWqUsYNYJDpzma6/WsH4c 2Yk7k+OjoXG1+tkiP2YWhJaVyZlSB7NKstz8CLMvG/20chGXAFZGPx2RQ mECpF+qDZm4CUJX9ubUuo6W/i88lPfTAus5ltiUywj2o44hlbqGQCwTaS qwKP83zTffx7ddiD5bfRsZwwsH9NcGXeh7TyWH1WbABuM/0MSzSQoP7BD NOZSJQueTi+Uuqk2+n0Hf7y9Uh0Hv1EYo2FNGLn/Z5GWN4SCX9v0iB6zR gmQdMRP13nQgiPm4MIxLx8zIvaQ06U7HLI1kVUx2G58fVAjr+7YjPGfB6 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="329060903" X-IronPort-AV: E=Sophos;i="5.93,365,1654585200"; d="scan'208";a="329060903" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2022 08:26:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="625810627" X-IronPort-AV: E=Sophos;i="5.93,365,1654585200"; d="scan'208";a="625810627" Received: from silpixa00400883.ir.intel.com ([10.243.23.138]) by fmsmga007.fm.intel.com with ESMTP; 03 Oct 2022 08:26:56 -0700 From: Brian Dooley To: Kai Ji Cc: dev@dpdk.org, stable@dpdk.org, Brian Dooley Subject: [PATCH v1] crypto/qat: reallocate on openssl version check Date: Mon, 3 Oct 2022 15:26:36 +0000 Message-Id: <20221003152637.360985-1-brian.dooley@intel.com> X-Mailer: git-send-email 2.25.1 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 This patch reallocates the openssl version check from qat_session_configure() to a proper qat_security_session_create() routine Fixes: 3227bc7138f5 ("crypto/qat: use intel-ipsec-mb for partial hash and AES") Cc: stable@dpdk.org Signed-off-by: Brian Dooley --- drivers/crypto/qat/qat_sym_session.c | 31 ++++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index bfc9836351..61d078082f 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -537,8 +537,19 @@ qat_sym_session_configure(struct rte_cryptodev *dev, } #if (OPENSSL_VERSION_NUMBER >= 0x30000000L) - if (ossl_legacy_provider_load()) - return -EINVAL; + 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; + } #endif ret = qat_sym_session_set_parameters(dev, xform, sess_private_data); if (ret != 0) { @@ -554,7 +565,8 @@ qat_sym_session_configure(struct rte_cryptodev *dev, sess_private_data); # if (OPENSSL_VERSION_NUMBER >= 0x30000000L) - ossl_legacy_provider_unload(); + OSSL_PROVIDER_unload(legacy); + OSSL_PROVIDER_unload(deflt); # endif return 0; } @@ -2594,8 +2606,11 @@ qat_sec_session_set_docsis_parameters(struct rte_cryptodev *dev, { int ret; int qat_cmd_id; + struct rte_cryptodev *cdev = (struct rte_cryptodev *)dev; struct rte_crypto_sym_xform *xform = NULL; struct qat_sym_session *session = session_private; + struct qat_cryptodev_private *internals = cdev->data->dev_private; + enum qat_device_gen qat_dev_gen = internals->qat_dev->qat_dev_gen; /* Clear the session */ memset(session, 0, qat_sym_session_get_private_size(dev)); @@ -2633,7 +2648,7 @@ qat_sec_session_set_docsis_parameters(struct rte_cryptodev *dev, return ret; qat_sym_session_finalize(session); - return 0; + return qat_sym_gen_dev_ops[qat_dev_gen].set_session((void *)cdev, session); } int @@ -2644,9 +2659,6 @@ qat_security_session_create(void *dev, { void *sess_private_data; struct rte_cryptodev *cdev = (struct rte_cryptodev *)dev; - struct qat_cryptodev_private *internals = cdev->data->dev_private; - enum qat_device_gen qat_dev_gen = internals->qat_dev->qat_dev_gen; - struct qat_sym_session *sym_session = NULL; int ret; if (conf->action_type != RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL || @@ -2674,11 +2686,8 @@ qat_security_session_create(void *dev, } set_sec_session_private_data(sess, sess_private_data); - sym_session = (struct qat_sym_session *)sess_private_data; - sym_session->dev_id = internals->dev_id; - return qat_sym_gen_dev_ops[qat_dev_gen].set_session((void *)cdev, - sess_private_data); + return 0; } int -- 2.25.1