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