@@ -87,17 +87,15 @@ static void secp256k1_ecmult_const_odd_multiples_table_globalz(secp256k1_ge *pre
8787 secp256k1_fe neg_y ; \
8888 VERIFY_CHECK ((n ) < (1U << ECMULT_CONST_GROUP_SIZE )); \
8989 VERIFY_CHECK (index < (1U << (ECMULT_CONST_GROUP_SIZE - 1 ))); \
90- /* Unconditionally set r->x = (pre)[m].x. r->y = (pre)[m].y. because it's either the correct one
90+ /* Unconditionally set r->x = (pre)[m].x and r->y = (pre)[m].y because it's either the correct one
9191 * or will get replaced in the later iterations, this is needed to make sure `r` is initialized. */ \
92- (r )-> x = (pre )[m ].x ; \
93- (r )-> y = (pre )[m ].y ; \
92+ secp256k1_ge_set_xy ((r ), & (pre )[m ].x , & (pre )[m ].y ); \
9493 for (m = 1 ; m < ECMULT_CONST_TABLE_SIZE ; m ++ ) { \
9594 /* This loop is used to avoid secret data in array indices. See
9695 * the comment in ecmult_gen_impl.h for rationale. */ \
9796 secp256k1_fe_cmov (& (r )-> x , & (pre )[m ].x , m == index ); \
9897 secp256k1_fe_cmov (& (r )-> y , & (pre )[m ].y , m == index ); \
9998 } \
100- (r )-> infinity = 0 ; \
10199 secp256k1_fe_negate (& neg_y , & (r )-> y , 1 ); \
102100 secp256k1_fe_cmov (& (r )-> y , & neg_y , negative ); \
103101} while (0 )
@@ -375,11 +373,14 @@ static int secp256k1_ecmult_const_xonly(secp256k1_fe* r, const secp256k1_fe *n,
375373
376374 SECP256K1_FE_VERIFY_MAGNITUDE (& g , 2 );
377375
378- /* Compute base point P = (n*g, g^2), the effective affine version of (n*g, g^2, v), which has
379- * corresponding affine X coordinate n/d. */
380- secp256k1_fe_mul (& p .x , & g , n );
381- secp256k1_fe_sqr (& p .y , & g );
382- p .infinity = 0 ;
376+ /* Compute base point P = (n*g, g^2), the effective affine version of
377+ * (n*g, g^2, v), which has corresponding affine X coordinate n/d. */
378+ {
379+ secp256k1_fe x , y ;
380+ secp256k1_fe_mul (& x , & g , n );
381+ secp256k1_fe_sqr (& y , & g );
382+ secp256k1_ge_set_xy (& p , & x , & y );
383+ }
383384
384385 /* Perform x-only EC multiplication of P with q. */
385386 VERIFY_CHECK (!secp256k1_scalar_is_zero (q ));
0 commit comments