> From: Andre Muezerie [mailto:andre...@linux.microsoft.com] > Sent: Monday, 27 January 2025 17.04 > > MSVC issues the warning below: > > ../lib/cryptodev/rte_cryptodev.c(623): warning C4334: '<<': > result of 32-bit shift implicitly converted to 64 bits > (was 64-bit shift intended?) > > The code would be better off by using 64 bit numbers to begin with. > That eliminates the need for a conversion to 64 bits later. > > Signed-off-by: Andre Muezerie <andre...@linux.microsoft.com> > Acked-by: Akhil Goyal <gak...@marvell.com> > --- > lib/cryptodev/rte_cryptodev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/cryptodev/rte_cryptodev.c > b/lib/cryptodev/rte_cryptodev.c > index 85a4b46ac9..a49b0662f3 100644 > --- a/lib/cryptodev/rte_cryptodev.c > +++ b/lib/cryptodev/rte_cryptodev.c > @@ -620,7 +620,7 @@ rte_cryptodev_asym_xform_capability_check_hash( > { > bool ret = false; > > - if (capability->hash_algos & (1 << hash)) > + if (capability->hash_algos & RTE_BIT64(hash)) > ret = true;
If I'm not mistaken, the last of the hash enums RTE_CRYPTO_AUTH_SM3_HMAC has the value 32, so this patch actually fixes a bug. If you agree with my analysis, a Fixes tag should be added, so the patch can be backported. (RTE_CRYPTO_AUTH_SM3_HMAC also exists in previous DPDK versions.) Furthermore, driver initializations of hash_algos should also use RTE_BIT64(): https://elixir.bootlin.com/dpdk/v24.11.1/C/ident/hash_algos Specifically, OpenSSL and CNXK crypto drivers have the same bug, and need to be fixed too: https://elixir.bootlin.com/dpdk/v24.11.1/source/drivers/crypto/openssl/rte_openssl_pmd_ops.c#L633 https://elixir.bootlin.com/dpdk/v24.11.1/source/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c#L1210 With Fixes tag added, Reviewed-by: Morten Brørup <m...@smartsharesystems.com>