mirror of
https://github.com/status-im/secp256k1.git
synced 2025-02-24 03:38:12 +00:00
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
This commit is contained in:
parent
09971a3ffd
commit
05e049b73c
@ -12,6 +12,22 @@
|
|||||||
#include "ecmult_const.h"
|
#include "ecmult_const.h"
|
||||||
#include "ecmult_impl.h"
|
#include "ecmult_impl.h"
|
||||||
|
|
||||||
|
/** Fill a table 'pre' with precomputed odd multiples of a.
|
||||||
|
*
|
||||||
|
* The resulting point set is brought to a single constant Z denominator, stores the X and Y
|
||||||
|
* coordinates as ge_storage points in pre, and stores the global Z in globalz.
|
||||||
|
* It only operates on tables sized for WINDOW_A wnaf multiples.
|
||||||
|
*/
|
||||||
|
static void secp256k1_ecmult_odd_multiples_table_globalz_windowa(secp256k1_ge *pre, secp256k1_fe *globalz, const secp256k1_gej *a) {
|
||||||
|
secp256k1_gej prej[ECMULT_TABLE_SIZE(WINDOW_A)];
|
||||||
|
secp256k1_fe zr[ECMULT_TABLE_SIZE(WINDOW_A)];
|
||||||
|
|
||||||
|
/* Compute the odd multiples in Jacobian form. */
|
||||||
|
secp256k1_ecmult_odd_multiples_table(ECMULT_TABLE_SIZE(WINDOW_A), prej, zr, a);
|
||||||
|
/* Bring them to the same Z denominator. */
|
||||||
|
secp256k1_ge_globalz_set_table_gej(ECMULT_TABLE_SIZE(WINDOW_A), pre, globalz, prej, zr);
|
||||||
|
}
|
||||||
|
|
||||||
/* This is like `ECMULT_TABLE_GET_GE` but is constant time */
|
/* This is like `ECMULT_TABLE_GET_GE` but is constant time */
|
||||||
#define ECMULT_CONST_TABLE_GET_GE(r,pre,n,w) do { \
|
#define ECMULT_CONST_TABLE_GET_GE(r,pre,n,w) do { \
|
||||||
int m = 0; \
|
int m = 0; \
|
||||||
|
@ -96,25 +96,6 @@ static void secp256k1_ecmult_odd_multiples_table(int n, secp256k1_gej *prej, sec
|
|||||||
secp256k1_fe_mul(&prej[n-1].z, &prej[n-1].z, &d.z);
|
secp256k1_fe_mul(&prej[n-1].z, &prej[n-1].z, &d.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Fill a table 'pre' with precomputed odd multiples of a.
|
|
||||||
*
|
|
||||||
* The resulting point set is brought to a single constant Z denominator, stores the X and Y
|
|
||||||
* coordinates as ge_storage points in pre, and stores the global Z in rz.
|
|
||||||
* It only operates on tables sized for WINDOW_A wnaf multiples.
|
|
||||||
*
|
|
||||||
* To compute a*P + b*G, we compute a table for P using this function,
|
|
||||||
* and use the precomputed table in <precomputed_ecmult.c> for G.
|
|
||||||
*/
|
|
||||||
static void secp256k1_ecmult_odd_multiples_table_globalz_windowa(secp256k1_ge *pre, secp256k1_fe *globalz, const secp256k1_gej *a) {
|
|
||||||
secp256k1_gej prej[ECMULT_TABLE_SIZE(WINDOW_A)];
|
|
||||||
secp256k1_fe zr[ECMULT_TABLE_SIZE(WINDOW_A)];
|
|
||||||
|
|
||||||
/* Compute the odd multiples in Jacobian form. */
|
|
||||||
secp256k1_ecmult_odd_multiples_table(ECMULT_TABLE_SIZE(WINDOW_A), prej, zr, a);
|
|
||||||
/* Bring them to the same Z denominator. */
|
|
||||||
secp256k1_ge_globalz_set_table_gej(ECMULT_TABLE_SIZE(WINDOW_A), pre, globalz, prej, zr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The following two macro retrieves a particular odd multiple from a table
|
/** The following two macro retrieves a particular odd multiple from a table
|
||||||
* of precomputed multiples. */
|
* of precomputed multiples. */
|
||||||
#define ECMULT_TABLE_GET_GE(r,pre,n,w) do { \
|
#define ECMULT_TABLE_GET_GE(r,pre,n,w) do { \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user