Skip to content

Commit 05e049b

Browse files
committed
ecmult: move _ecmult_odd_multiples_table_globalz_windowa
Changes: - move `secp256k1_ecmult_odd_multiples_table_globalz_windowa` function from ecmult to ecmult_const - remove outdated comment
1 parent 09971a3 commit 05e049b

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

src/ecmult_const_impl.h

+16
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@
1212
#include "ecmult_const.h"
1313
#include "ecmult_impl.h"
1414

15+
/** Fill a table 'pre' with precomputed odd multiples of a.
16+
*
17+
* The resulting point set is brought to a single constant Z denominator, stores the X and Y
18+
* coordinates as ge_storage points in pre, and stores the global Z in globalz.
19+
* It only operates on tables sized for WINDOW_A wnaf multiples.
20+
*/
21+
static void secp256k1_ecmult_odd_multiples_table_globalz_windowa(secp256k1_ge *pre, secp256k1_fe *globalz, const secp256k1_gej *a) {
22+
secp256k1_gej prej[ECMULT_TABLE_SIZE(WINDOW_A)];
23+
secp256k1_fe zr[ECMULT_TABLE_SIZE(WINDOW_A)];
24+
25+
/* Compute the odd multiples in Jacobian form. */
26+
secp256k1_ecmult_odd_multiples_table(ECMULT_TABLE_SIZE(WINDOW_A), prej, zr, a);
27+
/* Bring them to the same Z denominator. */
28+
secp256k1_ge_globalz_set_table_gej(ECMULT_TABLE_SIZE(WINDOW_A), pre, globalz, prej, zr);
29+
}
30+
1531
/* This is like `ECMULT_TABLE_GET_GE` but is constant time */
1632
#define ECMULT_CONST_TABLE_GET_GE(r,pre,n,w) do { \
1733
int m = 0; \

src/ecmult_impl.h

-19
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,6 @@ static void secp256k1_ecmult_odd_multiples_table(int n, secp256k1_gej *prej, sec
9696
secp256k1_fe_mul(&prej[n-1].z, &prej[n-1].z, &d.z);
9797
}
9898

99-
/** Fill a table 'pre' with precomputed odd multiples of a.
100-
*
101-
* The resulting point set is brought to a single constant Z denominator, stores the X and Y
102-
* coordinates as ge_storage points in pre, and stores the global Z in rz.
103-
* It only operates on tables sized for WINDOW_A wnaf multiples.
104-
*
105-
* To compute a*P + b*G, we compute a table for P using this function,
106-
* and use the precomputed table in <precomputed_ecmult.c> for G.
107-
*/
108-
static void secp256k1_ecmult_odd_multiples_table_globalz_windowa(secp256k1_ge *pre, secp256k1_fe *globalz, const secp256k1_gej *a) {
109-
secp256k1_gej prej[ECMULT_TABLE_SIZE(WINDOW_A)];
110-
secp256k1_fe zr[ECMULT_TABLE_SIZE(WINDOW_A)];
111-
112-
/* Compute the odd multiples in Jacobian form. */
113-
secp256k1_ecmult_odd_multiples_table(ECMULT_TABLE_SIZE(WINDOW_A), prej, zr, a);
114-
/* Bring them to the same Z denominator. */
115-
secp256k1_ge_globalz_set_table_gej(ECMULT_TABLE_SIZE(WINDOW_A), pre, globalz, prej, zr);
116-
}
117-
11899
/** The following two macro retrieves a particular odd multiple from a table
119100
* of precomputed multiples. */
120101
#define ECMULT_TABLE_GET_GE(r,pre,n,w) do { \

0 commit comments

Comments
 (0)