refactor: Make generator a parameter of ecmult_gen_create_prec_table

This commit is contained in:
Tim Ruffing 2021-10-06 20:45:17 +02:00
parent 9ad09f6911
commit e1a76530db
3 changed files with 4 additions and 4 deletions

View File

@ -11,6 +11,6 @@
static const size_t ECMULT_GEN_PREC_TABLE_SIZE = ECMULT_GEN_PREC_N * ECMULT_GEN_PREC_G * sizeof(secp256k1_ge_storage);
static void secp256k1_ecmult_gen_create_prec_table(secp256k1_ge_storage* table);
static void secp256k1_ecmult_gen_create_prec_table(secp256k1_ge_storage* table, const secp256k1_ge* gen);
#endif /* SECP256K1_ECMULT_GEN_PREC_H */

View File

@ -12,14 +12,14 @@
#include "field_impl.h"
#include "ecmult_gen.h"
static void secp256k1_ecmult_gen_create_prec_table(secp256k1_ge_storage* table) {
static void secp256k1_ecmult_gen_create_prec_table(secp256k1_ge_storage* table, const secp256k1_ge* gen) {
secp256k1_ge prec[ECMULT_GEN_PREC_N * ECMULT_GEN_PREC_G];
secp256k1_gej gj;
secp256k1_gej nums_gej;
int i, j;
/* get the generator */
secp256k1_gej_set_ge(&gj, &secp256k1_ge_const_g);
secp256k1_gej_set_ge(&gj, gen);
/* Construct a group element with no known corresponding scalar (nothing up my sleeve). */
{

View File

@ -60,7 +60,7 @@ int main(int argc, char **argv) {
fprintf(fp, "static const secp256k1_ge_storage secp256k1_ecmult_gen_prec_table[ECMULT_GEN_PREC_N][ECMULT_GEN_PREC_G] = {\n");
table = checked_malloc(&default_error_callback, ECMULT_GEN_PREC_TABLE_SIZE);
secp256k1_ecmult_gen_create_prec_table(table);
secp256k1_ecmult_gen_create_prec_table(table, &secp256k1_ge_const_g);
for(outer = 0; outer != ECMULT_GEN_PREC_N; outer++) {
fprintf(fp,"{\n");
for(inner = 0; inner != ECMULT_GEN_PREC_G; inner++) {