DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] crypto/openssl: do not build useless workaround
@ 2023-04-18 14:56 Didier Pallard
  2023-06-20  9:29 ` Ji, Kai
  2023-06-25 19:22 ` Thomas Monjalon
  0 siblings, 2 replies; 7+ messages in thread
From: Didier Pallard @ 2023-04-18 14:56 UTC (permalink / raw)
  To: dev
  Cc: stable, Kai Ji, Daniel Mrzyglod, Tomasz Kulasek,
	Michal Kobylinski, Pablo de Lara, Slawomir Mrozowicz

This workaround was needed before version 1.0.1f. Do not build it for
versions >= 1.1.

Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library")
Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Cc: stable@dpdk.org
---
 drivers/crypto/openssl/rte_openssl_pmd.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index e00db0facba5..a11885df8255 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -1195,8 +1195,11 @@ process_openssl_auth_encryption_gcm(struct rte_mbuf *mbuf_src, int offset,
 		int srclen, uint8_t *aad, int aadlen, uint8_t *iv,
 		uint8_t *dst, uint8_t *tag, EVP_CIPHER_CTX *ctx)
 {
-	int len = 0, unused = 0;
+	int len = 0;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+	int unused = 0;
 	uint8_t empty[] = {};
+#endif
 
 	if (EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0)
 		goto process_auth_encryption_gcm_err;
@@ -1210,9 +1213,11 @@ process_openssl_auth_encryption_gcm(struct rte_mbuf *mbuf_src, int offset,
 				srclen, ctx, 0))
 			goto process_auth_encryption_gcm_err;
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
 	/* Workaround open ssl bug in version less then 1.0.1f */
 	if (EVP_EncryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
 		goto process_auth_encryption_gcm_err;
+#endif
 
 	if (EVP_EncryptFinal_ex(ctx, dst, &len) <= 0)
 		goto process_auth_encryption_gcm_err;
@@ -1274,8 +1279,11 @@ process_openssl_auth_decryption_gcm(struct rte_mbuf *mbuf_src, int offset,
 		int srclen, uint8_t *aad, int aadlen, uint8_t *iv,
 		uint8_t *dst, uint8_t *tag, EVP_CIPHER_CTX *ctx)
 {
-	int len = 0, unused = 0;
+	int len = 0;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+	int unused = 0;
 	uint8_t empty[] = {};
+#endif
 
 	if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, 16, tag) <= 0)
 		goto process_auth_decryption_gcm_err;
