Skip to content

Commit 1ba100f

Browse files
real-or-randomisle2983sipa
committed
Separate between clearing memory and setting to zero in tests
Co-Authored-By: isle2983 <isle2983@yahoo.com> Co-Authored-By: Pieter Wuille <pieter.wuille@gmail.com>
1 parent 3c2cb41 commit 1ba100f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/tests.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ void test_ge(void) {
20632063
secp256k1_fe zfi2, zfi3;
20642064

20652065
secp256k1_gej_set_infinity(&gej[0]);
2066-
secp256k1_ge_clear(&ge[0]);
2066+
secp256k1_ge_set_gej(&ge[0], &gej[0]);
20672067
secp256k1_ge_set_gej_var(&ge[0], &gej[0]);
20682068
for (i = 0; i < runs; i++) {
20692069
int j;
@@ -2860,12 +2860,12 @@ void test_ecmult_multi(secp256k1_scratch *scratch, secp256k1_ecmult_multi_func e
28602860
random_group_element_test(&pt[ncount]);
28612861
}
28622862

2863-
secp256k1_scalar_clear(&sc[0]);
2863+
secp256k1_scalar_set_int(&sc[0], 0);
28642864
CHECK(ecmult_multi(&ctx->error_callback, &ctx->ecmult_ctx, scratch, &r, &szero, ecmult_multi_callback, &data, 20));
2865-
secp256k1_scalar_clear(&sc[1]);
2866-
secp256k1_scalar_clear(&sc[2]);
2867-
secp256k1_scalar_clear(&sc[3]);
2868-
secp256k1_scalar_clear(&sc[4]);
2865+
secp256k1_scalar_set_int(&sc[1], 0);
2866+
secp256k1_scalar_set_int(&sc[2], 0);
2867+
secp256k1_scalar_set_int(&sc[3], 0);
2868+
secp256k1_scalar_set_int(&sc[4], 0);
28692869
CHECK(ecmult_multi(&ctx->error_callback, &ctx->ecmult_ctx, scratch, &r, &szero, ecmult_multi_callback, &data, 6));
28702870
CHECK(ecmult_multi(&ctx->error_callback, &ctx->ecmult_ctx, scratch, &r, &szero, ecmult_multi_callback, &data, 5));
28712871
CHECK(secp256k1_gej_is_infinity(&r));

0 commit comments

Comments
 (0)