Skip to content

Commit 45b6468

Browse files
Have secp256k1_ge_set_all_gej_var initialize all fields.
Previous behaviour would not initialize r->y values in the case where infinity is passed in. Furthermore, the previous behaviour wouldn't initialize anything in the case where all inputs were infinity.
1 parent 31c0f6d commit 45b6468

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/group_impl.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ static void secp256k1_ge_set_all_gej_var(secp256k1_ge *r, const secp256k1_gej *a
119119
size_t last_i = SIZE_MAX;
120120

121121
for (i = 0; i < len; i++) {
122-
if (!a[i].infinity) {
122+
if (a[i].infinity) {
123+
secp256k1_ge_set_infinity(&r[i]);
124+
} else {
123125
/* Use destination's x coordinates as scratch space */
124126
if (last_i == SIZE_MAX) {
125127
r[i].x = a[i].z;
@@ -147,7 +149,6 @@ static void secp256k1_ge_set_all_gej_var(secp256k1_ge *r, const secp256k1_gej *a
147149
r[last_i].x = u;
148150

149151
for (i = 0; i < len; i++) {
150-
r[i].infinity = a[i].infinity;
151152
if (!a[i].infinity) {
152153
secp256k1_ge_set_gej_zinv(&r[i], &a[i], &r[i].x);
153154
}

0 commit comments

Comments
 (0)