Dash Core
0.12.2.1
P2P Digital Currency
gen_context.c
Go to the documentation of this file.
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
**********************************************************************/
6
7
#define USE_BASIC_CONFIG 1
8
9
#include "
basic-config.h
"
10
#include "
include/secp256k1.h
"
11
#include "
field_impl.h
"
12
#include "
scalar_impl.h
"
13
#include "
group_impl.h
"
14
#include "
ecmult_gen_impl.h
"
15
16
static
void
default_error_callback_fn
(
const
char
* str,
void
*
data
) {
17
(void)
data
;
18
fprintf(
stderr
,
"[libsecp256k1] internal consistency check failed: %s\n"
, str);
19
abort();
20
}
21
22
static
const
secp256k1_callback
default_error_callback
= {
23
default_error_callback_fn
,
24
NULL
25
};
26
27
int
main
(
int
argc,
char
**argv) {
28
secp256k1_ecmult_gen_context
ctx
;
29
int
inner;
30
int
outer;
31
FILE*
fp
;
32
33
(void)argc;
34
(void)argv;
35
36
fp
= fopen(
"src/ecmult_static_context.h"
,
"w"
);
37
if
(
fp
== NULL) {
38
fprintf(
stderr
,
"Could not open src/ecmult_static_context.h for writing!\n"
);
39
return
-1;
40
}
41
42
fprintf(
fp
,
"#ifndef _SECP256K1_ECMULT_STATIC_CONTEXT_\n"
);
43
fprintf(
fp
,
"#define _SECP256K1_ECMULT_STATIC_CONTEXT_\n"
);
44
fprintf(
fp
,
"#include \"group.h\"\n"
);
45
fprintf(
fp
,
"#define SC SECP256K1_GE_STORAGE_CONST\n"
);
46
fprintf(
fp
,
"static const secp256k1_ge_storage secp256k1_ecmult_static_context[64][16] = {\n"
);
47
48
secp256k1_ecmult_gen_context_init
(&
ctx
);
49
secp256k1_ecmult_gen_context_build
(&
ctx
, &
default_error_callback
);
50
for
(outer = 0; outer != 64; outer++) {
51
fprintf(
fp
,
"{\n"
);
52
for
(inner = 0; inner != 16; inner++) {
53
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]));
54
if
(inner != 15) {
55
fprintf(
fp
,
",\n"
);
56
}
else
{
57
fprintf(
fp
,
"\n"
);
58
}
59
}
60
if
(outer != 63) {
61
fprintf(
fp
,
"},\n"
);
62
}
else
{
63
fprintf(
fp
,
"}\n"
);
64
}
65
}
66
fprintf(
fp
,
"};\n"
);
67
secp256k1_ecmult_gen_context_clear
(&
ctx
);
68
69
fprintf(
fp
,
"#undef SC\n"
);
70
fprintf(
fp
,
"#endif\n"
);
71
fclose(
fp
);
72
73
return
0;
74
}
spendfrom.fp
fp
Definition:
spendfrom.py:49
default_error_callback
static const secp256k1_callback default_error_callback
Definition:
gen_context.c:22
secp256k1_ecmult_gen_context_build
static void secp256k1_ecmult_gen_context_build(secp256k1_ecmult_gen_context *ctx, const secp256k1_callback *cb)
main
int main(int argc, char **argv)
Definition:
gen_context.c:27
default_error_callback_fn
static void default_error_callback_fn(const char *str, void *data)
Definition:
gen_context.c:16
secp256k1_ecmult_gen_context_clear
static void secp256k1_ecmult_gen_context_clear(secp256k1_ecmult_gen_context *ctx)
optimize-pngs.stderr
stderr
Definition:
optimize-pngs.py:52
gen_base58_test_vectors.data
data
Definition:
gen_base58_test_vectors.py:123
field_impl.h
ctx
static secp256k1_context * ctx
Definition:
tests.c:42
basic-config.h
SECP256K1_GE_STORAGE_CONST_GET
#define SECP256K1_GE_STORAGE_CONST_GET(t)
Definition:
group.h:41
secp256k1_ecmult_gen_context
Definition:
ecmult_gen.h:13
ecmult_gen_impl.h
secp256k1.h
secp256k1_ecmult_gen_context_init
static void secp256k1_ecmult_gen_context_init(secp256k1_ecmult_gen_context *ctx)
scalar_impl.h
secp256k1_callback
Definition:
util.h:18
group_impl.h
src
secp256k1
src
gen_context.c
Generated on Thu Dec 14 2017 13:15:08 for Dash Core by
1.8.14