crypto/ipsec_mb: fix zuc256 maximum tag length

Message ID 20230131172027.524502-1-ciara.power@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series crypto/ipsec_mb: fix zuc256 maximum tag length |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Power, Ciara Jan. 31, 2023, 5:20 p.m. UTC
  The AESNI_MB PMD supports 8 and 16 byte tag lengths for ZUC256 when
intel-ipsec-mb version is 1.3 or newer.
The conditional check to enable these tag lengths had the incorrect
operator, which enabled 8 and 16 byte tag lengths for versions below 1.2,
which is not supported.

Fixes: 7babda4316f9 ("crypto/ipsec_mb: support all tag sizes for ZUC-EIA3-256")
Cc: pablo.de.lara.guarch@intel.com

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 drivers/crypto/ipsec_mb/pmd_aesni_mb.c      | 2 +-
 drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Brian Dooley Feb. 2, 2023, 2:10 p.m. UTC | #1
Hi Ciara,

> -----Original Message-----
> From: Ciara Power <ciara.power@intel.com>
> Sent: Tuesday 31 January 2023 17:20
> To: Ji, Kai <kai.ji@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> Cc: dev@dpdk.org; Power, Ciara <ciara.power@intel.com>
> Subject: [PATCH] crypto/ipsec_mb: fix zuc256 maximum tag length
> 
> The AESNI_MB PMD supports 8 and 16 byte tag lengths for ZUC256 when
> intel-ipsec-mb version is 1.3 or newer.
> The conditional check to enable these tag lengths had the incorrect operator,
> which enabled 8 and 16 byte tag lengths for versions below 1.2, which is not
> supported.
> 
> Fixes: 7babda4316f9 ("crypto/ipsec_mb: support all tag sizes for ZUC-EIA3-
> 256")
> Cc: pablo.de.lara.guarch@intel.com
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> ---
>  drivers/crypto/ipsec_mb/pmd_aesni_mb.c      | 2 +-
>  drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> index 147a38932d..ac20d01937 100644
> --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> @@ -199,7 +199,7 @@ aesni_mb_set_session_auth_parameters(const
> IMB_MGR *mb_mgr,
>  			}
>  		} else if (xform->auth.key.length == 32) {
>  			sess->auth.algo = IMB_AUTH_ZUC256_EIA3_BITLEN;
> -#if IMB_VERSION(1, 2, 0) > IMB_VERSION_NUM
> +#if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM
>  			if (sess->auth.req_digest_len != 4 &&
>  					sess->auth.req_digest_len != 8 &&
>  					sess->auth.req_digest_len != 16) {
> diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
> b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
> index 55fafbbbec..8a7c74f621 100644
> --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
> +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
> @@ -566,7 +566,7 @@ static const struct rte_cryptodev_capabilities
> aesni_mb_capabilities[] = {
>  				},
>  				.digest_size = {
>  					.min = 4,
> -#if IMB_VERSION(1, 2, 0) > IMB_VERSION_NUM
> +#if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM
>  					.max = 16,
>  					.increment = 4
>  #else
> --
> 2.25.1

Reviewed-by: Brian Dooley <brian.dooley@intel.com>
  
Akhil Goyal Feb. 5, 2023, 5:32 p.m. UTC | #2
> >
> > The AESNI_MB PMD supports 8 and 16 byte tag lengths for ZUC256 when
> > intel-ipsec-mb version is 1.3 or newer.
> > The conditional check to enable these tag lengths had the incorrect operator,
> > which enabled 8 and 16 byte tag lengths for versions below 1.2, which is not
> > supported.
> >
> > Fixes: 7babda4316f9 ("crypto/ipsec_mb: support all tag sizes for ZUC-EIA3-
> > 256")
> > Cc: pablo.de.lara.guarch@intel.com
> >
> > Signed-off-by: Ciara Power <ciara.power@intel.com>
> Reviewed-by: Brian Dooley <brian.dooley@intel.com>
Applied to dpdk-next-crypto

Thanks.
  
Akhil Goyal Feb. 5, 2023, 5:33 p.m. UTC | #3
> Subject: RE: [PATCH] crypto/ipsec_mb: fix zuc256 maximum tag length
> 
> > >
> > > The AESNI_MB PMD supports 8 and 16 byte tag lengths for ZUC256 when
> > > intel-ipsec-mb version is 1.3 or newer.
> > > The conditional check to enable these tag lengths had the incorrect
> operator,
> > > which enabled 8 and 16 byte tag lengths for versions below 1.2, which is not
> > > supported.
> > >
> > > Fixes: 7babda4316f9 ("crypto/ipsec_mb: support all tag sizes for ZUC-EIA3-
> > > 256")
> > > Cc: pablo.de.lara.guarch@intel.com
> > >
> > > Signed-off-by: Ciara Power <ciara.power@intel.com>
> > Reviewed-by: Brian Dooley <brian.dooley@intel.com>
> Applied to dpdk-next-crypto
> 
Cc: stable@dpdk.org
  

Patch

diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index 147a38932d..ac20d01937 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -199,7 +199,7 @@  aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr,
 			}
 		} else if (xform->auth.key.length == 32) {
 			sess->auth.algo = IMB_AUTH_ZUC256_EIA3_BITLEN;
-#if IMB_VERSION(1, 2, 0) > IMB_VERSION_NUM
+#if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM
 			if (sess->auth.req_digest_len != 4 &&
 					sess->auth.req_digest_len != 8 &&
 					sess->auth.req_digest_len != 16) {
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
index 55fafbbbec..8a7c74f621 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
@@ -566,7 +566,7 @@  static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = {
 				},
 				.digest_size = {
 					.min = 4,
-#if IMB_VERSION(1, 2, 0) > IMB_VERSION_NUM
+#if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM
 					.max = 16,
 					.increment = 4
 #else