From 9e36d1bfe239e1eb428a083a5ea61ae1723e2ade Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Fri, 23 Mar 2018 13:57:16 +0000 Subject: [PATCH] Fix bug in wnaf_fixed where the wnaf array is not completely zeroed when given a 0 scalar. --- src/ecmult_impl.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ecmult_impl.h b/src/ecmult_impl.h index 71ab284..608d19b 100644 --- a/src/ecmult_impl.h +++ b/src/ecmult_impl.h @@ -571,9 +571,8 @@ static int secp256k1_wnaf_fixed(int *wnaf, const secp256k1_scalar *s, int w) { const secp256k1_scalar *work = s; if (secp256k1_scalar_is_zero(s)) { - while (pos * w < WNAF_BITS) { + for (pos = 0; pos < WNAF_SIZE(w); pos++) { wnaf[pos] = 0; - ++pos; } return 0; }