|
Bitcoin Core
22.99.0
P2P Digital Currency
|
Go to the documentation of this file.
12 #if !defined(ECMULT_WINDOW_SIZE)
16 #include "../include/secp256k1.h"
34 fprintf(fp,
"static const secp256k1_ge_storage %s[ECMULT_TABLE_SIZE(WINDOW_G)] = {\n",
name);
35 fprintf(fp,
" S(%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
36 ",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
")\n",
43 for(i = 3; i <= window_g; ++i) {
44 if (with_conditionals) {
53 fprintf(fp,
",S(%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
54 ",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
",%"PRIx32
")\n",
57 if (with_conditionals) {
58 fprintf(fp,
"#endif\n");
69 print_table(fp,
"secp256k1_pre_g", window_g, &gj, with_conditionals);
70 for (i = 0; i < 128; ++i) {
73 print_table(fp,
"secp256k1_pre_g_128", window_g, &gj, with_conditionals);
80 const int window_g_13 = 4;
81 const int window_g_199 = 8;
84 fp =
fopen(
"src/ecmult_static_pre_g.h",
"w");
86 fprintf(stderr,
"Could not open src/ecmult_static_pre_g.h for writing!\n");
90 fprintf(fp,
"/* This file was automatically generated by gen_ecmult_static_pre_g. */\n");
91 fprintf(fp,
"/* This file contains an array secp256k1_pre_g with odd multiples of the base point G and\n");
92 fprintf(fp,
" * an array secp256k1_pre_g_128 with odd multiples of 2^128*G for accelerating the computation of a*P + b*G.\n");
94 fprintf(fp,
"#ifndef SECP256K1_ECMULT_STATIC_PRE_G_H\n");
95 fprintf(fp,
"#define SECP256K1_ECMULT_STATIC_PRE_G_H\n");
96 fprintf(fp,
"#include \"group.h\"\n");
97 fprintf(fp,
"#ifdef S\n");
98 fprintf(fp,
" #error macro identifier S already in use.\n");
99 fprintf(fp,
"#endif\n");
100 fprintf(fp,
"#define S(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) "
101 "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,"
102 "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");
104 fprintf(fp,
" #error configuration mismatch, invalid ECMULT_WINDOW_SIZE. Try deleting ecmult_static_pre_g.h before the build.\n");
105 fprintf(fp,
"#endif\n");
106 fprintf(fp,
"#if defined(EXHAUSTIVE_TEST_ORDER)\n");
107 fprintf(fp,
"#if EXHAUSTIVE_TEST_ORDER == 13\n");
108 fprintf(fp,
"#define WINDOW_G %d\n", window_g_13);
112 fprintf(fp,
"#elif EXHAUSTIVE_TEST_ORDER == 199\n");
113 fprintf(fp,
"#define WINDOW_G %d\n", window_g_199);
117 fprintf(fp,
"#else\n");
118 fprintf(fp,
" #error No known generator for the specified exhaustive test group order.\n");
119 fprintf(fp,
"#endif\n");
120 fprintf(fp,
"#else /* !defined(EXHAUSTIVE_TEST_ORDER) */\n");
121 fprintf(fp,
"#define WINDOW_G ECMULT_WINDOW_SIZE\n");
125 fprintf(fp,
"#endif\n");
126 fprintf(fp,
"#undef S\n");
127 fprintf(fp,
"#endif\n");
FILE * fopen(const fs::path &p, const char *mode)
#define SECP256K1_G_ORDER_13
A group element of the secp256k1 curve, in jacobian coordinates.
#define SECP256K1_G
Generator for secp256k1, value 'g' defined in "Standards for Efficient Cryptography" (SEC2) 2....
#define SECP256K1_GE_STORAGE_CONST_GET(t)
static void secp256k1_gej_add_ge_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, secp256k1_fe *rzr)
Set r equal to the sum of a and b (with b given in affine coordinates).
static void secp256k1_ge_set_gej_var(secp256k1_ge *r, secp256k1_gej *a)
Set a group element equal to another which is given in jacobian coordinates.
static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr)
Set r equal to the double of a.
#define ECMULT_WINDOW_SIZE
#define ECMULT_TABLE_SIZE(w)
The number of entries a table with precomputed multiples needs to have.
static void secp256k1_ge_to_storage(secp256k1_ge_storage *r, const secp256k1_ge *a)
Convert a group element to the storage type.
#define SECP256K1_G_ORDER_199
void print_table(FILE *fp, const char *name, int window_g, const secp256k1_gej *gen, int with_conditionals)
A group element of the secp256k1 curve, in affine coordinates.
static void secp256k1_gej_set_ge(secp256k1_gej *r, const secp256k1_ge *a)
Set a group element (jacobian) equal to another which is given in affine coordinates.
void print_two_tables(FILE *fp, int window_g, const secp256k1_ge *g, int with_conditionals)