refactor: Make generator a parameter of ecmult_gen_create_prec_table
This commit is contained in:
parent
9ad09f6911
commit
e1a76530db
|
@ -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 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 */
|
#endif /* SECP256K1_ECMULT_GEN_PREC_H */
|
||||||
|
|
|
@ -12,14 +12,14 @@
|
||||||
#include "field_impl.h"
|
#include "field_impl.h"
|
||||||
#include "ecmult_gen.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_ge prec[ECMULT_GEN_PREC_N * ECMULT_GEN_PREC_G];
|
||||||
secp256k1_gej gj;
|
secp256k1_gej gj;
|
||||||
secp256k1_gej nums_gej;
|
secp256k1_gej nums_gej;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
/* get the generator */
|
/* 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). */
|
/* Construct a group element with no known corresponding scalar (nothing up my sleeve). */
|
||||||
{
|
{
|
||||||
|
|
|
@ -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");
|
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);
|
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++) {
|
for(outer = 0; outer != ECMULT_GEN_PREC_N; outer++) {
|
||||||
fprintf(fp,"{\n");
|
fprintf(fp,"{\n");
|
||||||
for(inner = 0; inner != ECMULT_GEN_PREC_G; inner++) {
|
for(inner = 0; inner != ECMULT_GEN_PREC_G; inner++) {
|
||||||
|
|
Loading…
Reference in New Issue