ecdsa_in_range applies bitwise and to int and boolean arguments, which
can result in unpredictable behaviour. Use logical and instead.

Signed-off-by: Dmitry Baryshkov <[email protected]>
---
 ecc-random.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ecc-random.c b/ecc-random.c
index 79df511cb6b6..e80405fe46fd 100644
--- a/ecc-random.c
+++ b/ecc-random.c
@@ -60,7 +60,7 @@ ecdsa_in_range (const struct ecc_modulo *m,
 {
   /* Check if 0 < x < q, with data independent timing. */
   return !zero_p (m, xp)
-    & (mpn_sub_n (scratch, xp, m->m, m->size) != 0);
+    && (mpn_sub_n (scratch, xp, m->m, m->size) != 0);
 }
 
 void
-- 
2.25.1

_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to