@@ -1292,9 +1300,11 @@ process_openssl_auth_decryption_gcm(struct rte_mbuf *mbuf_src, int offset,
 				srclen, ctx, 0))
 			goto process_auth_decryption_gcm_err;
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
 	/* Workaround open ssl bug in version less then 1.0.1f */
 	if (EVP_DecryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
 		goto process_auth_decryption_gcm_err;
+#endif
 
 	if (EVP_DecryptFinal_ex(ctx, dst, &len) <= 0)
 		return -EFAULT;
-- 
2.30.2


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

* Re: [PATCH] crypto/openssl: do not build useless workaround
  2023-04-18 14:56 [PATCH] crypto/openssl: do not build useless workaround Didier Pallard
@ 2023-06-20  9:29 ` Ji, Kai
  2023-06-20 11:00   ` Akhil Goyal
  2023-06-25 19:22 ` Thomas Monjalon
  1 sibling, 1 reply; 7+ messages in thread
From: Ji, Kai @ 2023-06-20  9:29 UTC (permalink / raw)
  To: pallard, didier, dev
  Cc: stable, Mrzyglod, Daniel T, Tomasz Kulasek, Kobylinski, Michal,
	De Lara Guarch, Pablo, Mrozowicz, SlawomirX

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

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


________________________________
From: Didier Pallard <didier.pallard@6wind.com>
Sent: 18 April 2023 15:56
To: dev@dpdk.org <dev@dpdk.org>
Cc: stable@dpdk.org <stable@dpdk.org>; Ji, Kai <kai.ji@intel.com>; Mrzyglod, Daniel T <daniel.t.mrzyglod@intel.com>; Tomasz Kulasek <tomaszx.kulasek@intel.com>; Kobylinski, Michal <michal.kobylinski@intel.com>; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Mrozowicz, SlawomirX <slawomirx.mrozowicz@intel.com>
Subject: [PATCH] crypto/openssl: do not build useless workaround

This workaround was needed before version 1.0.1f. Do not build it for
versions >= 1.1.

Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library")
Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Cc: stable@dpdk.org
---
 drivers/crypto/openssl/rte_openssl_pmd.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

--
2.30.2


[-- Attachment #2: Type: text/html, Size: 2492 bytes --]

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

* RE: [PATCH] crypto/openssl: do not build useless workaround
  2023-06-20  9:29 ` Ji, Kai
@ 2023-06-20 11:00   ` Akhil Goyal
  0 siblings, 0 replies; 7+ messages in thread
From: Akhil Goyal @ 2023-06-20 11:00 UTC (permalink / raw)
  To: Ji, Kai, pallard, didier, dev
  Cc: stable, Mrzyglod, Daniel T, Tomasz Kulasek, Kobylinski, Michal,
	De Lara Guarch, Pablo, Mrozowicz, SlawomirX

[-- Attachment #1: Type: text/plain, Size: 40 bytes --]

Applied to dpdk-next-crypto

Thanks.

[-- Attachment #2: Type: text/html, Size: 1539 bytes --]

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

* Re: [PATCH] crypto/openssl: do not build useless workaround
  2023-04-18 14:56 [PATCH] crypto/openssl: do not build useless workaround Didier Pallard
  2023-06-20  9:29 ` Ji, Kai
@ 2023-06-25 19:22 ` Thomas Monjalon
  2023-06-26  9:13   ` Didier Pallard
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Monjalon @ 2023-06-25 19:22 UTC (permalink / raw)
  To: Kai Ji, Didier Pallard, gakhil
  Cc: dev, stable, Daniel Mrzyglod, Tomasz Kulasek, Michal Kobylinski,
	Pablo de Lara, Slawomir Mrozowicz

18/04/2023 16:56, Didier Pallard:
> This workaround was needed before version 1.0.1f. Do not build it for
> versions >= 1.1.
> 
> Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library")
> Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
> Cc: stable@dpdk.org
[...]
> +#if OPENSSL_VERSION_NUMBER < 0x10100000L
>  	/* Workaround open ssl bug in version less then 1.0.1f */
>  	if (EVP_EncryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
>  		goto process_auth_encryption_gcm_err;
> +#endif

What happens if we build with OpenSSL 1.1 and run with OpenSSL 1.0?
Can we have a runtime check?
Or is it better doing the workaround always as before?



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

* Re: [PATCH] crypto/openssl: do not build useless workaround
  2023-06-25 19:22 ` Thomas Monjalon
@ 2023-06-26  9:13   ` Didier Pallard
  2023-06-26 10:04     ` Thomas Monjalon
  0 siblings, 1 reply; 7+ messages in thread
From: Didier Pallard @ 2023-06-26  9:13 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Kai Ji, gakhil, dev, stable, Daniel Mrzyglod, Tomasz Kulasek,
	Michal Kobylinski, Pablo de Lara, Slawomir Mrozowicz

[-- Attachment #1: Type: text/plain, Size: 1162 bytes --]

HI,
not sure to understand how it is possible.
If build  OPENSSL_VERSION_NUMBER <  0x10100000L, linker should link binary
with libcrypto.so.1.0.0.
libcrypto.so.1.1 if build for 0x10100000L and libcrypto.so.3 for
0x30000000L
loader should not allow to link with a library different from the one used
at build time, no?

didier

On Sun, Jun 25, 2023 at 9:22 PM Thomas Monjalon <thomas@monjalon.net> wrote:

> 18/04/2023 16:56, Didier Pallard:
> > This workaround was needed before version 1.0.1f. Do not build it for
> > versions >= 1.1.
> >
> > Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library")
> > Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
> > Cc: stable@dpdk.org
> [...]
> > +#if OPENSSL_VERSION_NUMBER < 0x10100000L
> >       /* Workaround open ssl bug in version less then 1.0.1f */
> >       if (EVP_EncryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
> >               goto process_auth_encryption_gcm_err;
> > +#endif
>
> What happens if we build with OpenSSL 1.1 and run with OpenSSL 1.0?
> Can we have a runtime check?
> Or is it better doing the workaround always as before?
>
>
>

[-- Attachment #2: Type: text/html, Size: 1774 bytes --]

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

* Re: [PATCH] crypto/openssl: do not build useless workaround
  2023-06-26  9:13   ` Didier Pallard
@ 2023-06-26 10:04     ` Thomas Monjalon
  2023-06-26 10:39       ` Didier Pallard
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Monjalon @ 2023-06-26 10:04 UTC (permalink / raw)
  To: Didier Pallard
  Cc: Kai Ji, gakhil, dev, stable, Daniel Mrzyglod, Tomasz Kulasek,
	Michal Kobylinski, Pablo de Lara, Slawomir Mrozowicz

26/06/2023 11:13, Didier Pallard:
> HI,
> not sure to understand how it is possible.
> If build  OPENSSL_VERSION_NUMBER <  0x10100000L, linker should link binary
> with libcrypto.so.1.0.0.
> libcrypto.so.1.1 if build for 0x10100000L and libcrypto.so.3 for
> 0x30000000L
> loader should not allow to link with a library different from the one used
> at build time, no?

You are probably right.
libcrypto.so.1.1 and libcrypto.so.1.0 are incompatible versions?
If we are linking against libcrypto.so.1.1 and you did exactly
a check for lower than libcrypto.so.1.1, then it should be OK.


> On Sun, Jun 25, 2023 at 9:22 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> 
> > 18/04/2023 16:56, Didier Pallard:
> > > This workaround was needed before version 1.0.1f. Do not build it for
> > > versions >= 1.1.
> > >
> > > Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library")
> > > Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
> > > Cc: stable@dpdk.org
> > [...]
> > > +#if OPENSSL_VERSION_NUMBER < 0x10100000L
> > >       /* Workaround open ssl bug in version less then 1.0.1f */
> > >       if (EVP_EncryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
> > >               goto process_auth_encryption_gcm_err;
> > > +#endif
> >
> > What happens if we build with OpenSSL 1.1 and run with OpenSSL 1.0?
> > Can we have a runtime check?
> > Or is it better doing the workaround always as before?




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

* Re: [PATCH] crypto/openssl: do not build useless workaround
  2023-06-26 10:04     ` Thomas Monjalon
@ 2023-06-26 10:39       ` Didier Pallard
  0 siblings, 0 replies; 7+ messages in thread
From: Didier Pallard @ 2023-06-26 10:39 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Kai Ji, gakhil, dev, stable, Daniel Mrzyglod, Tomasz Kulasek,
	Michal Kobylinski, Pablo de Lara, Slawomir Mrozowicz

[-- Attachment #1: Type: text/plain, Size: 1675 bytes --]

On Mon, Jun 26, 2023 at 12:04 PM Thomas Monjalon <thomas@monjalon.net>
wrote:

> 26/06/2023 11:13, Didier Pallard:
> > HI,
> > not sure to understand how it is possible.
> > If build  OPENSSL_VERSION_NUMBER <  0x10100000L, linker should link
> binary
> > with libcrypto.so.1.0.0.
> > libcrypto.so.1.1 if build for 0x10100000L and libcrypto.so.3 for
> > 0x30000000L
> > loader should not allow to link with a library different from the one
> used
> > at build time, no?
>
> You are probably right.
> libcrypto.so.1.1 and libcrypto.so.1.0 are incompatible versions?
>
I think so. Can someone else confirm?


> If we are linking against libcrypto.so.1.1 and you did exactly
> a check for lower than libcrypto.so.1.1, then it should be OK.
>
>
> > On Sun, Jun 25, 2023 at 9:22 PM Thomas Monjalon <thomas@monjalon.net>
> wrote:
> >
> > > 18/04/2023 16:56, Didier Pallard:
> > > > This workaround was needed before version 1.0.1f. Do not build it for
> > > > versions >= 1.1.
> > > >
> > > > Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL
> library")
> > > > Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
> > > > Cc: stable@dpdk.org
> > > [...]
> > > > +#if OPENSSL_VERSION_NUMBER < 0x10100000L
> > > >       /* Workaround open ssl bug in version less then 1.0.1f */
> > > >       if (EVP_EncryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
> > > >               goto process_auth_encryption_gcm_err;
> > > > +#endif
> > >
> > > What happens if we build with OpenSSL 1.1 and run with OpenSSL 1.0?
> > > Can we have a runtime check?
> > > Or is it better doing the workaround always as before?
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 2592 bytes --]

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

end of thread, other threads:[~2023-06-26 10:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 14:56 [PATCH] crypto/openssl: do not build useless workaround Didier Pallard
2023-06-20  9:29 ` Ji, Kai
2023-06-20 11:00   ` Akhil Goyal
2023-06-25 19:22 ` Thomas Monjalon
2023-06-26  9:13   ` Didier Pallard
2023-06-26 10:04     ` Thomas Monjalon
2023-06-26 10:39       ` Didier Pallard

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).