xref: /openssl/crypto/ec/ec_curve.c (revision 7ed6de99)
1 /*
2  * Copyright 2002-2024 The OpenSSL Project Authors. All Rights Reserved.
3  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
4  *
5  * Licensed under the Apache License 2.0 (the "License").  You may not use
6  * this file except in compliance with the License.  You can obtain a copy
7  * in the file LICENSE in the source distribution or at
8  * https://www.openssl.org/source/license.html
9  */
10 
11 /*
12  * ECDSA low level APIs are deprecated for public use, but still ok for
13  * internal use.
14  */
15 #include "internal/deprecated.h"
16 
17 #include <string.h>
18 #include "ec_local.h"
19 #include <openssl/err.h>
20 #include <openssl/obj_mac.h>
21 #include <openssl/objects.h>
22 #include <openssl/opensslconf.h>
23 #include "internal/nelem.h"
24 
25 typedef struct {
26     int field_type,             /* either NID_X9_62_prime_field or
27                                  * NID_X9_62_characteristic_two_field */
28      seed_len, param_len;
29     unsigned int cofactor;      /* promoted to BN_ULONG */
30 } EC_CURVE_DATA;
31 
32 /* the nist prime curves */
33 static const struct {
34     EC_CURVE_DATA h;
35     unsigned char data[20 + 24 * 6];
36 } _EC_NIST_PRIME_192 = {
37     {
38         NID_X9_62_prime_field, 20, 24, 1
39     },
40     {
41         /* seed */
42         0x30, 0x45, 0xAE, 0x6F, 0xC8, 0x42, 0x2F, 0x64, 0xED, 0x57, 0x95, 0x28,
43         0xD3, 0x81, 0x20, 0xEA, 0xE1, 0x21, 0x96, 0xD5,
44         /* p */
45         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
46         0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
47         /* a */
48         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
49         0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
50         /* b */
51         0x64, 0x21, 0x05, 0x19, 0xE5, 0x9C, 0x80, 0xE7, 0x0F, 0xA7, 0xE9, 0xAB,
52         0x72, 0x24, 0x30, 0x49, 0xFE, 0xB8, 0xDE, 0xEC, 0xC1, 0x46, 0xB9, 0xB1,
53         /* x */
54         0x18, 0x8D, 0xA8, 0x0E, 0xB0, 0x30, 0x90, 0xF6, 0x7C, 0xBF, 0x20, 0xEB,
55         0x43, 0xA1, 0x88, 0x00, 0xF4, 0xFF, 0x0A, 0xFD, 0x82, 0xFF, 0x10, 0x12,
56         /* y */
57         0x07, 0x19, 0x2b, 0x95, 0xff, 0xc8, 0xda, 0x78, 0x63, 0x10, 0x11, 0xed,
58         0x6b, 0x24, 0xcd, 0xd5, 0x73, 0xf9, 0x77, 0xa1, 0x1e, 0x79, 0x48, 0x11,
59         /* order */
60         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
61         0x99, 0xDE, 0xF8, 0x36, 0x14, 0x6B, 0xC9, 0xB1, 0xB4, 0xD2, 0x28, 0x31
62     }
63 };
64 
65 static const struct {
66     EC_CURVE_DATA h;
67     unsigned char data[20 + 28 * 6];
68 } _EC_NIST_PRIME_224 = {
69     {
70         NID_X9_62_prime_field, 20, 28, 1
71     },
72     {
73         /* seed */
74         0xBD, 0x71, 0x34, 0x47, 0x99, 0xD5, 0xC7, 0xFC, 0xDC, 0x45, 0xB5, 0x9F,
75         0xA3, 0xB9, 0xAB, 0x8F, 0x6A, 0x94, 0x8B, 0xC5,
76         /* p */
77         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
78         0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
79         0x00, 0x00, 0x00, 0x01,
80         /* a */
81         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
82         0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
83         0xFF, 0xFF, 0xFF, 0xFE,
84         /* b */
85         0xB4, 0x05, 0x0A, 0x85, 0x0C, 0x04, 0xB3, 0xAB, 0xF5, 0x41, 0x32, 0x56,
86         0x50, 0x44, 0xB0, 0xB7, 0xD7, 0xBF, 0xD8, 0xBA, 0x27, 0x0B, 0x39, 0x43,
87         0x23, 0x55, 0xFF, 0xB4,
88         /* x */
89         0xB7, 0x0E, 0x0C, 0xBD, 0x6B, 0xB4, 0xBF, 0x7F, 0x32, 0x13, 0x90, 0xB9,
90         0x4A, 0x03, 0xC1, 0xD3, 0x56, 0xC2, 0x11, 0x22, 0x34, 0x32, 0x80, 0xD6,
91         0x11, 0x5C, 0x1D, 0x21,
92         /* y */
93         0xbd, 0x37, 0x63, 0x88, 0xb5, 0xf7, 0x23, 0xfb, 0x4c, 0x22, 0xdf, 0xe6,
94         0xcd, 0x43, 0x75, 0xa0, 0x5a, 0x07, 0x47, 0x64, 0x44, 0xd5, 0x81, 0x99,
95         0x85, 0x00, 0x7e, 0x34,
96         /* order */
97         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
98         0xFF, 0xFF, 0x16, 0xA2, 0xE0, 0xB8, 0xF0, 0x3E, 0x13, 0xDD, 0x29, 0x45,
99         0x5C, 0x5C, 0x2A, 0x3D
100     }
101 };
102 
103 static const struct {
104     EC_CURVE_DATA h;
105     unsigned char data[20 + 48 * 6];
106 } _EC_NIST_PRIME_384 = {
107     {
108         NID_X9_62_prime_field, 20, 48, 1
109     },
110     {
111         /* seed */
112         0xA3, 0x35, 0x92, 0x6A, 0xA3, 0x19, 0xA2, 0x7A, 0x1D, 0x00, 0x89, 0x6A,
113         0x67, 0x73, 0xA4, 0x82, 0x7A, 0xCD, 0xAC, 0x73,
114         /* p */
115         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
116         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
117         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
118         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
119         /* a */
120         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
121         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
122         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
123         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFC,
124         /* b */
125         0xB3, 0x31, 0x2F, 0xA7, 0xE2, 0x3E, 0xE7, 0xE4, 0x98, 0x8E, 0x05, 0x6B,
126         0xE3, 0xF8, 0x2D, 0x19, 0x18, 0x1D, 0x9C, 0x6E, 0xFE, 0x81, 0x41, 0x12,
127         0x03, 0x14, 0x08, 0x8F, 0x50, 0x13, 0x87, 0x5A, 0xC6, 0x56, 0x39, 0x8D,
128         0x8A, 0x2E, 0xD1, 0x9D, 0x2A, 0x85, 0xC8, 0xED, 0xD3, 0xEC, 0x2A, 0xEF,
129         /* x */
130         0xAA, 0x87, 0xCA, 0x22, 0xBE, 0x8B, 0x05, 0x37, 0x8E, 0xB1, 0xC7, 0x1E,
131         0xF3, 0x20, 0xAD, 0x74, 0x6E, 0x1D, 0x3B, 0x62, 0x8B, 0xA7, 0x9B, 0x98,
132         0x59, 0xF7, 0x41, 0xE0, 0x82, 0x54, 0x2A, 0x38, 0x55, 0x02, 0xF2, 0x5D,
133         0xBF, 0x55, 0x29, 0x6C, 0x3A, 0x54, 0x5E, 0x38, 0x72, 0x76, 0x0A, 0xB7,
134         /* y */
135         0x36, 0x17, 0xde, 0x4a, 0x96, 0x26, 0x2c, 0x6f, 0x5d, 0x9e, 0x98, 0xbf,
136         0x92, 0x92, 0xdc, 0x29, 0xf8, 0xf4, 0x1d, 0xbd, 0x28, 0x9a, 0x14, 0x7c,
137         0xe9, 0xda, 0x31, 0x13, 0xb5, 0xf0, 0xb8, 0xc0, 0x0a, 0x60, 0xb1, 0xce,
138         0x1d, 0x7e, 0x81, 0x9d, 0x7a, 0x43, 0x1d, 0x7c, 0x90, 0xea, 0x0e, 0x5f,
139         /* order */
140         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
141         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
142         0xC7, 0x63, 0x4D, 0x81, 0xF4, 0x37, 0x2D, 0xDF, 0x58, 0x1A, 0x0D, 0xB2,
143         0x48, 0xB0, 0xA7, 0x7A, 0xEC, 0xEC, 0x19, 0x6A, 0xCC, 0xC5, 0x29, 0x73
144     }
145 };
146 
147 static const struct {
148     EC_CURVE_DATA h;
149     unsigned char data[20 + 66 * 6];
150 } _EC_NIST_PRIME_521 = {
151     {
152         NID_X9_62_prime_field, 20, 66, 1
153     },
154     {
155         /* seed */
156         0xD0, 0x9E, 0x88, 0x00, 0x29, 0x1C, 0xB8, 0x53, 0x96, 0xCC, 0x67, 0x17,
157         0x39, 0x32, 0x84, 0xAA, 0xA0, 0xDA, 0x64, 0xBA,
158         /* p */
159         0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
160         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
161         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
162         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
163         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
164         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
165         /* a */
166         0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
167         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
168         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
169         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
170         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
171         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
172         /* b */
173         0x00, 0x51, 0x95, 0x3E, 0xB9, 0x61, 0x8E, 0x1C, 0x9A, 0x1F, 0x92, 0x9A,
174         0x21, 0xA0, 0xB6, 0x85, 0x40, 0xEE, 0xA2, 0xDA, 0x72, 0x5B, 0x99, 0xB3,
175         0x15, 0xF3, 0xB8, 0xB4, 0x89, 0x91, 0x8E, 0xF1, 0x09, 0xE1, 0x56, 0x19,
176         0x39, 0x51, 0xEC, 0x7E, 0x93, 0x7B, 0x16, 0x52, 0xC0, 0xBD, 0x3B, 0xB1,
177         0xBF, 0x07, 0x35, 0x73, 0xDF, 0x88, 0x3D, 0x2C, 0x34, 0xF1, 0xEF, 0x45,
178         0x1F, 0xD4, 0x6B, 0x50, 0x3F, 0x00,
179         /* x */
180         0x00, 0xC6, 0x85, 0x8E, 0x06, 0xB7, 0x04, 0x04, 0xE9, 0xCD, 0x9E, 0x3E,
181         0xCB, 0x66, 0x23, 0x95, 0xB4, 0x42, 0x9C, 0x64, 0x81, 0x39, 0x05, 0x3F,
182         0xB5, 0x21, 0xF8, 0x28, 0xAF, 0x60, 0x6B, 0x4D, 0x3D, 0xBA, 0xA1, 0x4B,
183         0x5E, 0x77, 0xEF, 0xE7, 0x59, 0x28, 0xFE, 0x1D, 0xC1, 0x27, 0xA2, 0xFF,
184         0xA8, 0xDE, 0x33, 0x48, 0xB3, 0xC1, 0x85, 0x6A, 0x42, 0x9B, 0xF9, 0x7E,
185         0x7E, 0x31, 0xC2, 0xE5, 0xBD, 0x66,
186         /* y */
187         0x01, 0x18, 0x39, 0x29, 0x6a, 0x78, 0x9a, 0x3b, 0xc0, 0x04, 0x5c, 0x8a,
188         0x5f, 0xb4, 0x2c, 0x7d, 0x1b, 0xd9, 0x98, 0xf5, 0x44, 0x49, 0x57, 0x9b,
189         0x44, 0x68, 0x17, 0xaf, 0xbd, 0x17, 0x27, 0x3e, 0x66, 0x2c, 0x97, 0xee,
190         0x72, 0x99, 0x5e, 0xf4, 0x26, 0x40, 0xc5, 0x50, 0xb9, 0x01, 0x3f, 0xad,
191         0x07, 0x61, 0x35, 0x3c, 0x70, 0x86, 0xa2, 0x72, 0xc2, 0x40, 0x88, 0xbe,
192         0x94, 0x76, 0x9f, 0xd1, 0x66, 0x50,
193         /* order */
194         0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
195         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
196         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0x51, 0x86,
197         0x87, 0x83, 0xBF, 0x2F, 0x96, 0x6B, 0x7F, 0xCC, 0x01, 0x48, 0xF7, 0x09,
198         0xA5, 0xD0, 0x3B, 0xB5, 0xC9, 0xB8, 0x89, 0x9C, 0x47, 0xAE, 0xBB, 0x6F,
199         0xB7, 0x1E, 0x91, 0x38, 0x64, 0x09
200     }
201 };
202 
203 # ifndef FIPS_MODULE
204 /* the x9.62 prime curves (minus the nist prime curves) */
205 static const struct {
206     EC_CURVE_DATA h;
207     unsigned char data[20 + 24 * 6];
208 } _EC_X9_62_PRIME_192V2 = {
209     {
210         NID_X9_62_prime_field, 20, 24, 1
211     },
212     {
213         /* seed */
214         0x31, 0xA9, 0x2E, 0xE2, 0x02, 0x9F, 0xD1, 0x0D, 0x90, 0x1B, 0x11, 0x3E,
215         0x99, 0x07, 0x10, 0xF0, 0xD2, 0x1A, 0xC6, 0xB6,
216         /* p */
217         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
218         0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
219         /* a */
220         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
221         0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
222         /* b */
223         0xCC, 0x22, 0xD6, 0xDF, 0xB9, 0x5C, 0x6B, 0x25, 0xE4, 0x9C, 0x0D, 0x63,
224         0x64, 0xA4, 0xE5, 0x98, 0x0C, 0x39, 0x3A, 0xA2, 0x16, 0x68, 0xD9, 0x53,
225         /* x */
226         0xEE, 0xA2, 0xBA, 0xE7, 0xE1, 0x49, 0x78, 0x42, 0xF2, 0xDE, 0x77, 0x69,
227         0xCF, 0xE9, 0xC9, 0x89, 0xC0, 0x72, 0xAD, 0x69, 0x6F, 0x48, 0x03, 0x4A,
228         /* y */
229         0x65, 0x74, 0xd1, 0x1d, 0x69, 0xb6, 0xec, 0x7a, 0x67, 0x2b, 0xb8, 0x2a,
230         0x08, 0x3d, 0xf2, 0xf2, 0xb0, 0x84, 0x7d, 0xe9, 0x70, 0xb2, 0xde, 0x15,
231         /* order */
232         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
233         0x5F, 0xB1, 0xA7, 0x24, 0xDC, 0x80, 0x41, 0x86, 0x48, 0xD8, 0xDD, 0x31
234     }
235 };
236 
237 static const struct {
238     EC_CURVE_DATA h;
239     unsigned char data[20 + 24 * 6];
240 } _EC_X9_62_PRIME_192V3 = {
241     {
242         NID_X9_62_prime_field, 20, 24, 1
243     },
244     {
245         /* seed */
246         0xC4, 0x69, 0x68, 0x44, 0x35, 0xDE, 0xB3, 0x78, 0xC4, 0xB6, 0x5C, 0xA9,
247         0x59, 0x1E, 0x2A, 0x57, 0x63, 0x05, 0x9A, 0x2E,
248         /* p */
249         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
250         0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
251         /* a */
252         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
253         0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
254         /* b */
255         0x22, 0x12, 0x3D, 0xC2, 0x39, 0x5A, 0x05, 0xCA, 0xA7, 0x42, 0x3D, 0xAE,
256         0xCC, 0xC9, 0x47, 0x60, 0xA7, 0xD4, 0x62, 0x25, 0x6B, 0xD5, 0x69, 0x16,
257         /* x */
258         0x7D, 0x29, 0x77, 0x81, 0x00, 0xC6, 0x5A, 0x1D, 0xA1, 0x78, 0x37, 0x16,
259         0x58, 0x8D, 0xCE, 0x2B, 0x8B, 0x4A, 0xEE, 0x8E, 0x22, 0x8F, 0x18, 0x96,
260         /* y */
261         0x38, 0xa9, 0x0f, 0x22, 0x63, 0x73, 0x37, 0x33, 0x4b, 0x49, 0xdc, 0xb6,
262         0x6a, 0x6d, 0xc8, 0xf9, 0x97, 0x8a, 0xca, 0x76, 0x48, 0xa9, 0x43, 0xb0,
263         /* order */
264         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
265         0x7A, 0x62, 0xD0, 0x31, 0xC8, 0x3F, 0x42, 0x94, 0xF6, 0x40, 0xEC, 0x13
266     }
267 };
268 
269 static const struct {
270     EC_CURVE_DATA h;
271     unsigned char data[20 + 30 * 6];
272 } _EC_X9_62_PRIME_239V1 = {
273     {
274         NID_X9_62_prime_field, 20, 30, 1
275     },
276     {
277         /* seed */
278         0xE4, 0x3B, 0xB4, 0x60, 0xF0, 0xB8, 0x0C, 0xC0, 0xC0, 0xB0, 0x75, 0x79,
279         0x8E, 0x94, 0x80, 0x60, 0xF8, 0x32, 0x1B, 0x7D,
280         /* p */
281         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
282         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
283         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
284         /* a */
285         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
286         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
287         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
288         /* b */
289         0x6B, 0x01, 0x6C, 0x3B, 0xDC, 0xF1, 0x89, 0x41, 0xD0, 0xD6, 0x54, 0x92,
290         0x14, 0x75, 0xCA, 0x71, 0xA9, 0xDB, 0x2F, 0xB2, 0x7D, 0x1D, 0x37, 0x79,
291         0x61, 0x85, 0xC2, 0x94, 0x2C, 0x0A,
292         /* x */
293         0x0F, 0xFA, 0x96, 0x3C, 0xDC, 0xA8, 0x81, 0x6C, 0xCC, 0x33, 0xB8, 0x64,
294         0x2B, 0xED, 0xF9, 0x05, 0xC3, 0xD3, 0x58, 0x57, 0x3D, 0x3F, 0x27, 0xFB,
295         0xBD, 0x3B, 0x3C, 0xB9, 0xAA, 0xAF,
296         /* y */
297         0x7d, 0xeb, 0xe8, 0xe4, 0xe9, 0x0a, 0x5d, 0xae, 0x6e, 0x40, 0x54, 0xca,
298         0x53, 0x0b, 0xa0, 0x46, 0x54, 0xb3, 0x68, 0x18, 0xce, 0x22, 0x6b, 0x39,
299         0xfc, 0xcb, 0x7b, 0x02, 0xf1, 0xae,
300         /* order */
301         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
302         0x7F, 0xFF, 0xFF, 0x9E, 0x5E, 0x9A, 0x9F, 0x5D, 0x90, 0x71, 0xFB, 0xD1,
303         0x52, 0x26, 0x88, 0x90, 0x9D, 0x0B
304     }
305 };
306 
307 static const struct {
308     EC_CURVE_DATA h;
309     unsigned char data[20 + 30 * 6];
310 } _EC_X9_62_PRIME_239V2 = {
311     {
312         NID_X9_62_prime_field, 20, 30, 1
313     },
314     {
315         /* seed */
316         0xE8, 0xB4, 0x01, 0x16, 0x04, 0x09, 0x53, 0x03, 0xCA, 0x3B, 0x80, 0x99,
317         0x98, 0x2B, 0xE0, 0x9F, 0xCB, 0x9A, 0xE6, 0x16,
318         /* p */
319         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
320         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
321         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
322         /* a */
323         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
324         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
325         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
326         /* b */
327         0x61, 0x7F, 0xAB, 0x68, 0x32, 0x57, 0x6C, 0xBB, 0xFE, 0xD5, 0x0D, 0x99,
328         0xF0, 0x24, 0x9C, 0x3F, 0xEE, 0x58, 0xB9, 0x4B, 0xA0, 0x03, 0x8C, 0x7A,
329         0xE8, 0x4C, 0x8C, 0x83, 0x2F, 0x2C,
330         /* x */
331         0x38, 0xAF, 0x09, 0xD9, 0x87, 0x27, 0x70, 0x51, 0x20, 0xC9, 0x21, 0xBB,
332         0x5E, 0x9E, 0x26, 0x29, 0x6A, 0x3C, 0xDC, 0xF2, 0xF3, 0x57, 0x57, 0xA0,
333         0xEA, 0xFD, 0x87, 0xB8, 0x30, 0xE7,
334         /* y */
335         0x5b, 0x01, 0x25, 0xe4, 0xdb, 0xea, 0x0e, 0xc7, 0x20, 0x6d, 0xa0, 0xfc,
336         0x01, 0xd9, 0xb0, 0x81, 0x32, 0x9f, 0xb5, 0x55, 0xde, 0x6e, 0xf4, 0x60,
337         0x23, 0x7d, 0xff, 0x8b, 0xe4, 0xba,
338         /* order */
339         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
340         0x80, 0x00, 0x00, 0xCF, 0xA7, 0xE8, 0x59, 0x43, 0x77, 0xD4, 0x14, 0xC0,
341         0x38, 0x21, 0xBC, 0x58, 0x20, 0x63
342     }
343 };
344 
345 static const struct {
346     EC_CURVE_DATA h;
347     unsigned char data[20 + 30 * 6];
348 } _EC_X9_62_PRIME_239V3 = {
349     {
350         NID_X9_62_prime_field, 20, 30, 1
351     },
352     {
353         /* seed */
354         0x7D, 0x73, 0x74, 0x16, 0x8F, 0xFE, 0x34, 0x71, 0xB6, 0x0A, 0x85, 0x76,
355         0x86, 0xA1, 0x94, 0x75, 0xD3, 0xBF, 0xA2, 0xFF,
356         /* p */
357         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
358         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
359         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
360         /* a */
361         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
362         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
363         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
364         /* b */
365         0x25, 0x57, 0x05, 0xFA, 0x2A, 0x30, 0x66, 0x54, 0xB1, 0xF4, 0xCB, 0x03,
366         0xD6, 0xA7, 0x50, 0xA3, 0x0C, 0x25, 0x01, 0x02, 0xD4, 0x98, 0x87, 0x17,
367         0xD9, 0xBA, 0x15, 0xAB, 0x6D, 0x3E,
368         /* x */
369         0x67, 0x68, 0xAE, 0x8E, 0x18, 0xBB, 0x92, 0xCF, 0xCF, 0x00, 0x5C, 0x94,
370         0x9A, 0xA2, 0xC6, 0xD9, 0x48, 0x53, 0xD0, 0xE6, 0x60, 0xBB, 0xF8, 0x54,
371         0xB1, 0xC9, 0x50, 0x5F, 0xE9, 0x5A,
372         /* y */
373         0x16, 0x07, 0xe6, 0x89, 0x8f, 0x39, 0x0c, 0x06, 0xbc, 0x1d, 0x55, 0x2b,
374         0xad, 0x22, 0x6f, 0x3b, 0x6f, 0xcf, 0xe4, 0x8b, 0x6e, 0x81, 0x84, 0x99,
375         0xaf, 0x18, 0xe3, 0xed, 0x6c, 0xf3,
376         /* order */
377         0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
378         0x7F, 0xFF, 0xFF, 0x97, 0x5D, 0xEB, 0x41, 0xB3, 0xA6, 0x05, 0x7C, 0x3C,
379         0x43, 0x21, 0x46, 0x52, 0x65, 0x51
380     }
381 };
382 #endif /* FIPS_MODULE */
383 
384 static const struct {
385     EC_CURVE_DATA h;
386     unsigned char data[20 + 32 * 8];
387 } _EC_X9_62_PRIME_256V1 = {
388     {
389         NID_X9_62_prime_field, 20, 32, 1
390     },
391     {
392         /* seed */
393         0xC4, 0x9D, 0x36, 0x08, 0x86, 0xE7, 0x04, 0x93, 0x6A, 0x66, 0x78, 0xE1,
394         0x13, 0x9D, 0x26, 0xB7, 0x81, 0x9F, 0x7E, 0x90,
395         /* p */
396         0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
397         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
398         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
399         /* a */
400         0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
401         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
402         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
403         /* b */
404         0x5A, 0xC6, 0x35, 0xD8, 0xAA, 0x3A, 0x93, 0xE7, 0xB3, 0xEB, 0xBD, 0x55,
405         0x76, 0x98, 0x86, 0xBC, 0x65, 0x1D, 0x06, 0xB0, 0xCC, 0x53, 0xB0, 0xF6,
406         0x3B, 0xCE, 0x3C, 0x3E, 0x27, 0xD2, 0x60, 0x4B,
407         /* x */
408         0x6B, 0x17, 0xD1, 0xF2, 0xE1, 0x2C, 0x42, 0x47, 0xF8, 0xBC, 0xE6, 0xE5,
409         0x63, 0xA4, 0x40, 0xF2, 0x77, 0x03, 0x7D, 0x81, 0x2D, 0xEB, 0x33, 0xA0,
410         0xF4, 0xA1, 0x39, 0x45, 0xD8, 0x98, 0xC2, 0x96,
411         /* y */
412         0x4f, 0xe3, 0x42, 0xe2, 0xfe, 0x1a, 0x7f, 0x9b, 0x8e, 0xe7, 0xeb, 0x4a,
413         0x7c, 0x0f, 0x9e, 0x16, 0x2b, 0xce, 0x33, 0x57, 0x6b, 0x31, 0x5e, 0xce,
414         0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf, 0x51, 0xf5,
415         /* order */
416         0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
417         0xFF, 0xFF, 0xFF, 0xFF, 0xBC, 0xE6, 0xFA, 0xAD, 0xA7, 0x17, 0x9E, 0x84,
418         0xF3, 0xB9, 0xCA, 0xC2, 0xFC, 0x63, 0x25, 0x51,
419         /* RR for prime */
420         0x00, 0x00, 0x00, 0x04, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff,
421         0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff,
422         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
423         /* RR for order */
424         0x66, 0xe1, 0x2d, 0x94, 0xf3, 0xd9, 0x56, 0x20, 0x28, 0x45, 0xb2, 0x39,
425         0x2b, 0x6b, 0xec, 0x59, 0x46, 0x99, 0x79, 0x9c, 0x49, 0xbd, 0x6f, 0xa6,
426         0x83, 0x24, 0x4c, 0x95, 0xbe, 0x79, 0xee, 0xa2
427     }
428 };
429 
430 #ifndef FIPS_MODULE
431 /* the secg prime curves (minus the nist and x9.62 prime curves) */
432 static const struct {
433     EC_CURVE_DATA h;
434     unsigned char data[20 + 14 * 6];
435 } _EC_SECG_PRIME_112R1 = {
436     {
437         NID_X9_62_prime_field, 20, 14, 1
438     },
439     {
440         /* seed */
441         0x00, 0xF5, 0x0B, 0x02, 0x8E, 0x4D, 0x69, 0x6E, 0x67, 0x68, 0x75, 0x61,
442         0x51, 0x75, 0x29, 0x04, 0x72, 0x78, 0x3F, 0xB1,
443         /* p */
444         0xDB, 0x7C, 0x2A, 0xBF, 0x62, 0xE3, 0x5E, 0x66, 0x80, 0x76, 0xBE, 0xAD,
445         0x20, 0x8B,
446         /* a */
447         0xDB, 0x7C, 0x2A, 0xBF, 0x62, 0xE3, 0x5E, 0x66, 0x80, 0x76, 0xBE, 0xAD,
448         0x20, 0x88,
449         /* b */
450         0x65, 0x9E, 0xF8, 0xBA, 0x04, 0x39, 0x16, 0xEE, 0xDE, 0x89, 0x11, 0x70,
451         0x2B, 0x22,
452         /* x */
453         0x09, 0x48, 0x72, 0x39, 0x99, 0x5A, 0x5E, 0xE7, 0x6B, 0x55, 0xF9, 0xC2,
454         0xF0, 0x98,
455         /* y */
456         0xa8, 0x9c, 0xe5, 0xaf, 0x87, 0x24, 0xc0, 0xa2, 0x3e, 0x0e, 0x0f, 0xf7,
457         0x75, 0x00,
458         /* order */
459         0xDB, 0x7C, 0x2A, 0xBF, 0x62, 0xE3, 0x5E, 0x76, 0x28, 0xDF, 0xAC, 0x65,
460         0x61, 0xC5
461     }
462 };
463 
464 static const struct {
465     EC_CURVE_DATA h;
466     unsigned char data[20 + 14 * 6];
467 } _EC_SECG_PRIME_112R2 = {
468     {
469         NID_X9_62_prime_field, 20, 14, 4
470     },
471     {
472         /* seed */
473         0x00, 0x27, 0x57, 0xA1, 0x11, 0x4D, 0x69, 0x6E, 0x67, 0x68, 0x75, 0x61,
474         0x51, 0x75, 0x53, 0x16, 0xC0, 0x5E, 0x0B, 0xD4,
475         /* p */
476         0xDB, 0x7C, 0x2A, 0xBF, 0x62, 0xE3, 0x5E, 0x66, 0x80, 0x76, 0xBE, 0xAD,
477         0x20, 0x8B,
478         /* a */
479         0x61, 0x27, 0xC2, 0x4C, 0x05, 0xF3, 0x8A, 0x0A, 0xAA, 0xF6, 0x5C, 0x0E,
480         0xF0, 0x2C,
481         /* b */
482         0x51, 0xDE, 0xF1, 0x81, 0x5D, 0xB5, 0xED, 0x74, 0xFC, 0xC3, 0x4C, 0x85,
483         0xD7, 0x09,
484         /* x */
485         0x4B, 0xA3, 0x0A, 0xB5, 0xE8, 0x92, 0xB4, 0xE1, 0x64, 0x9D, 0xD0, 0x92,
486         0x86, 0x43,
487         /* y */
488         0xad, 0xcd, 0x46, 0xf5, 0x88, 0x2e, 0x37, 0x47, 0xde, 0xf3, 0x6e, 0x95,
489         0x6e, 0x97,
490         /* order */
491         0x36, 0xDF, 0x0A, 0xAF, 0xD8, 0xB8, 0xD7, 0x59, 0x7C, 0xA1, 0x05, 0x20,
492         0xD0, 0x4B
493     }
494 };
495 
496 static const struct {
497     EC_CURVE_DATA h;
498     unsigned char data[20 + 16 * 6];
499 } _EC_SECG_PRIME_128R1 = {
500     {
501         NID_X9_62_prime_field, 20, 16, 1
502     },
503     {
504         /* seed */
505         0x00, 0x0E, 0x0D, 0x4D, 0x69, 0x6E, 0x67, 0x68, 0x75, 0x61, 0x51, 0x75,
506         0x0C, 0xC0, 0x3A, 0x44, 0x73, 0xD0, 0x36, 0x79,
507         /* p */
508         0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
509         0xFF, 0xFF, 0xFF, 0xFF,
510         /* a */
511         0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
512         0xFF, 0xFF, 0xFF, 0xFC,
513         /* b */
514         0xE8, 0x75, 0x79, 0xC1, 0x10, 0x79, 0xF4, 0x3D, 0xD8, 0x24, 0x99, 0x3C,
515         0x2C, 0xEE, 0x5E, 0xD3,
516         /* x */
517         0x16, 0x1F, 0xF7, 0x52, 0x8B, 0x89, 0x9B, 0x2D, 0x0C, 0x28, 0x60, 0x7C,
518         0xA5, 0x2C, 0x5B, 0x86,
519         /* y */
520         0xcf, 0x5a, 0xc8, 0x39, 0x5b, 0xaf, 0xeb, 0x13, 0xc0, 0x2d, 0xa2, 0x92,
521         0xdd, 0xed, 0x7a, 0x83,
522         /* order */
523         0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x75, 0xA3, 0x0D, 0x1B,
524         0x90, 0x38, 0xA1, 0x15
525     }
526 };
527 
528 static const struct {
529     EC_CURVE_DATA h;
530     unsigned char data[20 + 16 * 6];
531 } _EC_SECG_PRIME_128R2 = {
532     {
533         NID_X9_62_prime_field, 20, 16, 4
534     },
535     {
536         /* seed */
537         0x00, 0x4D, 0x69, 0x6E, 0x67, 0x68, 0x75, 0x61, 0x51, 0x75, 0x12, 0xD8,
538         0xF0, 0x34, 0x31, 0xFC, 0xE6, 0x3B, 0x88, 0xF4,
539         /* p */
540         0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
541         0xFF, 0xFF, 0xFF, 0xFF,
542         /* a */
543         0xD6, 0x03, 0x19, 0x98, 0xD1, 0xB3, 0xBB, 0xFE, 0xBF, 0x59, 0xCC, 0x9B,
544         0xBF, 0xF9, 0xAE, 0xE1,
545         /* b */
546         0x5E, 0xEE, 0xFC, 0xA3, 0x80, 0xD0, 0x29, 0x19, 0xDC, 0x2C, 0x65, 0x58,
547         0xBB, 0x6D, 0x8A, 0x5D,
548         /* x */
549         0x7B, 0x6A, 0xA5, 0xD8, 0x5E, 0x57, 0x29, 0x83, 0xE6, 0xFB, 0x32, 0xA7,
550         0xCD, 0xEB, 0xC1, 0x40,
551         /* y */
552         0x27, 0xb6, 0x91, 0x6a, 0x89, 0x4d, 0x3a, 0xee, 0x71, 0x06, 0xfe, 0x80,
553         0x5f, 0xc3, 0x4b, 0x44,
554         /* order */
555         0x3F, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xBE, 0x00, 0x24, 0x72,
556         0x06, 0x13, 0xB5, 0xA3
557     }
558 };
559 
560 static const struct {
561     EC_CURVE_DATA h;
562     unsigned char data[0 + 21 * 6];
563 } _EC_SECG_PRIME_160K1 = {
564     {
565         NID_X9_62_prime_field, 0, 21, 1
566     },
567     {
568         /* no seed */
569         /* p */
570         0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
571         0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xAC, 0x73,
572         /* a */
573         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
574         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
575         /* b */
576         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
577         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
578         /* x */
579         0x00, 0x3B, 0x4C, 0x38, 0x2C, 0xE3, 0x7A, 0xA1, 0x92, 0xA4, 0x01, 0x9E,
580         0x76, 0x30, 0x36, 0xF4, 0xF5, 0xDD, 0x4D, 0x7E, 0xBB,
581         /* y */
582         0x00, 0x93, 0x8c, 0xf9, 0x35, 0x31, 0x8f, 0xdc, 0xed, 0x6b, 0xc2, 0x82,
583         0x86, 0x53, 0x17, 0x33, 0xc3, 0xf0, 0x3c, 0x4f, 0xee,
584         /* order */
585         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xB8,
586         0xFA, 0x16, 0xDF, 0xAB, 0x9A, 0xCA, 0x16, 0xB6, 0xB3
587     }
588 };
589 
590 static const struct {
591     EC_CURVE_DATA h;
592     unsigned char data[20 + 21 * 6];
593 } _EC_SECG_PRIME_160R1 = {
594     {
595         NID_X9_62_prime_field, 20, 21, 1
596     },
597     {
598         /* seed */
599         0x10, 0x53, 0xCD, 0xE4, 0x2C, 0x14, 0xD6, 0x96, 0xE6, 0x76, 0x87, 0x56,
600         0x15, 0x17, 0x53, 0x3B, 0xF3, 0xF8, 0x33, 0x45,
601         /* p */
602         0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
603         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF,
604         /* a */
605         0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
606         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFC,
607         /* b */
608         0x00, 0x1C, 0x97, 0xBE, 0xFC, 0x54, 0xBD, 0x7A, 0x8B, 0x65, 0xAC, 0xF8,
609         0x9F, 0x81, 0xD4, 0xD4, 0xAD, 0xC5, 0x65, 0xFA, 0x45,
610         /* x */
611         0x00, 0x4A, 0x96, 0xB5, 0x68, 0x8E, 0xF5, 0x73, 0x28, 0x46, 0x64, 0x69,
612         0x89, 0x68, 0xC3, 0x8B, 0xB9, 0x13, 0xCB, 0xFC, 0x82,
613         /* y */
614         0x00, 0x23, 0xa6, 0x28, 0x55, 0x31, 0x68, 0x94, 0x7d, 0x59, 0xdc, 0xc9,
615         0x12, 0x04, 0x23, 0x51, 0x37, 0x7a, 0xc5, 0xfb, 0x32,
616         /* order */
617         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF4,
618         0xC8, 0xF9, 0x27, 0xAE, 0xD3, 0xCA, 0x75, 0x22, 0x57
619     }
620 };
621 
622 static const struct {
623     EC_CURVE_DATA h;
624     unsigned char data[20 + 21 * 6];
625 } _EC_SECG_PRIME_160R2 = {
626     {
627         NID_X9_62_prime_field, 20, 21, 1
628     },
629     {
630         /* seed */
631         0xB9, 0x9B, 0x99, 0xB0, 0x99, 0xB3, 0x23, 0xE0, 0x27, 0x09, 0xA4, 0xD6,
632         0x96, 0xE6, 0x76, 0x87, 0x56, 0x15, 0x17, 0x51,
633         /* p */
634         0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
635         0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xAC, 0x73,
636         /* a */
637         0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
638         0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xAC, 0x70,
639         /* b */
640         0x00, 0xB4, 0xE1, 0x34, 0xD3, 0xFB, 0x59, 0xEB, 0x8B, 0xAB, 0x57, 0x27,
641         0x49, 0x04, 0x66, 0x4D, 0x5A, 0xF5, 0x03, 0x88, 0xBA,
642         /* x */
643         0x00, 0x52, 0xDC, 0xB0, 0x34, 0x29, 0x3A, 0x11, 0x7E, 0x1F, 0x4F, 0xF1,
644         0x1B, 0x30, 0xF7, 0x19, 0x9D, 0x31, 0x44, 0xCE, 0x6D,
645         /* y */
646         0x00, 0xfe, 0xaf, 0xfe, 0xf2, 0xe3, 0x31, 0xf2, 0x96, 0xe0, 0x71, 0xfa,
647         0x0d, 0xf9, 0x98, 0x2c, 0xfe, 0xa7, 0xd4, 0x3f, 0x2e,
648         /* order */
649         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x35,
650         0x1E, 0xE7, 0x86, 0xA8, 0x18, 0xF3, 0xA1, 0xA1, 0x6B
651     }
652 };
653 
654 static const struct {
655     EC_CURVE_DATA h;
656     unsigned char data[0 + 24 * 6];
657 } _EC_SECG_PRIME_192K1 = {
658     {
659         NID_X9_62_prime_field, 0, 24, 1
660     },
661     {
662         /* no seed */
663         /* p */
664         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
665         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xEE, 0x37,
666         /* a */
667         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
668         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
669         /* b */
670         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
671         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
672         /* x */
673         0xDB, 0x4F, 0xF1, 0x0E, 0xC0, 0x57, 0xE9, 0xAE, 0x26, 0xB0, 0x7D, 0x02,
674         0x80, 0xB7, 0xF4, 0x34, 0x1D, 0xA5, 0xD1, 0xB1, 0xEA, 0xE0, 0x6C, 0x7D,
675         /* y */
676         0x9b, 0x2f, 0x2f, 0x6d, 0x9c, 0x56, 0x28, 0xa7, 0x84, 0x41, 0x63, 0xd0,
677         0x15, 0xbe, 0x86, 0x34, 0x40, 0x82, 0xaa, 0x88, 0xd9, 0x5e, 0x2f, 0x9d,
678         /* order */
679         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
680         0x26, 0xF2, 0xFC, 0x17, 0x0F, 0x69, 0x46, 0x6A, 0x74, 0xDE, 0xFD, 0x8D
681     }
682 };
683 
684 static const struct {
685     EC_CURVE_DATA h;
686     unsigned char data[0 + 29 * 6];
687 } _EC_SECG_PRIME_224K1 = {
688     {
689         NID_X9_62_prime_field, 0, 29, 1
690     },
691     {
692         /* no seed */
693         /* p */
694         0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
695         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
696         0xFE, 0xFF, 0xFF, 0xE5, 0x6D,
697         /* a */
698         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
699         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
700         0x00, 0x00, 0x00, 0x00, 0x00,
701         /* b */
702         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
703         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
704         0x00, 0x00, 0x00, 0x00, 0x05,
705         /* x */
706         0x00, 0xA1, 0x45, 0x5B, 0x33, 0x4D, 0xF0, 0x99, 0xDF, 0x30, 0xFC, 0x28,
707         0xA1, 0x69, 0xA4, 0x67, 0xE9, 0xE4, 0x70, 0x75, 0xA9, 0x0F, 0x7E, 0x65,
708         0x0E, 0xB6, 0xB7, 0xA4, 0x5C,
709         /* y */
710         0x00, 0x7e, 0x08, 0x9f, 0xed, 0x7f, 0xba, 0x34, 0x42, 0x82, 0xca, 0xfb,
711         0xd6, 0xf7, 0xe3, 0x19, 0xf7, 0xc0, 0xb0, 0xbd, 0x59, 0xe2, 0xca, 0x4b,
712         0xdb, 0x55, 0x6d, 0x61, 0xa5,
713         /* order */
714         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
715         0x00, 0x00, 0x01, 0xDC, 0xE8, 0xD2, 0xEC, 0x61, 0x84, 0xCA, 0xF0, 0xA9,
716         0x71, 0x76, 0x9F, 0xB1, 0xF7
717     }
718 };
719 
720 static const struct {
721     EC_CURVE_DATA h;
722     unsigned char data[0 + 32 * 6];
723 } _EC_SECG_PRIME_256K1 = {
724     {
725         NID_X9_62_prime_field, 0, 32, 1
726     },
727     {
728         /* no seed */
729         /* p */
730         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
731         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
732         0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFC, 0x2F,
733         /* a */
734         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
735         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
736         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
737         /* b */
738         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
739         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
740         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
741         /* x */
742         0x79, 0xBE, 0x66, 0x7E, 0xF9, 0xDC, 0xBB, 0xAC, 0x55, 0xA0, 0x62, 0x95,
743         0xCE, 0x87, 0x0B, 0x07, 0x02, 0x9B, 0xFC, 0xDB, 0x2D, 0xCE, 0x28, 0xD9,
744         0x59, 0xF2, 0x81, 0x5B, 0x16, 0xF8, 0x17, 0x98,
745         /* y */
746         0x48, 0x3a, 0xda, 0x77, 0x26, 0xa3, 0xc4, 0x65, 0x5d, 0xa4, 0xfb, 0xfc,
747         0x0e, 0x11, 0x08, 0xa8, 0xfd, 0x17, 0xb4, 0x48, 0xa6, 0x85, 0x54, 0x19,
748         0x9c, 0x47, 0xd0, 0x8f, 0xfb, 0x10, 0xd4, 0xb8,
749         /* order */
750         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
751         0xFF, 0xFF, 0xFF, 0xFE, 0xBA, 0xAE, 0xDC, 0xE6, 0xAF, 0x48, 0xA0, 0x3B,
752         0xBF, 0xD2, 0x5E, 0x8C, 0xD0, 0x36, 0x41, 0x41
753     }
754 };
755 
756 /* some wap/wtls curves */
757 static const struct {
758     EC_CURVE_DATA h;
759     unsigned char data[0 + 15 * 6];
760 } _EC_WTLS_8 = {
761     {
762         NID_X9_62_prime_field, 0, 15, 1
763     },
764     {
765         /* no seed */
766         /* p */
767         0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
768         0xFF, 0xFD, 0xE7,
769         /* a */
770         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
771         0x00, 0x00, 0x00,
772         /* b */
773         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
774         0x00, 0x00, 0x03,
775         /* x */
776         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
777         0x00, 0x00, 0x01,
778         /* y */
779         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
780         0x00, 0x00, 0x02,
781         /* order */
782         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xEC, 0xEA, 0x55, 0x1A,
783         0xD8, 0x37, 0xE9
784     }
785 };
786 
787 static const struct {
788     EC_CURVE_DATA h;
789     unsigned char data[0 + 21 * 6];
790 } _EC_WTLS_9 = {
791     {
792         NID_X9_62_prime_field, 0, 21, 1
793     },
794     {
795         /* no seed */
796         /* p */
797         0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
798         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0x80, 0x8F,
799         /* a */
800         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
801         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
802         /* b */
803         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
804         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
805         /* x */
806         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
807         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
808         /* y */
809         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
810         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
811         /* order */
812         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xCD,
813         0xC9, 0x8A, 0xE0, 0xE2, 0xDE, 0x57, 0x4A, 0xBF, 0x33
814     }
815 };
816 
817 static const struct {
818     EC_CURVE_DATA h;
819     unsigned char data[0 + 28 * 6];
820 } _EC_WTLS_12 = {
821     {
822         NID_X9_62_prime_field, 0, 28, 1
823     },
824     {
825         /* no seed */
826         /* p */
827         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
828         0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
829         0x00, 0x00, 0x00, 0x01,
830         /* a */
831         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
832         0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
833         0xFF, 0xFF, 0xFF, 0xFE,
834         /* b */
835         0xB4, 0x05, 0x0A, 0x85, 0x0C, 0x04, 0xB3, 0xAB, 0xF5, 0x41, 0x32, 0x56,
836         0x50, 0x44, 0xB0, 0xB7, 0xD7, 0xBF, 0xD8, 0xBA, 0x27, 0x0B, 0x39, 0x43,
837         0x23, 0x55, 0xFF, 0xB4,
838         /* x */
839         0xB7, 0x0E, 0x0C, 0xBD, 0x6B, 0xB4, 0xBF, 0x7F, 0x32, 0x13, 0x90, 0xB9,
840         0x4A, 0x03, 0xC1, 0xD3, 0x56, 0xC2, 0x11, 0x22, 0x34, 0x32, 0x80, 0xD6,
841         0x11, 0x5C, 0x1D, 0x21,
842         /* y */
843         0xbd, 0x37, 0x63, 0x88, 0xb5, 0xf7, 0x23, 0xfb, 0x4c, 0x22, 0xdf, 0xe6,
844         0xcd, 0x43, 0x75, 0xa0, 0x5a, 0x07, 0x47, 0x64, 0x44, 0xd5, 0x81, 0x99,
845         0x85, 0x00, 0x7e, 0x34,
846         /* order */
847         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
848         0xFF, 0xFF, 0x16, 0xA2, 0xE0, 0xB8, 0xF0, 0x3E, 0x13, 0xDD, 0x29, 0x45,
849         0x5C, 0x5C, 0x2A, 0x3D
850     }
851 };
852 #endif /* FIPS_MODULE */
853 
854 #ifndef OPENSSL_NO_EC2M
855 
856 /* characteristic two curves */
857 
858 # ifndef FIPS_MODULE
859 static const struct {
860     EC_CURVE_DATA h;
861     unsigned char data[20 + 15 * 6];
862 } _EC_SECG_CHAR2_113R1 = {
863     {
864         NID_X9_62_characteristic_two_field, 20, 15, 2
865     },
866     {
867         /* seed */
868         0x10, 0xE7, 0x23, 0xAB, 0x14, 0xD6, 0x96, 0xE6, 0x76, 0x87, 0x56, 0x15,
869         0x17, 0x56, 0xFE, 0xBF, 0x8F, 0xCB, 0x49, 0xA9,
870         /* p */
871         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
872         0x00, 0x02, 0x01,
873         /* a */
874         0x00, 0x30, 0x88, 0x25, 0x0C, 0xA6, 0xE7, 0xC7, 0xFE, 0x64, 0x9C, 0xE8,
875         0x58, 0x20, 0xF7,
876         /* b */
877         0x00, 0xE8, 0xBE, 0xE4, 0xD3, 0xE2, 0x26, 0x07, 0x44, 0x18, 0x8B, 0xE0,
878         0xE9, 0xC7, 0x23,
879         /* x */
880         0x00, 0x9D, 0x73, 0x61, 0x6F, 0x35, 0xF4, 0xAB, 0x14, 0x07, 0xD7, 0x35,
881         0x62, 0xC1, 0x0F,
882         /* y */
883         0x00, 0xA5, 0x28, 0x30, 0x27, 0x79, 0x58, 0xEE, 0x84, 0xD1, 0x31, 0x5E,
884         0xD3, 0x18, 0x86,
885         /* order */
886         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD9, 0xCC, 0xEC, 0x8A,
887         0x39, 0xE5, 0x6F
888     }
889 };
890 
891 static const struct {
892     EC_CURVE_DATA h;
893     unsigned char data[20 + 15 * 6];
894 } _EC_SECG_CHAR2_113R2 = {
895     {
896         NID_X9_62_characteristic_two_field, 20, 15, 2
897     },
898     {
899         /* seed */
900         0x10, 0xC0, 0xFB, 0x15, 0x76, 0x08, 0x60, 0xDE, 0xF1, 0xEE, 0xF4, 0xD6,
901         0x96, 0xE6, 0x76, 0x87, 0x56, 0x15, 0x17, 0x5D,
902         /* p */
903         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
904         0x00, 0x02, 0x01,
905         /* a */
906         0x00, 0x68, 0x99, 0x18, 0xDB, 0xEC, 0x7E, 0x5A, 0x0D, 0xD6, 0xDF, 0xC0,
907         0xAA, 0x55, 0xC7,
908         /* b */
909         0x00, 0x95, 0xE9, 0xA9, 0xEC, 0x9B, 0x29, 0x7B, 0xD4, 0xBF, 0x36, 0xE0,
910         0x59, 0x18, 0x4F,
911         /* x */
912         0x01, 0xA5, 0x7A, 0x6A, 0x7B, 0x26, 0xCA, 0x5E, 0xF5, 0x2F, 0xCD, 0xB8,
913         0x16, 0x47, 0x97,
914         /* y */
915         0x00, 0xB3, 0xAD, 0xC9, 0x4E, 0xD1, 0xFE, 0x67, 0x4C, 0x06, 0xE6, 0x95,
916         0xBA, 0xBA, 0x1D,
917         /* order */
918         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x78, 0x9B, 0x24,
919         0x96, 0xAF, 0x93
920     }
921 };
922 
923 static const struct {
924     EC_CURVE_DATA h;
925     unsigned char data[20 + 17 * 6];
926 } _EC_SECG_CHAR2_131R1 = {
927     {
928         NID_X9_62_characteristic_two_field, 20, 17, 2
929     },
930     {
931         /* seed */
932         0x4D, 0x69, 0x6E, 0x67, 0x68, 0x75, 0x61, 0x51, 0x75, 0x98, 0x5B, 0xD3,
933         0xAD, 0xBA, 0xDA, 0x21, 0xB4, 0x3A, 0x97, 0xE2,
934         /* p */
935         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
936         0x00, 0x00, 0x00, 0x01, 0x0D,
937         /* a */
938         0x07, 0xA1, 0x1B, 0x09, 0xA7, 0x6B, 0x56, 0x21, 0x44, 0x41, 0x8F, 0xF3,
939         0xFF, 0x8C, 0x25, 0x70, 0xB8,
940         /* b */
941         0x02, 0x17, 0xC0, 0x56, 0x10, 0x88, 0x4B, 0x63, 0xB9, 0xC6, 0xC7, 0x29,
942         0x16, 0x78, 0xF9, 0xD3, 0x41,
943         /* x */
944         0x00, 0x81, 0xBA, 0xF9, 0x1F, 0xDF, 0x98, 0x33, 0xC4, 0x0F, 0x9C, 0x18,
945         0x13, 0x43, 0x63, 0x83, 0x99,
946         /* y */
947         0x07, 0x8C, 0x6E, 0x7E, 0xA3, 0x8C, 0x00, 0x1F, 0x73, 0xC8, 0x13, 0x4B,
948         0x1B, 0x4E, 0xF9, 0xE1, 0x50,
949         /* order */
950         0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x31, 0x23, 0x95,
951         0x3A, 0x94, 0x64, 0xB5, 0x4D
952     }
953 };
954 
955 static const struct {
956     EC_CURVE_DATA h;
957     unsigned char data[20 + 17 * 6];
958 } _EC_SECG_CHAR2_131R2 = {
959     {
960         NID_X9_62_characteristic_two_field, 20, 17, 2
961     },
962     {
963         /* seed */
964         0x98, 0x5B, 0xD3, 0xAD, 0xBA, 0xD4, 0xD6, 0x96, 0xE6, 0x76, 0x87, 0x56,
965         0x15, 0x17, 0x5A, 0x21, 0xB4, 0x3A, 0x97, 0xE3,
966         /* p */
967         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
968         0x00, 0x00, 0x00, 0x01, 0x0D,
969         /* a */
970         0x03, 0xE5, 0xA8, 0x89, 0x19, 0xD7, 0xCA, 0xFC, 0xBF, 0x41, 0x5F, 0x07,
971         0xC2, 0x17, 0x65, 0x73, 0xB2,
972         /* b */
973         0x04, 0xB8, 0x26, 0x6A, 0x46, 0xC5, 0x56, 0x57, 0xAC, 0x73, 0x4C, 0xE3,
974         0x8F, 0x01, 0x8F, 0x21, 0x92,
975         /* x */
976         0x03, 0x56, 0xDC, 0xD8, 0xF2, 0xF9, 0x50, 0x31, 0xAD, 0x65, 0x2D, 0x23,
977         0x95, 0x1B, 0xB3, 0x66, 0xA8,
978         /* y */
979         0x06, 0x48, 0xF0, 0x6D, 0x86, 0x79, 0x40, 0xA5, 0x36, 0x6D, 0x9E, 0x26,
980         0x5D, 0xE9, 0xEB, 0x24, 0x0F,
981         /* order */
982         0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x69, 0x54, 0xA2,
983         0x33, 0x04, 0x9B, 0xA9, 0x8F
984     }
985 };
986 # endif /* FIPS_MODULE */
987 
988 static const struct {
989     EC_CURVE_DATA h;
990     unsigned char data[0 + 21 * 6];
991 } _EC_NIST_CHAR2_163K = {
992     {
993         NID_X9_62_characteristic_two_field, 0, 21, 2
994     },
995     {
996         /* no seed */
997         /* p */
998         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
999         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC9,
1000         /* a */
1001         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1002         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1003         /* b */
1004         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1005         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1006         /* x */
1007         0x02, 0xFE, 0x13, 0xC0, 0x53, 0x7B, 0xBC, 0x11, 0xAC, 0xAA, 0x07, 0xD7,
1008         0x93, 0xDE, 0x4E, 0x6D, 0x5E, 0x5C, 0x94, 0xEE, 0xE8,
1009         /* y */
1010         0x02, 0x89, 0x07, 0x0F, 0xB0, 0x5D, 0x38, 0xFF, 0x58, 0x32, 0x1F, 0x2E,
1011         0x80, 0x05, 0x36, 0xD5, 0x38, 0xCC, 0xDA, 0xA3, 0xD9,
1012         /* order */
1013         0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01,
1014         0x08, 0xA2, 0xE0, 0xCC, 0x0D, 0x99, 0xF8, 0xA5, 0xEF
1015     }
1016 };
1017 
1018 # ifndef FIPS_MODULE
1019 static const struct {
1020     EC_CURVE_DATA h;
1021     unsigned char data[0 + 21 * 6];
1022 } _EC_SECG_CHAR2_163R1 = {
1023     {
1024         NID_X9_62_characteristic_two_field, 0, 21, 2
1025     },
1026     {
1027         /* p */
1028         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1029         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC9,
1030         /* a */
1031         0x07, 0xB6, 0x88, 0x2C, 0xAA, 0xEF, 0xA8, 0x4F, 0x95, 0x54, 0xFF, 0x84,
1032         0x28, 0xBD, 0x88, 0xE2, 0x46, 0xD2, 0x78, 0x2A, 0xE2,
1033         /* b */
1034         0x07, 0x13, 0x61, 0x2D, 0xCD, 0xDC, 0xB4, 0x0A, 0xAB, 0x94, 0x6B, 0xDA,
1035         0x29, 0xCA, 0x91, 0xF7, 0x3A, 0xF9, 0x58, 0xAF, 0xD9,
1036         /* x */
1037         0x03, 0x69, 0x97, 0x96, 0x97, 0xAB, 0x43, 0x89, 0x77, 0x89, 0x56, 0x67,
1038         0x89, 0x56, 0x7F, 0x78, 0x7A, 0x78, 0x76, 0xA6, 0x54,
1039         /* y */
1040         0x00, 0x43, 0x5E, 0xDB, 0x42, 0xEF, 0xAF, 0xB2, 0x98, 0x9D, 0x51, 0xFE,
1041         0xFC, 0xE3, 0xC8, 0x09, 0x88, 0xF4, 0x1F, 0xF8, 0x83,
1042         /* order */
1043         0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x48,
1044         0xAA, 0xB6, 0x89, 0xC2, 0x9C, 0xA7, 0x10, 0x27, 0x9B
1045     }
1046 };
1047 # endif /* FIPS_MODULE */
1048 
1049 static const struct {
1050     EC_CURVE_DATA h;
1051     unsigned char data[0 + 21 * 6];
1052 } _EC_NIST_CHAR2_163B = {
1053     {
1054         NID_X9_62_characteristic_two_field, 0, 21, 2
1055     },
1056     {
1057         /* p */
1058         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1059         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC9,
1060         /* a */
1061         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1062         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1063         /* b */
1064         0x02, 0x0A, 0x60, 0x19, 0x07, 0xB8, 0xC9, 0x53, 0xCA, 0x14, 0x81, 0xEB,
1065         0x10, 0x51, 0x2F, 0x78, 0x74, 0x4A, 0x32, 0x05, 0xFD,
1066         /* x */
1067         0x03, 0xF0, 0xEB, 0xA1, 0x62, 0x86, 0xA2, 0xD5, 0x7E, 0xA0, 0x99, 0x11,
1068         0x68, 0xD4, 0x99, 0x46, 0x37, 0xE8, 0x34, 0x3E, 0x36,
1069         /* y */
1070         0x00, 0xD5, 0x1F, 0xBC, 0x6C, 0x71, 0xA0, 0x09, 0x4F, 0xA2, 0xCD, 0xD5,
1071         0x45, 0xB1, 0x1C, 0x5C, 0x0C, 0x79, 0x73, 0x24, 0xF1,
1072         /* order */
1073         0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x92,
1074         0xFE, 0x77, 0xE7, 0x0C, 0x12, 0xA4, 0x23, 0x4C, 0x33
1075     }
1076 };
1077 
1078 # ifndef FIPS_MODULE
1079 static const struct {
1080     EC_CURVE_DATA h;
1081     unsigned char data[20 + 25 * 6];
1082 } _EC_SECG_CHAR2_193R1 = {
1083     {
1084         NID_X9_62_characteristic_two_field, 20, 25, 2
1085     },
1086     {
1087         /* seed */
1088         0x10, 0x3F, 0xAE, 0xC7, 0x4D, 0x69, 0x6E, 0x67, 0x68, 0x75, 0x61, 0x51,
1089         0x75, 0x77, 0x7F, 0xC5, 0xB1, 0x91, 0xEF, 0x30,
1090         /* p */
1091         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1092         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
1093         0x01,
1094         /* a */
1095         0x00, 0x17, 0x85, 0x8F, 0xEB, 0x7A, 0x98, 0x97, 0x51, 0x69, 0xE1, 0x71,
1096         0xF7, 0x7B, 0x40, 0x87, 0xDE, 0x09, 0x8A, 0xC8, 0xA9, 0x11, 0xDF, 0x7B,
1097         0x01,
1098         /* b */
1099         0x00, 0xFD, 0xFB, 0x49, 0xBF, 0xE6, 0xC3, 0xA8, 0x9F, 0xAC, 0xAD, 0xAA,
1100         0x7A, 0x1E, 0x5B, 0xBC, 0x7C, 0xC1, 0xC2, 0xE5, 0xD8, 0x31, 0x47, 0x88,
1101         0x14,
1102         /* x */
1103         0x01, 0xF4, 0x81, 0xBC, 0x5F, 0x0F, 0xF8, 0x4A, 0x74, 0xAD, 0x6C, 0xDF,
1104         0x6F, 0xDE, 0xF4, 0xBF, 0x61, 0x79, 0x62, 0x53, 0x72, 0xD8, 0xC0, 0xC5,
1105         0xE1,
1106         /* y */
1107         0x00, 0x25, 0xE3, 0x99, 0xF2, 0x90, 0x37, 0x12, 0xCC, 0xF3, 0xEA, 0x9E,
1108         0x3A, 0x1A, 0xD1, 0x7F, 0xB0, 0xB3, 0x20, 0x1B, 0x6A, 0xF7, 0xCE, 0x1B,
1109         0x05,
1110         /* order */
1111         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1112         0x00, 0xC7, 0xF3, 0x4A, 0x77, 0x8F, 0x44, 0x3A, 0xCC, 0x92, 0x0E, 0xBA,
1113         0x49
1114     }
1115 };
1116 
1117 static const struct {
1118     EC_CURVE_DATA h;
1119     unsigned char data[20 + 25 * 6];
1120 } _EC_SECG_CHAR2_193R2 = {
1121     {
1122         NID_X9_62_characteristic_two_field, 20, 25, 2
1123     },
1124     {
1125         /* seed */
1126         0x10, 0xB7, 0xB4, 0xD6, 0x96, 0xE6, 0x76, 0x87, 0x56, 0x15, 0x17, 0x51,
1127         0x37, 0xC8, 0xA1, 0x6F, 0xD0, 0xDA, 0x22, 0x11,
1128         /* p */
1129         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1130         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
1131         0x01,
1132         /* a */
1133         0x01, 0x63, 0xF3, 0x5A, 0x51, 0x37, 0xC2, 0xCE, 0x3E, 0xA6, 0xED, 0x86,
1134         0x67, 0x19, 0x0B, 0x0B, 0xC4, 0x3E, 0xCD, 0x69, 0x97, 0x77, 0x02, 0x70,
1135         0x9B,
1136         /* b */
1137         0x00, 0xC9, 0xBB, 0x9E, 0x89, 0x27, 0xD4, 0xD6, 0x4C, 0x37, 0x7E, 0x2A,
1138         0xB2, 0x85, 0x6A, 0x5B, 0x16, 0xE3, 0xEF, 0xB7, 0xF6, 0x1D, 0x43, 0x16,
1139         0xAE,
1140         /* x */
1141         0x00, 0xD9, 0xB6, 0x7D, 0x19, 0x2E, 0x03, 0x67, 0xC8, 0x03, 0xF3, 0x9E,
1142         0x1A, 0x7E, 0x82, 0xCA, 0x14, 0xA6, 0x51, 0x35, 0x0A, 0xAE, 0x61, 0x7E,
1143         0x8F,
1144         /* y */
1145         0x01, 0xCE, 0x94, 0x33, 0x56, 0x07, 0xC3, 0x04, 0xAC, 0x29, 0xE7, 0xDE,
1146         0xFB, 0xD9, 0xCA, 0x01, 0xF5, 0x96, 0xF9, 0x27, 0x22, 0x4C, 0xDE, 0xCF,
1147         0x6C,
1148         /* order */
1149         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1150         0x01, 0x5A, 0xAB, 0x56, 0x1B, 0x00, 0x54, 0x13, 0xCC, 0xD4, 0xEE, 0x99,
1151         0xD5
1152     }
1153 };
1154 # endif /* FIPS_MODULE */
1155 
1156 static const struct {
1157     EC_CURVE_DATA h;
1158     unsigned char data[0 + 30 * 6];
1159 } _EC_NIST_CHAR2_233K = {
1160     {
1161         NID_X9_62_characteristic_two_field, 0, 30, 4
1162     },
1163     {
1164         /* no seed */
1165         /* p */
1166         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1167         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1168         0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1169         /* a */
1170         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1171         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1172         0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1173         /* b */
1174         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1175         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1176         0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1177         /* x */
1178         0x01, 0x72, 0x32, 0xBA, 0x85, 0x3A, 0x7E, 0x73, 0x1A, 0xF1, 0x29, 0xF2,
1179         0x2F, 0xF4, 0x14, 0x95, 0x63, 0xA4, 0x19, 0xC2, 0x6B, 0xF5, 0x0A, 0x4C,
1180         0x9D, 0x6E, 0xEF, 0xAD, 0x61, 0x26,
1181         /* y */
1182         0x01, 0xDB, 0x53, 0x7D, 0xEC, 0xE8, 0x19, 0xB7, 0xF7, 0x0F, 0x55, 0x5A,
1183         0x67, 0xC4, 0x27, 0xA8, 0xCD, 0x9B, 0xF1, 0x8A, 0xEB, 0x9B, 0x56, 0xE0,
1184         0xC1, 0x10, 0x56, 0xFA, 0xE6, 0xA3,
1185         /* order */
1186         0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1187         0x00, 0x00, 0x00, 0x06, 0x9D, 0x5B, 0xB9, 0x15, 0xBC, 0xD4, 0x6E, 0xFB,
1188         0x1A, 0xD5, 0xF1, 0x73, 0xAB, 0xDF
1189     }
1190 };
1191 
1192 static const struct {
1193     EC_CURVE_DATA h;
1194     unsigned char data[20 + 30 * 6];
1195 } _EC_NIST_CHAR2_233B = {
1196     {
1197         NID_X9_62_characteristic_two_field, 20, 30, 2
1198     },
1199     {
1200         /* seed */
1201         0x74, 0xD5, 0x9F, 0xF0, 0x7F, 0x6B, 0x41, 0x3D, 0x0E, 0xA1, 0x4B, 0x34,
1202         0x4B, 0x20, 0xA2, 0xDB, 0x04, 0x9B, 0x50, 0xC3,
1203         /* p */
1204         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1205         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1206         0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1207         /* a */
1208         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1209         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1210         0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1211         /* b */
1212         0x00, 0x66, 0x64, 0x7E, 0xDE, 0x6C, 0x33, 0x2C, 0x7F, 0x8C, 0x09, 0x23,
1213         0xBB, 0x58, 0x21, 0x3B, 0x33, 0x3B, 0x20, 0xE9, 0xCE, 0x42, 0x81, 0xFE,
1214         0x11, 0x5F, 0x7D, 0x8F, 0x90, 0xAD,
1215         /* x */
1216         0x00, 0xFA, 0xC9, 0xDF, 0xCB, 0xAC, 0x83, 0x13, 0xBB, 0x21, 0x39, 0xF1,
1217         0xBB, 0x75, 0x5F, 0xEF, 0x65, 0xBC, 0x39, 0x1F, 0x8B, 0x36, 0xF8, 0xF8,
1218         0xEB, 0x73, 0x71, 0xFD, 0x55, 0x8B,
1219         /* y */
1220         0x01, 0x00, 0x6A, 0x08, 0xA4, 0x19, 0x03, 0x35, 0x06, 0x78, 0xE5, 0x85,
1221         0x28, 0xBE, 0xBF, 0x8A, 0x0B, 0xEF, 0xF8, 0x67, 0xA7, 0xCA, 0x36, 0x71,
1222         0x6F, 0x7E, 0x01, 0xF8, 0x10, 0x52,
1223         /* order */
1224         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1225         0x00, 0x00, 0x00, 0x13, 0xE9, 0x74, 0xE7, 0x2F, 0x8A, 0x69, 0x22, 0x03,
1226         0x1D, 0x26, 0x03, 0xCF, 0xE0, 0xD7
1227     }
1228 };
1229 
1230 #ifndef FIPS_MODULE
1231 static const struct {
1232     EC_CURVE_DATA h;
1233     unsigned char data[0 + 30 * 6];
1234 } _EC_SECG_CHAR2_239K1 = {
1235     {
1236         NID_X9_62_characteristic_two_field, 0, 30, 4
1237     },
1238     {
1239         /* no seed */
1240         /* p */
1241         0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
1242         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1243         0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1244         /* a */
1245         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1246         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1247         0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1248         /* b */
1249         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1250         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1251         0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1252         /* x */
1253         0x29, 0xA0, 0xB6, 0xA8, 0x87, 0xA9, 0x83, 0xE9, 0x73, 0x09, 0x88, 0xA6,
1254         0x87, 0x27, 0xA8, 0xB2, 0xD1, 0x26, 0xC4, 0x4C, 0xC2, 0xCC, 0x7B, 0x2A,
1255         0x65, 0x55, 0x19, 0x30, 0x35, 0xDC,
1256         /* y */
1257         0x76, 0x31, 0x08, 0x04, 0xF1, 0x2E, 0x54, 0x9B, 0xDB, 0x01, 0x1C, 0x10,
1258         0x30, 0x89, 0xE7, 0x35, 0x10, 0xAC, 0xB2, 0x75, 0xFC, 0x31, 0x2A, 0x5D,
1259         0xC6, 0xB7, 0x65, 0x53, 0xF0, 0xCA,
1260         /* order */
1261         0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1262         0x00, 0x00, 0x00, 0x5A, 0x79, 0xFE, 0xC6, 0x7C, 0xB6, 0xE9, 0x1F, 0x1C,
1263         0x1D, 0xA8, 0x00, 0xE4, 0x78, 0xA5
1264     }
1265 };
1266 # endif /* FIPS_MODULE */
1267 
1268 static const struct {
1269     EC_CURVE_DATA h;
1270     unsigned char data[0 + 36 * 6];
1271 } _EC_NIST_CHAR2_283K = {
1272     {
1273         NID_X9_62_characteristic_two_field, 0, 36, 4
1274     },
1275     {
1276         /* no seed */
1277         /* p */
1278         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1279         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1280         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xA1,
1281         /* a */
1282         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1283         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1284         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1285         /* b */
1286         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1287         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1288         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1289         /* x */
1290         0x05, 0x03, 0x21, 0x3F, 0x78, 0xCA, 0x44, 0x88, 0x3F, 0x1A, 0x3B, 0x81,
1291         0x62, 0xF1, 0x88, 0xE5, 0x53, 0xCD, 0x26, 0x5F, 0x23, 0xC1, 0x56, 0x7A,
1292         0x16, 0x87, 0x69, 0x13, 0xB0, 0xC2, 0xAC, 0x24, 0x58, 0x49, 0x28, 0x36,
1293         /* y */
1294         0x01, 0xCC, 0xDA, 0x38, 0x0F, 0x1C, 0x9E, 0x31, 0x8D, 0x90, 0xF9, 0x5D,
1295         0x07, 0xE5, 0x42, 0x6F, 0xE8, 0x7E, 0x45, 0xC0, 0xE8, 0x18, 0x46, 0x98,
1296         0xE4, 0x59, 0x62, 0x36, 0x4E, 0x34, 0x11, 0x61, 0x77, 0xDD, 0x22, 0x59,
1297         /* order */
1298         0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1299         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE9, 0xAE, 0x2E, 0xD0, 0x75, 0x77,
1300         0x26, 0x5D, 0xFF, 0x7F, 0x94, 0x45, 0x1E, 0x06, 0x1E, 0x16, 0x3C, 0x61
1301     }
1302 };
1303 
1304 static const struct {
1305     EC_CURVE_DATA h;
1306     unsigned char data[20 + 36 * 6];
1307 } _EC_NIST_CHAR2_283B = {
1308     {
1309         NID_X9_62_characteristic_two_field, 20, 36, 2
1310     },
1311     {
1312         /* seed */
1313         0x77, 0xE2, 0xB0, 0x73, 0x70, 0xEB, 0x0F, 0x83, 0x2A, 0x6D, 0xD5, 0xB6,
1314         0x2D, 0xFC, 0x88, 0xCD, 0x06, 0xBB, 0x84, 0xBE,
1315         /* p */
1316         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1317         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1318         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xA1,
1319         /* a */
1320         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1321         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1322         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1323         /* b */
1324         0x02, 0x7B, 0x68, 0x0A, 0xC8, 0xB8, 0x59, 0x6D, 0xA5, 0xA4, 0xAF, 0x8A,
1325         0x19, 0xA0, 0x30, 0x3F, 0xCA, 0x97, 0xFD, 0x76, 0x45, 0x30, 0x9F, 0xA2,
1326         0xA5, 0x81, 0x48, 0x5A, 0xF6, 0x26, 0x3E, 0x31, 0x3B, 0x79, 0xA2, 0xF5,
1327         /* x */
1328         0x05, 0xF9, 0x39, 0x25, 0x8D, 0xB7, 0xDD, 0x90, 0xE1, 0x93, 0x4F, 0x8C,
1329         0x70, 0xB0, 0xDF, 0xEC, 0x2E, 0xED, 0x25, 0xB8, 0x55, 0x7E, 0xAC, 0x9C,
1330         0x80, 0xE2, 0xE1, 0x98, 0xF8, 0xCD, 0xBE, 0xCD, 0x86, 0xB1, 0x20, 0x53,
1331         /* y */
1332         0x03, 0x67, 0x68, 0x54, 0xFE, 0x24, 0x14, 0x1C, 0xB9, 0x8F, 0xE6, 0xD4,
1333         0xB2, 0x0D, 0x02, 0xB4, 0x51, 0x6F, 0xF7, 0x02, 0x35, 0x0E, 0xDD, 0xB0,
1334         0x82, 0x67, 0x79, 0xC8, 0x13, 0xF0, 0xDF, 0x45, 0xBE, 0x81, 0x12, 0xF4,
1335         /* order */
1336         0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1337         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0x90, 0x39, 0x96, 0x60, 0xFC,
1338         0x93, 0x8A, 0x90, 0x16, 0x5B, 0x04, 0x2A, 0x7C, 0xEF, 0xAD, 0xB3, 0x07
1339     }
1340 };
1341 
1342 static const struct {
1343     EC_CURVE_DATA h;
1344     unsigned char data[0 + 52 * 6];
1345 } _EC_NIST_CHAR2_409K = {
1346     {
1347         NID_X9_62_characteristic_two_field, 0, 52, 4
1348     },
1349     {
1350         /* no seed */
1351         /* p */
1352         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1353         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1354         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1355         0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1356         0x00, 0x00, 0x00, 0x01,
1357         /* a */
1358         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1359         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1360         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1361         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1362         0x00, 0x00, 0x00, 0x00,
1363         /* b */
1364         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1365         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1366         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1367         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1368         0x00, 0x00, 0x00, 0x01,
1369         /* x */
1370         0x00, 0x60, 0xF0, 0x5F, 0x65, 0x8F, 0x49, 0xC1, 0xAD, 0x3A, 0xB1, 0x89,
1371         0x0F, 0x71, 0x84, 0x21, 0x0E, 0xFD, 0x09, 0x87, 0xE3, 0x07, 0xC8, 0x4C,
1372         0x27, 0xAC, 0xCF, 0xB8, 0xF9, 0xF6, 0x7C, 0xC2, 0xC4, 0x60, 0x18, 0x9E,
1373         0xB5, 0xAA, 0xAA, 0x62, 0xEE, 0x22, 0x2E, 0xB1, 0xB3, 0x55, 0x40, 0xCF,
1374         0xE9, 0x02, 0x37, 0x46,
1375         /* y */
1376         0x01, 0xE3, 0x69, 0x05, 0x0B, 0x7C, 0x4E, 0x42, 0xAC, 0xBA, 0x1D, 0xAC,
1377         0xBF, 0x04, 0x29, 0x9C, 0x34, 0x60, 0x78, 0x2F, 0x91, 0x8E, 0xA4, 0x27,
1378         0xE6, 0x32, 0x51, 0x65, 0xE9, 0xEA, 0x10, 0xE3, 0xDA, 0x5F, 0x6C, 0x42,
1379         0xE9, 0xC5, 0x52, 0x15, 0xAA, 0x9C, 0xA2, 0x7A, 0x58, 0x63, 0xEC, 0x48,
1380         0xD8, 0xE0, 0x28, 0x6B,
1381         /* order */
1382         0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1383         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1384         0xFF, 0xFF, 0xFE, 0x5F, 0x83, 0xB2, 0xD4, 0xEA, 0x20, 0x40, 0x0E, 0xC4,
1385         0x55, 0x7D, 0x5E, 0xD3, 0xE3, 0xE7, 0xCA, 0x5B, 0x4B, 0x5C, 0x83, 0xB8,
1386         0xE0, 0x1E, 0x5F, 0xCF
1387     }
1388 };
1389 
1390 static const struct {
1391     EC_CURVE_DATA h;
1392     unsigned char data[20 + 52 * 6];
1393 } _EC_NIST_CHAR2_409B = {
1394     {
1395         NID_X9_62_characteristic_two_field, 20, 52, 2
1396     },
1397     {
1398         /* seed */
1399         0x40, 0x99, 0xB5, 0xA4, 0x57, 0xF9, 0xD6, 0x9F, 0x79, 0x21, 0x3D, 0x09,
1400         0x4C, 0x4B, 0xCD, 0x4D, 0x42, 0x62, 0x21, 0x0B,
1401         /* p */
1402         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1403         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1404         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1405         0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1406         0x00, 0x00, 0x00, 0x01,
1407         /* a */
1408         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1409         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1410         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1411         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1412         0x00, 0x00, 0x00, 0x01,
1413         /* b */
1414         0x00, 0x21, 0xA5, 0xC2, 0xC8, 0xEE, 0x9F, 0xEB, 0x5C, 0x4B, 0x9A, 0x75,
1415         0x3B, 0x7B, 0x47, 0x6B, 0x7F, 0xD6, 0x42, 0x2E, 0xF1, 0xF3, 0xDD, 0x67,
1416         0x47, 0x61, 0xFA, 0x99, 0xD6, 0xAC, 0x27, 0xC8, 0xA9, 0xA1, 0x97, 0xB2,
1417         0x72, 0x82, 0x2F, 0x6C, 0xD5, 0x7A, 0x55, 0xAA, 0x4F, 0x50, 0xAE, 0x31,
1418         0x7B, 0x13, 0x54, 0x5F,
1419         /* x */
1420         0x01, 0x5D, 0x48, 0x60, 0xD0, 0x88, 0xDD, 0xB3, 0x49, 0x6B, 0x0C, 0x60,
1421         0x64, 0x75, 0x62, 0x60, 0x44, 0x1C, 0xDE, 0x4A, 0xF1, 0x77, 0x1D, 0x4D,
1422         0xB0, 0x1F, 0xFE, 0x5B, 0x34, 0xE5, 0x97, 0x03, 0xDC, 0x25, 0x5A, 0x86,
1423         0x8A, 0x11, 0x80, 0x51, 0x56, 0x03, 0xAE, 0xAB, 0x60, 0x79, 0x4E, 0x54,
1424         0xBB, 0x79, 0x96, 0xA7,
1425         /* y */
1426         0x00, 0x61, 0xB1, 0xCF, 0xAB, 0x6B, 0xE5, 0xF3, 0x2B, 0xBF, 0xA7, 0x83,
1427         0x24, 0xED, 0x10, 0x6A, 0x76, 0x36, 0xB9, 0xC5, 0xA7, 0xBD, 0x19, 0x8D,
1428         0x01, 0x58, 0xAA, 0x4F, 0x54, 0x88, 0xD0, 0x8F, 0x38, 0x51, 0x4F, 0x1F,
1429         0xDF, 0x4B, 0x4F, 0x40, 0xD2, 0x18, 0x1B, 0x36, 0x81, 0xC3, 0x64, 0xBA,
1430         0x02, 0x73, 0xC7, 0x06,
1431         /* order */
1432         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1433         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1434         0x00, 0x00, 0x01, 0xE2, 0xAA, 0xD6, 0xA6, 0x12, 0xF3, 0x33, 0x07, 0xBE,
1435         0x5F, 0xA4, 0x7C, 0x3C, 0x9E, 0x05, 0x2F, 0x83, 0x81, 0x64, 0xCD, 0x37,
1436         0xD9, 0xA2, 0x11, 0x73
1437     }
1438 };
1439 
1440 static const struct {
1441     EC_CURVE_DATA h;
1442     unsigned char data[0 + 72 * 6];
1443 } _EC_NIST_CHAR2_571K = {
1444     {
1445         NID_X9_62_characteristic_two_field, 0, 72, 4
1446     },
1447     {
1448         /* no seed */
1449         /* p */
1450         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1451         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1452         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1453         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1454         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1455         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x25,
1456         /* a */
1457         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1458         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1459         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1460         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1461         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1462         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1463         /* b */
1464         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1465         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1466         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1467         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1468         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1469         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1470         /* x */
1471         0x02, 0x6E, 0xB7, 0xA8, 0x59, 0x92, 0x3F, 0xBC, 0x82, 0x18, 0x96, 0x31,
1472         0xF8, 0x10, 0x3F, 0xE4, 0xAC, 0x9C, 0xA2, 0x97, 0x00, 0x12, 0xD5, 0xD4,
1473         0x60, 0x24, 0x80, 0x48, 0x01, 0x84, 0x1C, 0xA4, 0x43, 0x70, 0x95, 0x84,
1474         0x93, 0xB2, 0x05, 0xE6, 0x47, 0xDA, 0x30, 0x4D, 0xB4, 0xCE, 0xB0, 0x8C,
1475         0xBB, 0xD1, 0xBA, 0x39, 0x49, 0x47, 0x76, 0xFB, 0x98, 0x8B, 0x47, 0x17,
1476         0x4D, 0xCA, 0x88, 0xC7, 0xE2, 0x94, 0x52, 0x83, 0xA0, 0x1C, 0x89, 0x72,
1477         /* y */
1478         0x03, 0x49, 0xDC, 0x80, 0x7F, 0x4F, 0xBF, 0x37, 0x4F, 0x4A, 0xEA, 0xDE,
1479         0x3B, 0xCA, 0x95, 0x31, 0x4D, 0xD5, 0x8C, 0xEC, 0x9F, 0x30, 0x7A, 0x54,
1480         0xFF, 0xC6, 0x1E, 0xFC, 0x00, 0x6D, 0x8A, 0x2C, 0x9D, 0x49, 0x79, 0xC0,
1481         0xAC, 0x44, 0xAE, 0xA7, 0x4F, 0xBE, 0xBB, 0xB9, 0xF7, 0x72, 0xAE, 0xDC,
1482         0xB6, 0x20, 0xB0, 0x1A, 0x7B, 0xA7, 0xAF, 0x1B, 0x32, 0x04, 0x30, 0xC8,
1483         0x59, 0x19, 0x84, 0xF6, 0x01, 0xCD, 0x4C, 0x14, 0x3E, 0xF1, 0xC7, 0xA3,
1484         /* order */
1485         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1486         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1487         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1488         0x13, 0x18, 0x50, 0xE1, 0xF1, 0x9A, 0x63, 0xE4, 0xB3, 0x91, 0xA8, 0xDB,
1489         0x91, 0x7F, 0x41, 0x38, 0xB6, 0x30, 0xD8, 0x4B, 0xE5, 0xD6, 0x39, 0x38,
1490         0x1E, 0x91, 0xDE, 0xB4, 0x5C, 0xFE, 0x77, 0x8F, 0x63, 0x7C, 0x10, 0x01
1491     }
1492 };
1493 
1494 static const struct {
1495     EC_CURVE_DATA h;
1496     unsigned char data[20 + 72 * 6];
1497 } _EC_NIST_CHAR2_571B = {
1498     {
1499         NID_X9_62_characteristic_two_field, 20, 72, 2
1500     },
1501     {
1502         /* seed */
1503         0x2A, 0xA0, 0x58, 0xF7, 0x3A, 0x0E, 0x33, 0xAB, 0x48, 0x6B, 0x0F, 0x61,
1504         0x04, 0x10, 0xC5, 0x3A, 0x7F, 0x13, 0x23, 0x10,
1505         /* p */
1506         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1507         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1508         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1509         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1510         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1511         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x25,
1512         /* a */
1513         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1514         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1515         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1516         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1517         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1518         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1519         /* b */
1520         0x02, 0xF4, 0x0E, 0x7E, 0x22, 0x21, 0xF2, 0x95, 0xDE, 0x29, 0x71, 0x17,
1521         0xB7, 0xF3, 0xD6, 0x2F, 0x5C, 0x6A, 0x97, 0xFF, 0xCB, 0x8C, 0xEF, 0xF1,
1522         0xCD, 0x6B, 0xA8, 0xCE, 0x4A, 0x9A, 0x18, 0xAD, 0x84, 0xFF, 0xAB, 0xBD,
1523         0x8E, 0xFA, 0x59, 0x33, 0x2B, 0xE7, 0xAD, 0x67, 0x56, 0xA6, 0x6E, 0x29,
1524         0x4A, 0xFD, 0x18, 0x5A, 0x78, 0xFF, 0x12, 0xAA, 0x52, 0x0E, 0x4D, 0xE7,
1525         0x39, 0xBA, 0xCA, 0x0C, 0x7F, 0xFE, 0xFF, 0x7F, 0x29, 0x55, 0x72, 0x7A,
1526         /* x */
1527         0x03, 0x03, 0x00, 0x1D, 0x34, 0xB8, 0x56, 0x29, 0x6C, 0x16, 0xC0, 0xD4,
1528         0x0D, 0x3C, 0xD7, 0x75, 0x0A, 0x93, 0xD1, 0xD2, 0x95, 0x5F, 0xA8, 0x0A,
1529         0xA5, 0xF4, 0x0F, 0xC8, 0xDB, 0x7B, 0x2A, 0xBD, 0xBD, 0xE5, 0x39, 0x50,
1530         0xF4, 0xC0, 0xD2, 0x93, 0xCD, 0xD7, 0x11, 0xA3, 0x5B, 0x67, 0xFB, 0x14,
1531         0x99, 0xAE, 0x60, 0x03, 0x86, 0x14, 0xF1, 0x39, 0x4A, 0xBF, 0xA3, 0xB4,
1532         0xC8, 0x50, 0xD9, 0x27, 0xE1, 0xE7, 0x76, 0x9C, 0x8E, 0xEC, 0x2D, 0x19,
1533         /* y */
1534         0x03, 0x7B, 0xF2, 0x73, 0x42, 0xDA, 0x63, 0x9B, 0x6D, 0xCC, 0xFF, 0xFE,
1535         0xB7, 0x3D, 0x69, 0xD7, 0x8C, 0x6C, 0x27, 0xA6, 0x00, 0x9C, 0xBB, 0xCA,
1536         0x19, 0x80, 0xF8, 0x53, 0x39, 0x21, 0xE8, 0xA6, 0x84, 0x42, 0x3E, 0x43,
1537         0xBA, 0xB0, 0x8A, 0x57, 0x62, 0x91, 0xAF, 0x8F, 0x46, 0x1B, 0xB2, 0xA8,
1538         0xB3, 0x53, 0x1D, 0x2F, 0x04, 0x85, 0xC1, 0x9B, 0x16, 0xE2, 0xF1, 0x51,
1539         0x6E, 0x23, 0xDD, 0x3C, 0x1A, 0x48, 0x27, 0xAF, 0x1B, 0x8A, 0xC1, 0x5B,
1540         /* order */
1541         0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1542         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1543         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1544         0xE6, 0x61, 0xCE, 0x18, 0xFF, 0x55, 0x98, 0x73, 0x08, 0x05, 0x9B, 0x18,
1545         0x68, 0x23, 0x85, 0x1E, 0xC7, 0xDD, 0x9C, 0xA1, 0x16, 0x1D, 0xE9, 0x3D,
1546         0x51, 0x74, 0xD6, 0x6E, 0x83, 0x82, 0xE9, 0xBB, 0x2F, 0xE8, 0x4E, 0x47
1547     }
1548 };
1549 
1550 # ifndef FIPS_MODULE
1551 static const struct {
1552     EC_CURVE_DATA h;
1553     unsigned char data[20 + 21 * 6];
1554 } _EC_X9_62_CHAR2_163V1 = {
1555     {
1556         NID_X9_62_characteristic_two_field, 20, 21, 2
1557     },
1558     {
1559         /* seed */
1560         0xD2, 0xC0, 0xFB, 0x15, 0x76, 0x08, 0x60, 0xDE, 0xF1, 0xEE, 0xF4, 0xD6,
1561         0x96, 0xE6, 0x76, 0x87, 0x56, 0x15, 0x17, 0x54,
1562         /* p */
1563         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1564         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07,
1565         /* a */
1566         0x07, 0x25, 0x46, 0xB5, 0x43, 0x52, 0x34, 0xA4, 0x22, 0xE0, 0x78, 0x96,
1567         0x75, 0xF4, 0x32, 0xC8, 0x94, 0x35, 0xDE, 0x52, 0x42,
1568         /* b */
1569         0x00, 0xC9, 0x51, 0x7D, 0x06, 0xD5, 0x24, 0x0D, 0x3C, 0xFF, 0x38, 0xC7,
1570         0x4B, 0x20, 0xB6, 0xCD, 0x4D, 0x6F, 0x9D, 0xD4, 0xD9,
1571         /* x */
1572         0x07, 0xAF, 0x69, 0x98, 0x95, 0x46, 0x10, 0x3D, 0x79, 0x32, 0x9F, 0xCC,
1573         0x3D, 0x74, 0x88, 0x0F, 0x33, 0xBB, 0xE8, 0x03, 0xCB,
1574         /* y */
1575         0x01, 0xEC, 0x23, 0x21, 0x1B, 0x59, 0x66, 0xAD, 0xEA, 0x1D, 0x3F, 0x87,
1576         0xF7, 0xEA, 0x58, 0x48, 0xAE, 0xF0, 0xB7, 0xCA, 0x9F,
1577         /* order */
1578         0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xE6,
1579         0x0F, 0xC8, 0x82, 0x1C, 0xC7, 0x4D, 0xAE, 0xAF, 0xC1
1580     }
1581 };
1582 
1583 static const struct {
1584     EC_CURVE_DATA h;
1585     unsigned char data[20 + 21 * 6];
1586 } _EC_X9_62_CHAR2_163V2 = {
1587     {
1588         NID_X9_62_characteristic_two_field, 20, 21, 2
1589     },
1590     {
1591         /* seed */
1592         0x53, 0x81, 0x4C, 0x05, 0x0D, 0x44, 0xD6, 0x96, 0xE6, 0x76, 0x87, 0x56,
1593         0x15, 0x17, 0x58, 0x0C, 0xA4, 0xE2, 0x9F, 0xFD,
1594         /* p */
1595         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1596         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07,
1597         /* a */
1598         0x01, 0x08, 0xB3, 0x9E, 0x77, 0xC4, 0xB1, 0x08, 0xBE, 0xD9, 0x81, 0xED,
1599         0x0E, 0x89, 0x0E, 0x11, 0x7C, 0x51, 0x1C, 0xF0, 0x72,
1600         /* b */
1601         0x06, 0x67, 0xAC, 0xEB, 0x38, 0xAF, 0x4E, 0x48, 0x8C, 0x40, 0x74, 0x33,
1602         0xFF, 0xAE, 0x4F, 0x1C, 0x81, 0x16, 0x38, 0xDF, 0x20,
1603         /* x */
1604         0x00, 0x24, 0x26, 0x6E, 0x4E, 0xB5, 0x10, 0x6D, 0x0A, 0x96, 0x4D, 0x92,
1605         0xC4, 0x86, 0x0E, 0x26, 0x71, 0xDB, 0x9B, 0x6C, 0xC5,
1606         /* y */
1607         0x07, 0x9F, 0x68, 0x4D, 0xDF, 0x66, 0x84, 0xC5, 0xCD, 0x25, 0x8B, 0x38,
1608         0x90, 0x02, 0x1B, 0x23, 0x86, 0xDF, 0xD1, 0x9F, 0xC5,
1609         /* order */
1610         0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xF6,
1611         0x4D, 0xE1, 0x15, 0x1A, 0xDB, 0xB7, 0x8F, 0x10, 0xA7
1612     }
1613 };
1614 
1615 static const struct {
1616     EC_CURVE_DATA h;
1617     unsigned char data[20 + 21 * 6];
1618 } _EC_X9_62_CHAR2_163V3 = {
1619     {
1620         NID_X9_62_characteristic_two_field, 20, 21, 2
1621     },
1622     {
1623         /* seed */
1624         0x50, 0xCB, 0xF1, 0xD9, 0x5C, 0xA9, 0x4D, 0x69, 0x6E, 0x67, 0x68, 0x75,
1625         0x61, 0x51, 0x75, 0xF1, 0x6A, 0x36, 0xA3, 0xB8,
1626         /* p */
1627         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1628         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07,
1629         /* a */
1630         0x07, 0xA5, 0x26, 0xC6, 0x3D, 0x3E, 0x25, 0xA2, 0x56, 0xA0, 0x07, 0x69,
1631         0x9F, 0x54, 0x47, 0xE3, 0x2A, 0xE4, 0x56, 0xB5, 0x0E,
1632         /* b */
1633         0x03, 0xF7, 0x06, 0x17, 0x98, 0xEB, 0x99, 0xE2, 0x38, 0xFD, 0x6F, 0x1B,
1634         0xF9, 0x5B, 0x48, 0xFE, 0xEB, 0x48, 0x54, 0x25, 0x2B,
1635         /* x */
1636         0x02, 0xF9, 0xF8, 0x7B, 0x7C, 0x57, 0x4D, 0x0B, 0xDE, 0xCF, 0x8A, 0x22,
1637         0xE6, 0x52, 0x47, 0x75, 0xF9, 0x8C, 0xDE, 0xBD, 0xCB,
1638         /* y */
1639         0x05, 0xB9, 0x35, 0x59, 0x0C, 0x15, 0x5E, 0x17, 0xEA, 0x48, 0xEB, 0x3F,
1640         0xF3, 0x71, 0x8B, 0x89, 0x3D, 0xF5, 0x9A, 0x05, 0xD0,
1641         /* order */
1642         0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0x1A,
1643         0xEE, 0x14, 0x0F, 0x11, 0x0A, 0xFF, 0x96, 0x13, 0x09
1644     }
1645 };
1646 
1647 static const struct {
1648     EC_CURVE_DATA h;
1649     unsigned char data[0 + 23 * 6];
1650 } _EC_X9_62_CHAR2_176V1 = {
1651     {
1652         NID_X9_62_characteristic_two_field, 0, 23, 0xFF6E
1653     },
1654     {
1655         /* no seed */
1656         /* p */
1657         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1658         0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x07,
1659         /* a */
1660         0x00, 0xE4, 0xE6, 0xDB, 0x29, 0x95, 0x06, 0x5C, 0x40, 0x7D, 0x9D, 0x39,
1661         0xB8, 0xD0, 0x96, 0x7B, 0x96, 0x70, 0x4B, 0xA8, 0xE9, 0xC9, 0x0B,
1662         /* b */
1663         0x00, 0x5D, 0xDA, 0x47, 0x0A, 0xBE, 0x64, 0x14, 0xDE, 0x8E, 0xC1, 0x33,
1664         0xAE, 0x28, 0xE9, 0xBB, 0xD7, 0xFC, 0xEC, 0x0A, 0xE0, 0xFF, 0xF2,
1665         /* x */
1666         0x00, 0x8D, 0x16, 0xC2, 0x86, 0x67, 0x98, 0xB6, 0x00, 0xF9, 0xF0, 0x8B,
1667         0xB4, 0xA8, 0xE8, 0x60, 0xF3, 0x29, 0x8C, 0xE0, 0x4A, 0x57, 0x98,
1668         /* y */
1669         0x00, 0x6F, 0xA4, 0x53, 0x9C, 0x2D, 0xAD, 0xDD, 0xD6, 0xBA, 0xB5, 0x16,
1670         0x7D, 0x61, 0xB4, 0x36, 0xE1, 0xD9, 0x2B, 0xB1, 0x6A, 0x56, 0x2C,
1671         /* order */
1672         0x00, 0x00, 0x01, 0x00, 0x92, 0x53, 0x73, 0x97, 0xEC, 0xA4, 0xF6, 0x14,
1673         0x57, 0x99, 0xD6, 0x2B, 0x0A, 0x19, 0xCE, 0x06, 0xFE, 0x26, 0xAD
1674     }
1675 };
1676 
1677 static const struct {
1678     EC_CURVE_DATA h;
1679     unsigned char data[20 + 24 * 6];
1680 } _EC_X9_62_CHAR2_191V1 = {
1681     {
1682         NID_X9_62_characteristic_two_field, 20, 24, 2
1683     },
1684     {
1685         /* seed */
1686         0x4E, 0x13, 0xCA, 0x54, 0x27, 0x44, 0xD6, 0x96, 0xE6, 0x76, 0x87, 0x56,
1687         0x15, 0x17, 0x55, 0x2F, 0x27, 0x9A, 0x8C, 0x84,
1688         /* p */
1689         0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1690         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01,
1691         /* a */
1692         0x28, 0x66, 0x53, 0x7B, 0x67, 0x67, 0x52, 0x63, 0x6A, 0x68, 0xF5, 0x65,
1693         0x54, 0xE1, 0x26, 0x40, 0x27, 0x6B, 0x64, 0x9E, 0xF7, 0x52, 0x62, 0x67,
1694         /* b */
1695         0x2E, 0x45, 0xEF, 0x57, 0x1F, 0x00, 0x78, 0x6F, 0x67, 0xB0, 0x08, 0x1B,
1696         0x94, 0x95, 0xA3, 0xD9, 0x54, 0x62, 0xF5, 0xDE, 0x0A, 0xA1, 0x85, 0xEC,
1697         /* x */
1698         0x36, 0xB3, 0xDA, 0xF8, 0xA2, 0x32, 0x06, 0xF9, 0xC4, 0xF2, 0x99, 0xD7,
1699         0xB2, 0x1A, 0x9C, 0x36, 0x91, 0x37, 0xF2, 0xC8, 0x4A, 0xE1, 0xAA, 0x0D,
1700         /* y */
1701         0x76, 0x5B, 0xE7, 0x34, 0x33, 0xB3, 0xF9, 0x5E, 0x33, 0x29, 0x32, 0xE7,
1702         0x0E, 0xA2, 0x45, 0xCA, 0x24, 0x18, 0xEA, 0x0E, 0xF9, 0x80, 0x18, 0xFB,
1703         /* order */
1704         0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1705         0x04, 0xA2, 0x0E, 0x90, 0xC3, 0x90, 0x67, 0xC8, 0x93, 0xBB, 0xB9, 0xA5
1706     }
1707 };
1708 
1709 static const struct {
1710     EC_CURVE_DATA h;
1711     unsigned char data[20 + 24 * 6];
1712 } _EC_X9_62_CHAR2_191V2 = {
1713     {
1714         NID_X9_62_characteristic_two_field, 20, 24, 4
1715     },
1716     {
1717         /* seed */
1718         0x08, 0x71, 0xEF, 0x2F, 0xEF, 0x24, 0xD6, 0x96, 0xE6, 0x76, 0x87, 0x56,
1719         0x15, 0x17, 0x58, 0xBE, 0xE0, 0xD9, 0x5C, 0x15,
1720         /* p */
1721         0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1722         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01,
1723         /* a */
1724         0x40, 0x10, 0x28, 0x77, 0x4D, 0x77, 0x77, 0xC7, 0xB7, 0x66, 0x6D, 0x13,
1725         0x66, 0xEA, 0x43, 0x20, 0x71, 0x27, 0x4F, 0x89, 0xFF, 0x01, 0xE7, 0x18,
1726         /* b */
1727         0x06, 0x20, 0x04, 0x8D, 0x28, 0xBC, 0xBD, 0x03, 0xB6, 0x24, 0x9C, 0x99,
1728         0x18, 0x2B, 0x7C, 0x8C, 0xD1, 0x97, 0x00, 0xC3, 0x62, 0xC4, 0x6A, 0x01,
1729         /* x */
1730         0x38, 0x09, 0xB2, 0xB7, 0xCC, 0x1B, 0x28, 0xCC, 0x5A, 0x87, 0x92, 0x6A,
1731         0xAD, 0x83, 0xFD, 0x28, 0x78, 0x9E, 0x81, 0xE2, 0xC9, 0xE3, 0xBF, 0x10,
1732         /* y */
1733         0x17, 0x43, 0x43, 0x86, 0x62, 0x6D, 0x14, 0xF3, 0xDB, 0xF0, 0x17, 0x60,
1734         0xD9, 0x21, 0x3A, 0x3E, 0x1C, 0xF3, 0x7A, 0xEC, 0x43, 0x7D, 0x66, 0x8A,
1735         /* order */
1736         0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1737         0x50, 0x50, 0x8C, 0xB8, 0x9F, 0x65, 0x28, 0x24, 0xE0, 0x6B, 0x81, 0x73
1738     }
1739 };
1740 
1741 static const struct {
1742     EC_CURVE_DATA h;
1743     unsigned char data[20 + 24 * 6];
1744 } _EC_X9_62_CHAR2_191V3 = {
1745     {
1746         NID_X9_62_characteristic_two_field, 20, 24, 6
1747     },
1748     {
1749         /* seed */
1750         0xE0, 0x53, 0x51, 0x2D, 0xC6, 0x84, 0xD6, 0x96, 0xE6, 0x76, 0x87, 0x56,
1751         0x15, 0x17, 0x50, 0x67, 0xAE, 0x78, 0x6D, 0x1F,
1752         /* p */
1753         0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1754         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01,
1755         /* a */
1756         0x6C, 0x01, 0x07, 0x47, 0x56, 0x09, 0x91, 0x22, 0x22, 0x10, 0x56, 0x91,
1757         0x1C, 0x77, 0xD7, 0x7E, 0x77, 0xA7, 0x77, 0xE7, 0xE7, 0xE7, 0x7F, 0xCB,
1758         /* b */
1759         0x71, 0xFE, 0x1A, 0xF9, 0x26, 0xCF, 0x84, 0x79, 0x89, 0xEF, 0xEF, 0x8D,
1760         0xB4, 0x59, 0xF6, 0x63, 0x94, 0xD9, 0x0F, 0x32, 0xAD, 0x3F, 0x15, 0xE8,
1761         /* x */
1762         0x37, 0x5D, 0x4C, 0xE2, 0x4F, 0xDE, 0x43, 0x44, 0x89, 0xDE, 0x87, 0x46,
1763         0xE7, 0x17, 0x86, 0x01, 0x50, 0x09, 0xE6, 0x6E, 0x38, 0xA9, 0x26, 0xDD,
1764         /* y */
1765         0x54, 0x5A, 0x39, 0x17, 0x61, 0x96, 0x57, 0x5D, 0x98, 0x59, 0x99, 0x36,
1766         0x6E, 0x6A, 0xD3, 0x4C, 0xE0, 0xA7, 0x7C, 0xD7, 0x12, 0x7B, 0x06, 0xBE,
1767         /* order */
1768         0x15, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1769         0x61, 0x0C, 0x0B, 0x19, 0x68, 0x12, 0xBF, 0xB6, 0x28, 0x8A, 0x3E, 0xA3
1770     }
1771 };
1772 
1773 static const struct {
1774     EC_CURVE_DATA h;
1775     unsigned char data[0 + 27 * 6];
1776 } _EC_X9_62_CHAR2_208W1 = {
1777     {
1778         NID_X9_62_characteristic_two_field, 0, 27, 0xFE48
1779     },
1780     {
1781         /* no seed */
1782         /* p */
1783         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1784         0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1785         0x00, 0x00, 0x07,
1786         /* a */
1787         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1788         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1789         0x00, 0x00, 0x00,
1790         /* b */
1791         0x00, 0xC8, 0x61, 0x9E, 0xD4, 0x5A, 0x62, 0xE6, 0x21, 0x2E, 0x11, 0x60,
1792         0x34, 0x9E, 0x2B, 0xFA, 0x84, 0x44, 0x39, 0xFA, 0xFC, 0x2A, 0x3F, 0xD1,
1793         0x63, 0x8F, 0x9E,
1794         /* x */
1795         0x00, 0x89, 0xFD, 0xFB, 0xE4, 0xAB, 0xE1, 0x93, 0xDF, 0x95, 0x59, 0xEC,
1796         0xF0, 0x7A, 0xC0, 0xCE, 0x78, 0x55, 0x4E, 0x27, 0x84, 0xEB, 0x8C, 0x1E,
1797         0xD1, 0xA5, 0x7A,
1798         /* y */
1799         0x00, 0x0F, 0x55, 0xB5, 0x1A, 0x06, 0xE7, 0x8E, 0x9A, 0xC3, 0x8A, 0x03,
1800         0x5F, 0xF5, 0x20, 0xD8, 0xB0, 0x17, 0x81, 0xBE, 0xB1, 0xA6, 0xBB, 0x08,
1801         0x61, 0x7D, 0xE3,
1802         /* order */
1803         0x00, 0x00, 0x01, 0x01, 0xBA, 0xF9, 0x5C, 0x97, 0x23, 0xC5, 0x7B, 0x6C,
1804         0x21, 0xDA, 0x2E, 0xFF, 0x2D, 0x5E, 0xD5, 0x88, 0xBD, 0xD5, 0x71, 0x7E,
1805         0x21, 0x2F, 0x9D
1806     }
1807 };
1808 
1809 static const struct {
1810     EC_CURVE_DATA h;
1811     unsigned char data[20 + 30 * 6];
1812 } _EC_X9_62_CHAR2_239V1 = {
1813     {
1814         NID_X9_62_characteristic_two_field, 20, 30, 4
1815     },
1816     {
1817         /* seed */
1818         0xD3, 0x4B, 0x9A, 0x4D, 0x69, 0x6E, 0x67, 0x68, 0x75, 0x61, 0x51, 0x75,
1819         0xCA, 0x71, 0xB9, 0x20, 0xBF, 0xEF, 0xB0, 0x5D,
1820         /* p */
1821         0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1822         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1823         0x00, 0x10, 0x00, 0x00, 0x00, 0x01,
1824         /* a */
1825         0x32, 0x01, 0x08, 0x57, 0x07, 0x7C, 0x54, 0x31, 0x12, 0x3A, 0x46, 0xB8,
1826         0x08, 0x90, 0x67, 0x56, 0xF5, 0x43, 0x42, 0x3E, 0x8D, 0x27, 0x87, 0x75,
1827         0x78, 0x12, 0x57, 0x78, 0xAC, 0x76,
1828         /* b */
1829         0x79, 0x04, 0x08, 0xF2, 0xEE, 0xDA, 0xF3, 0x92, 0xB0, 0x12, 0xED, 0xEF,
1830         0xB3, 0x39, 0x2F, 0x30, 0xF4, 0x32, 0x7C, 0x0C, 0xA3, 0xF3, 0x1F, 0xC3,
1831         0x83, 0xC4, 0x22, 0xAA, 0x8C, 0x16,
1832         /* x */
1833         0x57, 0x92, 0x70, 0x98, 0xFA, 0x93, 0x2E, 0x7C, 0x0A, 0x96, 0xD3, 0xFD,
1834         0x5B, 0x70, 0x6E, 0xF7, 0xE5, 0xF5, 0xC1, 0x56, 0xE1, 0x6B, 0x7E, 0x7C,
1835         0x86, 0x03, 0x85, 0x52, 0xE9, 0x1D,
1836         /* y */
1837         0x61, 0xD8, 0xEE, 0x50, 0x77, 0xC3, 0x3F, 0xEC, 0xF6, 0xF1, 0xA1, 0x6B,
1838         0x26, 0x8D, 0xE4, 0x69, 0xC3, 0xC7, 0x74, 0x4E, 0xA9, 0xA9, 0x71, 0x64,
1839         0x9F, 0xC7, 0xA9, 0x61, 0x63, 0x05,
1840         /* order */
1841         0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1842         0x00, 0x00, 0x00, 0x0F, 0x4D, 0x42, 0xFF, 0xE1, 0x49, 0x2A, 0x49, 0x93,
1843         0xF1, 0xCA, 0xD6, 0x66, 0xE4, 0x47
1844     }
1845 };
1846 
1847 static const struct {
1848     EC_CURVE_DATA h;
1849     unsigned char data[20 + 30 * 6];
1850 } _EC_X9_62_CHAR2_239V2 = {
1851     {
1852         NID_X9_62_characteristic_two_field, 20, 30, 6
1853     },
1854     {
1855         /* seed */
1856         0x2A, 0xA6, 0x98, 0x2F, 0xDF, 0xA4, 0xD6, 0x96, 0xE6, 0x76, 0x87, 0x56,
1857         0x15, 0x17, 0x5D, 0x26, 0x67, 0x27, 0x27, 0x7D,
1858         /* p */
1859         0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1860         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1861         0x00, 0x10, 0x00, 0x00, 0x00, 0x01,
1862         /* a */
1863         0x42, 0x30, 0x01, 0x77, 0x57, 0xA7, 0x67, 0xFA, 0xE4, 0x23, 0x98, 0x56,
1864         0x9B, 0x74, 0x63, 0x25, 0xD4, 0x53, 0x13, 0xAF, 0x07, 0x66, 0x26, 0x64,
1865         0x79, 0xB7, 0x56, 0x54, 0xE6, 0x5F,
1866         /* b */
1867         0x50, 0x37, 0xEA, 0x65, 0x41, 0x96, 0xCF, 0xF0, 0xCD, 0x82, 0xB2, 0xC1,
1868         0x4A, 0x2F, 0xCF, 0x2E, 0x3F, 0xF8, 0x77, 0x52, 0x85, 0xB5, 0x45, 0x72,
1869         0x2F, 0x03, 0xEA, 0xCD, 0xB7, 0x4B,
1870         /* x */
1871         0x28, 0xF9, 0xD0, 0x4E, 0x90, 0x00, 0x69, 0xC8, 0xDC, 0x47, 0xA0, 0x85,
1872         0x34, 0xFE, 0x76, 0xD2, 0xB9, 0x00, 0xB7, 0xD7, 0xEF, 0x31, 0xF5, 0x70,
1873         0x9F, 0x20, 0x0C, 0x4C, 0xA2, 0x05,
1874         /* y */
1875         0x56, 0x67, 0x33, 0x4C, 0x45, 0xAF, 0xF3, 0xB5, 0xA0, 0x3B, 0xAD, 0x9D,
1876         0xD7, 0x5E, 0x2C, 0x71, 0xA9, 0x93, 0x62, 0x56, 0x7D, 0x54, 0x53, 0xF7,
1877         0xFA, 0x6E, 0x22, 0x7E, 0xC8, 0x33,
1878         /* order */
1879         0x15, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1880         0x55, 0x55, 0x55, 0x3C, 0x6F, 0x28, 0x85, 0x25, 0x9C, 0x31, 0xE3, 0xFC,
1881         0xDF, 0x15, 0x46, 0x24, 0x52, 0x2D
1882     }
1883 };
1884 
1885 static const struct {
1886     EC_CURVE_DATA h;
1887     unsigned char data[20 + 30 * 6];
1888 } _EC_X9_62_CHAR2_239V3 = {
1889     {
1890         NID_X9_62_characteristic_two_field, 20, 30, 0xA
1891     },
1892     {
1893         /* seed */
1894         0x9E, 0x07, 0x6F, 0x4D, 0x69, 0x6E, 0x67, 0x68, 0x75, 0x61, 0x51, 0x75,
1895         0xE1, 0x1E, 0x9F, 0xDD, 0x77, 0xF9, 0x20, 0x41,
1896         /* p */
1897         0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1898         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1899         0x00, 0x10, 0x00, 0x00, 0x00, 0x01,
1900         /* a */
1901         0x01, 0x23, 0x87, 0x74, 0x66, 0x6A, 0x67, 0x76, 0x6D, 0x66, 0x76, 0xF7,
1902         0x78, 0xE6, 0x76, 0xB6, 0x69, 0x99, 0x17, 0x66, 0x66, 0xE6, 0x87, 0x66,
1903         0x6D, 0x87, 0x66, 0xC6, 0x6A, 0x9F,
1904         /* b */
1905         0x6A, 0x94, 0x19, 0x77, 0xBA, 0x9F, 0x6A, 0x43, 0x51, 0x99, 0xAC, 0xFC,
1906         0x51, 0x06, 0x7E, 0xD5, 0x87, 0xF5, 0x19, 0xC5, 0xEC, 0xB5, 0x41, 0xB8,
1907         0xE4, 0x41, 0x11, 0xDE, 0x1D, 0x40,
1908         /* x */
1909         0x70, 0xF6, 0xE9, 0xD0, 0x4D, 0x28, 0x9C, 0x4E, 0x89, 0x91, 0x3C, 0xE3,
1910         0x53, 0x0B, 0xFD, 0xE9, 0x03, 0x97, 0x7D, 0x42, 0xB1, 0x46, 0xD5, 0x39,
1911         0xBF, 0x1B, 0xDE, 0x4E, 0x9C, 0x92,
1912         /* y */
1913         0x2E, 0x5A, 0x0E, 0xAF, 0x6E, 0x5E, 0x13, 0x05, 0xB9, 0x00, 0x4D, 0xCE,
1914         0x5C, 0x0E, 0xD7, 0xFE, 0x59, 0xA3, 0x56, 0x08, 0xF3, 0x38, 0x37, 0xC8,
1915         0x16, 0xD8, 0x0B, 0x79, 0xF4, 0x61,
1916         /* order */
1917         0x0C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
1918         0xCC, 0xCC, 0xCC, 0xAC, 0x49, 0x12, 0xD2, 0xD9, 0xDF, 0x90, 0x3E, 0xF9,
1919         0x88, 0x8B, 0x8A, 0x0E, 0x4C, 0xFF
1920     }
1921 };
1922 
1923 static const struct {
1924     EC_CURVE_DATA h;
1925     unsigned char data[0 + 35 * 6];
1926 } _EC_X9_62_CHAR2_272W1 = {
1927     {
1928         NID_X9_62_characteristic_two_field, 0, 35, 0xFF06
1929     },
1930     {
1931         /* no seed */
1932         /* p */
1933         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1934         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1935         0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B,
1936         /* a */
1937         0x00, 0x91, 0xA0, 0x91, 0xF0, 0x3B, 0x5F, 0xBA, 0x4A, 0xB2, 0xCC, 0xF4,
1938         0x9C, 0x4E, 0xDD, 0x22, 0x0F, 0xB0, 0x28, 0x71, 0x2D, 0x42, 0xBE, 0x75,
1939         0x2B, 0x2C, 0x40, 0x09, 0x4D, 0xBA, 0xCD, 0xB5, 0x86, 0xFB, 0x20,
1940         /* b */
1941         0x00, 0x71, 0x67, 0xEF, 0xC9, 0x2B, 0xB2, 0xE3, 0xCE, 0x7C, 0x8A, 0xAA,
1942         0xFF, 0x34, 0xE1, 0x2A, 0x9C, 0x55, 0x70, 0x03, 0xD7, 0xC7, 0x3A, 0x6F,
1943         0xAF, 0x00, 0x3F, 0x99, 0xF6, 0xCC, 0x84, 0x82, 0xE5, 0x40, 0xF7,
1944         /* x */
1945         0x00, 0x61, 0x08, 0xBA, 0xBB, 0x2C, 0xEE, 0xBC, 0xF7, 0x87, 0x05, 0x8A,
1946         0x05, 0x6C, 0xBE, 0x0C, 0xFE, 0x62, 0x2D, 0x77, 0x23, 0xA2, 0x89, 0xE0,
1947         0x8A, 0x07, 0xAE, 0x13, 0xEF, 0x0D, 0x10, 0xD1, 0x71, 0xDD, 0x8D,
1948         /* y */
1949         0x00, 0x10, 0xC7, 0x69, 0x57, 0x16, 0x85, 0x1E, 0xEF, 0x6B, 0xA7, 0xF6,
1950         0x87, 0x2E, 0x61, 0x42, 0xFB, 0xD2, 0x41, 0xB8, 0x30, 0xFF, 0x5E, 0xFC,
1951         0xAC, 0xEC, 0xCA, 0xB0, 0x5E, 0x02, 0x00, 0x5D, 0xDE, 0x9D, 0x23,
1952         /* order */
1953         0x00, 0x00, 0x01, 0x00, 0xFA, 0xF5, 0x13, 0x54, 0xE0, 0xE3, 0x9E, 0x48,
1954         0x92, 0xDF, 0x6E, 0x31, 0x9C, 0x72, 0xC8, 0x16, 0x16, 0x03, 0xFA, 0x45,
1955         0xAA, 0x7B, 0x99, 0x8A, 0x16, 0x7B, 0x8F, 0x1E, 0x62, 0x95, 0x21
1956     }
1957 };
1958 
1959 static const struct {
1960     EC_CURVE_DATA h;
1961     unsigned char data[0 + 39 * 6];
1962 } _EC_X9_62_CHAR2_304W1 = {
1963     {
1964         NID_X9_62_characteristic_two_field, 0, 39, 0xFE2E
1965     },
1966     {
1967         /* no seed */
1968         /* p */
1969         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1970         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1971         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1972         0x00, 0x08, 0x07,
1973         /* a */
1974         0x00, 0xFD, 0x0D, 0x69, 0x31, 0x49, 0xA1, 0x18, 0xF6, 0x51, 0xE6, 0xDC,
1975         0xE6, 0x80, 0x20, 0x85, 0x37, 0x7E, 0x5F, 0x88, 0x2D, 0x1B, 0x51, 0x0B,
1976         0x44, 0x16, 0x00, 0x74, 0xC1, 0x28, 0x80, 0x78, 0x36, 0x5A, 0x03, 0x96,
1977         0xC8, 0xE6, 0x81,
1978         /* b */
1979         0x00, 0xBD, 0xDB, 0x97, 0xE5, 0x55, 0xA5, 0x0A, 0x90, 0x8E, 0x43, 0xB0,
1980         0x1C, 0x79, 0x8E, 0xA5, 0xDA, 0xA6, 0x78, 0x8F, 0x1E, 0xA2, 0x79, 0x4E,
1981         0xFC, 0xF5, 0x71, 0x66, 0xB8, 0xC1, 0x40, 0x39, 0x60, 0x1E, 0x55, 0x82,
1982         0x73, 0x40, 0xBE,
1983         /* x */
1984         0x00, 0x19, 0x7B, 0x07, 0x84, 0x5E, 0x9B, 0xE2, 0xD9, 0x6A, 0xDB, 0x0F,
1985         0x5F, 0x3C, 0x7F, 0x2C, 0xFF, 0xBD, 0x7A, 0x3E, 0xB8, 0xB6, 0xFE, 0xC3,
1986         0x5C, 0x7F, 0xD6, 0x7F, 0x26, 0xDD, 0xF6, 0x28, 0x5A, 0x64, 0x4F, 0x74,
1987         0x0A, 0x26, 0x14,
1988         /* y */
1989         0x00, 0xE1, 0x9F, 0xBE, 0xB7, 0x6E, 0x0D, 0xA1, 0x71, 0x51, 0x7E, 0xCF,
1990         0x40, 0x1B, 0x50, 0x28, 0x9B, 0xF0, 0x14, 0x10, 0x32, 0x88, 0x52, 0x7A,
1991         0x9B, 0x41, 0x6A, 0x10, 0x5E, 0x80, 0x26, 0x0B, 0x54, 0x9F, 0xDC, 0x1B,
1992         0x92, 0xC0, 0x3B,
1993         /* order */
1994         0x00, 0x00, 0x01, 0x01, 0xD5, 0x56, 0x57, 0x2A, 0xAB, 0xAC, 0x80, 0x01,
1995         0x01, 0xD5, 0x56, 0x57, 0x2A, 0xAB, 0xAC, 0x80, 0x01, 0x02, 0x2D, 0x5C,
1996         0x91, 0xDD, 0x17, 0x3F, 0x8F, 0xB5, 0x61, 0xDA, 0x68, 0x99, 0x16, 0x44,
1997         0x43, 0x05, 0x1D
1998     }
1999 };
2000 
2001 static const struct {
2002     EC_CURVE_DATA h;
2003     unsigned char data[20 + 45 * 6];
2004 } _EC_X9_62_CHAR2_359V1 = {
2005     {
2006         NID_X9_62_characteristic_two_field, 20, 45, 0x4C
2007     },
2008     {
2009         /* seed */
2010         0x2B, 0x35, 0x49, 0x20, 0xB7, 0x24, 0xD6, 0x96, 0xE6, 0x76, 0x87, 0x56,
2011         0x15, 0x17, 0x58, 0x5B, 0xA1, 0x33, 0x2D, 0xC6,
2012         /* p */
2013         0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2014         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2015         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2016         0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
2017         /* a */
2018         0x56, 0x67, 0x67, 0x6A, 0x65, 0x4B, 0x20, 0x75, 0x4F, 0x35, 0x6E, 0xA9,
2019         0x20, 0x17, 0xD9, 0x46, 0x56, 0x7C, 0x46, 0x67, 0x55, 0x56, 0xF1, 0x95,
2020         0x56, 0xA0, 0x46, 0x16, 0xB5, 0x67, 0xD2, 0x23, 0xA5, 0xE0, 0x56, 0x56,
2021         0xFB, 0x54, 0x90, 0x16, 0xA9, 0x66, 0x56, 0xA5, 0x57,
2022         /* b */
2023         0x24, 0x72, 0xE2, 0xD0, 0x19, 0x7C, 0x49, 0x36, 0x3F, 0x1F, 0xE7, 0xF5,
2024         0xB6, 0xDB, 0x07, 0x5D, 0x52, 0xB6, 0x94, 0x7D, 0x13, 0x5D, 0x8C, 0xA4,
2025         0x45, 0x80, 0x5D, 0x39, 0xBC, 0x34, 0x56, 0x26, 0x08, 0x96, 0x87, 0x74,
2026         0x2B, 0x63, 0x29, 0xE7, 0x06, 0x80, 0x23, 0x19, 0x88,
2027         /* x */
2028         0x3C, 0x25, 0x8E, 0xF3, 0x04, 0x77, 0x67, 0xE7, 0xED, 0xE0, 0xF1, 0xFD,
2029         0xAA, 0x79, 0xDA, 0xEE, 0x38, 0x41, 0x36, 0x6A, 0x13, 0x2E, 0x16, 0x3A,
2030         0xCE, 0xD4, 0xED, 0x24, 0x01, 0xDF, 0x9C, 0x6B, 0xDC, 0xDE, 0x98, 0xE8,
2031         0xE7, 0x07, 0xC0, 0x7A, 0x22, 0x39, 0xB1, 0xB0, 0x97,
2032         /* y */
2033         0x53, 0xD7, 0xE0, 0x85, 0x29, 0x54, 0x70, 0x48, 0x12, 0x1E, 0x9C, 0x95,
2034         0xF3, 0x79, 0x1D, 0xD8, 0x04, 0x96, 0x39, 0x48, 0xF3, 0x4F, 0xAE, 0x7B,
2035         0xF4, 0x4E, 0xA8, 0x23, 0x65, 0xDC, 0x78, 0x68, 0xFE, 0x57, 0xE4, 0xAE,
2036         0x2D, 0xE2, 0x11, 0x30, 0x5A, 0x40, 0x71, 0x04, 0xBD,
2037         /* order */
2038         0x01, 0xAF, 0x28, 0x6B, 0xCA, 0x1A, 0xF2, 0x86, 0xBC, 0xA1, 0xAF, 0x28,
2039         0x6B, 0xCA, 0x1A, 0xF2, 0x86, 0xBC, 0xA1, 0xAF, 0x28, 0x6B, 0xC9, 0xFB,
2040         0x8F, 0x6B, 0x85, 0xC5, 0x56, 0x89, 0x2C, 0x20, 0xA7, 0xEB, 0x96, 0x4F,
2041         0xE7, 0x71, 0x9E, 0x74, 0xF4, 0x90, 0x75, 0x8D, 0x3B
2042     }
2043 };
2044 
2045 static const struct {
2046     EC_CURVE_DATA h;
2047     unsigned char data[0 + 47 * 6];
2048 } _EC_X9_62_CHAR2_368W1 = {
2049     {
2050         NID_X9_62_characteristic_two_field, 0, 47, 0xFF70
2051     },
2052     {
2053         /* no seed */
2054         /* p */
2055         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2056         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2057         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2058         0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
2059         /* a */
2060         0x00, 0xE0, 0xD2, 0xEE, 0x25, 0x09, 0x52, 0x06, 0xF5, 0xE2, 0xA4, 0xF9,
2061         0xED, 0x22, 0x9F, 0x1F, 0x25, 0x6E, 0x79, 0xA0, 0xE2, 0xB4, 0x55, 0x97,
2062         0x0D, 0x8D, 0x0D, 0x86, 0x5B, 0xD9, 0x47, 0x78, 0xC5, 0x76, 0xD6, 0x2F,
2063         0x0A, 0xB7, 0x51, 0x9C, 0xCD, 0x2A, 0x1A, 0x90, 0x6A, 0xE3, 0x0D,
2064         /* b */
2065         0x00, 0xFC, 0x12, 0x17, 0xD4, 0x32, 0x0A, 0x90, 0x45, 0x2C, 0x76, 0x0A,
2066         0x58, 0xED, 0xCD, 0x30, 0xC8, 0xDD, 0x06, 0x9B, 0x3C, 0x34, 0x45, 0x38,
2067         0x37, 0xA3, 0x4E, 0xD5, 0x0C, 0xB5, 0x49, 0x17, 0xE1, 0xC2, 0x11, 0x2D,
2068         0x84, 0xD1, 0x64, 0xF4, 0x44, 0xF8, 0xF7, 0x47, 0x86, 0x04, 0x6A,
2069         /* x */
2070         0x00, 0x10, 0x85, 0xE2, 0x75, 0x53, 0x81, 0xDC, 0xCC, 0xE3, 0xC1, 0x55,
2071         0x7A, 0xFA, 0x10, 0xC2, 0xF0, 0xC0, 0xC2, 0x82, 0x56, 0x46, 0xC5, 0xB3,
2072         0x4A, 0x39, 0x4C, 0xBC, 0xFA, 0x8B, 0xC1, 0x6B, 0x22, 0xE7, 0xE7, 0x89,
2073         0xE9, 0x27, 0xBE, 0x21, 0x6F, 0x02, 0xE1, 0xFB, 0x13, 0x6A, 0x5F,
2074         /* y */
2075         0x00, 0x7B, 0x3E, 0xB1, 0xBD, 0xDC, 0xBA, 0x62, 0xD5, 0xD8, 0xB2, 0x05,
2076         0x9B, 0x52, 0x57, 0x97, 0xFC, 0x73, 0x82, 0x2C, 0x59, 0x05, 0x9C, 0x62,
2077         0x3A, 0x45, 0xFF, 0x38, 0x43, 0xCE, 0xE8, 0xF8, 0x7C, 0xD1, 0x85, 0x5A,
2078         0xDA, 0xA8, 0x1E, 0x2A, 0x07, 0x50, 0xB8, 0x0F, 0xDA, 0x23, 0x10,
2079         /* order */
2080         0x00, 0x00, 0x01, 0x00, 0x90, 0x51, 0x2D, 0xA9, 0xAF, 0x72, 0xB0, 0x83,
2081         0x49, 0xD9, 0x8A, 0x5D, 0xD4, 0xC7, 0xB0, 0x53, 0x2E, 0xCA, 0x51, 0xCE,
2082         0x03, 0xE2, 0xD1, 0x0F, 0x3B, 0x7A, 0xC5, 0x79, 0xBD, 0x87, 0xE9, 0x09,
2083         0xAE, 0x40, 0xA6, 0xF1, 0x31, 0xE9, 0xCF, 0xCE, 0x5B, 0xD9, 0x67
2084     }
2085 };
2086 
2087 static const struct {
2088     EC_CURVE_DATA h;
2089     unsigned char data[0 + 54 * 6];
2090 } _EC_X9_62_CHAR2_431R1 = {
2091     {
2092         NID_X9_62_characteristic_two_field, 0, 54, 0x2760
2093     },
2094     {
2095         /* no seed */
2096         /* p */
2097         0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2098         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2099         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2100         0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2101         0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
2102         /* a */
2103         0x1A, 0x82, 0x7E, 0xF0, 0x0D, 0xD6, 0xFC, 0x0E, 0x23, 0x4C, 0xAF, 0x04,
2104         0x6C, 0x6A, 0x5D, 0x8A, 0x85, 0x39, 0x5B, 0x23, 0x6C, 0xC4, 0xAD, 0x2C,
2105         0xF3, 0x2A, 0x0C, 0xAD, 0xBD, 0xC9, 0xDD, 0xF6, 0x20, 0xB0, 0xEB, 0x99,
2106         0x06, 0xD0, 0x95, 0x7F, 0x6C, 0x6F, 0xEA, 0xCD, 0x61, 0x54, 0x68, 0xDF,
2107         0x10, 0x4D, 0xE2, 0x96, 0xCD, 0x8F,
2108         /* b */
2109         0x10, 0xD9, 0xB4, 0xA3, 0xD9, 0x04, 0x7D, 0x8B, 0x15, 0x43, 0x59, 0xAB,
2110         0xFB, 0x1B, 0x7F, 0x54, 0x85, 0xB0, 0x4C, 0xEB, 0x86, 0x82, 0x37, 0xDD,
2111         0xC9, 0xDE, 0xDA, 0x98, 0x2A, 0x67, 0x9A, 0x5A, 0x91, 0x9B, 0x62, 0x6D,
2112         0x4E, 0x50, 0xA8, 0xDD, 0x73, 0x1B, 0x10, 0x7A, 0x99, 0x62, 0x38, 0x1F,
2113         0xB5, 0xD8, 0x07, 0xBF, 0x26, 0x18,
2114         /* x */
2115         0x12, 0x0F, 0xC0, 0x5D, 0x3C, 0x67, 0xA9, 0x9D, 0xE1, 0x61, 0xD2, 0xF4,
2116         0x09, 0x26, 0x22, 0xFE, 0xCA, 0x70, 0x1B, 0xE4, 0xF5, 0x0F, 0x47, 0x58,
2117         0x71, 0x4E, 0x8A, 0x87, 0xBB, 0xF2, 0xA6, 0x58, 0xEF, 0x8C, 0x21, 0xE7,
2118         0xC5, 0xEF, 0xE9, 0x65, 0x36, 0x1F, 0x6C, 0x29, 0x99, 0xC0, 0xC2, 0x47,
2119         0xB0, 0xDB, 0xD7, 0x0C, 0xE6, 0xB7,
2120         /* y */
2121         0x20, 0xD0, 0xAF, 0x89, 0x03, 0xA9, 0x6F, 0x8D, 0x5F, 0xA2, 0xC2, 0x55,
2122         0x74, 0x5D, 0x3C, 0x45, 0x1B, 0x30, 0x2C, 0x93, 0x46, 0xD9, 0xB7, 0xE4,
2123         0x85, 0xE7, 0xBC, 0xE4, 0x1F, 0x6B, 0x59, 0x1F, 0x3E, 0x8F, 0x6A, 0xDD,
2124         0xCB, 0xB0, 0xBC, 0x4C, 0x2F, 0x94, 0x7A, 0x7D, 0xE1, 0xA8, 0x9B, 0x62,
2125         0x5D, 0x6A, 0x59, 0x8B, 0x37, 0x60,
2126         /* order */
2127         0x00, 0x03, 0x40, 0x34, 0x03, 0x40, 0x34, 0x03, 0x40, 0x34, 0x03, 0x40,
2128         0x34, 0x03, 0x40, 0x34, 0x03, 0x40, 0x34, 0x03, 0x40, 0x34, 0x03, 0x40,
2129         0x34, 0x03, 0x40, 0x34, 0x03, 0x23, 0xC3, 0x13, 0xFA, 0xB5, 0x05, 0x89,
2130         0x70, 0x3B, 0x5E, 0xC6, 0x8D, 0x35, 0x87, 0xFE, 0xC6, 0x0D, 0x16, 0x1C,
2131         0xC1, 0x49, 0xC1, 0xAD, 0x4A, 0x91
2132     }
2133 };
2134 
2135 static const struct {
2136     EC_CURVE_DATA h;
2137     unsigned char data[0 + 15 * 6];
2138 } _EC_WTLS_1 = {
2139     {
2140         NID_X9_62_characteristic_two_field, 0, 15, 2
2141     },
2142     {
2143         /* no seed */
2144         /* p */
2145         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2146         0x00, 0x02, 0x01,
2147         /* a */
2148         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2149         0x00, 0x00, 0x01,
2150         /* b */
2151         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2152         0x00, 0x00, 0x01,
2153         /* x */
2154         0x01, 0x66, 0x79, 0x79, 0xA4, 0x0B, 0xA4, 0x97, 0xE5, 0xD5, 0xC2, 0x70,
2155         0x78, 0x06, 0x17,
2156         /* y */
2157         0x00, 0xF4, 0x4B, 0x4A, 0xF1, 0xEC, 0xC2, 0x63, 0x0E, 0x08, 0x78, 0x5C,
2158         0xEB, 0xCC, 0x15,
2159         /* order */
2160         0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xBF, 0x91, 0xAF,
2161         0x6D, 0xEA, 0x73
2162     }
2163 };
2164 
2165 /* IPSec curves */
2166 /*
2167  * NOTE: The of curves over a extension field of non prime degree is not
2168  * recommended (Weil-descent). As the group order is not a prime this curve
2169  * is not suitable for ECDSA.
2170  */
2171 static const struct {
2172     EC_CURVE_DATA h;
2173     unsigned char data[0 + 20 * 6];
2174 } _EC_IPSEC_155_ID3 = {
2175     {
2176         NID_X9_62_characteristic_two_field, 0, 20, 3
2177     },
2178     {
2179         /* no seed */
2180         /* p */
2181         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2182         0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
2183         /* a */
2184         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2185         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2186         /* b */
2187         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2188         0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x33, 0x8f,
2189         /* x */
2190         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2191         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b,
2192         /* y */
2193         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2194         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc8,
2195         /* order */
2196         0x02, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xC7, 0xF3,
2197         0xC7, 0x88, 0x1B, 0xD0, 0x86, 0x8F, 0xA8, 0x6C
2198     }
2199 };
2200 
2201 /*
2202  * NOTE: The of curves over a extension field of non prime degree is not
2203  * recommended (Weil-descent). As the group order is not a prime this curve
2204  * is not suitable for ECDSA.
2205  */
2206 static const struct {
2207     EC_CURVE_DATA h;
2208     unsigned char data[0 + 24 * 6];
2209 } _EC_IPSEC_185_ID4 = {
2210     {
2211         NID_X9_62_characteristic_two_field, 0, 24, 2
2212     },
2213     {
2214         /* no seed */
2215         /* p */
2216         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2217         0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
2218         /* a */
2219         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2220         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2221         /* b */
2222         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2223         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xe9,
2224         /* x */
2225         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2226         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
2227         /* y */
2228         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2229         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d,
2230         /* order */
2231         0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2232         0xED, 0xF9, 0x7C, 0x44, 0xDB, 0x9F, 0x24, 0x20, 0xBA, 0xFC, 0xA7, 0x5E
2233     }
2234 };
2235 # endif /* FIPS_MODULE */
2236 #endif /* OPENSSL_NO_EC2M */
2237 
2238 /*
2239  * These curves were added by Annie Yousar.
2240  * For the definition of RFC 5639 curves see
2241  * http://www.ietf.org/rfc/rfc5639.txt These curves are generated verifiable
2242  * at random, nevertheless the seed is omitted as parameter because the
2243  * generation mechanism is different from those defined in ANSI X9.62.
2244  */
2245 
2246 #ifndef FIPS_MODULE
2247 static const struct {
2248     EC_CURVE_DATA h;
2249     unsigned char data[0 + 20 * 6];
2250 } _EC_brainpoolP160r1 = {
2251     {
2252         NID_X9_62_prime_field, 0, 20, 1
2253     },
2254     {
2255         /* no seed */
2256         /* p */
2257         0xE9, 0x5E, 0x4A, 0x5F, 0x73, 0x70, 0x59, 0xDC, 0x60, 0xDF, 0xC7, 0xAD,
2258         0x95, 0xB3, 0xD8, 0x13, 0x95, 0x15, 0x62, 0x0F,
2259         /* a */
2260         0x34, 0x0E, 0x7B, 0xE2, 0xA2, 0x80, 0xEB, 0x74, 0xE2, 0xBE, 0x61, 0xBA,
2261         0xDA, 0x74, 0x5D, 0x97, 0xE8, 0xF7, 0xC3, 0x00,
2262         /* b */
2263         0x1E, 0x58, 0x9A, 0x85, 0x95, 0x42, 0x34, 0x12, 0x13, 0x4F, 0xAA, 0x2D,
2264         0xBD, 0xEC, 0x95, 0xC8, 0xD8, 0x67, 0x5E, 0x58,
2265         /* x */
2266         0xBE, 0xD5, 0xAF, 0x16, 0xEA, 0x3F, 0x6A, 0x4F, 0x62, 0x93, 0x8C, 0x46,
2267         0x31, 0xEB, 0x5A, 0xF7, 0xBD, 0xBC, 0xDB, 0xC3,
2268         /* y */
2269         0x16, 0x67, 0xCB, 0x47, 0x7A, 0x1A, 0x8E, 0xC3, 0x38, 0xF9, 0x47, 0x41,
2270         0x66, 0x9C, 0x97, 0x63, 0x16, 0xDA, 0x63, 0x21,
2271         /* order */
2272         0xE9, 0x5E, 0x4A, 0x5F, 0x73, 0x70, 0x59, 0xDC, 0x60, 0xDF, 0x59, 0x91,
2273         0xD4, 0x50, 0x29, 0x40, 0x9E, 0x60, 0xFC, 0x09
2274     }
2275 };
2276 
2277 static const struct {
2278     EC_CURVE_DATA h;
2279     unsigned char data[0 + 20 * 6];
2280 } _EC_brainpoolP160t1 = {
2281     {
2282         NID_X9_62_prime_field, 0, 20, 1
2283     },
2284     {
2285         /* no seed */
2286         /* p */
2287         0xE9, 0x5E, 0x4A, 0x5F, 0x73, 0x70, 0x59, 0xDC, 0x60, 0xDF, 0xC7, 0xAD,
2288         0x95, 0xB3, 0xD8, 0x13, 0x95, 0x15, 0x62, 0x0F,
2289         /* a */
2290         0xE9, 0x5E, 0x4A, 0x5F, 0x73, 0x70, 0x59, 0xDC, 0x60, 0xDF, 0xC7, 0xAD,
2291         0x95, 0xB3, 0xD8, 0x13, 0x95, 0x15, 0x62, 0x0C,
2292         /* b */
2293         0x7A, 0x55, 0x6B, 0x6D, 0xAE, 0x53, 0x5B, 0x7B, 0x51, 0xED, 0x2C, 0x4D,
2294         0x7D, 0xAA, 0x7A, 0x0B, 0x5C, 0x55, 0xF3, 0x80,
2295         /* x */
2296         0xB1, 0x99, 0xB1, 0x3B, 0x9B, 0x34, 0xEF, 0xC1, 0x39, 0x7E, 0x64, 0xBA,
2297         0xEB, 0x05, 0xAC, 0xC2, 0x65, 0xFF, 0x23, 0x78,
2298         /* y */
2299         0xAD, 0xD6, 0x71, 0x8B, 0x7C, 0x7C, 0x19, 0x61, 0xF0, 0x99, 0x1B, 0x84,
2300         0x24, 0x43, 0x77, 0x21, 0x52, 0xC9, 0xE0, 0xAD,
2301         /* order */
2302         0xE9, 0x5E, 0x4A, 0x5F, 0x73, 0x70, 0x59, 0xDC, 0x60, 0xDF, 0x59, 0x91,
2303         0xD4, 0x50, 0x29, 0x40, 0x9E, 0x60, 0xFC, 0x09
2304     }
2305 };
2306 
2307 static const struct {
2308     EC_CURVE_DATA h;
2309     unsigned char data[0 + 24 * 6];
2310 } _EC_brainpoolP192r1 = {
2311     {
2312         NID_X9_62_prime_field, 0, 24, 1
2313     },
2314     {
2315         /* no seed */
2316         /* p */
2317         0xC3, 0x02, 0xF4, 0x1D, 0x93, 0x2A, 0x36, 0xCD, 0xA7, 0xA3, 0x46, 0x30,
2318         0x93, 0xD1, 0x8D, 0xB7, 0x8F, 0xCE, 0x47, 0x6D, 0xE1, 0xA8, 0x62, 0x97,
2319         /* a */
2320         0x6A, 0x91, 0x17, 0x40, 0x76, 0xB1, 0xE0, 0xE1, 0x9C, 0x39, 0xC0, 0x31,
2321         0xFE, 0x86, 0x85, 0xC1, 0xCA, 0xE0, 0x40, 0xE5, 0xC6, 0x9A, 0x28, 0xEF,
2322         /* b */
2323         0x46, 0x9A, 0x28, 0xEF, 0x7C, 0x28, 0xCC, 0xA3, 0xDC, 0x72, 0x1D, 0x04,
2324         0x4F, 0x44, 0x96, 0xBC, 0xCA, 0x7E, 0xF4, 0x14, 0x6F, 0xBF, 0x25, 0xC9,
2325         /* x */
2326         0xC0, 0xA0, 0x64, 0x7E, 0xAA, 0xB6, 0xA4, 0x87, 0x53, 0xB0, 0x33, 0xC5,
2327         0x6C, 0xB0, 0xF0, 0x90, 0x0A, 0x2F, 0x5C, 0x48, 0x53, 0x37, 0x5F, 0xD6,
2328         /* y */
2329         0x14, 0xB6, 0x90, 0x86, 0x6A, 0xBD, 0x5B, 0xB8, 0x8B, 0x5F, 0x48, 0x28,
2330         0xC1, 0x49, 0x00, 0x02, 0xE6, 0x77, 0x3F, 0xA2, 0xFA, 0x29, 0x9B, 0x8F,
2331         /* order */
2332         0xC3, 0x02, 0xF4, 0x1D, 0x93, 0x2A, 0x36, 0xCD, 0xA7, 0xA3, 0x46, 0x2F,
2333         0x9E, 0x9E, 0x91, 0x6B, 0x5B, 0xE8, 0xF1, 0x02, 0x9A, 0xC4, 0xAC, 0xC1
2334     }
2335 };
2336 
2337 static const struct {
2338     EC_CURVE_DATA h;
2339     unsigned char data[0 + 24 * 6];
2340 } _EC_brainpoolP192t1 = {
2341     {
2342         NID_X9_62_prime_field, 0, 24, 1
2343     },
2344     {
2345         /* no seed */
2346         /* p */
2347         0xC3, 0x02, 0xF4, 0x1D, 0x93, 0x2A, 0x36, 0xCD, 0xA7, 0xA3, 0x46, 0x30,
2348         0x93, 0xD1, 0x8D, 0xB7, 0x8F, 0xCE, 0x47, 0x6D, 0xE1, 0xA8, 0x62, 0x97,
2349         /* a */
2350         0xC3, 0x02, 0xF4, 0x1D, 0x93, 0x2A, 0x36, 0xCD, 0xA7, 0xA3, 0x46, 0x30,
2351         0x93, 0xD1, 0x8D, 0xB7, 0x8F, 0xCE, 0x47, 0x6D, 0xE1, 0xA8, 0x62, 0x94,
2352         /* b */
2353         0x13, 0xD5, 0x6F, 0xFA, 0xEC, 0x78, 0x68, 0x1E, 0x68, 0xF9, 0xDE, 0xB4,
2354         0x3B, 0x35, 0xBE, 0xC2, 0xFB, 0x68, 0x54, 0x2E, 0x27, 0x89, 0x7B, 0x79,
2355         /* x */
2356         0x3A, 0xE9, 0xE5, 0x8C, 0x82, 0xF6, 0x3C, 0x30, 0x28, 0x2E, 0x1F, 0xE7,
2357         0xBB, 0xF4, 0x3F, 0xA7, 0x2C, 0x44, 0x6A, 0xF6, 0xF4, 0x61, 0x81, 0x29,
2358         /* y */
2359         0x09, 0x7E, 0x2C, 0x56, 0x67, 0xC2, 0x22, 0x3A, 0x90, 0x2A, 0xB5, 0xCA,
2360         0x44, 0x9D, 0x00, 0x84, 0xB7, 0xE5, 0xB3, 0xDE, 0x7C, 0xCC, 0x01, 0xC9,
2361         /* order */
2362         0xC3, 0x02, 0xF4, 0x1D, 0x93, 0x2A, 0x36, 0xCD, 0xA7, 0xA3, 0x46, 0x2F,
2363         0x9E, 0x9E, 0x91, 0x6B, 0x5B, 0xE8, 0xF1, 0x02, 0x9A, 0xC4, 0xAC, 0xC1
2364     }
2365 };
2366 
2367 static const struct {
2368     EC_CURVE_DATA h;
2369     unsigned char data[0 + 28 * 6];
2370 } _EC_brainpoolP224r1 = {
2371     {
2372         NID_X9_62_prime_field, 0, 28, 1
2373     },
2374     {
2375         /* no seed */
2376         /* p */
2377         0xD7, 0xC1, 0x34, 0xAA, 0x26, 0x43, 0x66, 0x86, 0x2A, 0x18, 0x30, 0x25,
2378         0x75, 0xD1, 0xD7, 0x87, 0xB0, 0x9F, 0x07, 0x57, 0x97, 0xDA, 0x89, 0xF5,
2379         0x7E, 0xC8, 0xC0, 0xFF,
2380         /* a */
2381         0x68, 0xA5, 0xE6, 0x2C, 0xA9, 0xCE, 0x6C, 0x1C, 0x29, 0x98, 0x03, 0xA6,
2382         0xC1, 0x53, 0x0B, 0x51, 0x4E, 0x18, 0x2A, 0xD8, 0xB0, 0x04, 0x2A, 0x59,
2383         0xCA, 0xD2, 0x9F, 0x43,
2384         /* b */
2385         0x25, 0x80, 0xF6, 0x3C, 0xCF, 0xE4, 0x41, 0x38, 0x87, 0x07, 0x13, 0xB1,
2386         0xA9, 0x23, 0x69, 0xE3, 0x3E, 0x21, 0x35, 0xD2, 0x66, 0xDB, 0xB3, 0x72,
2387         0x38, 0x6C, 0x40, 0x0B,
2388         /* x */
2389         0x0D, 0x90, 0x29, 0xAD, 0x2C, 0x7E, 0x5C, 0xF4, 0x34, 0x08, 0x23, 0xB2,
2390         0xA8, 0x7D, 0xC6, 0x8C, 0x9E, 0x4C, 0xE3, 0x17, 0x4C, 0x1E, 0x6E, 0xFD,
2391         0xEE, 0x12, 0xC0, 0x7D,
2392         /* y */
2393         0x58, 0xAA, 0x56, 0xF7, 0x72, 0xC0, 0x72, 0x6F, 0x24, 0xC6, 0xB8, 0x9E,
2394         0x4E, 0xCD, 0xAC, 0x24, 0x35, 0x4B, 0x9E, 0x99, 0xCA, 0xA3, 0xF6, 0xD3,
2395         0x76, 0x14, 0x02, 0xCD,
2396         /* order */
2397         0xD7, 0xC1, 0x34, 0xAA, 0x26, 0x43, 0x66, 0x86, 0x2A, 0x18, 0x30, 0x25,
2398         0x75, 0xD0, 0xFB, 0x98, 0xD1, 0x16, 0xBC, 0x4B, 0x6D, 0xDE, 0xBC, 0xA3,
2399         0xA5, 0xA7, 0x93, 0x9F
2400     }
2401 };
2402 
2403 static const struct {
2404     EC_CURVE_DATA h;
2405     unsigned char data[0 + 28 * 6];
2406 } _EC_brainpoolP224t1 = {
2407     {
2408         NID_X9_62_prime_field, 0, 28, 1
2409     },
2410     {
2411         /* no seed */
2412         /* p */
2413         0xD7, 0xC1, 0x34, 0xAA, 0x26, 0x43, 0x66, 0x86, 0x2A, 0x18, 0x30, 0x25,
2414         0x75, 0xD1, 0xD7, 0x87, 0xB0, 0x9F, 0x07, 0x57, 0x97, 0xDA, 0x89, 0xF5,
2415         0x7E, 0xC8, 0xC0, 0xFF,
2416         /* a */
2417         0xD7, 0xC1, 0x34, 0xAA, 0x26, 0x43, 0x66, 0x86, 0x2A, 0x18, 0x30, 0x25,
2418         0x75, 0xD1, 0xD7, 0x87, 0xB0, 0x9F, 0x07, 0x57, 0x97, 0xDA, 0x89, 0xF5,
2419         0x7E, 0xC8, 0xC0, 0xFC,
2420         /* b */
2421         0x4B, 0x33, 0x7D, 0x93, 0x41, 0x04, 0xCD, 0x7B, 0xEF, 0x27, 0x1B, 0xF6,
2422         0x0C, 0xED, 0x1E, 0xD2, 0x0D, 0xA1, 0x4C, 0x08, 0xB3, 0xBB, 0x64, 0xF1,
2423         0x8A, 0x60, 0x88, 0x8D,
2424         /* x */
2425         0x6A, 0xB1, 0xE3, 0x44, 0xCE, 0x25, 0xFF, 0x38, 0x96, 0x42, 0x4E, 0x7F,
2426         0xFE, 0x14, 0x76, 0x2E, 0xCB, 0x49, 0xF8, 0x92, 0x8A, 0xC0, 0xC7, 0x60,
2427         0x29, 0xB4, 0xD5, 0x80,
2428         /* y */
2429         0x03, 0x74, 0xE9, 0xF5, 0x14, 0x3E, 0x56, 0x8C, 0xD2, 0x3F, 0x3F, 0x4D,
2430         0x7C, 0x0D, 0x4B, 0x1E, 0x41, 0xC8, 0xCC, 0x0D, 0x1C, 0x6A, 0xBD, 0x5F,
2431         0x1A, 0x46, 0xDB, 0x4C,
2432         /* order */
2433         0xD7, 0xC1, 0x34, 0xAA, 0x26, 0x43, 0x66, 0x86, 0x2A, 0x18, 0x30, 0x25,
2434         0x75, 0xD0, 0xFB, 0x98, 0xD1, 0x16, 0xBC, 0x4B, 0x6D, 0xDE, 0xBC, 0xA3,
2435         0xA5, 0xA7, 0x93, 0x9F
2436     }
2437 };
2438 
2439 static const struct {
2440     EC_CURVE_DATA h;
2441     unsigned char data[0 + 32 * 6];
2442 } _EC_brainpoolP256r1 = {
2443     {
2444         NID_X9_62_prime_field, 0, 32, 1
2445     },
2446     {
2447         /* no seed */
2448         /* p */
2449         0xA9, 0xFB, 0x57, 0xDB, 0xA1, 0xEE, 0xA9, 0xBC, 0x3E, 0x66, 0x0A, 0x90,
2450         0x9D, 0x83, 0x8D, 0x72, 0x6E, 0x3B, 0xF6, 0x23, 0xD5, 0x26, 0x20, 0x28,
2451         0x20, 0x13, 0x48, 0x1D, 0x1F, 0x6E, 0x53, 0x77,
2452         /* a */
2453         0x7D, 0x5A, 0x09, 0x75, 0xFC, 0x2C, 0x30, 0x57, 0xEE, 0xF6, 0x75, 0x30,
2454         0x41, 0x7A, 0xFF, 0xE7, 0xFB, 0x80, 0x55, 0xC1, 0x26, 0xDC, 0x5C, 0x6C,
2455         0xE9, 0x4A, 0x4B, 0x44, 0xF3, 0x30, 0xB5, 0xD9,
2456         /* b */
2457         0x26, 0xDC, 0x5C, 0x6C, 0xE9, 0x4A, 0x4B, 0x44, 0xF3, 0x30, 0xB5, 0xD9,
2458         0xBB, 0xD7, 0x7C, 0xBF, 0x95, 0x84, 0x16, 0x29, 0x5C, 0xF7, 0xE1, 0xCE,
2459         0x6B, 0xCC, 0xDC, 0x18, 0xFF, 0x8C, 0x07, 0xB6,
2460         /* x */
2461         0x8B, 0xD2, 0xAE, 0xB9, 0xCB, 0x7E, 0x57, 0xCB, 0x2C, 0x4B, 0x48, 0x2F,
2462         0xFC, 0x81, 0xB7, 0xAF, 0xB9, 0xDE, 0x27, 0xE1, 0xE3, 0xBD, 0x23, 0xC2,
2463         0x3A, 0x44, 0x53, 0xBD, 0x9A, 0xCE, 0x32, 0x62,
2464         /* y */
2465         0x54, 0x7E, 0xF8, 0x35, 0xC3, 0xDA, 0xC4, 0xFD, 0x97, 0xF8, 0x46, 0x1A,
2466         0x14, 0x61, 0x1D, 0xC9, 0xC2, 0x77, 0x45, 0x13, 0x2D, 0xED, 0x8E, 0x54,
2467         0x5C, 0x1D, 0x54, 0xC7, 0x2F, 0x04, 0x69, 0x97,
2468         /* order */
2469         0xA9, 0xFB, 0x57, 0xDB, 0xA1, 0xEE, 0xA9, 0xBC, 0x3E, 0x66, 0x0A, 0x90,
2470         0x9D, 0x83, 0x8D, 0x71, 0x8C, 0x39, 0x7A, 0xA3, 0xB5, 0x61, 0xA6, 0xF7,
2471         0x90, 0x1E, 0x0E, 0x82, 0x97, 0x48, 0x56, 0xA7
2472     }
2473 };
2474 
2475 static const struct {
2476     EC_CURVE_DATA h;
2477     unsigned char data[0 + 32 * 6];
2478 } _EC_brainpoolP256t1 = {
2479     {
2480         NID_X9_62_prime_field, 0, 32, 1
2481     },
2482     {
2483         /* no seed */
2484         /* p */
2485         0xA9, 0xFB, 0x57, 0xDB, 0xA1, 0xEE, 0xA9, 0xBC, 0x3E, 0x66, 0x0A, 0x90,
2486         0x9D, 0x83, 0x8D, 0x72, 0x6E, 0x3B, 0xF6, 0x23, 0xD5, 0x26, 0x20, 0x28,
2487         0x20, 0x13, 0x48, 0x1D, 0x1F, 0x6E, 0x53, 0x77,
2488         /* a */
2489         0xA9, 0xFB, 0x57, 0xDB, 0xA1, 0xEE, 0xA9, 0xBC, 0x3E, 0x66, 0x0A, 0x90,
2490         0x9D, 0x83, 0x8D, 0x72, 0x6E, 0x3B, 0xF6, 0x23, 0xD5, 0x26, 0x20, 0x28,
2491         0x20, 0x13, 0x48, 0x1D, 0x1F, 0x6E, 0x53, 0x74,
2492         /* b */
2493         0x66, 0x2C, 0x61, 0xC4, 0x30, 0xD8, 0x4E, 0xA4, 0xFE, 0x66, 0xA7, 0x73,
2494         0x3D, 0x0B, 0x76, 0xB7, 0xBF, 0x93, 0xEB, 0xC4, 0xAF, 0x2F, 0x49, 0x25,
2495         0x6A, 0xE5, 0x81, 0x01, 0xFE, 0xE9, 0x2B, 0x04,
2496         /* x */
2497         0xA3, 0xE8, 0xEB, 0x3C, 0xC1, 0xCF, 0xE7, 0xB7, 0x73, 0x22, 0x13, 0xB2,
2498         0x3A, 0x65, 0x61, 0x49, 0xAF, 0xA1, 0x42, 0xC4, 0x7A, 0xAF, 0xBC, 0x2B,
2499         0x79, 0xA1, 0x91, 0x56, 0x2E, 0x13, 0x05, 0xF4,
2500         /* y */
2501         0x2D, 0x99, 0x6C, 0x82, 0x34, 0x39, 0xC5, 0x6D, 0x7F, 0x7B, 0x22, 0xE1,
2502         0x46, 0x44, 0x41, 0x7E, 0x69, 0xBC, 0xB6, 0xDE, 0x39, 0xD0, 0x27, 0x00,
2503         0x1D, 0xAB, 0xE8, 0xF3, 0x5B, 0x25, 0xC9, 0xBE,
2504         /* order */
2505         0xA9, 0xFB, 0x57, 0xDB, 0xA1, 0xEE, 0xA9, 0xBC, 0x3E, 0x66, 0x0A, 0x90,
2506         0x9D, 0x83, 0x8D, 0x71, 0x8C, 0x39, 0x7A, 0xA3, 0xB5, 0x61, 0xA6, 0xF7,
2507         0x90, 0x1E, 0x0E, 0x82, 0x97, 0x48, 0x56, 0xA7
2508     }
2509 };
2510 
2511 static const struct {
2512     EC_CURVE_DATA h;
2513     unsigned char data[0 + 40 * 6];
2514 } _EC_brainpoolP320r1 = {
2515     {
2516         NID_X9_62_prime_field, 0, 40, 1
2517     },
2518     {
2519         /* no seed */
2520         /* p */
2521         0xD3, 0x5E, 0x47, 0x20, 0x36, 0xBC, 0x4F, 0xB7, 0xE1, 0x3C, 0x78, 0x5E,
2522         0xD2, 0x01, 0xE0, 0x65, 0xF9, 0x8F, 0xCF, 0xA6, 0xF6, 0xF4, 0x0D, 0xEF,
2523         0x4F, 0x92, 0xB9, 0xEC, 0x78, 0x93, 0xEC, 0x28, 0xFC, 0xD4, 0x12, 0xB1,
2524         0xF1, 0xB3, 0x2E, 0x27,
2525         /* a */
2526         0x3E, 0xE3, 0x0B, 0x56, 0x8F, 0xBA, 0xB0, 0xF8, 0x83, 0xCC, 0xEB, 0xD4,
2527         0x6D, 0x3F, 0x3B, 0xB8, 0xA2, 0xA7, 0x35, 0x13, 0xF5, 0xEB, 0x79, 0xDA,
2528         0x66, 0x19, 0x0E, 0xB0, 0x85, 0xFF, 0xA9, 0xF4, 0x92, 0xF3, 0x75, 0xA9,
2529         0x7D, 0x86, 0x0E, 0xB4,
2530         /* b */
2531         0x52, 0x08, 0x83, 0x94, 0x9D, 0xFD, 0xBC, 0x42, 0xD3, 0xAD, 0x19, 0x86,
2532         0x40, 0x68, 0x8A, 0x6F, 0xE1, 0x3F, 0x41, 0x34, 0x95, 0x54, 0xB4, 0x9A,
2533         0xCC, 0x31, 0xDC, 0xCD, 0x88, 0x45, 0x39, 0x81, 0x6F, 0x5E, 0xB4, 0xAC,
2534         0x8F, 0xB1, 0xF1, 0xA6,
2535         /* x */
2536         0x43, 0xBD, 0x7E, 0x9A, 0xFB, 0x53, 0xD8, 0xB8, 0x52, 0x89, 0xBC, 0xC4,
2537         0x8E, 0xE5, 0xBF, 0xE6, 0xF2, 0x01, 0x37, 0xD1, 0x0A, 0x08, 0x7E, 0xB6,
2538         0xE7, 0x87, 0x1E, 0x2A, 0x10, 0xA5, 0x99, 0xC7, 0x10, 0xAF, 0x8D, 0x0D,
2539         0x39, 0xE2, 0x06, 0x11,
2540         /* y */
2541         0x14, 0xFD, 0xD0, 0x55, 0x45, 0xEC, 0x1C, 0xC8, 0xAB, 0x40, 0x93, 0x24,
2542         0x7F, 0x77, 0x27, 0x5E, 0x07, 0x43, 0xFF, 0xED, 0x11, 0x71, 0x82, 0xEA,
2543         0xA9, 0xC7, 0x78, 0x77, 0xAA, 0xAC, 0x6A, 0xC7, 0xD3, 0x52, 0x45, 0xD1,
2544         0x69, 0x2E, 0x8E, 0xE1,
2545         /* order */
2546         0xD3, 0x5E, 0x47, 0x20, 0x36, 0xBC, 0x4F, 0xB7, 0xE1, 0x3C, 0x78, 0x5E,
2547         0xD2, 0x01, 0xE0, 0x65, 0xF9, 0x8F, 0xCF, 0xA5, 0xB6, 0x8F, 0x12, 0xA3,
2548         0x2D, 0x48, 0x2E, 0xC7, 0xEE, 0x86, 0x58, 0xE9, 0x86, 0x91, 0x55, 0x5B,
2549         0x44, 0xC5, 0x93, 0x11
2550     }
2551 };
2552 
2553 static const struct {
2554     EC_CURVE_DATA h;
2555     unsigned char data[0 + 40 * 6];
2556 } _EC_brainpoolP320t1 = {
2557     {
2558         NID_X9_62_prime_field, 0, 40, 1
2559     },
2560     {
2561         /* no seed */
2562         /* p */
2563         0xD3, 0x5E, 0x47, 0x20, 0x36, 0xBC, 0x4F, 0xB7, 0xE1, 0x3C, 0x78, 0x5E,
2564         0xD2, 0x01, 0xE0, 0x65, 0xF9, 0x8F, 0xCF, 0xA6, 0xF6, 0xF4, 0x0D, 0xEF,
2565         0x4F, 0x92, 0xB9, 0xEC, 0x78, 0x93, 0xEC, 0x28, 0xFC, 0xD4, 0x12, 0xB1,
2566         0xF1, 0xB3, 0x2E, 0x27,
2567         /* a */
2568         0xD3, 0x5E, 0x47, 0x20, 0x36, 0xBC, 0x4F, 0xB7, 0xE1, 0x3C, 0x78, 0x5E,
2569         0xD2, 0x01, 0xE0, 0x65, 0xF9, 0x8F, 0xCF, 0xA6, 0xF6, 0xF4, 0x0D, 0xEF,
2570         0x4F, 0x92, 0xB9, 0xEC, 0x78, 0x93, 0xEC, 0x28, 0xFC, 0xD4, 0x12, 0xB1,
2571         0xF1, 0xB3, 0x2E, 0x24,
2572         /* b */
2573         0xA7, 0xF5, 0x61, 0xE0, 0x38, 0xEB, 0x1E, 0xD5, 0x60, 0xB3, 0xD1, 0x47,
2574         0xDB, 0x78, 0x20, 0x13, 0x06, 0x4C, 0x19, 0xF2, 0x7E, 0xD2, 0x7C, 0x67,
2575         0x80, 0xAA, 0xF7, 0x7F, 0xB8, 0xA5, 0x47, 0xCE, 0xB5, 0xB4, 0xFE, 0xF4,
2576         0x22, 0x34, 0x03, 0x53,
2577         /* x */
2578         0x92, 0x5B, 0xE9, 0xFB, 0x01, 0xAF, 0xC6, 0xFB, 0x4D, 0x3E, 0x7D, 0x49,
2579         0x90, 0x01, 0x0F, 0x81, 0x34, 0x08, 0xAB, 0x10, 0x6C, 0x4F, 0x09, 0xCB,
2580         0x7E, 0xE0, 0x78, 0x68, 0xCC, 0x13, 0x6F, 0xFF, 0x33, 0x57, 0xF6, 0x24,
2581         0xA2, 0x1B, 0xED, 0x52,
2582         /* y */
2583         0x63, 0xBA, 0x3A, 0x7A, 0x27, 0x48, 0x3E, 0xBF, 0x66, 0x71, 0xDB, 0xEF,
2584         0x7A, 0xBB, 0x30, 0xEB, 0xEE, 0x08, 0x4E, 0x58, 0xA0, 0xB0, 0x77, 0xAD,
2585         0x42, 0xA5, 0xA0, 0x98, 0x9D, 0x1E, 0xE7, 0x1B, 0x1B, 0x9B, 0xC0, 0x45,
2586         0x5F, 0xB0, 0xD2, 0xC3,
2587         /* order */
2588         0xD3, 0x5E, 0x47, 0x20, 0x36, 0xBC, 0x4F, 0xB7, 0xE1, 0x3C, 0x78, 0x5E,
2589         0xD2, 0x01, 0xE0, 0x65, 0xF9, 0x8F, 0xCF, 0xA5, 0xB6, 0x8F, 0x12, 0xA3,
2590         0x2D, 0x48, 0x2E, 0xC7, 0xEE, 0x86, 0x58, 0xE9, 0x86, 0x91, 0x55, 0x5B,
2591         0x44, 0xC5, 0x93, 0x11
2592     }
2593 };
2594 
2595 static const struct {
2596     EC_CURVE_DATA h;
2597     unsigned char data[0 + 48 * 6];
2598 } _EC_brainpoolP384r1 = {
2599     {
2600         NID_X9_62_prime_field, 0, 48, 1
2601     },
2602     {
2603         /* no seed */
2604         /* p */
2605         0x8C, 0xB9, 0x1E, 0x82, 0xA3, 0x38, 0x6D, 0x28, 0x0F, 0x5D, 0x6F, 0x7E,
2606         0x50, 0xE6, 0x41, 0xDF, 0x15, 0x2F, 0x71, 0x09, 0xED, 0x54, 0x56, 0xB4,
2607         0x12, 0xB1, 0xDA, 0x19, 0x7F, 0xB7, 0x11, 0x23, 0xAC, 0xD3, 0xA7, 0x29,
2608         0x90, 0x1D, 0x1A, 0x71, 0x87, 0x47, 0x00, 0x13, 0x31, 0x07, 0xEC, 0x53,
2609         /* a */
2610         0x7B, 0xC3, 0x82, 0xC6, 0x3D, 0x8C, 0x15, 0x0C, 0x3C, 0x72, 0x08, 0x0A,
2611         0xCE, 0x05, 0xAF, 0xA0, 0xC2, 0xBE, 0xA2, 0x8E, 0x4F, 0xB2, 0x27, 0x87,
2612         0x13, 0x91, 0x65, 0xEF, 0xBA, 0x91, 0xF9, 0x0F, 0x8A, 0xA5, 0x81, 0x4A,
2613         0x50, 0x3A, 0xD4, 0xEB, 0x04, 0xA8, 0xC7, 0xDD, 0x22, 0xCE, 0x28, 0x26,
2614         /* b */
2615         0x04, 0xA8, 0xC7, 0xDD, 0x22, 0xCE, 0x28, 0x26, 0x8B, 0x39, 0xB5, 0x54,
2616         0x16, 0xF0, 0x44, 0x7C, 0x2F, 0xB7, 0x7D, 0xE1, 0x07, 0xDC, 0xD2, 0xA6,
2617         0x2E, 0x88, 0x0E, 0xA5, 0x3E, 0xEB, 0x62, 0xD5, 0x7C, 0xB4, 0x39, 0x02,
2618         0x95, 0xDB, 0xC9, 0x94, 0x3A, 0xB7, 0x86, 0x96, 0xFA, 0x50, 0x4C, 0x11,
2619         /* x */
2620         0x1D, 0x1C, 0x64, 0xF0, 0x68, 0xCF, 0x45, 0xFF, 0xA2, 0xA6, 0x3A, 0x81,
2621         0xB7, 0xC1, 0x3F, 0x6B, 0x88, 0x47, 0xA3, 0xE7, 0x7E, 0xF1, 0x4F, 0xE3,
2622         0xDB, 0x7F, 0xCA, 0xFE, 0x0C, 0xBD, 0x10, 0xE8, 0xE8, 0x26, 0xE0, 0x34,
2623         0x36, 0xD6, 0x46, 0xAA, 0xEF, 0x87, 0xB2, 0xE2, 0x47, 0xD4, 0xAF, 0x1E,
2624         /* y */
2625         0x8A, 0xBE, 0x1D, 0x75, 0x20, 0xF9, 0xC2, 0xA4, 0x5C, 0xB1, 0xEB, 0x8E,
2626         0x95, 0xCF, 0xD5, 0x52, 0x62, 0xB7, 0x0B, 0x29, 0xFE, 0xEC, 0x58, 0x64,
2627         0xE1, 0x9C, 0x05, 0x4F, 0xF9, 0x91, 0x29, 0x28, 0x0E, 0x46, 0x46, 0x21,
2628         0x77, 0x91, 0x81, 0x11, 0x42, 0x82, 0x03, 0x41, 0x26, 0x3C, 0x53, 0x15,
2629         /* order */
2630         0x8C, 0xB9, 0x1E, 0x82, 0xA3, 0x38, 0x6D, 0x28, 0x0F, 0x5D, 0x6F, 0x7E,
2631         0x50, 0xE6, 0x41, 0xDF, 0x15, 0x2F, 0x71, 0x09, 0xED, 0x54, 0x56, 0xB3,
2632         0x1F, 0x16, 0x6E, 0x6C, 0xAC, 0x04, 0x25, 0xA7, 0xCF, 0x3A, 0xB6, 0xAF,
2633         0x6B, 0x7F, 0xC3, 0x10, 0x3B, 0x88, 0x32, 0x02, 0xE9, 0x04, 0x65, 0x65
2634     }
2635 };
2636 
2637 static const struct {
2638     EC_CURVE_DATA h;
2639     unsigned char data[0 + 48 * 6];
2640 } _EC_brainpoolP384t1 = {
2641     {
2642         NID_X9_62_prime_field, 0, 48, 1
2643     },
2644     {
2645         /* no seed */
2646         /* p */
2647         0x8C, 0xB9, 0x1E, 0x82, 0xA3, 0x38, 0x6D, 0x28, 0x0F, 0x5D, 0x6F, 0x7E,
2648         0x50, 0xE6, 0x41, 0xDF, 0x15, 0x2F, 0x71, 0x09, 0xED, 0x54, 0x56, 0xB4,
2649         0x12, 0xB1, 0xDA, 0x19, 0x7F, 0xB7, 0x11, 0x23, 0xAC, 0xD3, 0xA7, 0x29,
2650         0x90, 0x1D, 0x1A, 0x71, 0x87, 0x47, 0x00, 0x13, 0x31, 0x07, 0xEC, 0x53,
2651         /* a */
2652         0x8C, 0xB9, 0x1E, 0x82, 0xA3, 0x38, 0x6D, 0x28, 0x0F, 0x5D, 0x6F, 0x7E,
2653         0x50, 0xE6, 0x41, 0xDF, 0x15, 0x2F, 0x71, 0x09, 0xED, 0x54, 0x56, 0xB4,
2654         0x12, 0xB1, 0xDA, 0x19, 0x7F, 0xB7, 0x11, 0x23, 0xAC, 0xD3, 0xA7, 0x29,
2655         0x90, 0x1D, 0x1A, 0x71, 0x87, 0x47, 0x00, 0x13, 0x31, 0x07, 0xEC, 0x50,
2656         /* b */
2657         0x7F, 0x51, 0x9E, 0xAD, 0xA7, 0xBD, 0xA8, 0x1B, 0xD8, 0x26, 0xDB, 0xA6,
2658         0x47, 0x91, 0x0F, 0x8C, 0x4B, 0x93, 0x46, 0xED, 0x8C, 0xCD, 0xC6, 0x4E,
2659         0x4B, 0x1A, 0xBD, 0x11, 0x75, 0x6D, 0xCE, 0x1D, 0x20, 0x74, 0xAA, 0x26,
2660         0x3B, 0x88, 0x80, 0x5C, 0xED, 0x70, 0x35, 0x5A, 0x33, 0xB4, 0x71, 0xEE,
2661         /* x */
2662         0x18, 0xDE, 0x98, 0xB0, 0x2D, 0xB9, 0xA3, 0x06, 0xF2, 0xAF, 0xCD, 0x72,
2663         0x35, 0xF7, 0x2A, 0x81, 0x9B, 0x80, 0xAB, 0x12, 0xEB, 0xD6, 0x53, 0x17,
2664         0x24, 0x76, 0xFE, 0xCD, 0x46, 0x2A, 0xAB, 0xFF, 0xC4, 0xFF, 0x19, 0x1B,
2665         0x94, 0x6A, 0x5F, 0x54, 0xD8, 0xD0, 0xAA, 0x2F, 0x41, 0x88, 0x08, 0xCC,
2666         /* y */
2667         0x25, 0xAB, 0x05, 0x69, 0x62, 0xD3, 0x06, 0x51, 0xA1, 0x14, 0xAF, 0xD2,
2668         0x75, 0x5A, 0xD3, 0x36, 0x74, 0x7F, 0x93, 0x47, 0x5B, 0x7A, 0x1F, 0xCA,
2669         0x3B, 0x88, 0xF2, 0xB6, 0xA2, 0x08, 0xCC, 0xFE, 0x46, 0x94, 0x08, 0x58,
2670         0x4D, 0xC2, 0xB2, 0x91, 0x26, 0x75, 0xBF, 0x5B, 0x9E, 0x58, 0x29, 0x28,
2671         /* order */
2672         0x8C, 0xB9, 0x1E, 0x82, 0xA3, 0x38, 0x6D, 0x28, 0x0F, 0x5D, 0x6F, 0x7E,
2673         0x50, 0xE6, 0x41, 0xDF, 0x15, 0x2F, 0x71, 0x09, 0xED, 0x54, 0x56, 0xB3,
2674         0x1F, 0x16, 0x6E, 0x6C, 0xAC, 0x04, 0x25, 0xA7, 0xCF, 0x3A, 0xB6, 0xAF,
2675         0x6B, 0x7F, 0xC3, 0x10, 0x3B, 0x88, 0x32, 0x02, 0xE9, 0x04, 0x65, 0x65
2676     }
2677 };
2678 
2679 static const struct {
2680     EC_CURVE_DATA h;
2681     unsigned char data[0 + 64 * 6];
2682 } _EC_brainpoolP512r1 = {
2683     {
2684         NID_X9_62_prime_field, 0, 64, 1
2685     },
2686     {
2687         /* no seed */
2688         /* p */
2689         0xAA, 0xDD, 0x9D, 0xB8, 0xDB, 0xE9, 0xC4, 0x8B, 0x3F, 0xD4, 0xE6, 0xAE,
2690         0x33, 0xC9, 0xFC, 0x07, 0xCB, 0x30, 0x8D, 0xB3, 0xB3, 0xC9, 0xD2, 0x0E,
2691         0xD6, 0x63, 0x9C, 0xCA, 0x70, 0x33, 0x08, 0x71, 0x7D, 0x4D, 0x9B, 0x00,
2692         0x9B, 0xC6, 0x68, 0x42, 0xAE, 0xCD, 0xA1, 0x2A, 0xE6, 0xA3, 0x80, 0xE6,
2693         0x28, 0x81, 0xFF, 0x2F, 0x2D, 0x82, 0xC6, 0x85, 0x28, 0xAA, 0x60, 0x56,
2694         0x58, 0x3A, 0x48, 0xF3,
2695         /* a */
2696         0x78, 0x30, 0xA3, 0x31, 0x8B, 0x60, 0x3B, 0x89, 0xE2, 0x32, 0x71, 0x45,
2697         0xAC, 0x23, 0x4C, 0xC5, 0x94, 0xCB, 0xDD, 0x8D, 0x3D, 0xF9, 0x16, 0x10,
2698         0xA8, 0x34, 0x41, 0xCA, 0xEA, 0x98, 0x63, 0xBC, 0x2D, 0xED, 0x5D, 0x5A,
2699         0xA8, 0x25, 0x3A, 0xA1, 0x0A, 0x2E, 0xF1, 0xC9, 0x8B, 0x9A, 0xC8, 0xB5,
2700         0x7F, 0x11, 0x17, 0xA7, 0x2B, 0xF2, 0xC7, 0xB9, 0xE7, 0xC1, 0xAC, 0x4D,
2701         0x77, 0xFC, 0x94, 0xCA,
2702         /* b */
2703         0x3D, 0xF9, 0x16, 0x10, 0xA8, 0x34, 0x41, 0xCA, 0xEA, 0x98, 0x63, 0xBC,
2704         0x2D, 0xED, 0x5D, 0x5A, 0xA8, 0x25, 0x3A, 0xA1, 0x0A, 0x2E, 0xF1, 0xC9,
2705         0x8B, 0x9A, 0xC8, 0xB5, 0x7F, 0x11, 0x17, 0xA7, 0x2B, 0xF2, 0xC7, 0xB9,
2706         0xE7, 0xC1, 0xAC, 0x4D, 0x77, 0xFC, 0x94, 0xCA, 0xDC, 0x08, 0x3E, 0x67,
2707         0x98, 0x40, 0x50, 0xB7, 0x5E, 0xBA, 0xE5, 0xDD, 0x28, 0x09, 0xBD, 0x63,
2708         0x80, 0x16, 0xF7, 0x23,
2709         /* x */
2710         0x81, 0xAE, 0xE4, 0xBD, 0xD8, 0x2E, 0xD9, 0x64, 0x5A, 0x21, 0x32, 0x2E,
2711         0x9C, 0x4C, 0x6A, 0x93, 0x85, 0xED, 0x9F, 0x70, 0xB5, 0xD9, 0x16, 0xC1,
2712         0xB4, 0x3B, 0x62, 0xEE, 0xF4, 0xD0, 0x09, 0x8E, 0xFF, 0x3B, 0x1F, 0x78,
2713         0xE2, 0xD0, 0xD4, 0x8D, 0x50, 0xD1, 0x68, 0x7B, 0x93, 0xB9, 0x7D, 0x5F,
2714         0x7C, 0x6D, 0x50, 0x47, 0x40, 0x6A, 0x5E, 0x68, 0x8B, 0x35, 0x22, 0x09,
2715         0xBC, 0xB9, 0xF8, 0x22,
2716         /* y */
2717         0x7D, 0xDE, 0x38, 0x5D, 0x56, 0x63, 0x32, 0xEC, 0xC0, 0xEA, 0xBF, 0xA9,
2718         0xCF, 0x78, 0x22, 0xFD, 0xF2, 0x09, 0xF7, 0x00, 0x24, 0xA5, 0x7B, 0x1A,
2719         0xA0, 0x00, 0xC5, 0x5B, 0x88, 0x1F, 0x81, 0x11, 0xB2, 0xDC, 0xDE, 0x49,
2720         0x4A, 0x5F, 0x48, 0x5E, 0x5B, 0xCA, 0x4B, 0xD8, 0x8A, 0x27, 0x63, 0xAE,
2721         0xD1, 0xCA, 0x2B, 0x2F, 0xA8, 0xF0, 0x54, 0x06, 0x78, 0xCD, 0x1E, 0x0F,
2722         0x3A, 0xD8, 0x08, 0x92,
2723         /* order */
2724         0xAA, 0xDD, 0x9D, 0xB8, 0xDB, 0xE9, 0xC4, 0x8B, 0x3F, 0xD4, 0xE6, 0xAE,
2725         0x33, 0xC9, 0xFC, 0x07, 0xCB, 0x30, 0x8D, 0xB3, 0xB3, 0xC9, 0xD2, 0x0E,
2726         0xD6, 0x63, 0x9C, 0xCA, 0x70, 0x33, 0x08, 0x70, 0x55, 0x3E, 0x5C, 0x41,
2727         0x4C, 0xA9, 0x26, 0x19, 0x41, 0x86, 0x61, 0x19, 0x7F, 0xAC, 0x10, 0x47,
2728         0x1D, 0xB1, 0xD3, 0x81, 0x08, 0x5D, 0xDA, 0xDD, 0xB5, 0x87, 0x96, 0x82,
2729         0x9C, 0xA9, 0x00, 0x69
2730     }
2731 };
2732 
2733 static const struct {
2734     EC_CURVE_DATA h;
2735     unsigned char data[0 + 64 * 6];
2736 } _EC_brainpoolP512t1 = {
2737     {
2738         NID_X9_62_prime_field, 0, 64, 1
2739     },
2740     {
2741         /* no seed */
2742         /* p */
2743         0xAA, 0xDD, 0x9D, 0xB8, 0xDB, 0xE9, 0xC4, 0x8B, 0x3F, 0xD4, 0xE6, 0xAE,
2744         0x33, 0xC9, 0xFC, 0x07, 0xCB, 0x30, 0x8D, 0xB3, 0xB3, 0xC9, 0xD2, 0x0E,
2745         0xD6, 0x63, 0x9C, 0xCA, 0x70, 0x33, 0x08, 0x71, 0x7D, 0x4D, 0x9B, 0x00,
2746         0x9B, 0xC6, 0x68, 0x42, 0xAE, 0xCD, 0xA1, 0x2A, 0xE6, 0xA3, 0x80, 0xE6,
2747         0x28, 0x81, 0xFF, 0x2F, 0x2D, 0x82, 0xC6, 0x85, 0x28, 0xAA, 0x60, 0x56,
2748         0x58, 0x3A, 0x48, 0xF3,
2749         /* a */
2750         0xAA, 0xDD, 0x9D, 0xB8, 0xDB, 0xE9, 0xC4, 0x8B, 0x3F, 0xD4, 0xE6, 0xAE,
2751         0x33, 0xC9, 0xFC, 0x07, 0xCB, 0x30, 0x8D, 0xB3, 0xB3, 0xC9, 0xD2, 0x0E,
2752         0xD6, 0x63, 0x9C, 0xCA, 0x70, 0x33, 0x08, 0x71, 0x7D, 0x4D, 0x9B, 0x00,
2753         0x9B, 0xC6, 0x68, 0x42, 0xAE, 0xCD, 0xA1, 0x2A, 0xE6, 0xA3, 0x80, 0xE6,
2754         0x28, 0x81, 0xFF, 0x2F, 0x2D, 0x82, 0xC6, 0x85, 0x28, 0xAA, 0x60, 0x56,
2755         0x58, 0x3A, 0x48, 0xF0,
2756         /* b */
2757         0x7C, 0xBB, 0xBC, 0xF9, 0x44, 0x1C, 0xFA, 0xB7, 0x6E, 0x18, 0x90, 0xE4,
2758         0x68, 0x84, 0xEA, 0xE3, 0x21, 0xF7, 0x0C, 0x0B, 0xCB, 0x49, 0x81, 0x52,
2759         0x78, 0x97, 0x50, 0x4B, 0xEC, 0x3E, 0x36, 0xA6, 0x2B, 0xCD, 0xFA, 0x23,
2760         0x04, 0x97, 0x65, 0x40, 0xF6, 0x45, 0x00, 0x85, 0xF2, 0xDA, 0xE1, 0x45,
2761         0xC2, 0x25, 0x53, 0xB4, 0x65, 0x76, 0x36, 0x89, 0x18, 0x0E, 0xA2, 0x57,
2762         0x18, 0x67, 0x42, 0x3E,
2763         /* x */
2764         0x64, 0x0E, 0xCE, 0x5C, 0x12, 0x78, 0x87, 0x17, 0xB9, 0xC1, 0xBA, 0x06,
2765         0xCB, 0xC2, 0xA6, 0xFE, 0xBA, 0x85, 0x84, 0x24, 0x58, 0xC5, 0x6D, 0xDE,
2766         0x9D, 0xB1, 0x75, 0x8D, 0x39, 0xC0, 0x31, 0x3D, 0x82, 0xBA, 0x51, 0x73,
2767         0x5C, 0xDB, 0x3E, 0xA4, 0x99, 0xAA, 0x77, 0xA7, 0xD6, 0x94, 0x3A, 0x64,
2768         0xF7, 0xA3, 0xF2, 0x5F, 0xE2, 0x6F, 0x06, 0xB5, 0x1B, 0xAA, 0x26, 0x96,
2769         0xFA, 0x90, 0x35, 0xDA,
2770         /* y */
2771         0x5B, 0x53, 0x4B, 0xD5, 0x95, 0xF5, 0xAF, 0x0F, 0xA2, 0xC8, 0x92, 0x37,
2772         0x6C, 0x84, 0xAC, 0xE1, 0xBB, 0x4E, 0x30, 0x19, 0xB7, 0x16, 0x34, 0xC0,
2773         0x11, 0x31, 0x15, 0x9C, 0xAE, 0x03, 0xCE, 0xE9, 0xD9, 0x93, 0x21, 0x84,
2774         0xBE, 0xEF, 0x21, 0x6B, 0xD7, 0x1D, 0xF2, 0xDA, 0xDF, 0x86, 0xA6, 0x27,
2775         0x30, 0x6E, 0xCF, 0xF9, 0x6D, 0xBB, 0x8B, 0xAC, 0xE1, 0x98, 0xB6, 0x1E,
2776         0x00, 0xF8, 0xB3, 0x32,
2777         /* order */
2778         0xAA, 0xDD, 0x9D, 0xB8, 0xDB, 0xE9, 0xC4, 0x8B, 0x3F, 0xD4, 0xE6, 0xAE,
2779         0x33, 0xC9, 0xFC, 0x07, 0xCB, 0x30, 0x8D, 0xB3, 0xB3, 0xC9, 0xD2, 0x0E,
2780         0xD6, 0x63, 0x9C, 0xCA, 0x70, 0x33, 0x08, 0x70, 0x55, 0x3E, 0x5C, 0x41,
2781         0x4C, 0xA9, 0x26, 0x19, 0x41, 0x86, 0x61, 0x19, 0x7F, 0xAC, 0x10, 0x47,
2782         0x1D, 0xB1, 0xD3, 0x81, 0x08, 0x5D, 0xDA, 0xDD, 0xB5, 0x87, 0x96, 0x82,
2783         0x9C, 0xA9, 0x00, 0x69
2784     }
2785 };
2786 #endif /* FIPS_MODULE */
2787 
2788 #if !defined(OPENSSL_NO_SM2) && !defined(FIPS_MODULE)
2789 static const struct {
2790     EC_CURVE_DATA h;
2791     unsigned char data[0 + 32 * 6];
2792 } _EC_sm2p256v1 = {
2793     {
2794        NID_X9_62_prime_field, 0, 32, 1
2795     },
2796     {
2797         /* no seed */
2798 
2799         /* p */
2800         0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
2801         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
2802         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
2803         /* a */
2804         0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
2805         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
2806         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
2807         /* b */
2808         0x28, 0xe9, 0xfa, 0x9e, 0x9d, 0x9f, 0x5e, 0x34, 0x4d, 0x5a, 0x9e, 0x4b,
2809         0xcf, 0x65, 0x09, 0xa7, 0xf3, 0x97, 0x89, 0xf5, 0x15, 0xab, 0x8f, 0x92,
2810         0xdd, 0xbc, 0xbd, 0x41, 0x4d, 0x94, 0x0e, 0x93,
2811         /* x */
2812         0x32, 0xc4, 0xae, 0x2c, 0x1f, 0x19, 0x81, 0x19, 0x5f, 0x99, 0x04, 0x46,
2813         0x6a, 0x39, 0xc9, 0x94, 0x8f, 0xe3, 0x0b, 0xbf, 0xf2, 0x66, 0x0b, 0xe1,
2814         0x71, 0x5a, 0x45, 0x89, 0x33, 0x4c, 0x74, 0xc7,
2815         /* y */
2816         0xbc, 0x37, 0x36, 0xa2, 0xf4, 0xf6, 0x77, 0x9c, 0x59, 0xbd, 0xce, 0xe3,
2817         0x6b, 0x69, 0x21, 0x53, 0xd0, 0xa9, 0x87, 0x7c, 0xc6, 0x2a, 0x47, 0x40,
2818         0x02, 0xdf, 0x32, 0xe5, 0x21, 0x39, 0xf0, 0xa0,
2819         /* order */
2820         0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
2821         0xff, 0xff, 0xff, 0xff, 0x72, 0x03, 0xdf, 0x6b, 0x21, 0xc6, 0x05, 0x2b,
2822         0x53, 0xbb, 0xf4, 0x09, 0x39, 0xd5, 0x41, 0x23,
2823     }
2824 };
2825 #endif /* OPENSSL_NO_SM2 */
2826 
2827 typedef struct _ec_list_element_st {
2828     int nid;
2829     const EC_CURVE_DATA *data;
2830     const EC_METHOD *(*meth) (void);
2831     const char *comment;
2832 } ec_list_element;
2833 
2834 #ifdef FIPS_MODULE
2835 static const ec_list_element curve_list[] = {
2836     /* prime field curves */
2837     /* secg curves */
2838     {NID_secp224r1, &_EC_NIST_PRIME_224.h,
2839 # if !defined(OPENSSL_NO_EC_NISTP_64_GCC_128)
2840      EC_GFp_nistp224_method,
2841 # else
2842      0,
2843 # endif
2844      "NIST/SECG curve over a 224 bit prime field"},
2845     /* SECG secp256r1 is the same as X9.62 prime256v1 and hence omitted */
2846     {NID_secp384r1, &_EC_NIST_PRIME_384.h,
2847 # if defined(S390X_EC_ASM)
2848      EC_GFp_s390x_nistp384_method,
2849 # elif !defined(OPENSSL_NO_EC_NISTP_64_GCC_128)
2850      ossl_ec_GFp_nistp384_method,
2851 # else
2852      0,
2853 # endif
2854      "NIST/SECG curve over a 384 bit prime field"},
2855 
2856     {NID_secp521r1, &_EC_NIST_PRIME_521.h,
2857 # if defined(S390X_EC_ASM)
2858      EC_GFp_s390x_nistp521_method,
2859 # elif !defined(OPENSSL_NO_EC_NISTP_64_GCC_128)
2860      EC_GFp_nistp521_method,
2861 # else
2862      0,
2863 # endif
2864      "NIST/SECG curve over a 521 bit prime field"},
2865 
2866     /* X9.62 curves */
2867     {NID_X9_62_prime192v1, &_EC_NIST_PRIME_192.h, 0,
2868      "NIST/X9.62/SECG curve over a 192 bit prime field"},
2869     {NID_X9_62_prime256v1, &_EC_X9_62_PRIME_256V1.h,
2870 # if defined(ECP_NISTZ256_ASM)
2871      EC_GFp_nistz256_method,
2872 # elif defined(S390X_EC_ASM)
2873      EC_GFp_s390x_nistp256_method,
2874 # elif !defined(OPENSSL_NO_EC_NISTP_64_GCC_128)
2875      EC_GFp_nistp256_method,
2876 # else
2877      0,
2878 # endif
2879      "X9.62/SECG curve over a 256 bit prime field"},
2880 
2881 # ifndef OPENSSL_NO_EC2M
2882     /* characteristic two field curves */
2883     /* NIST/SECG curves */
2884     {NID_sect163k1, &_EC_NIST_CHAR2_163K.h, 0,
2885      "NIST/SECG/WTLS curve over a 163 bit binary field"},
2886     {NID_sect163r2, &_EC_NIST_CHAR2_163B.h, 0,
2887      "NIST/SECG curve over a 163 bit binary field"},
2888     {NID_sect233k1, &_EC_NIST_CHAR2_233K.h, 0,
2889      "NIST/SECG/WTLS curve over a 233 bit binary field"},
2890     {NID_sect233r1, &_EC_NIST_CHAR2_233B.h, 0,
2891      "NIST/SECG/WTLS curve over a 233 bit binary field"},
2892     {NID_sect283k1, &_EC_NIST_CHAR2_283K.h, 0,
2893      "NIST/SECG curve over a 283 bit binary field"},
2894     {NID_sect283r1, &_EC_NIST_CHAR2_283B.h, 0,
2895      "NIST/SECG curve over a 283 bit binary field"},
2896     {NID_sect409k1, &_EC_NIST_CHAR2_409K.h, 0,
2897      "NIST/SECG curve over a 409 bit binary field"},
2898     {NID_sect409r1, &_EC_NIST_CHAR2_409B.h, 0,
2899      "NIST/SECG curve over a 409 bit binary field"},
2900     {NID_sect571k1, &_EC_NIST_CHAR2_571K.h, 0,
2901      "NIST/SECG curve over a 571 bit binary field"},
2902     {NID_sect571r1, &_EC_NIST_CHAR2_571B.h, 0,
2903      "NIST/SECG curve over a 571 bit binary field"},
2904 # endif
2905 };
2906 
2907 #else
2908 
2909 static const ec_list_element curve_list[] = {
2910     /* prime field curves */
2911     /* secg curves */
2912     {NID_secp112r1, &_EC_SECG_PRIME_112R1.h, 0,
2913      "SECG/WTLS curve over a 112 bit prime field"},
2914     {NID_secp112r2, &_EC_SECG_PRIME_112R2.h, 0,
2915      "SECG curve over a 112 bit prime field"},
2916     {NID_secp128r1, &_EC_SECG_PRIME_128R1.h, 0,
2917      "SECG curve over a 128 bit prime field"},
2918     {NID_secp128r2, &_EC_SECG_PRIME_128R2.h, 0,
2919      "SECG curve over a 128 bit prime field"},
2920     {NID_secp160k1, &_EC_SECG_PRIME_160K1.h, 0,
2921      "SECG curve over a 160 bit prime field"},
2922     {NID_secp160r1, &_EC_SECG_PRIME_160R1.h, 0,
2923      "SECG curve over a 160 bit prime field"},
2924     {NID_secp160r2, &_EC_SECG_PRIME_160R2.h, 0,
2925      "SECG/WTLS curve over a 160 bit prime field"},
2926     /* SECG secp192r1 is the same as X9.62 prime192v1 and hence omitted */
2927     {NID_secp192k1, &_EC_SECG_PRIME_192K1.h, 0,
2928      "SECG curve over a 192 bit prime field"},
2929     {NID_secp224k1, &_EC_SECG_PRIME_224K1.h, 0,
2930      "SECG curve over a 224 bit prime field"},
2931 # ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
2932     {NID_secp224r1, &_EC_NIST_PRIME_224.h, EC_GFp_nistp224_method,
2933      "NIST/SECG curve over a 224 bit prime field"},
2934 # else
2935     {NID_secp224r1, &_EC_NIST_PRIME_224.h, 0,
2936      "NIST/SECG curve over a 224 bit prime field"},
2937 # endif
2938     {NID_secp256k1, &_EC_SECG_PRIME_256K1.h, 0,
2939      "SECG curve over a 256 bit prime field"},
2940     /* SECG secp256r1 is the same as X9.62 prime256v1 and hence omitted */
2941     {NID_secp384r1, &_EC_NIST_PRIME_384.h,
2942 # if defined(S390X_EC_ASM)
2943      EC_GFp_s390x_nistp384_method,
2944 # elif !defined(OPENSSL_NO_EC_NISTP_64_GCC_128)
2945      ossl_ec_GFp_nistp384_method,
2946 # else
2947      0,
2948 # endif
2949      "NIST/SECG curve over a 384 bit prime field"},
2950     {NID_secp521r1, &_EC_NIST_PRIME_521.h,
2951 # if defined(S390X_EC_ASM)
2952      EC_GFp_s390x_nistp521_method,
2953 # elif !defined(OPENSSL_NO_EC_NISTP_64_GCC_128)
2954      EC_GFp_nistp521_method,
2955 # else
2956      0,
2957 # endif
2958      "NIST/SECG curve over a 521 bit prime field"},
2959     /* X9.62 curves */
2960     {NID_X9_62_prime192v1, &_EC_NIST_PRIME_192.h, 0,
2961      "NIST/X9.62/SECG curve over a 192 bit prime field"},
2962     {NID_X9_62_prime192v2, &_EC_X9_62_PRIME_192V2.h, 0,
2963      "X9.62 curve over a 192 bit prime field"},
2964     {NID_X9_62_prime192v3, &_EC_X9_62_PRIME_192V3.h, 0,
2965      "X9.62 curve over a 192 bit prime field"},
2966     {NID_X9_62_prime239v1, &_EC_X9_62_PRIME_239V1.h, 0,
2967      "X9.62 curve over a 239 bit prime field"},
2968     {NID_X9_62_prime239v2, &_EC_X9_62_PRIME_239V2.h, 0,
2969      "X9.62 curve over a 239 bit prime field"},
2970     {NID_X9_62_prime239v3, &_EC_X9_62_PRIME_239V3.h, 0,
2971      "X9.62 curve over a 239 bit prime field"},
2972     {NID_X9_62_prime256v1, &_EC_X9_62_PRIME_256V1.h,
2973 # if defined(ECP_NISTZ256_ASM)
2974      EC_GFp_nistz256_method,
2975 # elif defined(S390X_EC_ASM)
2976      EC_GFp_s390x_nistp256_method,
2977 # elif !defined(OPENSSL_NO_EC_NISTP_64_GCC_128)
2978      EC_GFp_nistp256_method,
2979 # else
2980      0,
2981 # endif
2982      "X9.62/SECG curve over a 256 bit prime field"},
2983 # ifndef OPENSSL_NO_EC2M
2984     /* characteristic two field curves */
2985     /* NIST/SECG curves */
2986     {NID_sect113r1, &_EC_SECG_CHAR2_113R1.h, 0,
2987      "SECG curve over a 113 bit binary field"},
2988     {NID_sect113r2, &_EC_SECG_CHAR2_113R2.h, 0,
2989      "SECG curve over a 113 bit binary field"},
2990     {NID_sect131r1, &_EC_SECG_CHAR2_131R1.h, 0,
2991      "SECG/WTLS curve over a 131 bit binary field"},
2992     {NID_sect131r2, &_EC_SECG_CHAR2_131R2.h, 0,
2993      "SECG curve over a 131 bit binary field"},
2994     {NID_sect163k1, &_EC_NIST_CHAR2_163K.h, 0,
2995      "NIST/SECG/WTLS curve over a 163 bit binary field"},
2996     {NID_sect163r1, &_EC_SECG_CHAR2_163R1.h, 0,
2997      "SECG curve over a 163 bit binary field"},
2998     {NID_sect163r2, &_EC_NIST_CHAR2_163B.h, 0,
2999      "NIST/SECG curve over a 163 bit binary field"},
3000     {NID_sect193r1, &_EC_SECG_CHAR2_193R1.h, 0,
3001      "SECG curve over a 193 bit binary field"},
3002     {NID_sect193r2, &_EC_SECG_CHAR2_193R2.h, 0,
3003      "SECG curve over a 193 bit binary field"},
3004     {NID_sect233k1, &_EC_NIST_CHAR2_233K.h, 0,
3005      "NIST/SECG/WTLS curve over a 233 bit binary field"},
3006     {NID_sect233r1, &_EC_NIST_CHAR2_233B.h, 0,
3007      "NIST/SECG/WTLS curve over a 233 bit binary field"},
3008     {NID_sect239k1, &_EC_SECG_CHAR2_239K1.h, 0,
3009      "SECG curve over a 239 bit binary field"},
3010     {NID_sect283k1, &_EC_NIST_CHAR2_283K.h, 0,
3011      "NIST/SECG curve over a 283 bit binary field"},
3012     {NID_sect283r1, &_EC_NIST_CHAR2_283B.h, 0,
3013      "NIST/SECG curve over a 283 bit binary field"},
3014     {NID_sect409k1, &_EC_NIST_CHAR2_409K.h, 0,
3015      "NIST/SECG curve over a 409 bit binary field"},
3016     {NID_sect409r1, &_EC_NIST_CHAR2_409B.h, 0,
3017      "NIST/SECG curve over a 409 bit binary field"},
3018     {NID_sect571k1, &_EC_NIST_CHAR2_571K.h, 0,
3019      "NIST/SECG curve over a 571 bit binary field"},
3020     {NID_sect571r1, &_EC_NIST_CHAR2_571B.h, 0,
3021      "NIST/SECG curve over a 571 bit binary field"},
3022     /* X9.62 curves */
3023     {NID_X9_62_c2pnb163v1, &_EC_X9_62_CHAR2_163V1.h, 0,
3024      "X9.62 curve over a 163 bit binary field"},
3025     {NID_X9_62_c2pnb163v2, &_EC_X9_62_CHAR2_163V2.h, 0,
3026      "X9.62 curve over a 163 bit binary field"},
3027     {NID_X9_62_c2pnb163v3, &_EC_X9_62_CHAR2_163V3.h, 0,
3028      "X9.62 curve over a 163 bit binary field"},
3029     {NID_X9_62_c2pnb176v1, &_EC_X9_62_CHAR2_176V1.h, 0,
3030      "X9.62 curve over a 176 bit binary field"},
3031     {NID_X9_62_c2tnb191v1, &_EC_X9_62_CHAR2_191V1.h, 0,
3032      "X9.62 curve over a 191 bit binary field"},
3033     {NID_X9_62_c2tnb191v2, &_EC_X9_62_CHAR2_191V2.h, 0,
3034      "X9.62 curve over a 191 bit binary field"},
3035     {NID_X9_62_c2tnb191v3, &_EC_X9_62_CHAR2_191V3.h, 0,
3036      "X9.62 curve over a 191 bit binary field"},
3037     {NID_X9_62_c2pnb208w1, &_EC_X9_62_CHAR2_208W1.h, 0,
3038      "X9.62 curve over a 208 bit binary field"},
3039     {NID_X9_62_c2tnb239v1, &_EC_X9_62_CHAR2_239V1.h, 0,
3040      "X9.62 curve over a 239 bit binary field"},
3041     {NID_X9_62_c2tnb239v2, &_EC_X9_62_CHAR2_239V2.h, 0,
3042      "X9.62 curve over a 239 bit binary field"},
3043     {NID_X9_62_c2tnb239v3, &_EC_X9_62_CHAR2_239V3.h, 0,
3044      "X9.62 curve over a 239 bit binary field"},
3045     {NID_X9_62_c2pnb272w1, &_EC_X9_62_CHAR2_272W1.h, 0,
3046      "X9.62 curve over a 272 bit binary field"},
3047     {NID_X9_62_c2pnb304w1, &_EC_X9_62_CHAR2_304W1.h, 0,
3048      "X9.62 curve over a 304 bit binary field"},
3049     {NID_X9_62_c2tnb359v1, &_EC_X9_62_CHAR2_359V1.h, 0,
3050      "X9.62 curve over a 359 bit binary field"},
3051     {NID_X9_62_c2pnb368w1, &_EC_X9_62_CHAR2_368W1.h, 0,
3052      "X9.62 curve over a 368 bit binary field"},
3053     {NID_X9_62_c2tnb431r1, &_EC_X9_62_CHAR2_431R1.h, 0,
3054      "X9.62 curve over a 431 bit binary field"},
3055     /*
3056      * the WAP/WTLS curves [unlike SECG, spec has its own OIDs for curves
3057      * from X9.62]
3058      */
3059     {NID_wap_wsg_idm_ecid_wtls1, &_EC_WTLS_1.h, 0,
3060      "WTLS curve over a 113 bit binary field"},
3061     {NID_wap_wsg_idm_ecid_wtls3, &_EC_NIST_CHAR2_163K.h, 0,
3062      "NIST/SECG/WTLS curve over a 163 bit binary field"},
3063     {NID_wap_wsg_idm_ecid_wtls4, &_EC_SECG_CHAR2_113R1.h, 0,
3064      "SECG curve over a 113 bit binary field"},
3065     {NID_wap_wsg_idm_ecid_wtls5, &_EC_X9_62_CHAR2_163V1.h, 0,
3066      "X9.62 curve over a 163 bit binary field"},
3067 # endif
3068     {NID_wap_wsg_idm_ecid_wtls6, &_EC_SECG_PRIME_112R1.h, 0,
3069      "SECG/WTLS curve over a 112 bit prime field"},
3070     {NID_wap_wsg_idm_ecid_wtls7, &_EC_SECG_PRIME_160R2.h, 0,
3071      "SECG/WTLS curve over a 160 bit prime field"},
3072     {NID_wap_wsg_idm_ecid_wtls8, &_EC_WTLS_8.h, 0,
3073      "WTLS curve over a 112 bit prime field"},
3074     {NID_wap_wsg_idm_ecid_wtls9, &_EC_WTLS_9.h, 0,
3075      "WTLS curve over a 160 bit prime field"},
3076 # ifndef OPENSSL_NO_EC2M
3077     {NID_wap_wsg_idm_ecid_wtls10, &_EC_NIST_CHAR2_233K.h, 0,
3078      "NIST/SECG/WTLS curve over a 233 bit binary field"},
3079     {NID_wap_wsg_idm_ecid_wtls11, &_EC_NIST_CHAR2_233B.h, 0,
3080      "NIST/SECG/WTLS curve over a 233 bit binary field"},
3081 # endif
3082     {NID_wap_wsg_idm_ecid_wtls12, &_EC_WTLS_12.h, 0,
3083      "WTLS curve over a 224 bit prime field"},
3084 # ifndef OPENSSL_NO_EC2M
3085     /* IPSec curves */
3086     {NID_ipsec3, &_EC_IPSEC_155_ID3.h, 0,
3087      "\n\tIPSec/IKE/Oakley curve #3 over a 155 bit binary field.\n"
3088      "\tNot suitable for ECDSA.\n\tQuestionable extension field!"},
3089     {NID_ipsec4, &_EC_IPSEC_185_ID4.h, 0,
3090      "\n\tIPSec/IKE/Oakley curve #4 over a 185 bit binary field.\n"
3091      "\tNot suitable for ECDSA.\n\tQuestionable extension field!"},
3092 # endif
3093     /* brainpool curves */
3094     {NID_brainpoolP160r1, &_EC_brainpoolP160r1.h, 0,
3095      "RFC 5639 curve over a 160 bit prime field"},
3096     {NID_brainpoolP160t1, &_EC_brainpoolP160t1.h, 0,
3097      "RFC 5639 curve over a 160 bit prime field"},
3098     {NID_brainpoolP192r1, &_EC_brainpoolP192r1.h, 0,
3099      "RFC 5639 curve over a 192 bit prime field"},
3100     {NID_brainpoolP192t1, &_EC_brainpoolP192t1.h, 0,
3101      "RFC 5639 curve over a 192 bit prime field"},
3102     {NID_brainpoolP224r1, &_EC_brainpoolP224r1.h, 0,
3103      "RFC 5639 curve over a 224 bit prime field"},
3104     {NID_brainpoolP224t1, &_EC_brainpoolP224t1.h, 0,
3105      "RFC 5639 curve over a 224 bit prime field"},
3106     {NID_brainpoolP256r1, &_EC_brainpoolP256r1.h, 0,
3107      "RFC 5639 curve over a 256 bit prime field"},
3108     {NID_brainpoolP256t1, &_EC_brainpoolP256t1.h, 0,
3109      "RFC 5639 curve over a 256 bit prime field"},
3110     {NID_brainpoolP320r1, &_EC_brainpoolP320r1.h, 0,
3111      "RFC 5639 curve over a 320 bit prime field"},
3112     {NID_brainpoolP320t1, &_EC_brainpoolP320t1.h, 0,
3113      "RFC 5639 curve over a 320 bit prime field"},
3114     {NID_brainpoolP384r1, &_EC_brainpoolP384r1.h, 0,
3115      "RFC 5639 curve over a 384 bit prime field"},
3116     {NID_brainpoolP384t1, &_EC_brainpoolP384t1.h, 0,
3117      "RFC 5639 curve over a 384 bit prime field"},
3118     {NID_brainpoolP512r1, &_EC_brainpoolP512r1.h, 0,
3119      "RFC 5639 curve over a 512 bit prime field"},
3120     {NID_brainpoolP512t1, &_EC_brainpoolP512t1.h, 0,
3121      "RFC 5639 curve over a 512 bit prime field"},
3122 #ifndef OPENSSL_NO_SM2
3123     {NID_sm2, &_EC_sm2p256v1.h,
3124 # ifdef ECP_SM2P256_ASM
3125      EC_GFp_sm2p256_method,
3126 # else
3127      0,
3128 # endif
3129      "SM2 curve over a 256 bit prime field"},
3130 # endif
3131 };
3132 #endif /* FIPS_MODULE */
3133 
3134 #define curve_list_length OSSL_NELEM(curve_list)
3135 
ec_curve_nid2curve(int nid)3136 static const ec_list_element *ec_curve_nid2curve(int nid)
3137 {
3138     size_t i;
3139 
3140     if (nid <= 0)
3141         return NULL;
3142 
3143     for (i = 0; i < curve_list_length; i++) {
3144         if (curve_list[i].nid == nid)
3145             return &curve_list[i];
3146     }
3147     return NULL;
3148 }
3149 
ec_group_new_from_data(OSSL_LIB_CTX * libctx,const char * propq,const ec_list_element curve)3150 static EC_GROUP *ec_group_new_from_data(OSSL_LIB_CTX *libctx,
3151                                         const char *propq,
3152                                         const ec_list_element curve)
3153 {
3154     EC_GROUP *group = NULL;
3155     EC_POINT *P = NULL;
3156     BN_CTX *ctx = NULL;
3157     BIGNUM *p = NULL, *a = NULL, *b = NULL, *x = NULL, *y = NULL, *order =
3158         NULL;
3159     int ok = 0;
3160     int seed_len, param_len;
3161     const EC_METHOD *meth;
3162     const EC_CURVE_DATA *data;
3163     const unsigned char *params;
3164 
3165     /* If no curve data curve method must handle everything */
3166     if (curve.data == NULL)
3167         return ossl_ec_group_new_ex(libctx, propq,
3168                                     curve.meth != NULL ? curve.meth() : NULL);
3169 
3170     if ((ctx = BN_CTX_new_ex(libctx)) == NULL) {
3171         ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
3172         goto err;
3173     }
3174 
3175     data = curve.data;
3176     seed_len = data->seed_len;
3177     param_len = data->param_len;
3178     params = (const unsigned char *)(data + 1); /* skip header */
3179 
3180     if (curve.meth != NULL) {
3181         meth = curve.meth();
3182         if ((group = ossl_ec_group_new_ex(libctx, propq, meth)) == NULL) {
3183             ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
3184             goto err;
3185         }
3186         if (group->meth->group_full_init != NULL) {
3187             if (!group->meth->group_full_init(group, params)){
3188                 ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
3189                 goto err;
3190             }
3191             EC_GROUP_set_curve_name(group, curve.nid);
3192             BN_CTX_free(ctx);
3193             return group;
3194         }
3195     }
3196 
3197     params += seed_len;         /* skip seed */
3198 
3199     if ((p = BN_bin2bn(params + 0 * param_len, param_len, NULL)) == NULL
3200         || (a = BN_bin2bn(params + 1 * param_len, param_len, NULL)) == NULL
3201         || (b = BN_bin2bn(params + 2 * param_len, param_len, NULL)) == NULL) {
3202         ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
3203         goto err;
3204     }
3205 
3206     if (group != NULL) {
3207         if (group->meth->group_set_curve(group, p, a, b, ctx) == 0) {
3208             ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
3209             goto err;
3210         }
3211     } else if (data->field_type == NID_X9_62_prime_field) {
3212         if ((group = EC_GROUP_new_curve_GFp(p, a, b, ctx)) == NULL) {
3213             ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
3214             goto err;
3215         }
3216     }
3217 #ifndef OPENSSL_NO_EC2M
3218     else {                      /* field_type ==
3219                                  * NID_X9_62_characteristic_two_field */
3220 
3221         if ((group = EC_GROUP_new_curve_GF2m(p, a, b, ctx)) == NULL) {
3222             ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
3223             goto err;
3224         }
3225     }
3226 #endif
3227 
3228     EC_GROUP_set_curve_name(group, curve.nid);
3229 
3230     if ((P = EC_POINT_new(group)) == NULL) {
3231         ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
3232         goto err;
3233     }
3234 
3235     if ((x = BN_bin2bn(params + 3 * param_len, param_len, NULL)) == NULL
3236         || (y = BN_bin2bn(params + 4 * param_len, param_len, NULL)) == NULL) {
3237         ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
3238         goto err;
3239     }
3240     if (!EC_POINT_set_affine_coordinates(group, P, x, y, ctx)) {
3241         ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
3242         goto err;
3243     }
3244     if ((order = BN_bin2bn(params + 5 * param_len, param_len, NULL)) == NULL
3245         || !BN_set_word(x, (BN_ULONG)data->cofactor)) {
3246         ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
3247         goto err;
3248     }
3249     if (!EC_GROUP_set_generator(group, P, order, x)) {
3250         ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
3251         goto err;
3252     }
3253     if (seed_len) {
3254         if (!EC_GROUP_set_seed(group, params - seed_len, seed_len)) {
3255             ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
3256             goto err;
3257         }
3258     }
3259 
3260 #ifndef FIPS_MODULE
3261     if (EC_GROUP_get_asn1_flag(group) == OPENSSL_EC_NAMED_CURVE) {
3262         /*
3263          * Some curves don't have an associated OID: for those we should not
3264          * default to `OPENSSL_EC_NAMED_CURVE` encoding of parameters and
3265          * instead set the ASN1 flag to `OPENSSL_EC_EXPLICIT_CURVE`.
3266          *
3267          * Note that `OPENSSL_EC_NAMED_CURVE` is set as the default ASN1 flag on
3268          * `EC_GROUP_new()`, when we don't have enough elements to determine if
3269          * an OID for the curve name actually exists.
3270          * We could implement this check on `EC_GROUP_set_curve_name()` but
3271          * overloading the simple setter with this lookup could have a negative
3272          * performance impact and unexpected consequences.
3273          */
3274         ASN1_OBJECT *asn1obj = OBJ_nid2obj(curve.nid);
3275 
3276         if (asn1obj == NULL) {
3277             ERR_raise(ERR_LIB_EC, ERR_R_OBJ_LIB);
3278             goto err;
3279         }
3280         if (OBJ_length(asn1obj) == 0)
3281             EC_GROUP_set_asn1_flag(group, OPENSSL_EC_EXPLICIT_CURVE);
3282 
3283         ASN1_OBJECT_free(asn1obj);
3284     }
3285 #else
3286     /*
3287      * Inside the FIPS module we do not support explicit curves anyway
3288      * so the above check is not necessary.
3289      *
3290      * Skipping it is also necessary because `OBJ_length()` and
3291      * `ASN1_OBJECT_free()` are not available within the FIPS module
3292      * boundaries.
3293      */
3294 #endif
3295 
3296     ok = 1;
3297  err:
3298     if (!ok) {
3299         EC_GROUP_free(group);
3300         group = NULL;
3301     }
3302     EC_POINT_free(P);
3303     BN_CTX_free(ctx);
3304     BN_free(p);
3305     BN_free(a);
3306     BN_free(b);
3307     BN_free(order);
3308     BN_free(x);
3309     BN_free(y);
3310     return group;
3311 }
3312 
EC_GROUP_new_by_curve_name_ex(OSSL_LIB_CTX * libctx,const char * propq,int nid)3313 EC_GROUP *EC_GROUP_new_by_curve_name_ex(OSSL_LIB_CTX *libctx, const char *propq,
3314                                         int nid)
3315 {
3316     EC_GROUP *ret = NULL;
3317     const ec_list_element *curve;
3318 
3319     if ((curve = ec_curve_nid2curve(nid)) == NULL
3320         || (ret = ec_group_new_from_data(libctx, propq, *curve)) == NULL) {
3321 #ifndef FIPS_MODULE
3322         ERR_raise_data(ERR_LIB_EC, EC_R_UNKNOWN_GROUP,
3323                        "name=%s", OBJ_nid2sn(nid));
3324 #else
3325         ERR_raise(ERR_LIB_EC, EC_R_UNKNOWN_GROUP);
3326 #endif
3327         return NULL;
3328     }
3329 
3330     return ret;
3331 }
3332 
3333 #ifndef FIPS_MODULE
EC_GROUP_new_by_curve_name(int nid)3334 EC_GROUP *EC_GROUP_new_by_curve_name(int nid)
3335 {
3336     return EC_GROUP_new_by_curve_name_ex(NULL, NULL, nid);
3337 }
3338 #endif
3339 
EC_get_builtin_curves(EC_builtin_curve * r,size_t nitems)3340 size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems)
3341 {
3342     size_t i, min;
3343 
3344     if (r == NULL || nitems == 0)
3345         return curve_list_length;
3346 
3347     min = nitems < curve_list_length ? nitems : curve_list_length;
3348 
3349     for (i = 0; i < min; i++) {
3350         r[i].nid = curve_list[i].nid;
3351         r[i].comment = curve_list[i].comment;
3352     }
3353 
3354     return curve_list_length;
3355 }
3356 
EC_curve_nid2nist(int nid)3357 const char *EC_curve_nid2nist(int nid)
3358 {
3359     return ossl_ec_curve_nid2nist_int(nid);
3360 }
3361 
EC_curve_nist2nid(const char * name)3362 int EC_curve_nist2nid(const char *name)
3363 {
3364     return ossl_ec_curve_nist2nid_int(name);
3365 }
3366 
3367 #define NUM_BN_FIELDS 6
3368 /*
3369  * Validates EC domain parameter data for known named curves.
3370  * This can be used when a curve is loaded explicitly (without a curve
3371  * name) or to validate that domain parameters have not been modified.
3372  *
3373  * Returns: The nid associated with the found named curve, or NID_undef
3374  *          if not found. If there was an error it returns -1.
3375  */
ossl_ec_curve_nid_from_params(const EC_GROUP * group,BN_CTX * ctx)3376 int ossl_ec_curve_nid_from_params(const EC_GROUP *group, BN_CTX *ctx)
3377 {
3378     int ret = -1, nid, len, field_type, param_len;
3379     size_t i, seed_len;
3380     const unsigned char *seed, *params_seed, *params;
3381     unsigned char *param_bytes = NULL;
3382     const EC_CURVE_DATA *data;
3383     const EC_POINT *generator = NULL;
3384     const BIGNUM *cofactor = NULL;
3385     /* An array of BIGNUMs for (p, a, b, x, y, order) */
3386     BIGNUM *bn[NUM_BN_FIELDS] = {NULL, NULL, NULL, NULL, NULL, NULL};
3387 
3388     /* Use the optional named curve nid as a search field */
3389     nid = EC_GROUP_get_curve_name(group);
3390     field_type = EC_GROUP_get_field_type(group);
3391     seed_len = EC_GROUP_get_seed_len(group);
3392     seed = EC_GROUP_get0_seed(group);
3393     cofactor = EC_GROUP_get0_cofactor(group);
3394 
3395     BN_CTX_start(ctx);
3396 
3397     /*
3398      * The built-in curves contains data fields (p, a, b, x, y, order) that are
3399      * all zero-padded to be the same size. The size of the padding is
3400      * determined by either the number of bytes in the field modulus (p) or the
3401      * EC group order, whichever is larger.
3402      */
3403     param_len = BN_num_bytes(group->order);
3404     len = BN_num_bytes(group->field);
3405     if (len > param_len)
3406         param_len = len;
3407 
3408     /* Allocate space to store the padded data for (p, a, b, x, y, order)  */
3409     param_bytes = OPENSSL_malloc(param_len * NUM_BN_FIELDS);
3410     if (param_bytes == NULL)
3411         goto end;
3412 
3413     /* Create the bignums */
3414     for (i = 0; i < NUM_BN_FIELDS; ++i) {
3415         if ((bn[i] = BN_CTX_get(ctx)) == NULL)
3416             goto end;
3417     }
3418     /*
3419      * Fill in the bn array with the same values as the internal curves
3420      * i.e. the values are p, a, b, x, y, order.
3421      */
3422     /* Get p, a & b */
3423     if (!(EC_GROUP_get_curve(group, bn[0], bn[1], bn[2], ctx)
3424         && ((generator = EC_GROUP_get0_generator(group)) != NULL)
3425         /* Get x & y */
3426         && EC_POINT_get_affine_coordinates(group, generator, bn[3], bn[4], ctx)
3427         /* Get order */
3428         && EC_GROUP_get_order(group, bn[5], ctx)))
3429         goto end;
3430 
3431    /*
3432      * Convert the bignum array to bytes that are joined together to form
3433      * a single buffer that contains data for all fields.
3434      * (p, a, b, x, y, order) are all zero padded to be the same size.
3435      */
3436     for (i = 0; i < NUM_BN_FIELDS; ++i) {
3437         if (BN_bn2binpad(bn[i], &param_bytes[i*param_len], param_len) <= 0)
3438             goto end;
3439     }
3440 
3441     for (i = 0; i < curve_list_length; i++) {
3442         const ec_list_element curve = curve_list[i];
3443 
3444         data = curve.data;
3445         /* Get the raw order byte data */
3446         params_seed = (const unsigned char *)(data + 1); /* skip header */
3447         params = params_seed + data->seed_len;
3448 
3449         /* Look for unique fields in the fixed curve data */
3450         if (data->field_type == field_type
3451             && param_len == data->param_len
3452             && (nid <= 0 || nid == curve.nid)
3453             /* check the optional cofactor (ignore if its zero) */
3454             && (BN_is_zero(cofactor)
3455                 || BN_is_word(cofactor, (const BN_ULONG)curve.data->cofactor))
3456             /* Check the optional seed (ignore if its not set) */
3457             && (data->seed_len == 0 || seed_len == 0
3458                 || ((size_t)data->seed_len == seed_len
3459                      && memcmp(params_seed, seed, seed_len) == 0))
3460             /* Check that the groups params match the built-in curve params */
3461             && memcmp(param_bytes, params, param_len * NUM_BN_FIELDS)
3462                              == 0) {
3463             ret = curve.nid;
3464             goto end;
3465         }
3466     }
3467     /* Gets here if the group was not found */
3468     ret = NID_undef;
3469 end:
3470     OPENSSL_free(param_bytes);
3471     BN_CTX_end(ctx);
3472     return ret;
3473 }
3474