2929 * To compute a*P + b*G, we use the jacobian version for P, and the affine version for G, as
3030 * G is constant, so it only needs to be done once in advance.
3131 */
32- void static secp256k1_ecmult_table_precomp_gej (secp256k1_gej_t * pre , const secp256k1_gej_t * a , int w ) {
32+ void static secp256k1_ecmult_table_precomp_gej_var (secp256k1_gej_t * pre , const secp256k1_gej_t * a , int w ) {
3333 pre [0 ] = * a ;
34- secp256k1_gej_t d ; secp256k1_gej_double (& d , & pre [0 ]);
34+ secp256k1_gej_t d ; secp256k1_gej_double_var (& d , & pre [0 ]);
3535 for (int i = 1 ; i < (1 << (w - 2 )); i ++ )
36- secp256k1_gej_add (& pre [i ], & d , & pre [i - 1 ]);
36+ secp256k1_gej_add_var (& pre [i ], & d , & pre [i - 1 ]);
3737}
3838
39- void static secp256k1_ecmult_table_precomp_ge (secp256k1_ge_t * pre , const secp256k1_gej_t * a , int w ) {
39+ void static secp256k1_ecmult_table_precomp_ge_var (secp256k1_ge_t * pre , const secp256k1_gej_t * a , int w ) {
4040 const int table_size = 1 << (w - 2 );
4141 secp256k1_gej_t prej [table_size ];
4242 prej [0 ] = * a ;
43- secp256k1_gej_t d ; secp256k1_gej_double (& d , a );
43+ secp256k1_gej_t d ; secp256k1_gej_double_var (& d , a );
4444 for (int i = 1 ; i < table_size ; i ++ ) {
45- secp256k1_gej_add (& prej [i ], & d , & prej [i - 1 ]);
45+ secp256k1_gej_add_var (& prej [i ], & d , & prej [i - 1 ]);
4646 }
47- secp256k1_ge_set_all_gej (table_size , pre , prej );
47+ secp256k1_ge_set_all_gej_var (table_size , pre , prej );
4848}
4949
5050/** The number of entries a table with precomputed multiples needs to have. */
@@ -87,11 +87,11 @@ static void secp256k1_ecmult_start(void) {
8787 // calculate 2^128*generator
8888 secp256k1_gej_t g_128j = gj ;
8989 for (int i = 0 ; i < 128 ; i ++ )
90- secp256k1_gej_double (& g_128j , & g_128j );
90+ secp256k1_gej_double_var (& g_128j , & g_128j );
9191
9292 // precompute the tables with odd multiples
93- secp256k1_ecmult_table_precomp_ge (ret -> pre_g , & gj , WINDOW_G );
94- secp256k1_ecmult_table_precomp_ge (ret -> pre_g_128 , & g_128j , WINDOW_G );
93+ secp256k1_ecmult_table_precomp_ge_var (ret -> pre_g , & gj , WINDOW_G );
94+ secp256k1_ecmult_table_precomp_ge_var (ret -> pre_g_128 , & g_128j , WINDOW_G );
9595
9696 // Set the global pointer to the precomputation table.
9797 secp256k1_ecmult_consts = ret ;
@@ -150,7 +150,7 @@ void static secp256k1_ecmult(secp256k1_gej_t *r, const secp256k1_gej_t *a, const
150150#ifdef USE_ENDOMORPHISM
151151 secp256k1_num_t na_1 , na_lam ;
152152 // split na into na_1 and na_lam (where na = na_1 + na_lam*lambda, and na_1 and na_lam are ~128 bit)
153- secp256k1_gej_split_exp (& na_1 , & na_lam , na );
153+ secp256k1_gej_split_exp_var (& na_1 , & na_lam , na );
154154
155155 // build wnaf representation for na_1 and na_lam.
156156 int wnaf_na_1 [129 ]; int bits_na_1 = secp256k1_ecmult_wnaf (wnaf_na_1 , & na_1 , WINDOW_A );
@@ -165,7 +165,7 @@ void static secp256k1_ecmult(secp256k1_gej_t *r, const secp256k1_gej_t *a, const
165165
166166 // calculate odd multiples of a
167167 secp256k1_gej_t pre_a [ECMULT_TABLE_SIZE (WINDOW_A )];
168- secp256k1_ecmult_table_precomp_gej (pre_a , a , WINDOW_A );
168+ secp256k1_ecmult_table_precomp_gej_var (pre_a , a , WINDOW_A );
169169
170170#ifdef USE_ENDOMORPHISM
171171 secp256k1_gej_t pre_a_lam [ECMULT_TABLE_SIZE (WINDOW_A )];
@@ -190,30 +190,30 @@ void static secp256k1_ecmult(secp256k1_gej_t *r, const secp256k1_gej_t *a, const
190190 secp256k1_ge_t tmpa ;
191191
192192 for (int i = bits - 1 ; i >=0 ; i -- ) {
193- secp256k1_gej_double (r , r );
193+ secp256k1_gej_double_var (r , r );
194194 int n ;
195195#ifdef USE_ENDOMORPHISM
196196 if (i < bits_na_1 && (n = wnaf_na_1 [i ])) {
197197 ECMULT_TABLE_GET_GEJ (& tmpj , pre_a , n , WINDOW_A );
198- secp256k1_gej_add (r , r , & tmpj );
198+ secp256k1_gej_add_var (r , r , & tmpj );
199199 }
200200 if (i < bits_na_lam && (n = wnaf_na_lam [i ])) {
201201 ECMULT_TABLE_GET_GEJ (& tmpj , pre_a_lam , n , WINDOW_A );
202- secp256k1_gej_add (r , r , & tmpj );
202+ secp256k1_gej_add_var (r , r , & tmpj );
203203 }
204204#else
205205 if (i < bits_na && (n = wnaf_na [i ])) {
206206 ECMULT_TABLE_GET_GEJ (& tmpj , pre_a , n , WINDOW_A );
207- secp256k1_gej_add (r , r , & tmpj );
207+ secp256k1_gej_add_var (r , r , & tmpj );
208208 }
209209#endif
210210 if (i < bits_ng_1 && (n = wnaf_ng_1 [i ])) {
211211 ECMULT_TABLE_GET_GE (& tmpa , c -> pre_g , n , WINDOW_G );
212- secp256k1_gej_add_ge (r , r , & tmpa );
212+ secp256k1_gej_add_ge_var (r , r , & tmpa );
213213 }
214214 if (i < bits_ng_128 && (n = wnaf_ng_128 [i ])) {
215215 ECMULT_TABLE_GET_GE (& tmpa , c -> pre_g_128 , n , WINDOW_G );
216- secp256k1_gej_add_ge (r , r , & tmpa );
216+ secp256k1_gej_add_ge_var (r , r , & tmpa );
217217 }
218218 }
219219}
0 commit comments