Skip to content

Commit 194f486

Browse files
committed
generator: cleanups in Pedersen/generator code
Silence a compiler warning about an unitialized use of a scalar in case the user tries to provide a 0-length list of commitments. Also ensures that commitments have normalized field elements when they are loaded into ges.
1 parent 68ee3fb commit 194f486

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/modules/generator/main_impl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ static void secp256k1_pedersen_commitment_load(secp256k1_ge* ge, const secp256k1
249249
if (commit->data[0] & 1) {
250250
secp256k1_ge_neg(ge, ge);
251251
}
252+
secp256k1_fe_normalize(&ge->y);
252253
}
253254

254255
static void secp256k1_pedersen_commitment_save(secp256k1_pedersen_commitment* commit, secp256k1_ge* ge) {
@@ -391,6 +392,7 @@ int secp256k1_pedersen_blind_generator_blind_sum(const secp256k1_context* ctx, c
391392
}
392393

393394
secp256k1_scalar_set_int(&sum, 0);
395+
secp256k1_scalar_set_int(&tmp, 0);
394396

395397
/* Here, n_total > 0. Thus the loop runs at least once.
396398
Thus we may use a do-while loop, which checks the loop

0 commit comments

Comments
 (0)