This repository has been archived by the owner on Jan 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 85
/
curves_list.h
248 lines (241 loc) · 10.9 KB
/
curves_list.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
/*
* Copyright (C) 2017 - This file is part of libecc project
*
* Authors:
* Ryad BENADJILA <[email protected]>
* Arnaud EBALARD <[email protected]>
* Jean-Pierre FLORI <[email protected]>
*
* Contributors:
* Nicolas VIVET <[email protected]>
* Karim KHALFALLAH <[email protected]>
*
* This software is licensed under a dual BSD and GPL v2 license.
* See LICENSE file at the root folder of the project.
*/
#ifndef __CURVES_LIST_H__
#define __CURVES_LIST_H__
#include "../lib_ecc_config.h"
#include "../lib_ecc_types.h"
#include "../words/words.h"
#include "known/ec_params_brainpoolp192r1.h"
#include "known/ec_params_brainpoolp224r1.h"
#include "known/ec_params_brainpoolp256r1.h"
#include "known/ec_params_brainpoolp384r1.h"
#include "known/ec_params_brainpoolp512r1.h"
#include "known/ec_params_secp192r1.h"
#include "known/ec_params_secp224r1.h"
#include "known/ec_params_secp256r1.h"
#include "known/ec_params_secp384r1.h"
#include "known/ec_params_secp521r1.h"
#include "known/ec_params_frp256v1.h"
#include "known/ec_params_gost256.h"
#include "known/ec_params_gost512.h"
#include "known/ec_params_sm2p192test.h"
#include "known/ec_params_sm2p256test.h"
#include "known/ec_params_sm2p256v1.h"
#include "known/ec_params_wei25519.h"
#include "known/ec_params_wei448.h"
#include "known/ec_params_gost_R3410_2012_256_paramSetA.h"
#include "known/ec_params_secp256k1.h"
#include "known/ec_params_gost_R3410_2001_TestParamSet.h"
#include "known/ec_params_gost_R3410_2001_CryptoPro_A_ParamSet.h"
#include "known/ec_params_gost_R3410_2001_CryptoPro_B_ParamSet.h"
#include "known/ec_params_gost_R3410_2001_CryptoPro_C_ParamSet.h"
#include "known/ec_params_gost_R3410_2001_CryptoPro_XchA_ParamSet.h"
#include "known/ec_params_gost_R3410_2001_CryptoPro_XchB_ParamSet.h"
#include "known/ec_params_gost_R3410_2012_256_paramSetA.h"
#include "known/ec_params_gost_R3410_2012_256_paramSetB.h"
#include "known/ec_params_gost_R3410_2012_256_paramSetC.h"
#include "known/ec_params_gost_R3410_2012_256_paramSetD.h"
#include "known/ec_params_gost_R3410_2012_512_paramSetTest.h"
#include "known/ec_params_gost_R3410_2012_512_paramSetA.h"
#include "known/ec_params_gost_R3410_2012_512_paramSetB.h"
#include "known/ec_params_gost_R3410_2012_512_paramSetC.h"
#include "known/ec_params_secp192k1.h"
#include "known/ec_params_secp224k1.h"
#include "known/ec_params_brainpoolp192t1.h"
#include "known/ec_params_brainpoolp224t1.h"
#include "known/ec_params_brainpoolp256t1.h"
#include "known/ec_params_brainpoolp320r1.h"
#include "known/ec_params_brainpoolp320t1.h"
#include "known/ec_params_brainpoolp384t1.h"
#include "known/ec_params_brainpoolp512t1.h"
#include "known/ec_params_bign256v1.h"
#include "known/ec_params_bign384v1.h"
#include "known/ec_params_bign512v1.h"
/* ADD curves header here */
/* XXX: Do not remove the comment above, as it is
* used by external tools as a placeholder to add or
* remove automatically generated code.
*/
#ifndef CURVES_MAX_P_BIT_LEN
#error "Max p bit length is 0; did you disable all curves in lib_ecc_config.h?"
#endif
#if (CURVES_MAX_P_BIT_LEN > 65535)
#error "Prime field length (in bytes) MUST fit on an u16!"
#endif
#ifndef CURVES_MAX_Q_BIT_LEN
#error "Max q bit length is 0; did you disable all curves in lib_ecc_config.h?"
#endif
#if (CURVES_MAX_Q_BIT_LEN > 65535)
#error "Generator order length (in bytes) MUST fit on an u16!"
#endif
#ifndef CURVES_MAX_CURVE_ORDER_BIT_LEN
#error "Max curve order bit length is 0; did you disable all curves in lib_ecc_config.h?"
#endif
#if (CURVES_MAX_CURVE_ORDER_BIT_LEN > 65535)
#error "Curve order length (in bytes) MUST fit on an u16!"
#endif
typedef struct {
ec_curve_type type;
const ec_str_params *params;
} ec_mapping;
static const ec_mapping ec_maps[] = {
#ifdef WITH_CURVE_FRP256V1
{.type = FRP256V1,.params = &frp256v1_str_params},
#endif /* WITH_CURVE_FRP256V1 */
#ifdef WITH_CURVE_SECP192R1
{.type = SECP192R1,.params = &secp192r1_str_params},
#endif /* WITH_CURVE_SECP192R1 */
#ifdef WITH_CURVE_SECP224R1
{.type = SECP224R1,.params = &secp224r1_str_params},
#endif /* WITH_CURVE_SECP224R1 */
#ifdef WITH_CURVE_SECP256R1
{.type = SECP256R1,.params = &secp256r1_str_params},
#endif /* WITH_CURVE_SECP256R1 */
#ifdef WITH_CURVE_SECP384R1
{.type = SECP384R1,.params = &secp384r1_str_params},
#endif /* WITH_CURVE_SECP384R1 */
#ifdef WITH_CURVE_SECP521R1
{.type = SECP521R1,.params = &secp521r1_str_params},
#endif /* WITH_CURVE_SECP521R1 */
#ifdef WITH_CURVE_BRAINPOOLP192R1
{.type = BRAINPOOLP192R1,.params = &brainpoolp192r1_str_params},
#endif /* WITH_CURVE_BRAINPOOLP192R1 */
#ifdef WITH_CURVE_BRAINPOOLP224R1
{.type = BRAINPOOLP224R1,.params = &brainpoolp224r1_str_params},
#endif /* WITH_CURVE_BRAINPOOLP224R1 */
#ifdef WITH_CURVE_BRAINPOOLP256R1
{.type = BRAINPOOLP256R1,.params = &brainpoolp256r1_str_params},
#endif /* WITH_CURVE_BRAINPOOLP256R1 */
#ifdef WITH_CURVE_BRAINPOOLP384R1
{.type = BRAINPOOLP384R1,.params = &brainpoolp384r1_str_params},
#endif /* WITH_CURVE_BRAINPOOLP384R1 */
#ifdef WITH_CURVE_BRAINPOOLP512R1
{.type = BRAINPOOLP512R1,.params = &brainpoolp512r1_str_params},
#endif /* WITH_CURVE_BRAINPOOLP512R1 */
#ifdef WITH_CURVE_GOST256
{.type = GOST256,.params = &GOST_256bits_curve_str_params},
#endif /* WITH_CURVE_GOST256 */
#ifdef WITH_CURVE_GOST512
{.type = GOST512,.params = &GOST_512bits_curve_str_params},
#endif /* WITH_CURVE_GOST512 */
#ifdef WITH_CURVE_SM2P256TEST
{.type = SM2P256TEST,.params = &sm2p256test_str_params},
#endif /* WITH_CURVE_SM2P256TEST */
#ifdef WITH_CURVE_SM2P256V1
{.type = SM2P256V1,.params = &sm2p256v1_str_params},
#endif /* WITH_CURVE_SM2P256V1 */
#ifdef WITH_CURVE_WEI25519
{.type = WEI25519,.params = &wei25519_str_params},
#endif /* WITH_CURVE_WEI25519 */
#ifdef WITH_CURVE_WEI448
{.type = WEI448,.params = &wei448_str_params},
#endif /* WITH_CURVE_WEI448 */
#ifdef WITH_CURVE_GOST_R3410_2012_256_PARAMSETA
{ .type = GOST_R3410_2012_256_PARAMSETA, .params = &gost_R3410_2012_256_paramSetA_str_params },
#endif /* WITH_CURVE_GOST_R3410_2012_256_PARAMSETA */
#ifdef WITH_CURVE_SECP256K1
{.type = SECP256K1,.params = &secp256k1_str_params},
#endif /* WITH_CURVE_SECP256K1 */
#ifdef WITH_CURVE_GOST_R3410_2001_TESTPARAMSET
{ .type = GOST_R3410_2001_TESTPARAMSET, .params = &gost_R3410_2001_TestParamSet_str_params },
#endif /* WITH_CURVE_GOST_R3410_2001_TESTPARAMSET */
#ifdef WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_A_PARAMSET
{ .type = GOST_R3410_2001_CRYPTOPRO_A_PARAMSET, .params = &gost_R3410_2001_CryptoPro_A_ParamSet_str_params },
#endif /* WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_A_PARAMSET */
#ifdef WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_B_PARAMSET
{ .type = GOST_R3410_2001_CRYPTOPRO_B_PARAMSET, .params = &gost_R3410_2001_CryptoPro_B_ParamSet_str_params },
#endif /* WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_B_PARAMSET */
#ifdef WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_C_PARAMSET
{ .type = GOST_R3410_2001_CRYPTOPRO_C_PARAMSET, .params = &gost_R3410_2001_CryptoPro_C_ParamSet_str_params },
#endif /* WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_C_PARAMSET */
#ifdef WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_XCHA_PARAMSET
{ .type = GOST_R3410_2001_CRYPTOPRO_XCHA_PARAMSET, .params = &gost_R3410_2001_CryptoPro_XchA_ParamSet_str_params },
#endif /* WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_XCHA_PARAMSET */
#ifdef WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_XCHB_PARAMSET
{ .type = GOST_R3410_2001_CRYPTOPRO_XCHB_PARAMSET, .params = &gost_R3410_2001_CryptoPro_XchB_ParamSet_str_params },
#endif /* WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_XCHB_PARAMSET */
#ifdef WITH_CURVE_GOST_R3410_2012_256_PARAMSETA
{ .type = GOST_R3410_2012_256_PARAMSETA, .params = &gost_R3410_2012_256_paramSetA_str_params },
#endif /* WITH_CURVE_GOST_R3410_2012_256_PARAMSETA */
#ifdef WITH_CURVE_GOST_R3410_2012_256_PARAMSETB
{ .type = GOST_R3410_2012_256_PARAMSETB, .params = &gost_R3410_2012_256_paramSetB_str_params },
#endif /* WITH_CURVE_GOST_R3410_2012_256_PARAMSETB */
#ifdef WITH_CURVE_GOST_R3410_2012_256_PARAMSETC
{ .type = GOST_R3410_2012_256_PARAMSETC, .params = &gost_R3410_2012_256_paramSetC_str_params },
#endif /* WITH_CURVE_GOST_R3410_2012_256_PARAMSETC */
#ifdef WITH_CURVE_GOST_R3410_2012_256_PARAMSETD
{ .type = GOST_R3410_2012_256_PARAMSETD, .params = &gost_R3410_2012_256_paramSetD_str_params },
#endif /* WITH_CURVE_GOST_R3410_2012_256_PARAMSETD */
#ifdef WITH_CURVE_GOST_R3410_2012_512_PARAMSETTEST
{ .type = GOST_R3410_2012_512_PARAMSETTEST, .params = &gost_R3410_2012_512_paramSetTest_str_params },
#endif /* WITH_CURVE_GOST_R3410_2012_512_PARAMSETTEST */
#ifdef WITH_CURVE_GOST_R3410_2012_512_PARAMSETA
{ .type = GOST_R3410_2012_512_PARAMSETA, .params = &gost_R3410_2012_512_paramSetA_str_params },
#endif /* WITH_CURVE_GOST_R3410_2012_512_PARAMSETA */
#ifdef WITH_CURVE_GOST_R3410_2012_512_PARAMSETB
{ .type = GOST_R3410_2012_512_PARAMSETB, .params = &gost_R3410_2012_512_paramSetB_str_params },
#endif /* WITH_CURVE_GOST_R3410_2012_512_PARAMSETB */
#ifdef WITH_CURVE_GOST_R3410_2012_512_PARAMSETC
{ .type = GOST_R3410_2012_512_PARAMSETC, .params = &gost_R3410_2012_512_paramSetC_str_params },
#endif /* WITH_CURVE_GOST_R3410_2012_512_PARAMSETC */
#ifdef WITH_CURVE_SECP192K1
{.type = SECP192K1,.params = &secp192k1_str_params},
#endif /* WITH_CURVE_SECP192K1 */
#ifdef WITH_CURVE_SECP224K1
{.type = SECP224K1,.params = &secp224k1_str_params},
#endif /* WITH_CURVE_SECP224K1 */
#ifdef WITH_CURVE_BRAINPOOLP192T1
{.type = BRAINPOOLP192T1,.params = &brainpoolp192t1_str_params},
#endif /* WITH_CURVE_BRAINPOOLP192T1 */
#ifdef WITH_CURVE_BRAINPOOLP224T1
{.type = BRAINPOOLP224T1,.params = &brainpoolp224t1_str_params},
#endif /* WITH_CURVE_BRAINPOOLP224T1 */
#ifdef WITH_CURVE_BRAINPOOLP256T1
{.type = BRAINPOOLP256T1,.params = &brainpoolp256t1_str_params},
#endif /* WITH_CURVE_BRAINPOOLP256T1 */
#ifdef WITH_CURVE_BRAINPOOLP320R1
{.type = BRAINPOOLP320R1,.params = &brainpoolp320r1_str_params},
#endif /* WITH_CURVE_BRAINPOOLP320R1 */
#ifdef WITH_CURVE_BRAINPOOLP320T1
{.type = BRAINPOOLP320T1,.params = &brainpoolp320t1_str_params},
#endif /* WITH_CURVE_BRAINPOOLP320T1 */
#ifdef WITH_CURVE_BRAINPOOLP384T1
{.type = BRAINPOOLP384T1,.params = &brainpoolp384t1_str_params},
#endif /* WITH_CURVE_BRAINPOOLP192T1 */
#ifdef WITH_CURVE_BRAINPOOLP512T1
{.type = BRAINPOOLP512T1,.params = &brainpoolp512t1_str_params},
#endif /* WITH_CURVE_BRAINPOOLP512T1 */
#ifdef WITH_CURVE_BIGN256V1
{.type = BIGN256V1,.params = &bign256v1_str_params},
#endif /* WITH_CURVE_BIGN256V1 */
#ifdef WITH_CURVE_BIGN384V1
{.type = BIGN384V1,.params = &bign384v1_str_params},
#endif /* WITH_CURVE_BIGN384V1 */
#ifdef WITH_CURVE_BIGN512V1
{.type = BIGN512V1,.params = &bign512v1_str_params},
#endif /* WITH_CURVE_BIGN512V1 */
/* ADD curves mapping here */
/* XXX: Do not remove the comment above, as it is
* used by external tools as a placeholder to add or
* remove automatically generated code.
*/
};
/*
* Number of cuvres supported by the lib, i.e. number of elements in
* ec_maps array above.
*/
#define EC_CURVES_NUM (sizeof(ec_maps) / sizeof(ec_mapping))
#endif /* __CURVES_LIST_H__ */