diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2023-02-06 12:53:38 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2023-02-14 13:39:33 +0800 |
commit | c269eaae1fa244599fd7917149259aed987b3782 (patch) | |
tree | 1308fe6263e605906d6454cb49966f86abf3e1f8 | |
parent | a4631368d0d1973c450a6a0f34aec6efde0fc6c9 (diff) | |
download | linux-crypto-c269eaae1fa244599fd7917149259aed987b3782.tar.gz linux-crypto-c269eaae1fa244599fd7917149259aed987b3782.zip |
crypto: ecc - Silence sparse warning
Rewrite the bitwise operations to silence the sparse warnings:
CHECK ../crypto/ecc.c
../crypto/ecc.c:1387:39: warning: dubious: !x | y
../crypto/ecc.c:1397:47: warning: dubious: !x | y
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: Vitaly Chikunov <vt@altlinux.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | crypto/ecc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/ecc.c b/crypto/ecc.c index 7315217c..f53fb4d6 100644 --- a/crypto/ecc.c +++ b/crypto/ecc.c @@ -1384,7 +1384,8 @@ void ecc_point_mult_shamir(const struct ecc_point *result, num_bits = max(vli_num_bits(u1, ndigits), vli_num_bits(u2, ndigits)); i = num_bits - 1; - idx = (!!vli_test_bit(u1, i)) | ((!!vli_test_bit(u2, i)) << 1); + idx = !!vli_test_bit(u1, i); + idx |= (!!vli_test_bit(u2, i)) << 1; point = points[idx]; vli_set(rx, point->x, ndigits); @@ -1394,7 +1395,8 @@ void ecc_point_mult_shamir(const struct ecc_point *result, for (--i; i >= 0; i--) { ecc_point_double_jacobian(rx, ry, z, curve); - idx = (!!vli_test_bit(u1, i)) | ((!!vli_test_bit(u2, i)) << 1); + idx = !!vli_test_bit(u1, i); + idx |= (!!vli_test_bit(u2, i)) << 1; point = points[idx]; if (point) { u64 tx[ECC_MAX_DIGITS]; |