xref: /freebsd/crypto/libecc/include/libecc/curves/known/ec_params_bign384v1.h (revision f0865ec9906d5a18fa2a3b61381f22ce16e606ad)
1 #include <libecc/lib_ecc_config.h>
2 #ifdef WITH_CURVE_BIGN384V1
3 
4 #ifndef __EC_PARAMS_BIGN384V1_H__
5 #define __EC_PARAMS_BIGN384V1_H__
6 #include <libecc/curves/known/ec_params_external.h>
7 static const u8 bign384v1_p[] = {
8 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
9 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
10 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
11 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
12 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
13 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xc3,
14 };
15 
16 TO_EC_STR_PARAM(bign384v1_p);
17 
18 #define CURVE_BIGN384V1_P_BITLEN 384
19 static const u8 bign384v1_p_bitlen[] = {
20 	0x01, 0x80,
21 };
22 
23 TO_EC_STR_PARAM(bign384v1_p_bitlen);
24 
25 #if (WORD_BYTES == 8)     /* 64-bit words */
26 static const u8 bign384v1_r[] = {
27 	0x01, 0x3d,
28 };
29 
30 TO_EC_STR_PARAM(bign384v1_r);
31 
32 static const u8 bign384v1_r_square[] = {
33 	0x01, 0x88, 0x89,
34 };
35 
36 TO_EC_STR_PARAM(bign384v1_r_square);
37 
38 static const u8 bign384v1_mpinv[] = {
39 	0xec, 0x9e, 0x48, 0xae, 0x6f, 0x71, 0xde, 0x15,
40 };
41 
42 TO_EC_STR_PARAM(bign384v1_mpinv);
43 
44 static const u8 bign384v1_p_shift[] = {
45 	0x00,
46 };
47 
48 TO_EC_STR_PARAM(bign384v1_p_shift);
49 
50 static const u8 bign384v1_p_normalized[] = {
51 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
52 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
53 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
54 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
55 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
56 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xc3,
57 };
58 
59 TO_EC_STR_PARAM(bign384v1_p_normalized);
60 
61 static const u8 bign384v1_p_reciprocal[] = {
62 	0x00,
63 };
64 
65 TO_EC_STR_PARAM(bign384v1_p_reciprocal);
66 
67 #elif (WORD_BYTES == 4)   /* 32-bit words */
68 static const u8 bign384v1_r[] = {
69 	0x01, 0x3d,
70 };
71 
72 TO_EC_STR_PARAM(bign384v1_r);
73 
74 static const u8 bign384v1_r_square[] = {
75 	0x01, 0x88, 0x89,
76 };
77 
78 TO_EC_STR_PARAM(bign384v1_r_square);
79 
80 static const u8 bign384v1_mpinv[] = {
81 	0x6f, 0x71, 0xde, 0x15,
82 };
83 
84 TO_EC_STR_PARAM(bign384v1_mpinv);
85 
86 static const u8 bign384v1_p_shift[] = {
87 	0x00,
88 };
89 
90 TO_EC_STR_PARAM(bign384v1_p_shift);
91 
92 static const u8 bign384v1_p_normalized[] = {
93 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
94 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
95 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
96 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
97 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
98 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xc3,
99 };
100 
101 TO_EC_STR_PARAM(bign384v1_p_normalized);
102 
103 static const u8 bign384v1_p_reciprocal[] = {
104 	0x00,
105 };
106 
107 TO_EC_STR_PARAM(bign384v1_p_reciprocal);
108 
109 #elif (WORD_BYTES == 2)   /* 16-bit words */
110 static const u8 bign384v1_r[] = {
111 	0x01, 0x3d,
112 };
113 
114 TO_EC_STR_PARAM(bign384v1_r);
115 
116 static const u8 bign384v1_r_square[] = {
117 	0x01, 0x88, 0x89,
118 };
119 
120 TO_EC_STR_PARAM(bign384v1_r_square);
121 
122 static const u8 bign384v1_mpinv[] = {
123 	0xde, 0x15,
124 };
125 
126 TO_EC_STR_PARAM(bign384v1_mpinv);
127 
128 static const u8 bign384v1_p_shift[] = {
129 	0x00,
130 };
131 
132 TO_EC_STR_PARAM(bign384v1_p_shift);
133 
134 static const u8 bign384v1_p_normalized[] = {
135 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
136 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
137 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
138 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
139 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
140 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xc3,
141 };
142 
143 TO_EC_STR_PARAM(bign384v1_p_normalized);
144 
145 static const u8 bign384v1_p_reciprocal[] = {
146 	0x00,
147 };
148 
149 TO_EC_STR_PARAM(bign384v1_p_reciprocal);
150 
151 #else                     /* unknown word size */
152 #error "Unsupported word size"
153 #endif
154 
155 static const u8 bign384v1_a[] = {
156 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
157 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
158 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
159 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
160 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
161 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xc0,
162 };
163 
164 TO_EC_STR_PARAM(bign384v1_a);
165 
166 static const u8 bign384v1_b[] = {
167 	0x3c, 0x75, 0xdf, 0xe1, 0x95, 0x9c, 0xef, 0x20,
168 	0x33, 0x07, 0x5a, 0xab, 0x65, 0x5d, 0x34, 0xd2,
169 	0x71, 0x27, 0x48, 0xbb, 0x0f, 0xfb, 0xb1, 0x96,
170 	0xa6, 0x21, 0x6a, 0xf9, 0xe9, 0x71, 0x2e, 0x3a,
171 	0x14, 0xbd, 0xe2, 0xf0, 0xf3, 0xce, 0xbd, 0x7c,
172 	0xbc, 0xa7, 0xfc, 0x23, 0x68, 0x73, 0xbf, 0x64,
173 };
174 
175 TO_EC_STR_PARAM(bign384v1_b);
176 
177 #define CURVE_BIGN384V1_CURVE_ORDER_BITLEN 384
178 static const u8 bign384v1_curve_order[] = {
179 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
180 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
181 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
182 	0x6c, 0xcc, 0xc4, 0x03, 0x73, 0xaf, 0x7b, 0xbb,
183 	0x80, 0x46, 0xda, 0xe7, 0xa6, 0xa4, 0xff, 0x0a,
184 	0x3d, 0xb7, 0xdc, 0x3f, 0xf3, 0x0c, 0xa7, 0xb7,
185 };
186 
187 TO_EC_STR_PARAM(bign384v1_curve_order);
188 
189 static const u8 bign384v1_gx[] = {
190 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
191 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
192 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
193 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
194 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
195 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
196 };
197 
198 TO_EC_STR_PARAM(bign384v1_gx);
199 
200 static const u8 bign384v1_gy[] = {
201 	0x5d, 0x43, 0x82, 0x24, 0xa8, 0x2e, 0x9e, 0x9e,
202 	0x63, 0x30, 0x11, 0x7e, 0x43, 0x2d, 0xbf, 0x89,
203 	0x3a, 0x72, 0x9a, 0x11, 0xdc, 0x86, 0xff, 0xa0,
204 	0x05, 0x49, 0xe7, 0x9e, 0x66, 0xb1, 0xd3, 0x55,
205 	0x84, 0x40, 0x3e, 0x27, 0x6b, 0x2a, 0x42, 0xf9,
206 	0xea, 0x5e, 0xcb, 0x31, 0xf7, 0x33, 0xc4, 0x51,
207 };
208 
209 TO_EC_STR_PARAM(bign384v1_gy);
210 
211 static const u8 bign384v1_gz[] = {
212 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
214 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
215 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
216 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
217 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
218 };
219 
220 TO_EC_STR_PARAM(bign384v1_gz);
221 
222 static const u8 bign384v1_gen_order[] = {
223 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
224 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
225 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
226 	0x6c, 0xcc, 0xc4, 0x03, 0x73, 0xaf, 0x7b, 0xbb,
227 	0x80, 0x46, 0xda, 0xe7, 0xa6, 0xa4, 0xff, 0x0a,
228 	0x3d, 0xb7, 0xdc, 0x3f, 0xf3, 0x0c, 0xa7, 0xb7,
229 };
230 
231 TO_EC_STR_PARAM(bign384v1_gen_order);
232 
233 #define CURVE_BIGN384V1_Q_BITLEN 384
234 static const u8 bign384v1_gen_order_bitlen[] = {
235 	0x01, 0x80,
236 };
237 
238 TO_EC_STR_PARAM(bign384v1_gen_order_bitlen);
239 
240 static const u8 bign384v1_cofactor[] = {
241 	0x01,
242 };
243 
244 TO_EC_STR_PARAM(bign384v1_cofactor);
245 
246 static const u8 bign384v1_alpha_montgomery[] = {
247 	0x00,
248 };
249 TO_EC_STR_PARAM_FIXED_SIZE(bign384v1_alpha_montgomery, 0);
250 
251 static const u8 bign384v1_gamma_montgomery[] = {
252 	0x00,
253 };
254 TO_EC_STR_PARAM_FIXED_SIZE(bign384v1_gamma_montgomery, 0);
255 
256 static const u8 bign384v1_alpha_edwards[] = {
257 	0x00,
258 };
259 TO_EC_STR_PARAM_FIXED_SIZE(bign384v1_alpha_edwards, 0);
260 
261 static const u8 bign384v1_name[] = "BIGN384V1";
262 TO_EC_STR_PARAM(bign384v1_name);
263 
264 static const u8 bign384v1_oid[] = "1.2.112.0.2.0.34.101.45.3.2";
265 TO_EC_STR_PARAM(bign384v1_oid);
266 
267 static const ec_str_params bign384v1_str_params = {
268 	.p = &bign384v1_p_str_param,
269 	.p_bitlen = &bign384v1_p_bitlen_str_param,
270 	.r = &bign384v1_r_str_param,
271 	.r_square = &bign384v1_r_square_str_param,
272 	.mpinv = &bign384v1_mpinv_str_param,
273 	.p_shift = &bign384v1_p_shift_str_param,
274 	.p_normalized = &bign384v1_p_normalized_str_param,
275 	.p_reciprocal = &bign384v1_p_reciprocal_str_param,
276 	.a = &bign384v1_a_str_param,
277 	.b = &bign384v1_b_str_param,
278 	.curve_order = &bign384v1_curve_order_str_param,
279 	.gx = &bign384v1_gx_str_param,
280 	.gy = &bign384v1_gy_str_param,
281 	.gz = &bign384v1_gz_str_param,
282 	.gen_order = &bign384v1_gen_order_str_param,
283 	.gen_order_bitlen = &bign384v1_gen_order_bitlen_str_param,
284 	.cofactor = &bign384v1_cofactor_str_param,
285 	.alpha_montgomery = &bign384v1_alpha_montgomery_str_param,
286 	.gamma_montgomery = &bign384v1_gamma_montgomery_str_param,
287 	.alpha_edwards = &bign384v1_alpha_edwards_str_param,
288 	.oid = &bign384v1_oid_str_param,
289 	.name = &bign384v1_name_str_param,
290 };
291 
292 /*
293  * Compute max bit length of all curves for p and q
294  */
295 #ifndef CURVES_MAX_P_BIT_LEN
296 #define CURVES_MAX_P_BIT_LEN    0
297 #endif
298 #if (CURVES_MAX_P_BIT_LEN < CURVE_BIGN384V1_P_BITLEN)
299 #undef CURVES_MAX_P_BIT_LEN
300 #define CURVES_MAX_P_BIT_LEN CURVE_BIGN384V1_P_BITLEN
301 #endif
302 #ifndef CURVES_MAX_Q_BIT_LEN
303 #define CURVES_MAX_Q_BIT_LEN    0
304 #endif
305 #if (CURVES_MAX_Q_BIT_LEN < CURVE_BIGN384V1_Q_BITLEN)
306 #undef CURVES_MAX_Q_BIT_LEN
307 #define CURVES_MAX_Q_BIT_LEN CURVE_BIGN384V1_Q_BITLEN
308 #endif
309 #ifndef CURVES_MAX_CURVE_ORDER_BIT_LEN
310 #define CURVES_MAX_CURVE_ORDER_BIT_LEN    0
311 #endif
312 #if (CURVES_MAX_CURVE_ORDER_BIT_LEN < CURVE_BIGN384V1_CURVE_ORDER_BITLEN)
313 #undef CURVES_MAX_CURVE_ORDER_BIT_LEN
314 #define CURVES_MAX_CURVE_ORDER_BIT_LEN CURVE_BIGN384V1_CURVE_ORDER_BITLEN
315 #endif
316 
317 /*
318  * Compute and adapt max name and oid length
319  */
320 #ifndef MAX_CURVE_OID_LEN
321 #define MAX_CURVE_OID_LEN 0
322 #endif
323 #ifndef MAX_CURVE_NAME_LEN
324 #define MAX_CURVE_NAME_LEN 0
325 #endif
326 #if (MAX_CURVE_OID_LEN < 1)
327 #undef MAX_CURVE_OID_LEN
328 #define MAX_CURVE_OID_LEN 1
329 #endif
330 #if (MAX_CURVE_NAME_LEN < 23)
331 #undef MAX_CURVE_NAME_LEN
332 #define MAX_CURVE_NAME_LEN 23
333 #endif
334 
335 #endif /* __EC_PARAMS_BIGN384V1_H__ */
336 
337 #endif /* WITH_CURVE_BIGN384V1 */
338