DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1] crypto/qat: reallocate on openssl version check
@ 2022-10-03 15:26 Brian Dooley
  2022-10-07 10:55 ` [EXT] " Akhil Goyal
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Brian Dooley @ 2022-10-03 15:26 UTC (permalink / raw)
  To: Kai Ji; +Cc: dev, stable, Brian Dooley

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 <brian.dooley@intel.com>
---
 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [EXT] [PATCH v1] crypto/qat: reallocate on openssl version check
  2022-10-03 15:26 [PATCH v1] crypto/qat: reallocate on openssl version check Brian Dooley
@ 2022-10-07 10:55 ` Akhil Goyal
  2022-10-07 14:03 ` Ji, Kai
  2022-10-07 15:48 ` [PATCH v2] " Brian Dooley
  2 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2022-10-07 10:55 UTC (permalink / raw)
  To: Brian Dooley, Kai Ji; +Cc: dev, stable

> 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 <brian.dooley@intel.com>
> ---
Please rebase.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v1] crypto/qat: reallocate on openssl version check
  2022-10-03 15:26 [PATCH v1] crypto/qat: reallocate on openssl version check Brian Dooley
  2022-10-07 10:55 ` [EXT] " Akhil Goyal
@ 2022-10-07 14:03 ` Ji, Kai
  2022-10-07 15:48 ` [PATCH v2] " Brian Dooley
  2 siblings, 0 replies; 5+ messages in thread
From: Ji, Kai @ 2022-10-07 14:03 UTC (permalink / raw)
  To: Dooley, Brian; +Cc: dev, stable

Please rebase

Acked-by: Kai Ji <kai.ji@intel.com>

> -----Original Message-----
> From: Dooley, Brian <brian.dooley@intel.com>
> Sent: Monday, October 3, 2022 4:27 PM
> To: Ji, Kai <kai.ji@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Dooley, Brian
> <brian.dooley@intel.com>
> Subject: [PATCH v1] crypto/qat: reallocate on openssl version check
> 
> 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 <brian.dooley@intel.com>
> ---

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] crypto/qat: reallocate on openssl version check
  2022-10-03 15:26 [PATCH v1] crypto/qat: reallocate on openssl version check Brian Dooley
  2022-10-07 10:55 ` [EXT] " Akhil Goyal
  2022-10-07 14:03 ` Ji, Kai
@ 2022-10-07 15:48 ` Brian Dooley
  2022-10-10 19:39   ` [EXT] " Akhil Goyal
  2 siblings, 1 reply; 5+ messages in thread
From: Brian Dooley @ 2022-10-07 15:48 UTC (permalink / raw)
  To: Kai Ji; +Cc: dev, stable, gakhil, Brian Dooley

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 <brian.dooley@intel.com>
---
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
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [EXT] [PATCH v2] crypto/qat: reallocate on openssl version check
  2022-10-07 15:48 ` [PATCH v2] " Brian Dooley
@ 2022-10-10 19:39   ` Akhil Goyal
  0 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2022-10-10 19:39 UTC (permalink / raw)
  To: Brian Dooley, Kai Ji; +Cc: dev, stable

> 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 <brian.dooley@intel.com>
> ---
> v2: rebase on main
Applied to dpdk-next-crypto

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-10 19:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-03 15:26 [PATCH v1] crypto/qat: reallocate on openssl version check Brian Dooley
2022-10-07 10:55 ` [EXT] " Akhil Goyal
2022-10-07 14:03 ` Ji, Kai
2022-10-07 15:48 ` [PATCH v2] " Brian Dooley
2022-10-10 19:39   ` [EXT] " Akhil Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).