xref: /freebsd/crypto/libecc/include/libecc/lib_ecc_types.h (revision f0865ec9906d5a18fa2a3b61381f22ce16e606ad)
1 /*
2  *  Copyright (C) 2017 - This file is part of libecc project
3  *
4  *  Authors:
5  *      Ryad BENADJILA <ryadbenadjila@gmail.com>
6  *      Arnaud EBALARD <arnaud.ebalard@ssi.gouv.fr>
7  *      Jean-Pierre FLORI <jean-pierre.flori@ssi.gouv.fr>
8  *
9  *  Contributors:
10  *      Nicolas VIVET <nicolas.vivet@ssi.gouv.fr>
11  *      Karim KHALFALLAH <karim.khalfallah@ssi.gouv.fr>
12  *
13  *  This software is licensed under a dual BSD and GPL v2 license.
14  *  See LICENSE file at the root folder of the project.
15  */
16 #ifndef __LIB_ECC_TYPES_H__
17 #define __LIB_ECC_TYPES_H__
18 
19 #include <libecc/lib_ecc_config.h>
20 
21 /* Signature algorithm types */
22 typedef enum {
23 	UNKNOWN_ALG = 0,
24 #ifdef WITH_SIG_ECDSA
25 	ECDSA = 1,
26 #endif
27 #ifdef WITH_SIG_ECKCDSA
28 	ECKCDSA = 2,
29 #endif
30 #ifdef WITH_SIG_ECSDSA
31 	ECSDSA = 3,
32 #endif
33 #ifdef WITH_SIG_ECOSDSA
34 	ECOSDSA = 4,
35 #endif
36 #ifdef WITH_SIG_ECFSDSA
37 	ECFSDSA = 5,
38 #endif
39 #ifdef WITH_SIG_ECGDSA
40 	ECGDSA = 6,
41 #endif
42 #ifdef WITH_SIG_ECRDSA
43 	ECRDSA = 7,
44 #endif
45 #ifdef WITH_SIG_SM2
46         SM2 = 8,
47 #endif
48 #ifdef WITH_SIG_EDDSA25519
49 	EDDSA25519    = 9,
50 	EDDSA25519CTX = 10,
51 	EDDSA25519PH  = 11,
52 #endif
53 #ifdef WITH_SIG_EDDSA448
54 	EDDSA448   = 12,
55 	EDDSA448PH = 13,
56 #endif
57 #ifdef WITH_SIG_DECDSA
58 	DECDSA = 14,
59 #endif
60 	/* ECDH types */
61 #ifdef WITH_ECCCDH
62 	ECCCDH = 15,
63 #endif
64 #ifdef WITH_X25519
65 	X25519 = 16,
66 #endif
67 #ifdef WITH_X448
68 	X448 = 17,
69 #endif
70 #ifdef WITH_SIG_BIGN
71 	BIGN = 18,
72 #endif
73 #ifdef WITH_SIG_DBIGN
74 	DBIGN = 19,
75 #endif
76 #ifdef WITH_SIG_BIP0340
77 	BIP0340 = 20,
78 #endif
79 } ec_alg_type;
80 
81 /* Hash algorithm types */
82 typedef enum {
83 	UNKNOWN_HASH_ALG = 0,
84 #ifdef WITH_HASH_SHA224
85 	SHA224 = 1,
86 #endif
87 #ifdef WITH_HASH_SHA256
88 	SHA256 = 2,
89 #endif
90 #ifdef WITH_HASH_SHA384
91 	SHA384 = 3,
92 #endif
93 #ifdef WITH_HASH_SHA512
94 	SHA512 = 4,
95 #endif
96 #ifdef WITH_HASH_SHA3_224
97 	SHA3_224 = 5,
98 #endif
99 #ifdef WITH_HASH_SHA3_256
100 	SHA3_256 = 6,
101 #endif
102 #ifdef WITH_HASH_SHA3_384
103 	SHA3_384 = 7,
104 #endif
105 #ifdef WITH_HASH_SHA3_512
106 	SHA3_512 = 8,
107 #endif
108 #ifdef WITH_HASH_SHA512_224
109 	SHA512_224 = 9,
110 #endif
111 #ifdef WITH_HASH_SHA512_256
112 	SHA512_256 = 10,
113 #endif
114 #ifdef WITH_HASH_SM3
115         SM3 = 11,
116 #endif
117 #ifdef WITH_HASH_SHAKE256
118 	SHAKE256 = 12,
119 #endif
120 #ifdef WITH_HASH_STREEBOG256
121 	STREEBOG256 = 13,
122 #endif
123 #ifdef WITH_HASH_STREEBOG512
124 	STREEBOG512 = 14,
125 #endif
126 #ifdef WITH_HASH_RIPEMD160
127 	RIPEMD160 = 15,
128 #endif
129 #ifdef WITH_HASH_BELT_HASH
130 	BELT_HASH = 16,
131 #endif
132 #ifdef WITH_HASH_BASH224
133 	BASH224 = 17,
134 #endif
135 #ifdef WITH_HASH_BASH256
136 	BASH256 = 18,
137 #endif
138 #ifdef WITH_HASH_BASH384
139 	BASH384 = 19,
140 #endif
141 #ifdef WITH_HASH_BASH512
142 	BASH512 = 20,
143 #endif
144 } hash_alg_type;
145 
146 /* All curves we support */
147 typedef enum {
148 	UNKNOWN_CURVE = 0,
149 #ifdef WITH_CURVE_FRP256V1
150 	FRP256V1 = 1,
151 #endif
152 #ifdef WITH_CURVE_SECP192R1
153 	SECP192R1 = 2,
154 #endif
155 #ifdef WITH_CURVE_SECP224R1
156 	SECP224R1 = 3,
157 #endif
158 #ifdef WITH_CURVE_SECP256R1
159 	SECP256R1 = 4,
160 #endif
161 #ifdef WITH_CURVE_SECP384R1
162 	SECP384R1 = 5,
163 #endif
164 #ifdef WITH_CURVE_SECP521R1
165 	SECP521R1 = 6,
166 #endif
167 #ifdef WITH_CURVE_BRAINPOOLP224R1
168 	BRAINPOOLP224R1 = 7,
169 #endif
170 #ifdef WITH_CURVE_BRAINPOOLP256R1
171 	BRAINPOOLP256R1 = 8,
172 #endif
173 #ifdef WITH_CURVE_BRAINPOOLP512R1
174 	BRAINPOOLP512R1 = 9,
175 #endif
176 #ifdef WITH_CURVE_GOST256
177 	GOST256 = 10,
178 #endif
179 #ifdef WITH_CURVE_GOST512
180 	GOST512 = 11,
181 #endif
182 #ifdef WITH_CURVE_BRAINPOOLP384R1
183 	BRAINPOOLP384R1 = 12,
184 #endif
185 #ifdef WITH_CURVE_BRAINPOOLP192R1
186 	BRAINPOOLP192R1 = 13,
187 #endif
188 #ifdef WITH_CURVE_WEI25519
189 	WEI25519 = 14,
190 #endif
191 #ifdef WITH_CURVE_WEI448
192 	WEI448 = 15,
193 #endif
194 #ifdef WITH_CURVE_SM2P256TEST
195 	SM2P256TEST = 16,
196 #endif
197 #ifdef WITH_CURVE_SM2P256V1
198 	SM2P256V1 = 17,
199 #endif
200 #ifdef WITH_CURVE_GOST_R3410_2012_256_PARAMSETA
201 	GOST_R3410_2012_256_PARAMSETA = 18,
202 #endif
203 #ifdef WITH_CURVE_SECP256K1
204 	SECP256K1 = 19,
205 #endif
206 #ifdef WITH_CURVE_GOST_R3410_2001_TESTPARAMSET
207 	GOST_R3410_2001_TESTPARAMSET = 20,
208 #endif
209 #ifdef WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_A_PARAMSET
210 	GOST_R3410_2001_CRYPTOPRO_A_PARAMSET = 21,
211 #endif
212 #ifdef WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_B_PARAMSET
213 	GOST_R3410_2001_CRYPTOPRO_B_PARAMSET = 22,
214 #endif
215 #ifdef WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_C_PARAMSET
216 	GOST_R3410_2001_CRYPTOPRO_C_PARAMSET = 23,
217 #endif
218 #ifdef WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_XCHA_PARAMSET
219 	GOST_R3410_2001_CRYPTOPRO_XCHA_PARAMSET = 24,
220 #endif
221 #ifdef WITH_CURVE_GOST_R3410_2001_CRYPTOPRO_XCHB_PARAMSET
222 	GOST_R3410_2001_CRYPTOPRO_XCHB_PARAMSET = 25,
223 #endif
224 #ifdef WITH_CURVE_GOST_R3410_2012_256_PARAMSETB
225 	GOST_R3410_2012_256_PARAMSETB = 26,
226 #endif
227 #ifdef WITH_CURVE_GOST_R3410_2012_256_PARAMSETC
228 	GOST_R3410_2012_256_PARAMSETC = 27,
229 #endif
230 #ifdef WITH_CURVE_GOST_R3410_2012_256_PARAMSETD
231 	GOST_R3410_2012_256_PARAMSETD = 28,
232 #endif
233 #ifdef WITH_CURVE_GOST_R3410_2012_512_PARAMSETTEST
234 	GOST_R3410_2012_512_PARAMSETTEST = 29,
235 #endif
236 #ifdef WITH_CURVE_GOST_R3410_2012_512_PARAMSETA
237 	GOST_R3410_2012_512_PARAMSETA = 30,
238 #endif
239 #ifdef WITH_CURVE_GOST_R3410_2012_512_PARAMSETB
240 	GOST_R3410_2012_512_PARAMSETB = 31,
241 #endif
242 #ifdef WITH_CURVE_GOST_R3410_2012_512_PARAMSETC
243 	GOST_R3410_2012_512_PARAMSETC = 32,
244 #endif
245 #ifdef WITH_CURVE_SECP192K1
246 	SECP192K1 = 33,
247 #endif
248 #ifdef WITH_CURVE_SECP224K1
249 	SECP224K1 = 34,
250 #endif
251 #ifdef WITH_CURVE_BRAINPOOLP192T1
252 	BRAINPOOLP192T1 = 35,
253 #endif
254 #ifdef WITH_CURVE_BRAINPOOLP224T1
255 	BRAINPOOLP224T1 = 36,
256 #endif
257 #ifdef WITH_CURVE_BRAINPOOLP256T1
258 	BRAINPOOLP256T1 = 37,
259 #endif
260 #ifdef WITH_CURVE_BRAINPOOLP320R1
261 	BRAINPOOLP320R1 = 38,
262 #endif
263 #ifdef WITH_CURVE_BRAINPOOLP320T1
264 	BRAINPOOLP320T1 = 39,
265 #endif
266 #ifdef WITH_CURVE_BRAINPOOLP384T1
267 	BRAINPOOLP384T1 = 40,
268 #endif
269 #ifdef WITH_CURVE_BRAINPOOLP512T1
270 	BRAINPOOLP512T1 = 41,
271 #endif
272 #ifdef WITH_CURVE_BIGN256V1
273 	BIGN256V1 = 42,
274 #endif
275 #ifdef WITH_CURVE_BIGN384V1
276 	BIGN384V1 = 43,
277 #endif
278 #ifdef WITH_CURVE_BIGN512V1
279 	BIGN512V1 = 44,
280 #endif
281 /* ADD curves type here */
282 /* XXX: Do not remove the comment above, as it is
283  * used by external tools as a placeholder to add or
284  * remove automatically generated code.
285  */
286 } ec_curve_type;
287 
288 #endif /* __LIB_ECC_TYPES_H__ */
289