10 #include "../include/secp256k1.h"
20 int main(
int argc,
char **argv) {
21 const char outfile[] =
"src/precomputed_ecmult_gen.c";
28 fp =
fopen(outfile,
"w");
30 fprintf(stderr,
"Could not open %s for writing!\n", outfile);
34 fprintf(fp,
"/* This file was automatically generated by precompute_ecmult_gen. */\n");
35 fprintf(fp,
"/* See ecmult_gen_impl.h for details about the contents of this file. */\n");
36 fprintf(fp,
"#include \"group.h\"\n");
37 fprintf(fp,
"#include \"ecmult_gen.h\"\n");
38 fprintf(fp,
"#include \"precomputed_ecmult_gen.h\"\n");
39 fprintf(fp,
"#ifdef EXHAUSTIVE_TEST_ORDER\n");
40 fprintf(fp,
"# error Cannot compile precomputed_ecmult_gen.c in exhaustive test mode\n");
41 fprintf(fp,
"#endif /* EXHAUSTIVE_TEST_ORDER */\n");
42 fprintf(fp,
"#define S(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SECP256K1_GE_STORAGE_CONST(0x##a##u,0x##b##u,0x##c##u,0x##d##u,0x##e##u,0x##f##u,0x##g##u,0x##h##u,0x##i##u,0x##j##u,0x##k##u,0x##l##u,0x##m##u,0x##n##u,0x##o##u,0x##p##u)\n");
43 fprintf(fp,
"const secp256k1_ge_storage secp256k1_ecmult_gen_prec_table[ECMULT_GEN_PREC_N(ECMULT_GEN_PREC_BITS)][ECMULT_GEN_PREC_G(ECMULT_GEN_PREC_BITS)] = {\n");
45 for (bits = 2; bits <= 8; bits *= 2) {
53 fprintf(fp,
"#if ECMULT_GEN_PREC_BITS == %d\n", bits);
54 for(outer = 0; outer != n; outer++) {
56 for(inner = 0; inner !=
g; inner++) {
57 fprintf(fp,
"S(%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
58 ",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
")",
70 fprintf(fp,
"#endif\n");
75 fprintf(fp,
"#undef S\n");
#define ECMULT_GEN_PREC_G(bits)
#define ECMULT_GEN_PREC_N(bits)
static void secp256k1_ecmult_gen_compute_table(secp256k1_ge_storage *table, const secp256k1_ge *gen, int bits)
#define SECP256K1_GE_STORAGE_CONST_GET(t)
static const secp256k1_ge secp256k1_ge_const_g
FILE * fopen(const fs::path &p, const char *mode)
int main(int argc, char **argv)
static SECP256K1_INLINE void * checked_malloc(const secp256k1_callback *cb, size_t size)
static const secp256k1_callback default_error_callback