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-2024 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 2.4.0
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 //SM2 elliptic curve support
193 #ifndef SM2_SUPPORT
194  #define SM2_SUPPORT DISABLED
195 #elif (SM2_SUPPORT != ENABLED && SM2_SUPPORT != DISABLED)
196  #error SM2_SUPPORT parameter is not valid
197 #endif
198 
199 //Curve25519 elliptic curve support
200 #ifndef X25519_SUPPORT
201  #define X25519_SUPPORT DISABLED
202 #elif (X25519_SUPPORT != ENABLED && X25519_SUPPORT != DISABLED)
203  #error X25519_SUPPORT parameter is not valid
204 #endif
205 
206 //Curve448 elliptic curve support
207 #ifndef X448_SUPPORT
208  #define X448_SUPPORT DISABLED
209 #elif (X448_SUPPORT != ENABLED && X448_SUPPORT != DISABLED)
210  #error X448_SUPPORT parameter is not valid
211 #endif
212 
213 //Ed25519 elliptic curve support
214 #ifndef ED25519_SUPPORT
215  #define ED25519_SUPPORT DISABLED
216 #elif (ED25519_SUPPORT != ENABLED && ED25519_SUPPORT != DISABLED)
217  #error ED25519_SUPPORT parameter is not valid
218 #endif
219 
220 //Ed448 elliptic curve support
221 #ifndef ED448_SUPPORT
222  #define ED448_SUPPORT DISABLED
223 #elif (ED448_SUPPORT != ENABLED && ED448_SUPPORT != DISABLED)
224  #error ED448_SUPPORT parameter is not valid
225 #endif
226 
227 //Elliptic curves
228 #define SECP112R1_CURVE (&secp112r1Curve)
229 #define SECP112R2_CURVE (&secp112r2Curve)
230 #define SECP128R1_CURVE (&secp128r1Curve)
231 #define SECP128R2_CURVE (&secp128r2Curve)
232 #define SECP160K1_CURVE (&secp160k1Curve)
233 #define SECP160R1_CURVE (&secp160r1Curve)
234 #define SECP160R2_CURVE (&secp160r2Curve)
235 #define SECP192K1_CURVE (&secp192k1Curve)
236 #define SECP192R1_CURVE (&secp192r1Curve)
237 #define SECP224K1_CURVE (&secp224k1Curve)
238 #define SECP224R1_CURVE (&secp224r1Curve)
239 #define SECP256K1_CURVE (&secp256k1Curve)
240 #define SECP256R1_CURVE (&secp256r1Curve)
241 #define SECP384R1_CURVE (&secp384r1Curve)
242 #define SECP521R1_CURVE (&secp521r1Curve)
243 #define BRAINPOOLP160R1_CURVE (&brainpoolP160r1Curve)
244 #define BRAINPOOLP192R1_CURVE (&brainpoolP192r1Curve)
245 #define BRAINPOOLP224R1_CURVE (&brainpoolP224r1Curve)
246 #define BRAINPOOLP256R1_CURVE (&brainpoolP256r1Curve)
247 #define BRAINPOOLP320R1_CURVE (&brainpoolP320r1Curve)
248 #define BRAINPOOLP384R1_CURVE (&brainpoolP384r1Curve)
249 #define BRAINPOOLP512R1_CURVE (&brainpoolP512r1Curve)
250 #define SM2_CURVE (&sm2Curve)
251 #define X25519_CURVE (&x25519Curve)
252 #define X448_CURVE (&x448Curve)
253 #define ED25519_CURVE (&ed25519Curve)
254 #define ED448_CURVE (&ed448Curve)
255 
256 //C++ guard
257 #ifdef __cplusplus
258 extern "C" {
259 #endif
260 
261 
262 /**
263  * @brief Elliptic curve type
264  **/
265 
266 typedef enum
267 {
281 
282 
283 /**
284  * @brief Fast modular reduction
285  **/
286 
287 typedef error_t (*EcFastModAlgo)(Mpi *a, const Mpi *p);
288 
289 
290 /**
291  * @brief Elliptic curve parameters
292  **/
293 
294 typedef struct
295 {
296  const char_t *name; ///<Curve name
297  const uint8_t *oid; ///<Object identifier
298  size_t oidSize; ///<OID size
299  EcCurveType type; ///<Curve type
300  const uint8_t p[66]; ///<Prime modulus p
301  size_t pLen; ///<Length of p
302  const uint8_t a[66]; ///<Curve parameter a
303  size_t aLen; ///<Length of a
304  const uint8_t b[66]; ///<Curve parameter b
305  size_t bLen; ///<Length of b
306  const uint8_t gx[66]; ///<x-coordinate of the base point G
307  size_t gxLen; ///<Length of Gx
308  const uint8_t gy[66]; ///<y-coordinate of the base point G
309  size_t gyLen; ///<Length of Gy
310  const uint8_t q[66]; ///<Order of the base point G
311  size_t qLen; ///<Length of q
312  uint32_t h; ///<Cofactor h
313  EcFastModAlgo mod; ///<Fast modular reduction
314 } EcCurveInfo;
315 
316 
317 //Constants
318 extern const uint8_t SECP112R1_OID[5];
319 extern const uint8_t SECP112R2_OID[5];
320 extern const uint8_t SECP128R1_OID[5];
321 extern const uint8_t SECP128R2_OID[5];
322 extern const uint8_t SECP160K1_OID[5];
323 extern const uint8_t SECP160R1_OID[5];
324 extern const uint8_t SECP160R2_OID[5];
325 extern const uint8_t SECP192K1_OID[5];
326 extern const uint8_t SECP192R1_OID[8];
327 extern const uint8_t SECP224K1_OID[5];
328 extern const uint8_t SECP224R1_OID[5];
329 extern const uint8_t SECP256K1_OID[5];
330 extern const uint8_t SECP256R1_OID[8];
331 extern const uint8_t SECP384R1_OID[5];
332 extern const uint8_t SECP521R1_OID[5];
333 extern const uint8_t BRAINPOOLP160R1_OID[9];
334 extern const uint8_t BRAINPOOLP192R1_OID[9];
335 extern const uint8_t BRAINPOOLP224R1_OID[9];
336 extern const uint8_t BRAINPOOLP256R1_OID[9];
337 extern const uint8_t BRAINPOOLP320R1_OID[9];
338 extern const uint8_t BRAINPOOLP384R1_OID[9];
339 extern const uint8_t BRAINPOOLP512R1_OID[9];
340 extern const uint8_t SM2_OID[8];
341 extern const uint8_t X25519_OID[3];
342 extern const uint8_t X448_OID[3];
343 extern const uint8_t ED25519_OID[3];
344 extern const uint8_t ED448_OID[3];
345 
346 extern const EcCurveInfo secp112r1Curve;
347 extern const EcCurveInfo secp112r2Curve;
348 extern const EcCurveInfo secp128r1Curve;
349 extern const EcCurveInfo secp128r2Curve;
350 extern const EcCurveInfo secp160k1Curve;
351 extern const EcCurveInfo secp160r1Curve;
352 extern const EcCurveInfo secp160r2Curve;
353 extern const EcCurveInfo secp192k1Curve;
354 extern const EcCurveInfo secp192r1Curve;
355 extern const EcCurveInfo secp224k1Curve;
356 extern const EcCurveInfo secp224r1Curve;
357 extern const EcCurveInfo secp256k1Curve;
358 extern const EcCurveInfo secp256r1Curve;
359 extern const EcCurveInfo secp384r1Curve;
360 extern const EcCurveInfo secp521r1Curve;
361 extern const EcCurveInfo brainpoolP160r1Curve;
362 extern const EcCurveInfo brainpoolP192r1Curve;
363 extern const EcCurveInfo brainpoolP224r1Curve;
364 extern const EcCurveInfo brainpoolP256r1Curve;
365 extern const EcCurveInfo brainpoolP320r1Curve;
366 extern const EcCurveInfo brainpoolP384r1Curve;
367 extern const EcCurveInfo brainpoolP512r1Curve;
368 extern const EcCurveInfo sm2Curve;
369 extern const EcCurveInfo x25519Curve;
370 extern const EcCurveInfo x448Curve;
371 extern const EcCurveInfo ed25519Curve;
372 extern const EcCurveInfo ed448Curve;
373 
374 //Fast modular reduction
375 error_t secp128r1Mod(Mpi *a, const Mpi *p);
376 error_t secp128r2Mod(Mpi *a, const Mpi *p);
377 error_t secp160k1Mod(Mpi *a, const Mpi *p);
378 error_t secp160r1Mod(Mpi *a, const Mpi *p);
379 error_t secp160r2Mod(Mpi *a, const Mpi *p);
380 error_t secp192k1Mod(Mpi *a, const Mpi *p);
381 error_t secp192r1Mod(Mpi *a, const Mpi *p);
382 error_t secp224k1Mod(Mpi *a, const Mpi *p);
383 error_t secp224r1Mod(Mpi *a, const Mpi *p);
384 error_t secp256k1Mod(Mpi *a, const Mpi *p);
385 error_t secp256r1Mod(Mpi *a, const Mpi *p);
386 error_t secp384r1Mod(Mpi *a, const Mpi *p);
387 error_t secp521r1Mod(Mpi *a, const Mpi *p);
388 error_t sm2Mod(Mpi *a, const Mpi *p);
389 
390 const EcCurveInfo *ecGetCurveInfo(const uint8_t *oid, size_t length);
391 
392 //C++ guard
393 #ifdef __cplusplus
394 }
395 #endif
396 
397 #endif
char char_t
Definition: compiler_port.h:48
General definitions for cryptographic algorithms.
const EcCurveInfo secp112r1Curve
secp112r1 elliptic curve
Definition: ec_curves.c:109
const uint8_t SECP521R1_OID[5]
Definition: ec_curves.c:76
error_t secp224r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp224r1 curve)
Definition: ec_curves.c:1817
error_t secp256r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp256r1 curve)
Definition: ec_curves.c:1943
const uint8_t SECP160R1_OID[5]
Definition: ec_curves.c:58
const uint8_t ED25519_OID[3]
Definition: ec_curves.c:98
const EcCurveInfo * ecGetCurveInfo(const uint8_t *oid, size_t length)
Get the elliptic curve that matches the specified OID.
Definition: ec_curves.c:2374
error_t secp128r2Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp128r2 curve)
Definition: ec_curves.c:1450
const EcCurveInfo secp521r1Curve
secp521r1 elliptic curve
Definition: ec_curves.c:735
const uint8_t SECP160R2_OID[5]
Definition: ec_curves.c:60
const uint8_t SECP192K1_OID[5]
Definition: ec_curves.c:62
const EcCurveInfo brainpoolP192r1Curve
brainpoolP192r1 elliptic curve
Definition: ec_curves.c:845
error_t secp128r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp128r1 curve)
Definition: ec_curves.c:1402
const EcCurveInfo secp384r1Curve
secp384r1 elliptic curve
Definition: ec_curves.c:683
const EcCurveInfo brainpoolP320r1Curve
brainpoolP320r1 elliptic curve
Definition: ec_curves.c:983
const EcCurveInfo secp256k1Curve
secp256k1 elliptic curve
Definition: ec_curves.c:591
error_t sm2Mod(Mpi *a, const Mpi *p)
Fast modular reduction (SM2 curve)
Definition: ec_curves.c:2220
const uint8_t SECP192R1_OID[8]
Definition: ec_curves.c:64
error_t secp192k1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp192k1 curve)
Definition: ec_curves.c:1648
error_t secp160r2Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp160r2 curve)
Definition: ec_curves.c:1597
const uint8_t BRAINPOOLP192R1_OID[9]
Definition: ec_curves.c:80
const EcCurveInfo brainpoolP160r1Curve
brainpoolP160r1 elliptic curve
Definition: ec_curves.c:799
const EcCurveInfo brainpoolP384r1Curve
brainpoolP384r1 elliptic curve
Definition: ec_curves.c:1035
error_t secp160k1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp160k1 curve)
Definition: ec_curves.c:1498
const EcCurveInfo brainpoolP256r1Curve
brainpoolP256r1 elliptic curve
Definition: ec_curves.c:937
const EcCurveInfo ed25519Curve
Ed25519 elliptic curve.
Definition: ec_curves.c:1295
const uint8_t BRAINPOOLP320R1_OID[9]
Definition: ec_curves.c:86
const EcCurveInfo brainpoolP512r1Curve
brainpoolP512r1 elliptic curve
Definition: ec_curves.c:1087
const EcCurveInfo secp112r2Curve
secp112r2 elliptic curve
Definition: ec_curves.c:149
const EcCurveInfo x448Curve
Curve448 elliptic curve.
Definition: ec_curves.c:1237
const uint8_t BRAINPOOLP224R1_OID[9]
Definition: ec_curves.c:82
const uint8_t BRAINPOOLP512R1_OID[9]
Definition: ec_curves.c:90
const EcCurveInfo brainpoolP224r1Curve
brainpoolP224r1 elliptic curve
Definition: ec_curves.c:891
const uint8_t BRAINPOOLP256R1_OID[9]
Definition: ec_curves.c:84
const uint8_t X448_OID[3]
Definition: ec_curves.c:96
const uint8_t SECP112R2_OID[5]
Definition: ec_curves.c:50
const EcCurveInfo secp224k1Curve
secp224k1 elliptic curve
Definition: ec_curves.c:499
error_t secp384r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp384r1 curve)
Definition: ec_curves.c:2059
const uint8_t BRAINPOOLP160R1_OID[9]
Definition: ec_curves.c:78
error_t secp192r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp192r1 curve)
Definition: ec_curves.c:1699
const EcCurveInfo secp128r1Curve
secp128r1 elliptic curve
Definition: ec_curves.c:189
const EcCurveInfo secp256r1Curve
secp256r1 elliptic curve
Definition: ec_curves.c:637
const uint8_t SECP128R1_OID[5]
Definition: ec_curves.c:52
const EcCurveInfo secp192k1Curve
secp192k1 elliptic curve
Definition: ec_curves.c:407
error_t secp256k1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp256k1 curve)
Definition: ec_curves.c:1892
const EcCurveInfo sm2Curve
SM2 elliptic curve.
Definition: ec_curves.c:1145
error_t(* EcFastModAlgo)(Mpi *a, const Mpi *p)
Fast modular reduction.
Definition: ec_curves.h:287
const uint8_t X25519_OID[3]
Definition: ec_curves.c:94
const uint8_t SM2_OID[8]
Definition: ec_curves.c:92
const uint8_t SECP256R1_OID[8]
Definition: ec_curves.c:72
const EcCurveInfo ed448Curve
Ed448 elliptic curve.
Definition: ec_curves.c:1341
const EcCurveInfo secp160r1Curve
secp160r1 elliptic curve
Definition: ec_curves.c:315
const EcCurveInfo secp160r2Curve
secp160r2 elliptic curve
Definition: ec_curves.c:361
error_t secp224k1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp224k1 curve)
Definition: ec_curves.c:1766
const uint8_t ED448_OID[3]
Definition: ec_curves.c:100
const EcCurveInfo secp160k1Curve
secp160k1 elliptic curve
Definition: ec_curves.c:269
error_t secp521r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp521r1 curve)
Definition: ec_curves.c:2174
const uint8_t SECP112R1_OID[5]
Definition: ec_curves.c:48
const uint8_t SECP384R1_OID[5]
Definition: ec_curves.c:74
const uint8_t SECP224K1_OID[5]
Definition: ec_curves.c:66
error_t secp160r1Mod(Mpi *a, const Mpi *p)
Fast modular reduction (secp160r1 curve)
Definition: ec_curves.c:1549
const uint8_t SECP160K1_OID[5]
Definition: ec_curves.c:56
const uint8_t BRAINPOOLP384R1_OID[9]
Definition: ec_curves.c:88
const EcCurveInfo secp192r1Curve
secp192r1 elliptic curve
Definition: ec_curves.c:453
const EcCurveInfo x25519Curve
Curve25519 elliptic curve.
Definition: ec_curves.c:1191
const uint8_t SECP128R2_OID[5]
Definition: ec_curves.c:54
const EcCurveInfo secp128r2Curve
secp128r2 elliptic curve
Definition: ec_curves.c:229
const EcCurveInfo secp224r1Curve
secp224r1 elliptic curve
Definition: ec_curves.c:545
const uint8_t SECP224R1_OID[5]
Definition: ec_curves.c:68
EcCurveType
Elliptic curve type.
Definition: ec_curves.h:267
@ EC_CURVE_TYPE_X25519
Definition: ec_curves.h:276
@ EC_CURVE_TYPE_SECT_R2
Definition: ec_curves.h:271
@ EC_CURVE_TYPE_ED25519
Definition: ec_curves.h:278
@ EC_CURVE_TYPE_SECP_R1
Definition: ec_curves.h:273
@ EC_CURVE_TYPE_X448
Definition: ec_curves.h:277
@ EC_CURVE_TYPE_BRAINPOOLP_R1
Definition: ec_curves.h:275
@ EC_CURVE_TYPE_NONE
Definition: ec_curves.h:268
@ EC_CURVE_TYPE_ED448
Definition: ec_curves.h:279
@ EC_CURVE_TYPE_SECP_K1
Definition: ec_curves.h:272
@ EC_CURVE_TYPE_SECP_R2
Definition: ec_curves.h:274
@ EC_CURVE_TYPE_SECT_K1
Definition: ec_curves.h:269
@ EC_CURVE_TYPE_SECT_R1
Definition: ec_curves.h:270
const uint8_t SECP256K1_OID[5]
Definition: ec_curves.c:70
error_t
Error codes.
Definition: error.h:43
uint8_t oid[]
Definition: lldp_tlv.h:300
MPI (Multiple Precision Integer Arithmetic)
uint8_t b
Definition: nbns_common.h:104
uint8_t p
Definition: ndp.h:300
uint8_t a
Definition: ndp.h:411
Elliptic curve parameters.
Definition: ec_curves.h:295
const char_t * name
Curve name.
Definition: ec_curves.h:296
size_t pLen
Length of p.
Definition: ec_curves.h:301
size_t gxLen
Length of Gx.
Definition: ec_curves.h:307
size_t qLen
Length of q.
Definition: ec_curves.h:311
size_t bLen
Length of b.
Definition: ec_curves.h:305
size_t aLen
Length of a.
Definition: ec_curves.h:303
uint32_t h
Cofactor h.
Definition: ec_curves.h:312
size_t gyLen
Length of Gy.
Definition: ec_curves.h:309
size_t oidSize
OID size.
Definition: ec_curves.h:298
EcCurveType type
Curve type.
Definition: ec_curves.h:299
EcFastModAlgo mod
Fast modular reduction.
Definition: ec_curves.h:313
const uint8_t * oid
Object identifier.
Definition: ec_curves.h:297
Arbitrary precision integer.
Definition: mpi.h:80
uint8_t length
Definition: tcp.h:368