Commit 5072b1c2 authored by Herbert Xu's avatar Herbert Xu

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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: default avatarVitaly Chikunov <vt@altlinux.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent d3777cea
...@@ -1384,7 +1384,8 @@ void ecc_point_mult_shamir(const struct ecc_point *result, ...@@ -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)); num_bits = max(vli_num_bits(u1, ndigits), vli_num_bits(u2, ndigits));
i = num_bits - 1; 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]; point = points[idx];
vli_set(rx, point->x, ndigits); vli_set(rx, point->x, ndigits);
...@@ -1394,7 +1395,8 @@ void ecc_point_mult_shamir(const struct ecc_point *result, ...@@ -1394,7 +1395,8 @@ void ecc_point_mult_shamir(const struct ecc_point *result,
for (--i; i >= 0; i--) { for (--i; i >= 0; i--) {
ecc_point_double_jacobian(rx, ry, z, curve); 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]; point = points[idx];
if (point) { if (point) {
u64 tx[ECC_MAX_DIGITS]; u64 tx[ECC_MAX_DIGITS];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment