From patchwork Fri Oct 7 15:48:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Dooley X-Patchwork-Id: 117572 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 84C84A00C3; Fri, 7 Oct 2022 17:49:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3DBE040DDC; Fri, 7 Oct 2022 17:49:04 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 42C3540A80; Fri, 7 Oct 2022 17:49:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665157742; x=1696693742; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6l7PGlHfDwlWR7RacEYWZxnT34xxTMnVf/80XFCrhI0=; b=Tqy62gXMibxe6ZtiW1Ekuu+O4FYMo+r5cNaLLoXcmpzsqhKcFtS9uDQ3 MZmxPgUKNfnq4vaTlUN3I+W3GbIFx1T/W07+UX4q3ysdznvtYeakMfXDa dVxTojK1W2HlZUwxTRGRznAdCGpqwO1o0OV7HlhtUVbVsHmAw4Or8+RKb ygqUjjvdkUuH8Lf1gazhxfye6h3d8bzJ0oj5DO86jnsRXNYXOfAjf2StP cJIyeGAQKjldGTz78FPpt5K6/md0fJORh7tgKm+Jm7tz3iQgUnnN0RfON wE1RhFezPdZ8DsO7etfzi/llN2ok9zQlPb6FUx2cU7YD/+McpLU3JGQqJ Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10493"; a="302484697" X-IronPort-AV: E=Sophos;i="5.95,167,1661842800"; d="scan'208";a="302484697" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2022 08:49:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10493"; a="625183787" X-IronPort-AV: E=Sophos;i="5.95,167,1661842800"; d="scan'208";a="625183787" Received: from silpixa00400883.ir.intel.com ([10.243.22.130]) by orsmga002.jf.intel.com with ESMTP; 07 Oct 2022 08:48:59 -0700 From: Brian Dooley To: Kai Ji Cc: dev@dpdk.org, stable@dpdk.org, gakhil@marvell.com, Brian Dooley Subject: [PATCH v2] crypto/qat: reallocate on openssl version check Date: Fri, 7 Oct 2022 15:48:52 +0000 Message-Id: <20221007154852.408512-1-brian.dooley@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221003152637.360985-1-brian.dooley@intel.com> References: <20221003152637.360985-1-brian.dooley@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-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 --- v2: rebase on main --- drivers/crypto/qat/qat_sym_session.c | 32 +++++++++++++++++----------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index d96122b208..13a8d36e95 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -520,8 +520,19 @@ qat_sym_session_configure(struct rte_cryptodev *dev, int ret; #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, CRYPTODEV_GET_SYM_SESS_PRIV(sess), @@ -534,7 +545,8 @@ qat_sym_session_configure(struct rte_cryptodev *dev, } # if (OPENSSL_VERSION_NUMBER >= 0x30000000L) - ossl_legacy_provider_unload(); + OSSL_PROVIDER_unload(legacy); + OSSL_PROVIDER_unload(deflt); # endif return 0; } @@ -2575,8 +2587,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)); @@ -2613,7 +2628,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 @@ -2623,9 +2638,6 @@ qat_security_session_create(void *dev, { void *sess_private_data = SECURITY_GET_SESS_PRIV(sess); 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 || @@ -2645,11 +2657,7 @@ qat_security_session_create(void *dev, return ret; } - 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