From e1a76530db40b8aa8953717d9f984b6bdf845308 Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Wed, 6 Oct 2021 20:45:17 +0200 Subject: [PATCH] refactor: Make generator a parameter of ecmult_gen_create_prec_table --- src/ecmult_gen_prec.h | 2 +- src/ecmult_gen_prec_impl.h | 4 ++-- src/gen_ecmult_gen_static_prec_table.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ecmult_gen_prec.h b/src/ecmult_gen_prec.h index cb8831af5..c8bd731f3 100644 --- a/src/ecmult_gen_prec.h +++ b/src/ecmult_gen_prec.h @@ -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 */ diff --git a/src/ecmult_gen_prec_impl.h b/src/ecmult_gen_prec_impl.h index fec7fb48b..19ed6c63c 100644 --- a/src/ecmult_gen_prec_impl.h +++ b/src/ecmult_gen_prec_impl.h @@ -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). */ { diff --git a/src/gen_ecmult_gen_static_prec_table.c b/src/gen_ecmult_gen_static_prec_table.c index 4d5ba95f9..60eebc004 100644 --- a/src/gen_ecmult_gen_static_prec_table.c +++ b/src/gen_ecmult_gen_static_prec_table.c @@ -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++) {