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.
This commit is contained in:
parent
31c0f6de41
commit
45b6468d7e
@ -119,7 +119,9 @@ static void secp256k1_ge_set_all_gej_var(secp256k1_ge *r, const secp256k1_gej *a
|
|||||||
size_t last_i = SIZE_MAX;
|
size_t last_i = SIZE_MAX;
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (!a[i].infinity) {
|
if (a[i].infinity) {
|
||||||
|
secp256k1_ge_set_infinity(&r[i]);
|
||||||
|
} else {
|
||||||
/* Use destination's x coordinates as scratch space */
|
/* Use destination's x coordinates as scratch space */
|
||||||
if (last_i == SIZE_MAX) {
|
if (last_i == SIZE_MAX) {
|
||||||
r[i].x = a[i].z;
|
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
|
|||||||
r[last_i].x = u;
|
r[last_i].x = u;
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
r[i].infinity = a[i].infinity;
|
|
||||||
if (!a[i].infinity) {
|
if (!a[i].infinity) {
|
||||||
secp256k1_ge_set_gej_zinv(&r[i], &a[i], &r[i].x);
|
secp256k1_ge_set_gej_zinv(&r[i], &a[i], &r[i].x);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user