[v3,3/3] drivers/crypto: use RTE_BIT64 in initializations of hash_algos

Message ID 1738006389-17193-3-git-send-email-andremue@linux.microsoft.com (mailing list archive)
State Accepted
Delegated to: akhil goyal
Headers
Series [v3,1/3] lib/cryptodev: avoid implicit conversion to 64 bit number |

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/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS

Commit Message

Andre Muezerie Jan. 27, 2025, 7:33 p.m. UTC
This was found during code review of similar issues.

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c | 4 ++--
 drivers/crypto/openssl/rte_openssl_pmd_ops.c      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Morten Brørup Jan. 28, 2025, 7:45 a.m. UTC | #1
> From: Andre Muezerie [mailto:andremue@linux.microsoft.com]
> Sent: Monday, 27 January 2025 20.33
> 
> This was found during code review of similar issues.
> 
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
> ---

Reviewed-by: Morten Brørup <mb@smartsharesystems.com>

CNXK crypto & OpenSSL crypto driver maintainers, please review/ack.


>  drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c | 4 ++--
>  drivers/crypto/openssl/rte_openssl_pmd_ops.c      | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c
> b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c
> index 4394513002..e78bc37c37 100644
> --- a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c
> +++ b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c
> @@ -1207,8 +1207,8 @@ static const struct rte_cryptodev_capabilities
> caps_eddsa[] = {
>  		{.asym = {
>  			.xform_capa = {
>  				.xform_type = RTE_CRYPTO_ASYM_XFORM_EDDSA,
> -				.hash_algos = (1 << RTE_CRYPTO_AUTH_SHA512 |
> -					       1 << RTE_CRYPTO_AUTH_SHAKE_256),
> +				.hash_algos =
> (RTE_BIT64(RTE_CRYPTO_AUTH_SHA512) |
> +
> RTE_BIT64(RTE_CRYPTO_AUTH_SHAKE_256)),
>  				.op_types = ((1 << RTE_CRYPTO_ASYM_OP_SIGN) |
>  					     (1 << RTE_CRYPTO_ASYM_OP_VERIFY))
>  			}
> diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
> b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
> index 18f096abfd..04e018f3df 100644
> --- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
> +++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
> @@ -630,8 +630,8 @@ static const struct rte_cryptodev_capabilities
> openssl_pmd_capabilities[] = {
>  		{.asym = {
>  			.xform_capa = {
>  				.xform_type = RTE_CRYPTO_ASYM_XFORM_EDDSA,
> -				.hash_algos = (1 << RTE_CRYPTO_AUTH_SHA512 |
> -					       1 << RTE_CRYPTO_AUTH_SHAKE_256),
> +				.hash_algos =
> (RTE_BIT64(RTE_CRYPTO_AUTH_SHA512) |
> +
> RTE_BIT64(RTE_CRYPTO_AUTH_SHAKE_256)),
>  				.op_types =
>  				((1<<RTE_CRYPTO_ASYM_OP_SIGN) |
>  				 (1 << RTE_CRYPTO_ASYM_OP_VERIFY)),
> --
> 2.47.2.vfs.0.1
  
Anoob Joseph Jan. 28, 2025, 7:49 a.m. UTC | #2
> > From: Andre Muezerie [mailto:andremue@linux.microsoft.com]
> > Sent: Monday, 27 January 2025 20.33
> > 
> > This was found during code review of similar issues.
> > 
> > Signed-off-by: Andre Muezerie <mailto:andremue@linux.microsoft.com>
> > ---
>
> Reviewed-by: Morten Brørup <mailto:mb@smartsharesystems.com>
>
> CNXK crypto & OpenSSL crypto driver maintainers, please review/ack.

Acked-by: Anoob Joseph <anoobj@marvell.com>
  

Patch

diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c
index 4394513002..e78bc37c37 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c
@@ -1207,8 +1207,8 @@  static const struct rte_cryptodev_capabilities caps_eddsa[] = {
 		{.asym = {
 			.xform_capa = {
 				.xform_type = RTE_CRYPTO_ASYM_XFORM_EDDSA,
-				.hash_algos = (1 << RTE_CRYPTO_AUTH_SHA512 |
-					       1 << RTE_CRYPTO_AUTH_SHAKE_256),
+				.hash_algos = (RTE_BIT64(RTE_CRYPTO_AUTH_SHA512) |
+					       RTE_BIT64(RTE_CRYPTO_AUTH_SHAKE_256)),
 				.op_types = ((1 << RTE_CRYPTO_ASYM_OP_SIGN) |
 					     (1 << RTE_CRYPTO_ASYM_OP_VERIFY))
 			}
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index 18f096abfd..04e018f3df 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -630,8 +630,8 @@  static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = {
 		{.asym = {
 			.xform_capa = {
 				.xform_type = RTE_CRYPTO_ASYM_XFORM_EDDSA,
-				.hash_algos = (1 << RTE_CRYPTO_AUTH_SHA512 |
-					       1 << RTE_CRYPTO_AUTH_SHAKE_256),
+				.hash_algos = (RTE_BIT64(RTE_CRYPTO_AUTH_SHA512) |
+					       RTE_BIT64(RTE_CRYPTO_AUTH_SHAKE_256)),
 				.op_types =
 				((1<<RTE_CRYPTO_ASYM_OP_SIGN) |
 				 (1 << RTE_CRYPTO_ASYM_OP_VERIFY)),