ec_curves.h
Go to the documentation of this file.
1 /**
2  * @file ec_curves.h
3  * @brief Elliptic curves
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2019 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCrypto Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 1.9.6
29  **/
30 
31 #ifndef _EC_CURVES_H
32 #define _EC_CURVES_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "mpi/mpi.h"
37 
38 //secp112r1 elliptic curve support
39 #ifndef SECP112R1_SUPPORT
40  #define SECP112R1_SUPPORT DISABLED
41 #elif (SECP112R1_SUPPORT != ENABLED && SECP112R1_SUPPORT != DISABLED)
42  #error SECP112R1_SUPPORT parameter is not valid
43 #endif
44 
45 //secp112r2 elliptic curve support
46 #ifndef SECP112R2_SUPPORT
47  #define SECP112R2_SUPPORT DISABLED
48 #elif (SECP112R2_SUPPORT != ENABLED && SECP112R2_SUPPORT != DISABLED)
49  #error SECP112R2_SUPPORT parameter is not valid
50 #endif
51 
52 //secp128r1 elliptic curve support
53 #ifndef SECP128R1_SUPPORT
54  #define SECP128R1_SUPPORT DISABLED
55 #elif (SECP128R1_SUPPORT != ENABLED && SECP128R1_SUPPORT != DISABLED)
56  #error SECP128R1_SUPPORT parameter is not valid
57 #endif
58 
59 //secp128r2 elliptic curve support
60 #ifndef SECP128R2_SUPPORT
61  #define SECP128R2_SUPPORT DISABLED
62 #elif (SECP128R2_SUPPORT != ENABLED && SECP128R2_SUPPORT != DISABLED)
63  #error SECP128R2_SUPPORT parameter is not valid
64 #endif
65 
66 //secp160k1 elliptic curve support
67 #ifndef SECP160K1_SUPPORT
68  #define SECP160K1_SUPPORT DISABLED
69 #elif (SECP160K1_SUPPORT != ENABLED && SECP160K1_SUPPORT != DISABLED)
70  #error SECP160K1_SUPPORT parameter is not valid
71 #endif
72 
73 //secp160r1 elliptic curve support
74 #ifndef SECP160R1_SUPPORT
75  #define SECP160R1_SUPPORT DISABLED
76 #elif (SECP160R1_SUPPORT != ENABLED && SECP160R1_SUPPORT != DISABLED)
77  #error SECP160R1_SUPPORT parameter is not valid
78 #endif
79 
80 //secp160r2 elliptic curve support
81 #ifndef SECP160R2_SUPPORT
82  #define SECP160R2_SUPPORT DISABLED
83 #elif (SECP160R2_SUPPORT != ENABLED && SECP160R2_SUPPORT != DISABLED)
84  #error SECP160R2_SUPPORT parameter is not valid
85 #endif
86 
87 //secp192k1 elliptic curve support
88 #ifndef SECP192K1_SUPPORT
89  #define SECP192K1_SUPPORT DISABLED
90 #elif (SECP192K1_SUPPORT != ENABLED && SECP192K1_SUPPORT != DISABLED)
91  #error SECP192K1_SUPPORT parameter is not valid
92 #endif
93 
94 //secp192r1 elliptic curve support (NIST P-192)
95 #ifndef SECP192R1_SUPPORT
96  #define SECP192R1_SUPPORT DISABLED
97 #elif (SECP192R1_SUPPORT != ENABLED && SECP192R1_SUPPORT != DISABLED)
98  #error SECP192R1_SUPPORT parameter is not valid
99 #endif
100 
101 //secp224k1 elliptic curve support
102 #ifndef SECP224K1_SUPPORT
103  #define SECP224K1_SUPPORT DISABLED
104 #elif (SECP224K1_SUPPORT != ENABLED && SECP224K1_SUPPORT != DISABLED)
105  #error SECP224K1_SUPPORT parameter is not valid
106 #endif
107 
108 //secp224r1 elliptic curve support (NIST P-224)
109 #ifndef SECP224R1_SUPPORT
110  #define SECP224R1_SUPPORT ENABLED
111 #elif (SECP224R1_SUPPORT != ENABLED && SECP224R1_SUPPORT != DISABLED)
112  #error SECP224R1_SUPPORT parameter is not valid
113 #endif
114 
115 //secp256k1 elliptic curve support
116 #ifndef SECP256K1_SUPPORT
117  #define SECP256K1_SUPPORT DISABLED
118 #elif (SECP256K1_SUPPORT != ENABLED && SECP256K1_SUPPORT != DISABLED)
119  #error SECP256K1_SUPPORT parameter is not valid
120 #endif
121 
122 //secp256r1 elliptic curve support (NIST P-256)
123 #ifndef SECP256R1_SUPPORT
124  #define SECP256R1_SUPPORT ENABLED
125 #elif (SECP256R1_SUPPORT != ENABLED && SECP256R1_SUPPORT != DISABLED)
126  #error SECP256R1_SUPPORT parameter is not valid
127 #endif
128 
129 //secp384r1 elliptic curve support (NIST P-384)
130 #ifndef SECP384R1_SUPPORT
131  #define SECP384R1_SUPPORT ENABLED
132 #elif (SECP384R1_SUPPORT != ENABLED && SECP384R1_SUPPORT != DISABLED)
133  #error SECP384R1_SUPPORT parameter is not valid
134 #endif
135 
136 //secp521r1 elliptic curve support (NIST P-521)
137 #ifndef SECP521R1_SUPPORT
138  #define SECP521R1_SUPPORT ENABLED
139 #elif (SECP521R1_SUPPORT != ENABLED && SECP521R1_SUPPORT != DISABLED)
140  #error SECP521R1_SUPPORT parameter is not valid
141 #endif
142 
143 //brainpoolP160r1 elliptic curve support
144 #ifndef BRAINPOOLP160R1_SUPPORT
145  #define BRAINPOOLP160R1_SUPPORT DISABLED
146 #elif (BRAINPOOLP160R1_SUPPORT != ENABLED && BRAINPOOLP160R1_SUPPORT != DISABLED)
147  #error BRAINPOOLP160R1_SUPPORT parameter is not valid
148 #endif
149 
150 //brainpoolP192r1 elliptic curve support
151 #ifndef BRAINPOOLP192R1_SUPPORT
152  #define BRAINPOOLP192R1_SUPPORT DISABLED
153 #elif (BRAINPOOLP192R1_SUPPORT != ENABLED && BRAINPOOLP192R1_SUPPORT != DISABLED)
154  #error BRAINPOOLP192R1_SUPPORT parameter is not valid
155 #endif
156 
157 //brainpoolP224r1 elliptic curve support
158 #ifndef BRAINPOOLP224R1_SUPPORT
159  #define BRAINPOOLP224R1_SUPPORT DISABLED
160 #elif (BRAINPOOLP224R1_SUPPORT != ENABLED && BRAINPOOLP224R1_SUPPORT != DISABLED)
161  #error BRAINPOOLP224R1_SUPPORT parameter is not valid
162 #endif
163 
164 //brainpoolP256r1 elliptic curve support
165 #ifndef BRAINPOOLP256R1_SUPPORT
166  #define BRAINPOOLP256R1_SUPPORT DISABLED
167 #elif (BRAINPOOLP256R1_SUPPORT != ENABLED && BRAINPOOLP256R1_SUPPORT != DISABLED)
168  #error BRAINPOOLP256R1_SUPPORT parameter is not valid
169 #endif
170 
171 //brainpoolP320r1 elliptic curve support
172 #ifndef BRAINPOOLP320R1_SUPPORT
173  #define BRAINPOOLP320R1_SUPPORT DISABLED
174 #elif (BRAINPOOLP320R1_SUPPORT != ENABLED && BRAINPOOLP320R1_SUPPORT != DISABLED)
175  #error BRAINPOOLP320R1_SUPPORT parameter is not valid
176 #endif
177 
178 //brainpoolP384r1 elliptic curve support
179 #ifndef BRAINPOOLP384R1_SUPPORT
180  #define BRAINPOOLP384R1_SUPPORT DISABLED
181 #elif (BRAINPOOLP384R1_SUPPORT != ENABLED && BRAINPOOLP384R1_SUPPORT != DISABLED)
182  #error BRAINPOOLP384R1_SUPPORT parameter is not valid
183 #endif
184 
185 //brainpoolP512r1 elliptic curve support
186 #ifndef BRAINPOOLP512R1_SUPPORT
187  #define BRAINPOOLP512R1_SUPPORT DISABLED
188 #elif (BRAINPOOLP512R1_SUPPORT != ENABLED && BRAINPOOLP512R1_SUPPORT != DISABLED)
189  #error BRAINPOOLP512R1_SUPPORT parameter is not valid
190 #endif
191 
192 //Curve25519 elliptic curve support
193 #ifndef X25519_SUPPORT
194  #define X25519_SUPPORT DISABLED
195 #elif (X25519_SUPPORT != ENABLED && X25519_SUPPORT != DISABLED)
196  #error X25519_SUPPORT parameter is not valid
197 #endif
198 
199 //Curve448 elliptic curve support
200 #ifndef X448_SUPPORT
201  #define X448_SUPPORT DISABLED
202 #elif (X448_SUPPORT != ENABLED && X448_SUPPORT != DISABLED)
203  #error X448_SUPPORT parameter is not valid
204 #endif
205 
206 //Ed25519 elliptic curve support
207 #ifndef ED25519_SUPPORT
208  #define ED25519_SUPPORT DISABLED
209 #elif (ED25519_SUPPORT != ENABLED && ED25519_SUPPORT != DISABLED)
210  #error ED25519_SUPPORT parameter is not valid
211 #endif
212 
213 //Ed448 elliptic curve support
214 #ifndef ED448_SUPPORT
215  #define ED448_SUPPORT DISABLED
216 #elif (ED448_SUPPORT != ENABLED && ED448_SUPPORT != DISABLED)
217  #error ED448_SUPPORT parameter is not valid
218 #endif
219 
220 //SECG curves
221 #define SECP112R1_CURVE (&secp112r1Curve)
222 #define SECP112R2_CURVE (&secp112r2Curve)
223 #define SECP128R1_CURVE (&secp128r1Curve)
224 #define SECP128R2_CURVE (&secp128r2Curve)
225 #define SECP160K1_CURVE (&secp160k1Curve)
226 #define SECP160R1_CURVE (&secp160r1Curve)
227 #define SECP160R2_CURVE (&secp160r2Curve)
228 #define SECP192K1_CURVE (&secp192k1Curve)
229 #define SECP192R1_CURVE (&secp192r1Curve)
230 #define SECP224K1_CURVE (&secp224k1Curve)
231 #define SECP224R1_CURVE (&secp224r1Curve)
232 #define SECP256K1_CURVE (&secp256k1Curve)
233 #define SECP256R1_CURVE (&secp256r1Curve)
234 #define SECP384R1_CURVE (&secp384r1Curve)
235 #define SECP521R1_CURVE (&secp521r1Curve)
236 
237 //Brainpool curves
238 #define BRAINPOOLP160R1_CURVE (&brainpoolP160r1Curve)
239 #define BRAINPOOLP192R1_CURVE (&brainpoolP192r1Curve)
240 #define BRAINPOOLP224R1_CURVE (&brainpoolP224r1Curve)
241 #define BRAINPOOLP256R1_CURVE (&brainpoolP256r1Curve)
242 #define BRAINPOOLP320R1_CURVE (&brainpoolP320r1Curve)
243 #define BRAINPOOLP384R1_CURVE (&brainpoolP384r1Curve)
244 #define BRAINPOOLP512R1_CURVE (&brainpoolP512r1Curve)
245 
246 //Montgomery curves
247 #define X25519_CURVE (&x25519Curve)
248 #define X448_CURVE (&x448Curve)
249 
250 //Edwards curves
251 #define ED25519_CURVE (&ed25519Curve)
252 #define ED448_CURVE (&ed448Curve)
253 
254 //C++ guard
255 #ifdef __cplusplus
256 extern "C" {
257 #endif
258 
259 
260 /**
261  * @brief Elliptic curve type
262  **/
263 
264 typedef enum
265 {
278 } EcCurveType;
279 
280 
281 /**
282  * @brief Fast modular reduction
283  **/
284 
285 typedef error_t (*EcFastModAlgo)(Mpi *a, const Mpi *p);
286 
287 
288 /**
289  * @brief Elliptic curve parameters
290  **/
291 
292 typedef struct
293 {
294  const char_t *name; ///<Curve name
295  const uint8_t *oid; ///<Object identifier
296  size_t oidSize; ///<OID size
297  EcCurveType type; ///<Curve type
298  const uint8_t p[66]; ///<Prime modulus p
299  size_t pLen; ///<Length of p
300  const uint8_t a[66]; ///<Curve parameter a
301  size_t aLen; ///<Length of a
302  const uint8_t b[66]; ///<Curve parameter b
303  size_t bLen; ///<Length of b
304  const uint8_t gx[66]; ///<x-coordinate of the base point G
305  size_t gxLen; ///<Length of Gx
306  const uint8_t gy[66]; ///<y-coordinate of the base point G
307  size_t gyLen; ///<Length of Gy
308  const uint8_t q[66]; ///<Order of the base point G
309  size_t qLen; ///<Length of q
310  uint32_t h; ///<Cofactor h
311  EcFastModAlgo mod; ///<Fast modular reduction
312 } EcCurveInfo;
313 
314 
315 //Constants
316 extern const uint8_t SECP112R1_OID[5];
317 extern const uint8_t SECP112R2_OID[5];
318 extern const uint8_t SECP128R1_OID[5];
319 extern const uint8_t SECP128R2_OID[5];
320 extern const uint8_t SECP160K1_OID[5];
321 extern const uint8_t SECP160R1_OID[5];
322 extern const uint8_t SECP160R2_OID[5];
323 extern const uint8_t SECP192K1_OID[5];
324 extern const uint8_t SECP192R1_OID[8];
325 extern const uint8_t SECP224K1_OID[5];
326 extern const uint8_t SECP224R1_OID[5];
327 extern const uint8_t SECP256K1_OID[5];
328 extern const uint8_t SECP256R1_OID[8];
329 extern const uint8_t SECP384R1_OID[5];
330 extern const uint8_t SECP521R1_OID[5];
331 extern const uint8_t BRAINPOOLP160R1_OID[9];
332 extern const uint8_t BRAINPOOLP192R1_OID[9];
333 extern const uint8_t BRAINPOOLP224R1_OID[9];
334 extern const uint8_t BRAINPOOLP256R1_OID[9];
335 extern const uint8_t BRAINPOOLP320R1_OID[9];
336 extern const uint8_t BRAINPOOLP384R1_OID[9];
337 extern const uint8_t BRAINPOOLP512R1_OID[9];
338 extern const uint8_t X25519_OID[3];
339 extern const uint8_t X448_OID[3];
340 extern const uint8_t ED25519_OID[3];
341 extern const uint8_t ED448_OID[3];
342 
343 extern const EcCurveInfo secp112r1Curve;
344 extern const EcCurveInfo secp112r2Curve;
345 extern const EcCurveInfo secp128r1Curve;
346 extern const EcCurveInfo secp128r2Curve;
347 extern const EcCurveInfo secp160k1Curve;
348 extern const EcCurveInfo secp160r1Curve;
349 extern const EcCurveInfo secp160r2Curve;
350 extern const EcCurveInfo secp192k1Curve;
351 extern const EcCurveInfo secp192r1Curve;
352 extern const EcCurveInfo secp224k1Curve;
353 extern const EcCurveInfo secp224r1Curve;
354 extern const EcCurveInfo secp256k1Curve;
355 extern const EcCurveInfo secp256r1Curve;
356 extern const EcCurveInfo secp384r1Curve;
357 extern const EcCurveInfo secp521r1Curve;
358 extern const EcCurveInfo brainpoolP160r1Curve;
359 extern const EcCurveInfo brainpoolP192r1Curve;
360 extern const EcCurveInfo brainpoolP224r1Curve;
361 extern const EcCurveInfo brainpoolP256r1Curve;
362 extern const EcCurveInfo brainpoolP320r1Curve;
363 extern const EcCurveInfo brainpoolP384r1Curve;
364 extern const EcCurveInfo brainpoolP512r1Curve;
365 extern const EcCurveInfo x25519Curve;
366 extern const EcCurveInfo x448Curve;
367 extern const EcCurveInfo ed25519Curve;
368 extern const EcCurveInfo ed448Curve;
369 
370 //Fast modular reduction
371 error_t secp128r1Mod(Mpi *a, const Mpi *p);
372 error_t secp128r2Mod(Mpi *a, const Mpi *p);
373 error_t secp160k1Mod(Mpi *a, const Mpi *p);
374 error_t secp160r1Mod(Mpi *a, const Mpi *p);
375 error_t secp160r2Mod(Mpi *a, const Mpi *p);
376 error_t secp192k1Mod(Mpi *a, const Mpi *p);
377 error_t secp192r1Mod(Mpi *a, const Mpi *p);
378 error_t secp224k1Mod(Mpi *a, const Mpi *p);
379 error_t secp224r1Mod(Mpi *a, const Mpi *p);
380 error_t secp256k1Mod(Mpi *a, const Mpi *p);
381 error_t secp256r1Mod(Mpi *a, const Mpi *p);
382 error_t secp384r1Mod(Mpi *a, const Mpi *p);
383 error_t secp521r1Mod(Mpi *a, const Mpi *p);
384 
385 const EcCurveInfo *ecGetCurveInfo(const uint8_t *oid, size_t length);
386 
387 //C++ guard
388 #ifdef __cplusplus
389 }
390 #endif
391 
392 #endif
const uint8_t BRAINPOOLP224R1_OID[9]
Definition: ec_curves.c:82
uint8_t length
Definition: dtls_misc.h:149
error_t secp256k1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp256k1 curve)
Definition: ec_curves.c:1844
const EcCurveInfo brainpoolP256r1Curve
brainpoolP256r1 elliptic curve
Definition: ec_curves.c:935
error_t secp521r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp521r1 curve)
Definition: ec_curves.c:2126
uint8_t a
Definition: ndp.h:410
Arbitrary precision integer.
Definition: mpi.h:69
error_t secp192k1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp192k1 curve)
Definition: ec_curves.c:1600
const EcCurveInfo secp160k1Curve
secp160k1 elliptic curve
Definition: ec_curves.c:267
size_t aLen
Length of a.
Definition: ec_curves.h:301
uint8_t b[6]
Definition: dtls_misc.h:139
uint8_t p
Definition: ndp.h:298
const uint8_t BRAINPOOLP256R1_OID[9]
Definition: ec_curves.c:84
const EcCurveInfo secp224k1Curve
secp224k1 elliptic curve
Definition: ec_curves.c:497
uint32_t h
Cofactor h.
Definition: ec_curves.h:310
const EcCurveInfo brainpoolP512r1Curve
brainpoolP512r1 elliptic curve
Definition: ec_curves.c:1085
const uint8_t X448_OID[3]
Definition: ec_curves.c:94
const uint8_t * oid
Object identifier.
Definition: ec_curves.h:295
error_t secp160k1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp160k1 curve)
Definition: ec_curves.c:1450
@ EC_CURVE_TYPE_ED25519
Definition: ec_curves.h:276
@ EC_CURVE_TYPE_SECP_K1
Definition: ec_curves.h:270
error_t secp224k1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp224k1 curve)
Definition: ec_curves.c:1718
error_t secp192r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp192r1 curve)
Definition: ec_curves.c:1651
const uint8_t BRAINPOOLP320R1_OID[9]
Definition: ec_curves.c:86
const EcCurveInfo secp224r1Curve
secp224r1 elliptic curve
Definition: ec_curves.c:543
@ EC_CURVE_TYPE_X448
Definition: ec_curves.h:275
error_t secp160r2Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp160r2 curve)
Definition: ec_curves.c:1549
const uint8_t SECP160R2_OID[5]
Definition: ec_curves.c:60
const EcCurveInfo secp112r1Curve
secp112r1 elliptic curve
Definition: ec_curves.c:107
error_t secp160r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp160r1 curve)
Definition: ec_curves.c:1501
const EcCurveInfo x448Curve
Curve448 elliptic curve.
Definition: ec_curves.c:1189
const uint8_t SECP128R1_OID[5]
Definition: ec_curves.c:52
const EcCurveInfo brainpoolP384r1Curve
brainpoolP384r1 elliptic curve
Definition: ec_curves.c:1033
const EcCurveInfo x25519Curve
Curve25519 elliptic curve.
Definition: ec_curves.c:1143
@ EC_CURVE_TYPE_SECP_R1
Definition: ec_curves.h:271
Elliptic curve parameters.
Definition: ec_curves.h:292
const uint8_t SECP192R1_OID[8]
Definition: ec_curves.c:64
const EcCurveInfo brainpoolP320r1Curve
brainpoolP320r1 elliptic curve
Definition: ec_curves.c:981
const EcCurveInfo secp256r1Curve
secp256r1 elliptic curve
Definition: ec_curves.c:635
const uint8_t SECP384R1_OID[5]
Definition: ec_curves.c:74
size_t bLen
Length of b.
Definition: ec_curves.h:303
error_t
Error codes.
Definition: error.h:42
const EcCurveInfo ed448Curve
Ed448 elliptic curve.
Definition: ec_curves.c:1293
const EcCurveInfo secp112r2Curve
secp112r2 elliptic curve
Definition: ec_curves.c:147
size_t qLen
Length of q.
Definition: ec_curves.h:309
const uint8_t SECP256R1_OID[8]
Definition: ec_curves.c:72
const EcCurveInfo brainpoolP224r1Curve
brainpoolP224r1 elliptic curve
Definition: ec_curves.c:889
const uint8_t SECP160K1_OID[5]
Definition: ec_curves.c:56
@ EC_CURVE_TYPE_SECT_R1
Definition: ec_curves.h:268
error_t secp224r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp224r1 curve)
Definition: ec_curves.c:1769
EcFastModAlgo mod
Fast modular reduction.
Definition: ec_curves.h:311
MPI (Multiple Precision Integer Arithmetic)
@ EC_CURVE_TYPE_SECT_K1
Definition: ec_curves.h:267
const uint8_t SECP160R1_OID[5]
Definition: ec_curves.c:58
General definitions for cryptographic algorithms.
uint8_t oid[1]
Definition: mib_common.h:186
const uint8_t SECP224K1_OID[5]
Definition: ec_curves.c:66
const uint8_t ED448_OID[3]
Definition: ec_curves.c:98
const EcCurveInfo brainpoolP192r1Curve
brainpoolP192r1 elliptic curve
Definition: ec_curves.c:843
const uint8_t SECP521R1_OID[5]
Definition: ec_curves.c:76
const uint8_t SECP112R2_OID[5]
Definition: ec_curves.c:50
const uint8_t SECP256K1_OID[5]
Definition: ec_curves.c:70
@ EC_CURVE_TYPE_SECT_R2
Definition: ec_curves.h:269
size_t gyLen
Length of Gy.
Definition: ec_curves.h:307
const char_t * name
Curve name.
Definition: ec_curves.h:294
const uint8_t ED25519_OID[3]
Definition: ec_curves.c:96
const EcCurveInfo ed25519Curve
Ed25519 elliptic curve.
Definition: ec_curves.c:1247
@ EC_CURVE_TYPE_ED448
Definition: ec_curves.h:277
const EcCurveInfo secp521r1Curve
secp521r1 elliptic curve
Definition: ec_curves.c:733
char char_t
Definition: compiler_port.h:43
error_t secp256r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp256r1 curve)
Definition: ec_curves.c:1895
error_t secp384r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp384r1 curve)
Definition: ec_curves.c:2011
const uint8_t X25519_OID[3]
Definition: ec_curves.c:92
const EcCurveInfo secp128r2Curve
secp128r2 elliptic curve
Definition: ec_curves.c:227
@ EC_CURVE_TYPE_X25519
Definition: ec_curves.h:274
error_t secp128r2Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp128r2 curve)
Definition: ec_curves.c:1402
const uint8_t BRAINPOOLP384R1_OID[9]
Definition: ec_curves.c:88
@ EC_CURVE_TYPE_SECP_R2
Definition: ec_curves.h:272
const EcCurveInfo secp128r1Curve
secp128r1 elliptic curve
Definition: ec_curves.c:187
const uint8_t SECP128R2_OID[5]
Definition: ec_curves.c:54
const EcCurveInfo secp192r1Curve
secp192r1 elliptic curve
Definition: ec_curves.c:451
const EcCurveInfo secp384r1Curve
secp384r1 elliptic curve
Definition: ec_curves.c:681
const EcCurveInfo secp160r2Curve
secp160r2 elliptic curve
Definition: ec_curves.c:359
const EcCurveInfo * ecGetCurveInfo(const uint8_t *oid, size_t length)
Get the elliptic curve that matches the specified OID.
Definition: ec_curves.c:2172
const uint8_t SECP192K1_OID[5]
Definition: ec_curves.c:62
const uint8_t BRAINPOOLP160R1_OID[9]
Definition: ec_curves.c:78
size_t gxLen
Length of Gx.
Definition: ec_curves.h:305
@ EC_CURVE_TYPE_NONE
Definition: ec_curves.h:266
size_t oidSize
OID size.
Definition: ec_curves.h:296
const uint8_t SECP112R1_OID[5]
Definition: ec_curves.c:48
const EcCurveInfo secp192k1Curve
secp192k1 elliptic curve
Definition: ec_curves.c:405
error_t(* EcFastModAlgo)(Mpi *a, const Mpi *p)
Fast modular reduction.
Definition: ec_curves.h:285
const EcCurveInfo secp160r1Curve
secp160r1 elliptic curve
Definition: ec_curves.c:313
EcCurveType
Elliptic curve type.
Definition: ec_curves.h:264
const uint8_t BRAINPOOLP512R1_OID[9]
Definition: ec_curves.c:90
const uint8_t BRAINPOOLP192R1_OID[9]
Definition: ec_curves.c:80
@ EC_CURVE_TYPE_BRAINPOOLP_R1
Definition: ec_curves.h:273
size_t pLen
Length of p.
Definition: ec_curves.h:299
error_t secp128r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp128r1 curve)
Definition: ec_curves.c:1354
const uint8_t SECP224R1_OID[5]
Definition: ec_curves.c:68
const EcCurveInfo brainpoolP160r1Curve
brainpoolP160r1 elliptic curve
Definition: ec_curves.c:797
EcCurveType type
Curve type.
Definition: ec_curves.h:297
const EcCurveInfo secp256k1Curve
secp256k1 elliptic curve
Definition: ec_curves.c:589