patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v1] crypto/qat: fix reallocate OpenSSL version check
@ 2022-10-31 17:49 Brian Dooley
  2022-11-01 17:04 ` Ji, Kai
  2022-11-02  9:54 ` [PATCH v2] " Brian Dooley
  0 siblings, 2 replies; 5+ messages in thread
From: Brian Dooley @ 2022-10-31 17:49 UTC (permalink / raw)
  To: Kai Ji; +Cc: dev, stable, gakhil, david.coyle, kevin.osullivan, Brian Dooley

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


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

* RE: [PATCH v1] crypto/qat: fix reallocate OpenSSL version check
  2022-10-31 17:49 [PATCH v1] crypto/qat: fix reallocate OpenSSL version check Brian Dooley
@ 2022-11-01 17:04 ` Ji, Kai
  2022-11-02  9:54 ` [PATCH v2] " Brian Dooley
  1 sibling, 0 replies; 5+ messages in thread
From: Ji, Kai @ 2022-11-01 17:04 UTC (permalink / raw)
  To: Dooley, Brian; +Cc: dev, stable, gakhil, Coyle, David, O'Sullivan, Kevin


Please see my comments below, In addition, in qat_sym_session.c l.2642

return qat_sym_gen_dev_ops[qat_dev_gen].set_session((void *)cdev, session);

the session pointer should cast to (void *) or we can pass session_private directly.

Regards

Kai 

> -----Original Message-----
> From: Dooley, Brian <brian.dooley@intel.com>
> Sent: Monday, October 31, 2022 5:49 PM
> To: Ji, Kai <kai.ji@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; gakhil@marvell.com; Coyle, David
> <david.coyle@intel.com>; O'Sullivan, Kevin <kevin.osullivan@intel.com>;
> Dooley, Brian <brian.dooley@intel.com>
> Subject: [PATCH v1] crypto/qat: fix reallocate OpenSSL version check
> 
> 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 <brian.dooley@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;
> +	}

[KJ] please use ossl_legacy_provider_load() helper instead load legacy and default libs manually here.   

>  #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);

[KJ] you can use ossl_legacy_provider_unload() here

>  # 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


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

* [PATCH v2] crypto/qat: fix reallocate OpenSSL version check
  2022-10-31 17:49 [PATCH v1] crypto/qat: fix reallocate OpenSSL version check Brian Dooley
  2022-11-01 17:04 ` Ji, Kai
@ 2022-11-02  9:54 ` Brian Dooley
  2022-11-02 23:30   ` Ji, Kai
  1 sibling, 1 reply; 5+ messages in thread
From: Brian Dooley @ 2022-11-02  9:54 UTC (permalink / raw)
  To: Kai Ji; +Cc: dev, stable, gakhil, david.coyle, kevin.osullivan, Brian Dooley

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


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

* RE: [PATCH v2] crypto/qat: fix reallocate OpenSSL version check
  2022-11-02  9:54 ` [PATCH v2] " Brian Dooley
@ 2022-11-02 23:30   ` Ji, Kai
  2022-11-03 10:55     ` Akhil Goyal
  0 siblings, 1 reply; 5+ messages in thread
From: Ji, Kai @ 2022-11-02 23:30 UTC (permalink / raw)
  To: Dooley, Brian; +Cc: dev, stable, gakhil, Coyle, David, O'Sullivan, Kevin

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

> -----Original Message-----
> From: Dooley, Brian <brian.dooley@intel.com>
> Sent: Wednesday, November 2, 2022 9:54 AM
> To: Ji, Kai <kai.ji@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; gakhil@marvell.com; Coyle, David
> <david.coyle@intel.com>; O'Sullivan, Kevin <kevin.osullivan@intel.com>;
> Dooley, Brian <brian.dooley@intel.com>
> Subject: [PATCH v2] crypto/qat: fix reallocate OpenSSL version check
> 
> 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 <brian.dooley@intel.com>
> ---
> v2:
> - Use ossl legacy provider helper functions
> - Cast session pointer to void
> ---

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

* RE: [PATCH v2] crypto/qat: fix reallocate OpenSSL version check
  2022-11-02 23:30   ` Ji, Kai
@ 2022-11-03 10:55     ` Akhil Goyal
  0 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2022-11-03 10:55 UTC (permalink / raw)
  To: Ji, Kai, Dooley, Brian; +Cc: dev, stable, Coyle, David, O'Sullivan, Kevin

> Acked-by: Kai Ji <kai.ji@intel.com>
> 
> > Subject: [PATCH v2] crypto/qat: fix reallocate OpenSSL version check
> >
> > 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 <brian.dooley@intel.com>
> > ---
Applied to dpdk-next-crypto

Thanks.

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

end of thread, other threads:[~2022-11-03 10:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-31 17:49 [PATCH v1] crypto/qat: fix reallocate OpenSSL version check Brian Dooley
2022-11-01 17:04 ` Ji, Kai
2022-11-02  9:54 ` [PATCH v2] " Brian Dooley
2022-11-02 23:30   ` Ji, Kai
2022-11-03 10:55     ` 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).