1 /**********************************************************************
2 * Copyright (c) 2013, 2014, 2015 Thomas Daede, Cory Fields *
3 * Distributed under the MIT software license, see the accompanying *
4 * file COPYING or http://www.opensource.org/licenses/mit-license.php.*
5 **********************************************************************/
7 #define USE_BASIC_CONFIG 1
9 #include "basic-config.h"
10 #include "include/secp256k1.h"
12 #include "field_impl.h"
13 #include "scalar_impl.h"
14 #include "group_impl.h"
15 #include "ecmult_gen_impl.h"
17 static void default_error_callback_fn(const char* str, void* data) {
19 fprintf(stderr, "[libsecp256k1] internal consistency check failed: %s\n", str);
23 static const secp256k1_callback default_error_callback = {
24 default_error_callback_fn,
28 int main(int argc, char **argv) {
29 secp256k1_ecmult_gen_context ctx;
30 void *prealloc, *base;
38 fp = fopen("src/ecmult_static_context.h","w");
40 fprintf(stderr, "Could not open src/ecmult_static_context.h for writing!\n");
44 fprintf(fp, "#ifndef _SECP256K1_ECMULT_STATIC_CONTEXT_\n");
45 fprintf(fp, "#define _SECP256K1_ECMULT_STATIC_CONTEXT_\n");
46 fprintf(fp, "#include \"src/group.h\"\n");
47 fprintf(fp, "#define SC SECP256K1_GE_STORAGE_CONST\n");
48 fprintf(fp, "static const secp256k1_ge_storage secp256k1_ecmult_static_context[64][16] = {\n");
50 base = checked_malloc(&default_error_callback, SECP256K1_ECMULT_GEN_CONTEXT_PREALLOCATED_SIZE);
52 secp256k1_ecmult_gen_context_init(&ctx);
53 secp256k1_ecmult_gen_context_build(&ctx, &prealloc);
54 for(outer = 0; outer != 64; outer++) {
56 for(inner = 0; inner != 16; inner++) {
57 fprintf(fp," SC(%uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu)", SECP256K1_GE_STORAGE_CONST_GET((*ctx.prec)[outer][inner]));
71 secp256k1_ecmult_gen_context_clear(&ctx);
74 fprintf(fp, "#undef SC\n");
75 fprintf(fp, "#endif\n");