patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] crypto/ipsec_mb: fix GMAC parameters setting
@ 2022-03-09 10:45 Pablo de Lara
  2022-03-09 11:01 ` Zhang, Roy Fan
  2022-03-09 11:44 ` Nicolau, Radu
  0 siblings, 2 replies; 5+ messages in thread
From: Pablo de Lara @ 2022-03-09 10:45 UTC (permalink / raw)
  To: radu.nicolau, daniel.m.buckley, roy.fan.zhang; +Cc: dev, Pablo de Lara, stable

AES-GMAC requires plaintext length to be 0 when using AES-GCM,
so only AAD data is used.

Fixes: a501609ea646 ("crypto/ipsec_mb: fix length and offset settings")
Cc: pablo.de.lara.guarch@intel.com
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index c974886032..afa0b6e3a4 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1296,9 +1296,9 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp,
 					op->sym->aead.data.offset;
 			job->msg_len_to_hash_in_bytes =
 					op->sym->aead.data.length;
-		} else {
-			job->msg_len_to_cipher_in_bytes = 0;
+		} else { /* AES-GMAC only, only AAD used */
 			job->msg_len_to_hash_in_bytes = 0;
+			job->hash_start_src_offset_in_bytes = 0;
 		}
 
 		job->iv = rte_crypto_op_ctod_offset(op, uint8_t *,
@@ -1378,8 +1378,18 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp,
 		job->msg_len_to_cipher_in_bits =
 					op->sym->cipher.data.length;
 		break;
-	case IMB_CIPHER_CCM:
 	case IMB_CIPHER_GCM:
+		if (session->cipher.mode == IMB_CIPHER_NULL) {
+			/* AES-GMAC only (only AAD used) */
+			job->msg_len_to_cipher_in_bytes = 0;
+			job->cipher_start_src_offset_in_bytes = 0;
+		} else {
+			job->cipher_start_src_offset_in_bytes =
+					op->sym->aead.data.offset;
+			job->msg_len_to_cipher_in_bytes = op->sym->aead.data.length;
+		}
+		break;
+	case IMB_CIPHER_CCM:
 	case IMB_CIPHER_CHACHA20_POLY1305:
 		job->cipher_start_src_offset_in_bytes =
 				op->sym->aead.data.offset;
-- 
2.25.1


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

* RE: [PATCH] crypto/ipsec_mb: fix GMAC parameters setting
  2022-03-09 10:45 [PATCH] crypto/ipsec_mb: fix GMAC parameters setting Pablo de Lara
@ 2022-03-09 11:01 ` Zhang, Roy Fan
  2022-03-09 19:02   ` De Lara Guarch, Pablo
  2022-03-09 11:44 ` Nicolau, Radu
  1 sibling, 1 reply; 5+ messages in thread
From: Zhang, Roy Fan @ 2022-03-09 11:01 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, Nicolau, Radu, Buckley, Daniel M; +Cc: dev, stable

> -----Original Message-----
> From: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Sent: Wednesday, March 9, 2022 10:45 AM
> To: Nicolau, Radu <radu.nicolau@intel.com>; Buckley, Daniel M
> <daniel.m.buckley@intel.com>; Zhang, Roy Fan <roy.fan.zhang@intel.com>
> Cc: dev@dpdk.org; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] crypto/ipsec_mb: fix GMAC parameters setting
> 
> AES-GMAC requires plaintext length to be 0 when using AES-GCM,
> so only AAD data is used.
> 
> Fixes: a501609ea646 ("crypto/ipsec_mb: fix length and offset settings")
> Cc: pablo.de.lara.guarch@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>  drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> index c974886032..afa0b6e3a4 100644
> --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> @@ -1296,9 +1296,9 @@ set_mb_job_params(IMB_JOB *job, struct
> ipsec_mb_qp *qp,
>  					op->sym->aead.data.offset;
>  			job->msg_len_to_hash_in_bytes =
>  					op->sym->aead.data.length;
> -		} else {
> -			job->msg_len_to_cipher_in_bytes = 0;
> +		} else { /* AES-GMAC only, only AAD used */
>  			job->msg_len_to_hash_in_bytes = 0;
> +			job->hash_start_src_offset_in_bytes = 0;
>  		}
> 
>  		job->iv = rte_crypto_op_ctod_offset(op, uint8_t *,
> @@ -1378,8 +1378,18 @@ set_mb_job_params(IMB_JOB *job, struct
> ipsec_mb_qp *qp,
>  		job->msg_len_to_cipher_in_bits =
>  					op->sym->cipher.data.length;
>  		break;
> -	case IMB_CIPHER_CCM:
>  	case IMB_CIPHER_GCM:
> +		if (session->cipher.mode == IMB_CIPHER_NULL) {
> +			/* AES-GMAC only (only AAD used) */
> +			job->msg_len_to_cipher_in_bytes = 0;
> +			job->cipher_start_src_offset_in_bytes = 0;
> +		} else {
> +			job->cipher_start_src_offset_in_bytes =
> +					op->sym->aead.data.offset;
> +			job->msg_len_to_cipher_in_bytes = op->sym-
> >aead.data.length;
> +		}
> +		break;
> +	case IMB_CIPHER_CCM:
>  	case IMB_CIPHER_CHACHA20_POLY1305:
>  		job->cipher_start_src_offset_in_bytes =
>  				op->sym->aead.data.offset;
> --
> 2.25.1
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Thanks Pablo!


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

* Re: [PATCH] crypto/ipsec_mb: fix GMAC parameters setting
  2022-03-09 10:45 [PATCH] crypto/ipsec_mb: fix GMAC parameters setting Pablo de Lara
  2022-03-09 11:01 ` Zhang, Roy Fan
@ 2022-03-09 11:44 ` Nicolau, Radu
  1 sibling, 0 replies; 5+ messages in thread
From: Nicolau, Radu @ 2022-03-09 11:44 UTC (permalink / raw)
  To: Pablo de Lara, daniel.m.buckley, roy.fan.zhang; +Cc: dev, stable


On 3/9/2022 10:45 AM, Pablo de Lara wrote:
> AES-GMAC requires plaintext length to be 0 when using AES-GCM,
> so only AAD data is used.
>
> Fixes: a501609ea646 ("crypto/ipsec_mb: fix length and offset settings")
> Cc: pablo.de.lara.guarch@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>
Tested-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>

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

* RE: [PATCH] crypto/ipsec_mb: fix GMAC parameters setting
  2022-03-09 11:01 ` Zhang, Roy Fan
@ 2022-03-09 19:02   ` De Lara Guarch, Pablo
  2022-03-14 10:19     ` Thomas Monjalon
  0 siblings, 1 reply; 5+ messages in thread
From: De Lara Guarch, Pablo @ 2022-03-09 19:02 UTC (permalink / raw)
  To: Zhang, Roy Fan, Nicolau, Radu, Buckley, Daniel M, Thomas Monjalon
  Cc: dev, stable

Hi Thomas,

> -----Original Message-----
> From: Zhang, Roy Fan <roy.fan.zhang@intel.com>
> Sent: Wednesday, March 9, 2022 11:01 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Nicolau, Radu
> <radu.nicolau@intel.com>; Buckley, Daniel M <daniel.m.buckley@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH] crypto/ipsec_mb: fix GMAC parameters setting
> 
> > -----Original Message-----
> > From: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> > Sent: Wednesday, March 9, 2022 10:45 AM
> > To: Nicolau, Radu <radu.nicolau@intel.com>; Buckley, Daniel M
> > <daniel.m.buckley@intel.com>; Zhang, Roy Fan <roy.fan.zhang@intel.com>
> > Cc: dev@dpdk.org; De Lara Guarch, Pablo
> > <pablo.de.lara.guarch@intel.com>; stable@dpdk.org
> > Subject: [PATCH] crypto/ipsec_mb: fix GMAC parameters setting
> >
> > AES-GMAC requires plaintext length to be 0 when using AES-GCM, so only
> > AAD data is used.
> >
> > Fixes: a501609ea646 ("crypto/ipsec_mb: fix length and offset
> > settings")
> > Cc: pablo.de.lara.guarch@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > ---
> >  drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 16 +++++++++++++---
> >  1 file changed, 13 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> > b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> > index c974886032..afa0b6e3a4 100644
> > --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> > +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> > @@ -1296,9 +1296,9 @@ set_mb_job_params(IMB_JOB *job, struct
> > ipsec_mb_qp *qp,
> >  					op->sym->aead.data.offset;
> >  			job->msg_len_to_hash_in_bytes =
> >  					op->sym->aead.data.length;
> > -		} else {
> > -			job->msg_len_to_cipher_in_bytes = 0;
> > +		} else { /* AES-GMAC only, only AAD used */
> >  			job->msg_len_to_hash_in_bytes = 0;
> > +			job->hash_start_src_offset_in_bytes = 0;
> >  		}
> >
> >  		job->iv = rte_crypto_op_ctod_offset(op, uint8_t *, @@ -1378,8
> > +1378,18 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp,
> >  		job->msg_len_to_cipher_in_bits =
> >  					op->sym->cipher.data.length;
> >  		break;
> > -	case IMB_CIPHER_CCM:
> >  	case IMB_CIPHER_GCM:
> > +		if (session->cipher.mode == IMB_CIPHER_NULL) {
> > +			/* AES-GMAC only (only AAD used) */
> > +			job->msg_len_to_cipher_in_bytes = 0;
> > +			job->cipher_start_src_offset_in_bytes = 0;
> > +		} else {
> > +			job->cipher_start_src_offset_in_bytes =
> > +					op->sym->aead.data.offset;
> > +			job->msg_len_to_cipher_in_bytes = op->sym-
> > >aead.data.length;
> > +		}
> > +		break;
> > +	case IMB_CIPHER_CCM:
> >  	case IMB_CIPHER_CHACHA20_POLY1305:
> >  		job->cipher_start_src_offset_in_bytes =
> >  				op->sym->aead.data.offset;
> > --
> > 2.25.1
> Acked-by: Fan Zhang <roy.fan.zhang@intel.com> Thanks Pablo!

Would it be possible to merge this fix for this release?
A previous commit merged in this release has introduced a bug,
so it would be great if this fix can make it into 22.03.

Thanks,
Pablo

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

* Re: [PATCH] crypto/ipsec_mb: fix GMAC parameters setting
  2022-03-09 19:02   ` De Lara Guarch, Pablo
@ 2022-03-14 10:19     ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2022-03-14 10:19 UTC (permalink / raw)
  To: De Lara Guarch, Pablo
  Cc: Zhang, Roy Fan, Nicolau, Radu, Buckley, Daniel M, stable, dev

> > > AES-GMAC requires plaintext length to be 0 when using AES-GCM, so only
> > > AAD data is used.
> > >
> > > Fixes: a501609ea646 ("crypto/ipsec_mb: fix length and offset
> > > settings")
> > > Cc: pablo.de.lara.guarch@intel.com
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > Acked-by: Fan Zhang <roy.fan.zhang@intel.com> Thanks Pablo!
> 
> Would it be possible to merge this fix for this release?
> A previous commit merged in this release has introduced a bug,
> so it would be great if this fix can make it into 22.03.

Applied, thanks.




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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09 10:45 [PATCH] crypto/ipsec_mb: fix GMAC parameters setting Pablo de Lara
2022-03-09 11:01 ` Zhang, Roy Fan
2022-03-09 19:02   ` De Lara Guarch, Pablo
2022-03-14 10:19     ` Thomas Monjalon
2022-03-09 11:44 ` Nicolau, Radu

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