Skip to content

Commit 86e3b38

Browse files
Merge #1149: Remove usage of CHECK from non-test file
6a965b6 Remove usage of CHECK from non-test file (Tobin C. Harding) Pull request description: Currently CHECK is used only in test and bench mark files except for one usage in `ecmult_impl.h`. We would like to move the definition of CHECK out of `util.h` so that `util.h` no longer has a hard dependency on `stdio.h`. Done as part of an effort to allow secp256k1 to be compiled to WASM as part of `rust-secp256k1`. ### Note to reviewers Please review carefully, I don't actually know if this patch is correct. Done while working on #1095. I'm happy to make any changes both in concept and execution - I'm super rusty at C programming. cc real-or-random ACKs for top commit: sipa: utACK 6a965b6 real-or-random: utACK 6a965b6 Tree-SHA512: 6bfb456bdb92a831acd3bc202607e80f6d0a194d6b2cf745c8eceb12ba675d03a319d6d105332b0cbca474e443969295e5a8e938635453e21e057d0ee597440b
2 parents 44916ae + 6a965b6 commit 86e3b38

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/ecmult_impl.h

+9-3
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,15 @@ static int secp256k1_ecmult_wnaf(int *wnaf, int len, const secp256k1_scalar *a,
200200
bit += now;
201201
}
202202
#ifdef VERIFY
203-
CHECK(carry == 0);
204-
while (bit < 256) {
205-
CHECK(secp256k1_scalar_get_bits(&s, bit++, 1) == 0);
203+
{
204+
int verify_bit = bit;
205+
206+
VERIFY_CHECK(carry == 0);
207+
208+
while (verify_bit < 256) {
209+
VERIFY_CHECK(secp256k1_scalar_get_bits(&s, verify_bit, 1) == 0);
210+
verify_bit++;
211+
}
206212
}
207213
#endif
208214
return last_set_bit + 1;

0 commit comments

Comments
 (0)