Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Have secp256k1_ge_set_gej_var initialize all fields.
Browse files Browse the repository at this point in the history
Previous behaviour would not initialize r->x and r->y values in the case where infinity is passed in.
  • Loading branch information
roconnor-blockstream committed May 4, 2021
1 parent d0bd269 commit dd6c3de
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/group_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ static void secp256k1_ge_set_gej(secp256k1_ge *r, secp256k1_gej *a) {

static void secp256k1_ge_set_gej_var(secp256k1_ge *r, secp256k1_gej *a) {
secp256k1_fe z2, z3;
r->infinity = a->infinity;
if (a->infinity) {
secp256k1_ge_set_infinity(r);
return;
}
secp256k1_fe_inv_var(&a->z, &a->z);
Expand All @@ -110,8 +110,7 @@ static void secp256k1_ge_set_gej_var(secp256k1_ge *r, secp256k1_gej *a) {
secp256k1_fe_mul(&a->x, &a->x, &z2);
secp256k1_fe_mul(&a->y, &a->y, &z3);
secp256k1_fe_set_int(&a->z, 1);
r->x = a->x;
r->y = a->y;
secp256k1_ge_set_xy(r, &a->x, &a->y);
}

static void secp256k1_ge_set_all_gej_var(secp256k1_ge *r, const secp256k1_gej *a, size_t len) {
Expand Down

0 comments on commit dd6c3de

Please sign in to comment.