]>
Commit | Line | Data |
---|---|---|
bd3602eb | 1 | |
65e81670 | 2 | /* crypto/ec/ec.h */ |
35b73a1f BM |
3 | /* |
4 | * Originally written by Bodo Moeller for the OpenSSL project. | |
5 | */ | |
ba12070f NL |
6 | /** |
7 | * \file crypto/ec/ec.h Include file for the OpenSSL EC functions | |
8 | * \author Originally written by Bodo Moeller for the OpenSSL project | |
9 | */ | |
65e81670 | 10 | /* ==================================================================== |
ba12070f | 11 | * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. |
6cc5e19d | 12 | * |
65e81670 BM |
13 | * Redistribution and use in source and binary forms, with or without |
14 | * modification, are permitted provided that the following conditions | |
15 | * are met: | |
6cc5e19d | 16 | * |
65e81670 | 17 | * 1. Redistributions of source code must retain the above copyright |
0f113f3e | 18 | * notice, this list of conditions and the following disclaimer. |
6cc5e19d | 19 | * |
65e81670 BM |
20 | * 2. Redistributions in binary form must reproduce the above copyright |
21 | * notice, this list of conditions and the following disclaimer in | |
22 | * the documentation and/or other materials provided with the | |
23 | * distribution. | |
6cc5e19d | 24 | * |
65e81670 BM |
25 | * 3. All advertising materials mentioning features or use of this |
26 | * software must display the following acknowledgment: | |
27 | * "This product includes software developed by the OpenSSL Project | |
28 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | |
29 | * | |
30 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | |
31 | * endorse or promote products derived from this software without | |
32 | * prior written permission. For written permission, please contact | |
33 | * openssl-core@openssl.org. | |
34 | * | |
35 | * 5. Products derived from this software may not be called "OpenSSL" | |
36 | * nor may "OpenSSL" appear in their names without prior written | |
37 | * permission of the OpenSSL Project. | |
38 | * | |
39 | * 6. Redistributions of any form whatsoever must retain the following | |
40 | * acknowledgment: | |
41 | * "This product includes software developed by the OpenSSL Project | |
42 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | |
43 | * | |
44 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | |
45 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
46 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
47 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | |
48 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
49 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
50 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
51 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
52 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
53 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
54 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
55 | * OF THE POSSIBILITY OF SUCH DAMAGE. | |
56 | * ==================================================================== | |
57 | * | |
58 | * This product includes cryptographic software written by Eric Young | |
59 | * (eay@cryptsoft.com). This product includes software written by Tim | |
60 | * Hudson (tjh@cryptsoft.com). | |
6cc5e19d BM |
61 | * |
62 | */ | |
7793f30e BM |
63 | /* ==================================================================== |
64 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | |
65 | * | |
0f113f3e | 66 | * Portions of the attached software ("Contribution") are developed by |
7793f30e BM |
67 | * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. |
68 | * | |
69 | * The Contribution is licensed pursuant to the OpenSSL open source | |
70 | * license provided above. | |
71 | * | |
0f113f3e | 72 | * The elliptic curve binary polynomial software is originally written by |
7793f30e BM |
73 | * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. |
74 | * | |
75 | */ | |
6cc5e19d | 76 | |
6cc5e19d | 77 | #ifndef HEADER_EC_H |
0f113f3e | 78 | # define HEADER_EC_H |
6cc5e19d | 79 | |
0f113f3e | 80 | # include <openssl/opensslconf.h> |
87c9c659 | 81 | |
0f113f3e MC |
82 | # ifdef OPENSSL_NO_EC |
83 | # error EC is disabled. | |
84 | # endif | |
bb62a8b0 | 85 | |
0f113f3e MC |
86 | # include <openssl/asn1.h> |
87 | # include <openssl/symhacks.h> | |
98186eb4 | 88 | # if OPENSSL_API_COMPAT < 0x10100000L |
0f113f3e MC |
89 | # include <openssl/bn.h> |
90 | # endif | |
6cc5e19d | 91 | |
0f113f3e | 92 | # ifdef __cplusplus |
65e81670 | 93 | extern "C" { |
0f113f3e MC |
94 | # elif defined(__SUNPRO_C) |
95 | # if __SUNPRO_C >= 0x520 | |
96 | # pragma error_messages (off,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) | |
97 | # endif | |
7f24b1c3 | 98 | # endif |
6cc5e19d | 99 | |
0f113f3e MC |
100 | # ifndef OPENSSL_ECC_MAX_FIELD_BITS |
101 | # define OPENSSL_ECC_MAX_FIELD_BITS 661 | |
102 | # endif | |
5e3225cc | 103 | |
ba12070f NL |
104 | /** Enum for the point conversion form as defined in X9.62 (ECDSA) |
105 | * for the encoding of a elliptic curve point (x,y) */ | |
3a12ce01 | 106 | typedef enum { |
0f113f3e | 107 | /** the point is encoded as z||x, where the octet z specifies |
ba12070f | 108 | * which solution of the quadratic equation y is */ |
0f113f3e | 109 | POINT_CONVERSION_COMPRESSED = 2, |
91d2728b | 110 | /** the point is encoded as z||x||y, where z is the octet 0x04 */ |
0f113f3e MC |
111 | POINT_CONVERSION_UNCOMPRESSED = 4, |
112 | /** the point is encoded as z||x||y, where the octet z specifies | |
113 | * which solution of the quadratic equation y is */ | |
114 | POINT_CONVERSION_HYBRID = 6 | |
3a12ce01 BM |
115 | } point_conversion_form_t; |
116 | ||
3a12ce01 BM |
117 | typedef struct ec_method_st EC_METHOD; |
118 | ||
119 | typedef struct ec_group_st | |
50e735f9 MC |
120 | /*- |
121 | EC_METHOD *meth; | |
122 | -- field definition | |
123 | -- curve coefficients | |
124 | -- optional generator with associated information (order, cofactor) | |
125 | -- optional extra data (precomputed table for fast computation of multiples of generator) | |
126 | -- ASN1 stuff | |
127 | */ | |
0f113f3e | 128 | EC_GROUP; |
3a12ce01 BM |
129 | |
130 | typedef struct ec_point_st EC_POINT; | |
131 | ||
ba12070f | 132 | /********************************************************************/ |
0f113f3e | 133 | /* EC_METHODs for curves over GF(p) */ |
ba12070f NL |
134 | /********************************************************************/ |
135 | ||
136 | /** Returns the basic GFp ec methods which provides the basis for the | |
0f113f3e | 137 | * optimized methods. |
ba12070f | 138 | * \return EC_METHOD object |
3a12ce01 | 139 | */ |
3a12ce01 | 140 | const EC_METHOD *EC_GFp_simple_method(void); |
ba12070f NL |
141 | |
142 | /** Returns GFp methods using montgomery multiplication. | |
143 | * \return EC_METHOD object | |
144 | */ | |
3a12ce01 | 145 | const EC_METHOD *EC_GFp_mont_method(void); |
ba12070f NL |
146 | |
147 | /** Returns GFp methods using optimized methods for NIST recommended curves | |
148 | * \return EC_METHOD object | |
149 | */ | |
5c6bf031 | 150 | const EC_METHOD *EC_GFp_nist_method(void); |
3a12ce01 | 151 | |
0f113f3e MC |
152 | # ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 |
153 | # ifndef OPENSSL_SYS_WIN32 | |
04daec86 BM |
154 | /** Returns 64-bit optimized methods for nistp224 |
155 | * \return EC_METHOD object | |
156 | */ | |
157 | const EC_METHOD *EC_GFp_nistp224_method(void); | |
3e00b4c9 BM |
158 | |
159 | /** Returns 64-bit optimized methods for nistp256 | |
160 | * \return EC_METHOD object | |
161 | */ | |
162 | const EC_METHOD *EC_GFp_nistp256_method(void); | |
163 | ||
164 | /** Returns 64-bit optimized methods for nistp521 | |
165 | * \return EC_METHOD object | |
166 | */ | |
167 | const EC_METHOD *EC_GFp_nistp521_method(void); | |
0f113f3e MC |
168 | # endif |
169 | # endif | |
ba12070f | 170 | |
0f113f3e MC |
171 | # ifndef OPENSSL_NO_EC2M |
172 | /********************************************************************/ | |
ba12070f NL |
173 | /* EC_METHOD for curves over GF(2^m) */ |
174 | /********************************************************************/ | |
175 | ||
0f113f3e | 176 | /** Returns the basic GF2m ec method |
ba12070f | 177 | * \return EC_METHOD object |
7793f30e BM |
178 | */ |
179 | const EC_METHOD *EC_GF2m_simple_method(void); | |
180 | ||
0f113f3e | 181 | # endif |
3a12ce01 | 182 | |
ba12070f NL |
183 | /********************************************************************/ |
184 | /* EC_GROUP functions */ | |
185 | /********************************************************************/ | |
186 | ||
187 | /** Creates a new EC_GROUP object | |
188 | * \param meth EC_METHOD to use | |
189 | * \return newly created EC_GROUP object or NULL in case of an error. | |
190 | */ | |
191 | EC_GROUP *EC_GROUP_new(const EC_METHOD *meth); | |
192 | ||
193 | /** Frees a EC_GROUP object | |
194 | * \param group EC_GROUP object to be freed. | |
195 | */ | |
196 | void EC_GROUP_free(EC_GROUP *group); | |
197 | ||
198 | /** Clears and frees a EC_GROUP object | |
199 | * \param group EC_GROUP object to be cleared and freed. | |
200 | */ | |
201 | void EC_GROUP_clear_free(EC_GROUP *group); | |
202 | ||
203 | /** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. | |
204 | * \param dst destination EC_GROUP object | |
205 | * \param src source EC_GROUP object | |
206 | * \return 1 on success and 0 if an error occurred. | |
207 | */ | |
208 | int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); | |
209 | ||
210 | /** Creates a new EC_GROUP object and copies the copies the content | |
211 | * form src to the newly created EC_KEY object | |
212 | * \param src source EC_GROUP object | |
213 | * \return newly created EC_GROUP object or NULL in case of an error. | |
214 | */ | |
215 | EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); | |
216 | ||
217 | /** Returns the EC_METHOD of the EC_GROUP object. | |
0f113f3e | 218 | * \param group EC_GROUP object |
ba12070f NL |
219 | * \return EC_METHOD used in this EC_GROUP object. |
220 | */ | |
221 | const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); | |
222 | ||
223 | /** Returns the field type of the EC_METHOD. | |
224 | * \param meth EC_METHOD object | |
225 | * \return NID of the underlying field type OID. | |
226 | */ | |
227 | int EC_METHOD_get_field_type(const EC_METHOD *meth); | |
228 | ||
229 | /** Sets the generator and it's order/cofactor of a EC_GROUP object. | |
0f113f3e | 230 | * \param group EC_GROUP object |
ba12070f NL |
231 | * \param generator EC_POINT object with the generator. |
232 | * \param order the order of the group generated by the generator. | |
233 | * \param cofactor the index of the sub-group generated by the generator | |
234 | * in the group of all points on the elliptic curve. | |
478b50cf | 235 | * \return 1 on success and 0 if an error occurred |
ba12070f | 236 | */ |
0f113f3e MC |
237 | int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, |
238 | const BIGNUM *order, const BIGNUM *cofactor); | |
ba12070f NL |
239 | |
240 | /** Returns the generator of a EC_GROUP object. | |
241 | * \param group EC_GROUP object | |
242 | * \return the currently used generator (possibly NULL). | |
243 | */ | |
244 | const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); | |
245 | ||
f54be179 AP |
246 | /** Returns the montgomery data for order(Generator) |
247 | * \param group EC_GROUP object | |
248 | * \return the currently used generator (possibly NULL). | |
249 | */ | |
250 | BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group); | |
251 | ||
ba12070f NL |
252 | /** Gets the order of a EC_GROUP |
253 | * \param group EC_GROUP object | |
254 | * \param order BIGNUM to which the order is copied | |
255 | * \param ctx BN_CTX object (optional) | |
478b50cf | 256 | * \return 1 on success and 0 if an error occurred |
ba12070f NL |
257 | */ |
258 | int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx); | |
48fe4d62 | 259 | |
be2e334f DSH |
260 | /** Gets the order of an EC_GROUP |
261 | * \param group EC_GROUP object | |
262 | * \return the group order | |
263 | */ | |
264 | ||
265 | const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group); | |
266 | ||
267 | /** Gets the number of bits of ther order of an EC_GROUP | |
268 | * \param group EC_GROUP object | |
269 | * \return number of bits of group order. | |
270 | */ | |
271 | ||
272 | int EC_GROUP_order_bits(const EC_GROUP *group); | |
273 | ||
ba12070f NL |
274 | /** Gets the cofactor of a EC_GROUP |
275 | * \param group EC_GROUP object | |
276 | * \param cofactor BIGNUM to which the cofactor is copied | |
277 | * \param ctx BN_CTX object (optional) | |
478b50cf | 278 | * \return 1 on success and 0 if an error occurred |
ba12070f | 279 | */ |
0f113f3e MC |
280 | int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, |
281 | BN_CTX *ctx); | |
b6db386f | 282 | |
be2e334f DSH |
283 | /** Gets the cofactor of an EC_GROUP |
284 | * \param group EC_GROUP object | |
285 | * \return the group cofactor | |
286 | */ | |
287 | ||
288 | const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group); | |
289 | ||
ba12070f NL |
290 | /** Sets the name of a EC_GROUP object |
291 | * \param group EC_GROUP object | |
292 | * \param nid NID of the curve name OID | |
293 | */ | |
294 | void EC_GROUP_set_curve_name(EC_GROUP *group, int nid); | |
b6db386f | 295 | |
ba12070f NL |
296 | /** Returns the curve name of a EC_GROUP object |
297 | * \param group EC_GROUP object | |
298 | * \return NID of the curve name OID or 0 if not set. | |
299 | */ | |
300 | int EC_GROUP_get_curve_name(const EC_GROUP *group); | |
945e15a2 | 301 | |
ba12070f NL |
302 | void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); |
303 | int EC_GROUP_get_asn1_flag(const EC_GROUP *group); | |
5f3d6f70 | 304 | |
0f113f3e MC |
305 | void EC_GROUP_set_point_conversion_form(EC_GROUP *group, |
306 | point_conversion_form_t form); | |
5f3d6f70 BM |
307 | point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); |
308 | ||
9945b460 | 309 | unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); |
5f3d6f70 BM |
310 | size_t EC_GROUP_get_seed_len(const EC_GROUP *); |
311 | size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); | |
48fe4d62 | 312 | |
ba12070f NL |
313 | /** Sets the parameter of a ec over GFp defined by y^2 = x^3 + a*x + b |
314 | * \param group EC_GROUP object | |
315 | * \param p BIGNUM with the prime number | |
316 | * \param a BIGNUM with parameter a of the equation | |
317 | * \param b BIGNUM with parameter b of the equation | |
318 | * \param ctx BN_CTX object (optional) | |
478b50cf | 319 | * \return 1 on success and 0 if an error occurred |
ba12070f | 320 | */ |
0f113f3e MC |
321 | int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, |
322 | const BIGNUM *b, BN_CTX *ctx); | |
ba12070f NL |
323 | |
324 | /** Gets the parameter of the ec over GFp defined by y^2 = x^3 + a*x + b | |
325 | * \param group EC_GROUP object | |
326 | * \param p BIGNUM for the prime number | |
327 | * \param a BIGNUM for parameter a of the equation | |
328 | * \param b BIGNUM for parameter b of the equation | |
329 | * \param ctx BN_CTX object (optional) | |
478b50cf | 330 | * \return 1 on success and 0 if an error occurred |
ba12070f | 331 | */ |
0f113f3e MC |
332 | int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, |
333 | BIGNUM *b, BN_CTX *ctx); | |
ba12070f | 334 | |
0f113f3e | 335 | # ifndef OPENSSL_NO_EC2M |
ba12070f NL |
336 | /** Sets the parameter of a ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + b |
337 | * \param group EC_GROUP object | |
338 | * \param p BIGNUM with the polynomial defining the underlying field | |
339 | * \param a BIGNUM with parameter a of the equation | |
340 | * \param b BIGNUM with parameter b of the equation | |
341 | * \param ctx BN_CTX object (optional) | |
478b50cf | 342 | * \return 1 on success and 0 if an error occurred |
ba12070f | 343 | */ |
0f113f3e MC |
344 | int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, |
345 | const BIGNUM *b, BN_CTX *ctx); | |
ba12070f NL |
346 | |
347 | /** Gets the parameter of the ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + b | |
348 | * \param group EC_GROUP object | |
349 | * \param p BIGNUM for the polynomial defining the underlying field | |
350 | * \param a BIGNUM for parameter a of the equation | |
351 | * \param b BIGNUM for parameter b of the equation | |
352 | * \param ctx BN_CTX object (optional) | |
478b50cf | 353 | * \return 1 on success and 0 if an error occurred |
ba12070f | 354 | */ |
0f113f3e MC |
355 | int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, |
356 | BIGNUM *b, BN_CTX *ctx); | |
357 | # endif | |
358 | /** Returns the number of bits needed to represent a field element | |
ba12070f NL |
359 | * \param group EC_GROUP object |
360 | * \return number of bits needed to represent a field element | |
361 | */ | |
362 | int EC_GROUP_get_degree(const EC_GROUP *group); | |
3a12ce01 | 363 | |
ba12070f NL |
364 | /** Checks whether the parameter in the EC_GROUP define a valid ec group |
365 | * \param group EC_GROUP object | |
366 | * \param ctx BN_CTX object (optional) | |
367 | * \return 1 if group is a valid ec group and 0 otherwise | |
368 | */ | |
af28dd6c | 369 | int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); |
945e15a2 | 370 | |
ba12070f NL |
371 | /** Checks whether the discriminant of the elliptic curve is zero or not |
372 | * \param group EC_GROUP object | |
373 | * \param ctx BN_CTX object (optional) | |
374 | * \return 1 if the discriminant is not zero and 0 otherwise | |
375 | */ | |
376 | int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx); | |
377 | ||
378 | /** Compares two EC_GROUP objects | |
379 | * \param a first EC_GROUP object | |
380 | * \param b second EC_GROUP object | |
381 | * \param ctx BN_CTX object (optional) | |
382 | * \return 0 if both groups are equal and 1 otherwise | |
383 | */ | |
384 | int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx); | |
ada0e717 | 385 | |
0f113f3e MC |
386 | /* |
387 | * EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() after | |
388 | * choosing an appropriate EC_METHOD | |
389 | */ | |
945e15a2 | 390 | |
ba12070f NL |
391 | /** Creates a new EC_GROUP object with the specified parameters defined |
392 | * over GFp (defined by the equation y^2 = x^3 + a*x + b) | |
393 | * \param p BIGNUM with the prime number | |
394 | * \param a BIGNUM with the parameter a of the equation | |
395 | * \param b BIGNUM with the parameter b of the equation | |
396 | * \param ctx BN_CTX object (optional) | |
397 | * \return newly created EC_GROUP object with the specified parameters | |
398 | */ | |
0f113f3e MC |
399 | EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, |
400 | const BIGNUM *b, BN_CTX *ctx); | |
401 | # ifndef OPENSSL_NO_EC2M | |
ba12070f NL |
402 | /** Creates a new EC_GROUP object with the specified parameters defined |
403 | * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b) | |
404 | * \param p BIGNUM with the polynomial defining the underlying field | |
405 | * \param a BIGNUM with the parameter a of the equation | |
406 | * \param b BIGNUM with the parameter b of the equation | |
407 | * \param ctx BN_CTX object (optional) | |
408 | * \return newly created EC_GROUP object with the specified parameters | |
409 | */ | |
0f113f3e MC |
410 | EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, |
411 | const BIGNUM *b, BN_CTX *ctx); | |
412 | # endif | |
ba12070f NL |
413 | /** Creates a EC_GROUP object with a curve specified by a NID |
414 | * \param nid NID of the OID of the curve name | |
415 | * \return newly created EC_GROUP object with specified curve or NULL | |
416 | * if an error occurred | |
417 | */ | |
8b15c740 | 418 | EC_GROUP *EC_GROUP_new_by_curve_name(int nid); |
ba12070f | 419 | |
ba12070f NL |
420 | /********************************************************************/ |
421 | /* handling of internal curves */ | |
422 | /********************************************************************/ | |
423 | ||
0f113f3e MC |
424 | typedef struct { |
425 | int nid; | |
426 | const char *comment; | |
427 | } EC_builtin_curve; | |
ba12070f | 428 | |
0f113f3e MC |
429 | /* |
430 | * EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number of all | |
431 | * available curves or zero if a error occurred. In case r ist not zero | |
432 | * nitems EC_builtin_curve structures are filled with the data of the first | |
433 | * nitems internal groups | |
434 | */ | |
65b1d31d | 435 | size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); |
7eb18f12 | 436 | |
64095ce9 DSH |
437 | const char *EC_curve_nid2nist(int nid); |
438 | int EC_curve_nist2nid(const char *name); | |
7e31164a | 439 | |
ba12070f NL |
440 | /********************************************************************/ |
441 | /* EC_POINT functions */ | |
442 | /********************************************************************/ | |
443 | ||
444 | /** Creates a new EC_POINT object for the specified EC_GROUP | |
445 | * \param group EC_GROUP the underlying EC_GROUP object | |
446 | * \return newly created EC_POINT object or NULL if an error occurred | |
447 | */ | |
448 | EC_POINT *EC_POINT_new(const EC_GROUP *group); | |
449 | ||
450 | /** Frees a EC_POINT object | |
451 | * \param point EC_POINT object to be freed | |
452 | */ | |
453 | void EC_POINT_free(EC_POINT *point); | |
454 | ||
455 | /** Clears and frees a EC_POINT object | |
456 | * \param point EC_POINT object to be cleared and freed | |
457 | */ | |
458 | void EC_POINT_clear_free(EC_POINT *point); | |
459 | ||
460 | /** Copies EC_POINT object | |
461 | * \param dst destination EC_POINT object | |
462 | * \param src source EC_POINT object | |
478b50cf | 463 | * \return 1 on success and 0 if an error occurred |
ba12070f NL |
464 | */ |
465 | int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); | |
945e15a2 | 466 | |
ba12070f NL |
467 | /** Creates a new EC_POINT object and copies the content of the supplied |
468 | * EC_POINT | |
469 | * \param src source EC_POINT object | |
470 | * \param group underlying the EC_GROUP object | |
0f113f3e | 471 | * \return newly created EC_POINT object or NULL if an error occurred |
ba12070f NL |
472 | */ |
473 | EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); | |
0f113f3e MC |
474 | |
475 | /** Returns the EC_METHOD used in EC_POINT object | |
ba12070f NL |
476 | * \param point EC_POINT object |
477 | * \return the EC_METHOD used | |
478 | */ | |
479 | const EC_METHOD *EC_POINT_method_of(const EC_POINT *point); | |
480 | ||
481 | /** Sets a point to infinity (neutral element) | |
482 | * \param group underlying EC_GROUP object | |
483 | * \param point EC_POINT to set to infinity | |
478b50cf | 484 | * \return 1 on success and 0 if an error occurred |
ba12070f NL |
485 | */ |
486 | int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); | |
487 | ||
488 | /** Sets the jacobian projective coordinates of a EC_POINT over GFp | |
489 | * \param group underlying EC_GROUP object | |
490 | * \param p EC_POINT object | |
491 | * \param x BIGNUM with the x-coordinate | |
492 | * \param y BIGNUM with the y-coordinate | |
493 | * \param z BIGNUM with the z-coordinate | |
494 | * \param ctx BN_CTX object (optional) | |
478b50cf | 495 | * \return 1 on success and 0 if an error occurred |
ba12070f | 496 | */ |
0f113f3e MC |
497 | int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, |
498 | EC_POINT *p, const BIGNUM *x, | |
499 | const BIGNUM *y, const BIGNUM *z, | |
500 | BN_CTX *ctx); | |
ba12070f NL |
501 | |
502 | /** Gets the jacobian projective coordinates of a EC_POINT over GFp | |
503 | * \param group underlying EC_GROUP object | |
504 | * \param p EC_POINT object | |
505 | * \param x BIGNUM for the x-coordinate | |
506 | * \param y BIGNUM for the y-coordinate | |
507 | * \param z BIGNUM for the z-coordinate | |
508 | * \param ctx BN_CTX object (optional) | |
478b50cf | 509 | * \return 1 on success and 0 if an error occurred |
ba12070f NL |
510 | */ |
511 | int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, | |
0f113f3e MC |
512 | const EC_POINT *p, BIGNUM *x, |
513 | BIGNUM *y, BIGNUM *z, | |
514 | BN_CTX *ctx); | |
ba12070f NL |
515 | |
516 | /** Sets the affine coordinates of a EC_POINT over GFp | |
517 | * \param group underlying EC_GROUP object | |
518 | * \param p EC_POINT object | |
519 | * \param x BIGNUM with the x-coordinate | |
520 | * \param y BIGNUM with the y-coordinate | |
521 | * \param ctx BN_CTX object (optional) | |
478b50cf | 522 | * \return 1 on success and 0 if an error occurred |
ba12070f NL |
523 | */ |
524 | int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, | |
0f113f3e MC |
525 | const BIGNUM *x, const BIGNUM *y, |
526 | BN_CTX *ctx); | |
ba12070f NL |
527 | |
528 | /** Gets the affine coordinates of a EC_POINT over GFp | |
529 | * \param group underlying EC_GROUP object | |
530 | * \param p EC_POINT object | |
531 | * \param x BIGNUM for the x-coordinate | |
532 | * \param y BIGNUM for the y-coordinate | |
533 | * \param ctx BN_CTX object (optional) | |
478b50cf | 534 | * \return 1 on success and 0 if an error occurred |
ba12070f NL |
535 | */ |
536 | int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, | |
0f113f3e MC |
537 | const EC_POINT *p, BIGNUM *x, |
538 | BIGNUM *y, BN_CTX *ctx); | |
ba12070f NL |
539 | |
540 | /** Sets the x9.62 compressed coordinates of a EC_POINT over GFp | |
541 | * \param group underlying EC_GROUP object | |
542 | * \param p EC_POINT object | |
543 | * \param x BIGNUM with x-coordinate | |
544 | * \param y_bit integer with the y-Bit (either 0 or 1) | |
545 | * \param ctx BN_CTX object (optional) | |
478b50cf | 546 | * \return 1 on success and 0 if an error occurred |
ba12070f | 547 | */ |
0f113f3e MC |
548 | int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, |
549 | EC_POINT *p, const BIGNUM *x, | |
550 | int y_bit, BN_CTX *ctx); | |
551 | # ifndef OPENSSL_NO_EC2M | |
ba12070f NL |
552 | /** Sets the affine coordinates of a EC_POINT over GF2m |
553 | * \param group underlying EC_GROUP object | |
554 | * \param p EC_POINT object | |
555 | * \param x BIGNUM with the x-coordinate | |
556 | * \param y BIGNUM with the y-coordinate | |
557 | * \param ctx BN_CTX object (optional) | |
478b50cf | 558 | * \return 1 on success and 0 if an error occurred |
ba12070f NL |
559 | */ |
560 | int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, | |
0f113f3e MC |
561 | const BIGNUM *x, const BIGNUM *y, |
562 | BN_CTX *ctx); | |
ba12070f NL |
563 | |
564 | /** Gets the affine coordinates of a EC_POINT over GF2m | |
565 | * \param group underlying EC_GROUP object | |
566 | * \param p EC_POINT object | |
567 | * \param x BIGNUM for the x-coordinate | |
568 | * \param y BIGNUM for the y-coordinate | |
569 | * \param ctx BN_CTX object (optional) | |
478b50cf | 570 | * \return 1 on success and 0 if an error occurred |
ba12070f NL |
571 | */ |
572 | int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, | |
0f113f3e MC |
573 | const EC_POINT *p, BIGNUM *x, |
574 | BIGNUM *y, BN_CTX *ctx); | |
ba12070f NL |
575 | |
576 | /** Sets the x9.62 compressed coordinates of a EC_POINT over GF2m | |
577 | * \param group underlying EC_GROUP object | |
578 | * \param p EC_POINT object | |
579 | * \param x BIGNUM with x-coordinate | |
580 | * \param y_bit integer with the y-Bit (either 0 or 1) | |
581 | * \param ctx BN_CTX object (optional) | |
478b50cf | 582 | * \return 1 on success and 0 if an error occurred |
ba12070f | 583 | */ |
0f113f3e MC |
584 | int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, |
585 | EC_POINT *p, const BIGNUM *x, | |
586 | int y_bit, BN_CTX *ctx); | |
587 | # endif | |
ba12070f NL |
588 | /** Encodes a EC_POINT object to a octet string |
589 | * \param group underlying EC_GROUP object | |
590 | * \param p EC_POINT object | |
591 | * \param form point conversion form | |
592 | * \param buf memory buffer for the result. If NULL the function returns | |
593 | * required buffer size. | |
594 | * \param len length of the memory buffer | |
595 | * \param ctx BN_CTX object (optional) | |
596 | * \return the length of the encoded octet string or 0 if an error occurred | |
597 | */ | |
598 | size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p, | |
0f113f3e MC |
599 | point_conversion_form_t form, |
600 | unsigned char *buf, size_t len, BN_CTX *ctx); | |
ba12070f NL |
601 | |
602 | /** Decodes a EC_POINT from a octet string | |
603 | * \param group underlying EC_GROUP object | |
604 | * \param p EC_POINT object | |
605 | * \param buf memory buffer with the encoded ec point | |
606 | * \param len length of the encoded ec point | |
607 | * \param ctx BN_CTX object (optional) | |
478b50cf | 608 | * \return 1 on success and 0 if an error occurred |
ba12070f NL |
609 | */ |
610 | int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p, | |
0f113f3e | 611 | const unsigned char *buf, size_t len, BN_CTX *ctx); |
7d7db13e | 612 | |
981bd8a2 DSH |
613 | /** Encodes an EC_POINT object to an allocated octet string |
614 | * \param group underlying EC_GROUP object | |
615 | * \param point EC_POINT object | |
616 | * \param form point conversion form | |
617 | * \param pbuf returns pointer to allocated buffer | |
618 | * \param len length of the memory buffer | |
619 | * \param ctx BN_CTX object (optional) | |
620 | * \return the length of the encoded octet string or 0 if an error occurred | |
621 | */ | |
622 | ||
623 | size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point, | |
624 | point_conversion_form_t form, | |
625 | unsigned char **pbuf, BN_CTX *ctx); | |
626 | ||
6cbe6382 BM |
627 | /* other interfaces to point2oct/oct2point: */ |
628 | BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *, | |
0f113f3e | 629 | point_conversion_form_t form, BIGNUM *, BN_CTX *); |
6cbe6382 | 630 | EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *, |
0f113f3e | 631 | EC_POINT *, BN_CTX *); |
6cbe6382 | 632 | char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *, |
0f113f3e | 633 | point_conversion_form_t form, BN_CTX *); |
6cbe6382 | 634 | EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, |
0f113f3e | 635 | EC_POINT *, BN_CTX *); |
3a12ce01 | 636 | |
ba12070f NL |
637 | /********************************************************************/ |
638 | /* functions for doing EC_POINT arithmetic */ | |
639 | /********************************************************************/ | |
640 | ||
0f113f3e | 641 | /** Computes the sum of two EC_POINT |
ba12070f NL |
642 | * \param group underlying EC_GROUP object |
643 | * \param r EC_POINT object for the result (r = a + b) | |
644 | * \param a EC_POINT object with the first summand | |
645 | * \param b EC_POINT object with the second summand | |
646 | * \param ctx BN_CTX object (optional) | |
478b50cf | 647 | * \return 1 on success and 0 if an error occurred |
ba12070f | 648 | */ |
0f113f3e MC |
649 | int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, |
650 | const EC_POINT *b, BN_CTX *ctx); | |
ba12070f NL |
651 | |
652 | /** Computes the double of a EC_POINT | |
653 | * \param group underlying EC_GROUP object | |
654 | * \param r EC_POINT object for the result (r = 2 * a) | |
0f113f3e | 655 | * \param a EC_POINT object |
ba12070f | 656 | * \param ctx BN_CTX object (optional) |
478b50cf | 657 | * \return 1 on success and 0 if an error occurred |
ba12070f | 658 | */ |
0f113f3e MC |
659 | int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, |
660 | BN_CTX *ctx); | |
ba12070f NL |
661 | |
662 | /** Computes the inverse of a EC_POINT | |
663 | * \param group underlying EC_GROUP object | |
664 | * \param a EC_POINT object to be inverted (it's used for the result as well) | |
665 | * \param ctx BN_CTX object (optional) | |
478b50cf | 666 | * \return 1 on success and 0 if an error occurred |
ba12070f NL |
667 | */ |
668 | int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx); | |
669 | ||
670 | /** Checks whether the point is the neutral element of the group | |
671 | * \param group the underlying EC_GROUP object | |
672 | * \param p EC_POINT object | |
673 | * \return 1 if the point is the neutral element and 0 otherwise | |
674 | */ | |
675 | int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p); | |
676 | ||
0f113f3e | 677 | /** Checks whether the point is on the curve |
ba12070f NL |
678 | * \param group underlying EC_GROUP object |
679 | * \param point EC_POINT object to check | |
680 | * \param ctx BN_CTX object (optional) | |
681 | * \return 1 if point if on the curve and 0 otherwise | |
682 | */ | |
0f113f3e MC |
683 | int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, |
684 | BN_CTX *ctx); | |
ba12070f | 685 | |
0f113f3e | 686 | /** Compares two EC_POINTs |
ba12070f NL |
687 | * \param group underlying EC_GROUP object |
688 | * \param a first EC_POINT object | |
689 | * \param b second EC_POINT object | |
690 | * \param ctx BN_CTX object (optional) | |
691 | * \return 0 if both points are equal and a value != 0 otherwise | |
692 | */ | |
0f113f3e MC |
693 | int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, |
694 | BN_CTX *ctx); | |
fb171e53 | 695 | |
9945b460 | 696 | int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); |
0f113f3e MC |
697 | int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, |
698 | EC_POINT *points[], BN_CTX *ctx); | |
fb171e53 | 699 | |
16602b5c | 700 | /** Computes r = generator * n sum_{i=0}^{num-1} p[i] * m[i] |
ba12070f NL |
701 | * \param group underlying EC_GROUP object |
702 | * \param r EC_POINT object for the result | |
703 | * \param n BIGNUM with the multiplier for the group generator (optional) | |
704 | * \param num number futher summands | |
705 | * \param p array of size num of EC_POINT objects | |
706 | * \param m array of size num of BIGNUM objects | |
707 | * \param ctx BN_CTX object (optional) | |
478b50cf | 708 | * \return 1 on success and 0 if an error occurred |
ba12070f | 709 | */ |
0f113f3e MC |
710 | int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, |
711 | size_t num, const EC_POINT *p[], const BIGNUM *m[], | |
712 | BN_CTX *ctx); | |
ba12070f NL |
713 | |
714 | /** Computes r = generator * n + q * m | |
715 | * \param group underlying EC_GROUP object | |
716 | * \param r EC_POINT object for the result | |
717 | * \param n BIGNUM with the multiplier for the group generator (optional) | |
718 | * \param q EC_POINT object with the first factor of the second summand | |
719 | * \param m BIGNUM with the second factor of the second summand | |
720 | * \param ctx BN_CTX object (optional) | |
478b50cf | 721 | * \return 1 on success and 0 if an error occurred |
ba12070f | 722 | */ |
0f113f3e MC |
723 | int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, |
724 | const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx); | |
3a12ce01 | 725 | |
ba12070f NL |
726 | /** Stores multiples of generator for faster point multiplication |
727 | * \param group EC_GROUP object | |
728 | * \param ctx BN_CTX object (optional) | |
478b50cf | 729 | * \return 1 on success and 0 if an error occurred |
ba12070f NL |
730 | */ |
731 | int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); | |
6cc5e19d | 732 | |
ba12070f NL |
733 | /** Reports whether a precomputation has been done |
734 | * \param group EC_GROUP object | |
735 | * \return 1 if a pre-computation has been done and 0 otherwise | |
736 | */ | |
737 | int EC_GROUP_have_precompute_mult(const EC_GROUP *group); | |
6cc5e19d | 738 | |
ba12070f NL |
739 | /********************************************************************/ |
740 | /* ASN1 stuff */ | |
741 | /********************************************************************/ | |
8aefe253 | 742 | |
0f113f3e MC |
743 | /* |
744 | * EC_GROUP_get_basis_type() returns the NID of the basis type used to | |
745 | * represent the field elements | |
746 | */ | |
34f1f2a8 | 747 | int EC_GROUP_get_basis_type(const EC_GROUP *); |
0f113f3e | 748 | # ifndef OPENSSL_NO_EC2M |
34f1f2a8 | 749 | int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k); |
0f113f3e MC |
750 | int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, |
751 | unsigned int *k2, unsigned int *k3); | |
752 | # endif | |
8aefe253 | 753 | |
86f300d3 DSH |
754 | # define OPENSSL_EC_EXPLICIT_CURVE 0x000 |
755 | # define OPENSSL_EC_NAMED_CURVE 0x001 | |
458c2917 | 756 | |
458c2917 BM |
757 | typedef struct ecpk_parameters_st ECPKPARAMETERS; |
758 | ||
6343829a | 759 | EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len); |
458c2917 BM |
760 | int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out); |
761 | ||
0f113f3e MC |
762 | # define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x) |
763 | # define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x) | |
764 | # define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \ | |
5dbd3efc | 765 | (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x)) |
0f113f3e MC |
766 | # define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \ |
767 | (unsigned char *)(x)) | |
5f3d6f70 | 768 | |
0f113f3e | 769 | int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off); |
0f113f3e MC |
770 | # ifndef OPENSSL_NO_STDIO |
771 | int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off); | |
772 | # endif | |
ba12070f NL |
773 | |
774 | /********************************************************************/ | |
775 | /* EC_KEY functions */ | |
776 | /********************************************************************/ | |
777 | ||
14a7cfb3 | 778 | /* some values for the encoding_flag */ |
0f113f3e MC |
779 | # define EC_PKEY_NO_PARAMETERS 0x001 |
780 | # define EC_PKEY_NO_PUBKEY 0x002 | |
14a7cfb3 | 781 | |
cac4fb58 | 782 | /* some values for the flags field */ |
0f113f3e MC |
783 | # define EC_FLAG_NON_FIPS_ALLOW 0x1 |
784 | # define EC_FLAG_FIPS_CHECKED 0x2 | |
a22a7e70 | 785 | # define EC_FLAG_COFACTOR_ECDH 0x1000 |
cac4fb58 | 786 | |
ba12070f NL |
787 | /** Creates a new EC_KEY object. |
788 | * \return EC_KEY object or NULL if an error occurred. | |
789 | */ | |
14a7cfb3 | 790 | EC_KEY *EC_KEY_new(void); |
ba12070f | 791 | |
cac4fb58 DSH |
792 | int EC_KEY_get_flags(const EC_KEY *key); |
793 | ||
794 | void EC_KEY_set_flags(EC_KEY *key, int flags); | |
795 | ||
796 | void EC_KEY_clear_flags(EC_KEY *key, int flags); | |
797 | ||
ba12070f NL |
798 | /** Creates a new EC_KEY object using a named curve as underlying |
799 | * EC_GROUP object. | |
800 | * \param nid NID of the named curve. | |
0f113f3e | 801 | * \return EC_KEY object or NULL if an error occurred. |
ba12070f | 802 | */ |
9dd84053 | 803 | EC_KEY *EC_KEY_new_by_curve_name(int nid); |
ba12070f NL |
804 | |
805 | /** Frees a EC_KEY object. | |
806 | * \param key EC_KEY object to be freed. | |
807 | */ | |
808 | void EC_KEY_free(EC_KEY *key); | |
809 | ||
810 | /** Copies a EC_KEY object. | |
811 | * \param dst destination EC_KEY object | |
812 | * \param src src EC_KEY object | |
813 | * \return dst or NULL if an error occurred. | |
814 | */ | |
3aef36ff | 815 | EC_KEY *EC_KEY_copy(EC_KEY *dst, EC_KEY *src); |
ba12070f NL |
816 | |
817 | /** Creates a new EC_KEY object and copies the content from src to it. | |
818 | * \param src the source EC_KEY object | |
819 | * \return newly created EC_KEY object or NULL if an error occurred. | |
820 | */ | |
3aef36ff | 821 | EC_KEY *EC_KEY_dup(EC_KEY *src); |
ba12070f NL |
822 | |
823 | /** Increases the internal reference count of a EC_KEY object. | |
824 | * \param key EC_KEY object | |
825 | * \return 1 on success and 0 if an error occurred. | |
826 | */ | |
827 | int EC_KEY_up_ref(EC_KEY *key); | |
828 | ||
829 | /** Returns the EC_GROUP object of a EC_KEY object | |
830 | * \param key EC_KEY object | |
831 | * \return the EC_GROUP object (possibly NULL). | |
832 | */ | |
833 | const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); | |
834 | ||
835 | /** Sets the EC_GROUP of a EC_KEY object. | |
836 | * \param key EC_KEY object | |
837 | * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY | |
838 | * object will use an own copy of the EC_GROUP). | |
839 | * \return 1 on success and 0 if an error occurred. | |
840 | */ | |
841 | int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group); | |
842 | ||
843 | /** Returns the private key of a EC_KEY object. | |
844 | * \param key EC_KEY object | |
845 | * \return a BIGNUM with the private key (possibly NULL). | |
846 | */ | |
847 | const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); | |
848 | ||
849 | /** Sets the private key of a EC_KEY object. | |
850 | * \param key EC_KEY object | |
851 | * \param prv BIGNUM with the private key (note: the EC_KEY object | |
852 | * will use an own copy of the BIGNUM). | |
853 | * \return 1 on success and 0 if an error occurred. | |
854 | */ | |
855 | int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); | |
856 | ||
857 | /** Returns the public key of a EC_KEY object. | |
858 | * \param key the EC_KEY object | |
859 | * \return a EC_POINT object with the public key (possibly NULL) | |
860 | */ | |
861 | const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); | |
862 | ||
863 | /** Sets the public key of a EC_KEY object. | |
864 | * \param key EC_KEY object | |
865 | * \param pub EC_POINT object with the public key (note: the EC_KEY object | |
866 | * will use an own copy of the EC_POINT object). | |
867 | * \return 1 on success and 0 if an error occurred. | |
868 | */ | |
869 | int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); | |
870 | ||
871 | unsigned EC_KEY_get_enc_flags(const EC_KEY *key); | |
9945b460 DSH |
872 | void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); |
873 | point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); | |
874 | void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); | |
3aef36ff RS |
875 | |
876 | #define EC_KEY_get_ex_new_index(l, p, newf, dupf, freef) \ | |
877 | CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_EC_KEY, l, p, newf, dupf, freef) | |
878 | int EC_KEY_set_ex_data(EC_KEY *key, int idx, void *arg); | |
879 | void *EC_KEY_get_ex_data(const EC_KEY *key, int idx); | |
880 | ||
9dd84053 | 881 | /* wrapper functions for the underlying EC_GROUP object */ |
9945b460 | 882 | void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); |
ba12070f | 883 | |
0f113f3e | 884 | /** Creates a table of pre-computed multiples of the generator to |
ba12070f NL |
885 | * accelerate further EC_KEY operations. |
886 | * \param key EC_KEY object | |
887 | * \param ctx BN_CTX object (optional) | |
888 | * \return 1 on success and 0 if an error occurred. | |
889 | */ | |
890 | int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx); | |
891 | ||
892 | /** Creates a new ec private (and optional a new public) key. | |
893 | * \param key EC_KEY object | |
894 | * \return 1 on success and 0 if an error occurred. | |
895 | */ | |
896 | int EC_KEY_generate_key(EC_KEY *key); | |
897 | ||
898 | /** Verifies that a private and/or public key is valid. | |
899 | * \param key the EC_KEY object | |
900 | * \return 1 on success and 0 otherwise. | |
901 | */ | |
902 | int EC_KEY_check_key(const EC_KEY *key); | |
903 | ||
fef1c40b | 904 | /** Sets a public key from affine coordindates performing |
478b50cf | 905 | * necessary NIST PKV tests. |
fef1c40b DSH |
906 | * \param key the EC_KEY object |
907 | * \param x public key x coordinate | |
908 | * \param y public key y coordinate | |
909 | * \return 1 on success and 0 otherwise. | |
910 | */ | |
0f113f3e MC |
911 | int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, |
912 | BIGNUM *y); | |
ba12070f | 913 | |
981bd8a2 DSH |
914 | /** Encodes an EC_KEY public key to an allocated octet string |
915 | * \param key key to encode | |
916 | * \param form point conversion form | |
917 | * \param pbuf returns pointer to allocated buffer | |
918 | * \param len length of the memory buffer | |
919 | * \param ctx BN_CTX object (optional) | |
920 | * \return the length of the encoded octet string or 0 if an error occurred | |
921 | */ | |
922 | ||
923 | size_t EC_KEY_key2buf(const EC_KEY *key, point_conversion_form_t form, | |
924 | unsigned char **pbuf, BN_CTX *ctx); | |
925 | ||
926 | /** Decodes a EC_KEY public key from a octet string | |
927 | * \param key key to decode | |
928 | * \param buf memory buffer with the encoded ec point | |
929 | * \param len length of the encoded ec point | |
930 | * \param ctx BN_CTX object (optional) | |
931 | * \return 1 on success and 0 if an error occurred | |
932 | */ | |
933 | ||
934 | int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, size_t len, | |
935 | BN_CTX *ctx); | |
936 | ||
cf241395 DSH |
937 | /** Decodes an EC_KEY private key from an octet string |
938 | * \param key key to decode | |
939 | * \param buf memory buffer with the encoded private key | |
940 | * \param len length of the encoded key | |
941 | * \return 1 on success and 0 if an error occurred | |
942 | */ | |
943 | ||
944 | int EC_KEY_oct2priv(EC_KEY *key, unsigned char *buf, size_t len); | |
945 | ||
946 | /** Encodes a EC_KEY private key to an octet string | |
947 | * \param key key to encode | |
948 | * \param buf memory buffer for the result. If NULL the function returns | |
949 | * required buffer size. | |
950 | * \param len length of the memory buffer | |
951 | * \return the length of the encoded octet string or 0 if an error occurred | |
952 | */ | |
953 | ||
954 | size_t EC_KEY_priv2oct(const EC_KEY *key, unsigned char *buf, size_t len); | |
955 | ||
956 | ||
ba12070f NL |
957 | /********************************************************************/ |
958 | /* de- and encoding functions for SEC1 ECPrivateKey */ | |
959 | /********************************************************************/ | |
960 | ||
961 | /** Decodes a private key from a memory buffer. | |
962 | * \param key a pointer to a EC_KEY object which should be used (or NULL) | |
963 | * \param in pointer to memory with the DER encoded private key | |
964 | * \param len length of the DER encoded private key | |
965 | * \return the decoded private key or NULL if an error occurred. | |
966 | */ | |
6343829a | 967 | EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len); |
ba12070f NL |
968 | |
969 | /** Encodes a private key object and stores the result in a buffer. | |
970 | * \param key the EC_KEY object to encode | |
971 | * \param out the buffer for the result (if NULL the function returns number | |
972 | * of bytes needed). | |
973 | * \return 1 on success and 0 if an error occurred. | |
974 | */ | |
975 | int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out); | |
976 | ||
ba12070f NL |
977 | /********************************************************************/ |
978 | /* de- and encoding functions for EC parameters */ | |
979 | /********************************************************************/ | |
980 | ||
981 | /** Decodes ec parameter from a memory buffer. | |
982 | * \param key a pointer to a EC_KEY object which should be used (or NULL) | |
983 | * \param in pointer to memory with the DER encoded ec parameters | |
984 | * \param len length of the DER encoded ec parameters | |
985 | * \return a EC_KEY object with the decoded parameters or NULL if an error | |
986 | * occurred. | |
987 | */ | |
988 | EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len); | |
989 | ||
990 | /** Encodes ec parameter and stores the result in a buffer. | |
1afd7fa9 | 991 | * \param key the EC_KEY object with ec parameters to encode |
ba12070f NL |
992 | * \param out the buffer for the result (if NULL the function returns number |
993 | * of bytes needed). | |
994 | * \return 1 on success and 0 if an error occurred. | |
995 | */ | |
996 | int i2d_ECParameters(EC_KEY *key, unsigned char **out); | |
997 | ||
ba12070f NL |
998 | /********************************************************************/ |
999 | /* de- and encoding functions for EC public key */ | |
1000 | /* (octet string, not DER -- hence 'o2i' and 'i2o') */ | |
1001 | /********************************************************************/ | |
1002 | ||
1003 | /** Decodes a ec public key from a octet string. | |
1004 | * \param key a pointer to a EC_KEY object which should be used | |
1005 | * \param in memory buffer with the encoded public key | |
1006 | * \param len length of the encoded public key | |
1007 | * \return EC_KEY object with decoded public key or NULL if an error | |
1008 | * occurred. | |
1009 | */ | |
1010 | EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len); | |
1011 | ||
1012 | /** Encodes a ec public key in an octet string. | |
1013 | * \param key the EC_KEY object with the public key | |
1014 | * \param out the buffer for the result (if NULL the function returns number | |
1015 | * of bytes needed). | |
1016 | * \return 1 on success and 0 if an error occurred | |
1017 | */ | |
1018 | int i2o_ECPublicKey(EC_KEY *key, unsigned char **out); | |
14a7cfb3 | 1019 | |
ba12070f NL |
1020 | /** Prints out the ec parameters on human readable form. |
1021 | * \param bp BIO object to which the information is printed | |
1022 | * \param key EC_KEY object | |
1023 | * \return 1 on success and 0 if an error occurred | |
1024 | */ | |
0f113f3e | 1025 | int ECParameters_print(BIO *bp, const EC_KEY *key); |
ba12070f NL |
1026 | |
1027 | /** Prints out the contents of a EC_KEY object | |
1028 | * \param bp BIO object to which the information is printed | |
1029 | * \param key EC_KEY object | |
0f113f3e | 1030 | * \param off line offset |
ba12070f NL |
1031 | * \return 1 on success and 0 if an error occurred |
1032 | */ | |
0f113f3e | 1033 | int EC_KEY_print(BIO *bp, const EC_KEY *key, int off); |
ba12070f | 1034 | |
0f113f3e | 1035 | # ifndef OPENSSL_NO_STDIO |
ba12070f NL |
1036 | /** Prints out the ec parameters on human readable form. |
1037 | * \param fp file descriptor to which the information is printed | |
1038 | * \param key EC_KEY object | |
1039 | * \return 1 on success and 0 if an error occurred | |
1040 | */ | |
0f113f3e | 1041 | int ECParameters_print_fp(FILE *fp, const EC_KEY *key); |
ba12070f NL |
1042 | |
1043 | /** Prints out the contents of a EC_KEY object | |
1044 | * \param fp file descriptor to which the information is printed | |
1045 | * \param key EC_KEY object | |
0f113f3e | 1046 | * \param off line offset |
ba12070f NL |
1047 | * \return 1 on success and 0 if an error occurred |
1048 | */ | |
0f113f3e | 1049 | int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off); |
ba12070f | 1050 | |
0f113f3e | 1051 | # endif |
0bee0e62 | 1052 | |
28572b57 DSH |
1053 | const EC_KEY_METHOD *EC_KEY_OpenSSL(void); |
1054 | const EC_KEY_METHOD *EC_KEY_get_default_method(void); | |
1055 | void EC_KEY_set_default_method(const EC_KEY_METHOD *meth); | |
3aef36ff RS |
1056 | const EC_KEY_METHOD *EC_KEY_get_method(const EC_KEY *key); |
1057 | int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth); | |
28572b57 DSH |
1058 | EC_KEY *EC_KEY_new_method(ENGINE *engine); |
1059 | ||
768c53e1 DSH |
1060 | int ECDH_KDF_X9_62(unsigned char *out, size_t outlen, |
1061 | const unsigned char *Z, size_t Zlen, | |
1062 | const unsigned char *sinfo, size_t sinfolen, | |
1063 | const EVP_MD *md); | |
1064 | ||
a22a7e70 | 1065 | int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, |
2c61a5ec DSH |
1066 | const EC_KEY *ecdh, |
1067 | void *(*KDF) (const void *in, size_t inlen, | |
1068 | void *out, size_t *outlen)); | |
a22a7e70 | 1069 | |
714b2abb DSH |
1070 | typedef struct ECDSA_SIG_st ECDSA_SIG; |
1071 | ||
ef5b2ba6 DSH |
1072 | /** Allocates and initialize a ECDSA_SIG structure |
1073 | * \return pointer to a ECDSA_SIG structure or NULL if an error occurred | |
1074 | */ | |
1075 | ECDSA_SIG *ECDSA_SIG_new(void); | |
1076 | ||
1077 | /** frees a ECDSA_SIG structure | |
1078 | * \param sig pointer to the ECDSA_SIG structure | |
1079 | */ | |
1080 | void ECDSA_SIG_free(ECDSA_SIG *sig); | |
1081 | ||
1082 | /** DER encode content of ECDSA_SIG object (note: this function modifies *pp | |
1083 | * (*pp += length of the DER encoded signature)). | |
1084 | * \param sig pointer to the ECDSA_SIG object | |
1085 | * \param pp pointer to a unsigned char pointer for the output or NULL | |
1086 | * \return the length of the DER encoded ECDSA_SIG object or 0 | |
1087 | */ | |
1088 | int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp); | |
1089 | ||
1090 | /** Decodes a DER encoded ECDSA signature (note: this function changes *pp | |
1091 | * (*pp += len)). | |
1092 | * \param sig pointer to ECDSA_SIG pointer (may be NULL) | |
1093 | * \param pp memory buffer with the DER encoded signature | |
1094 | * \param len length of the buffer | |
1095 | * \return pointer to the decoded ECDSA_SIG structure (or NULL) | |
1096 | */ | |
1097 | ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len); | |
1098 | ||
7236e3c8 DSH |
1099 | /** Accessor for r and s fields of ECDSA_SIG |
1100 | * \param sig pointer to ECDSA_SIG pointer | |
1101 | * \param pr pointer to BIGNUM pointer for r (may be NULL) | |
1102 | * \param ps pointer to BIGNUM pointer for s (may be NULL) | |
1103 | */ | |
1104 | void ECDSA_SIG_get0(BIGNUM **pr, BIGNUM **ps, ECDSA_SIG *sig); | |
1105 | ||
180eec16 DSH |
1106 | /** Computes the ECDSA signature of the given hash value using |
1107 | * the supplied private key and returns the created signature. | |
1108 | * \param dgst pointer to the hash value | |
1109 | * \param dgst_len length of the hash value | |
1110 | * \param eckey EC_KEY object containing a private EC key | |
1111 | * \return pointer to a ECDSA_SIG structure or NULL if an error occurred | |
1112 | */ | |
1113 | ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dgst_len, | |
1114 | EC_KEY *eckey); | |
1115 | ||
1116 | /** Computes ECDSA signature of a given hash value using the supplied | |
1117 | * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). | |
1118 | * \param dgst pointer to the hash value to sign | |
1119 | * \param dgstlen length of the hash value | |
1120 | * \param kinv BIGNUM with a pre-computed inverse k (optional) | |
1121 | * \param rp BIGNUM with a pre-computed rp value (optioanl), | |
1122 | * see ECDSA_sign_setup | |
1123 | * \param eckey EC_KEY object containing a private EC key | |
1124 | * \return pointer to a ECDSA_SIG structure or NULL if an error occurred | |
1125 | */ | |
1126 | ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen, | |
1127 | const BIGNUM *kinv, const BIGNUM *rp, | |
1128 | EC_KEY *eckey); | |
1129 | ||
1130 | /** Verifies that the supplied signature is a valid ECDSA | |
1131 | * signature of the supplied hash value using the supplied public key. | |
1132 | * \param dgst pointer to the hash value | |
1133 | * \param dgst_len length of the hash value | |
1134 | * \param sig ECDSA_SIG structure | |
1135 | * \param eckey EC_KEY object containing a public EC key | |
1136 | * \return 1 if the signature is valid, 0 if the signature is invalid | |
1137 | * and -1 on error | |
1138 | */ | |
1139 | int ECDSA_do_verify(const unsigned char *dgst, int dgst_len, | |
1140 | const ECDSA_SIG *sig, EC_KEY *eckey); | |
1141 | ||
bd3602eb DSH |
1142 | /** Precompute parts of the signing operation |
1143 | * \param eckey EC_KEY object containing a private EC key | |
1144 | * \param ctx BN_CTX object (optional) | |
1145 | * \param kinv BIGNUM pointer for the inverse of k | |
1146 | * \param rp BIGNUM pointer for x coordinate of k * generator | |
1147 | * \return 1 on success and 0 otherwise | |
1148 | */ | |
1149 | int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **rp); | |
1150 | ||
1151 | /** Computes ECDSA signature of a given hash value using the supplied | |
1152 | * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). | |
1153 | * \param type this parameter is ignored | |
1154 | * \param dgst pointer to the hash value to sign | |
1155 | * \param dgstlen length of the hash value | |
1156 | * \param sig memory for the DER encoded created signature | |
1157 | * \param siglen pointer to the length of the returned signature | |
1158 | * \param eckey EC_KEY object containing a private EC key | |
1159 | * \return 1 on success and 0 otherwise | |
1160 | */ | |
1161 | int ECDSA_sign(int type, const unsigned char *dgst, int dgstlen, | |
1162 | unsigned char *sig, unsigned int *siglen, EC_KEY *eckey); | |
1163 | ||
1164 | /** Computes ECDSA signature of a given hash value using the supplied | |
1165 | * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). | |
1166 | * \param type this parameter is ignored | |
1167 | * \param dgst pointer to the hash value to sign | |
1168 | * \param dgstlen length of the hash value | |
1169 | * \param sig buffer to hold the DER encoded signature | |
1170 | * \param siglen pointer to the length of the returned signature | |
1171 | * \param kinv BIGNUM with a pre-computed inverse k (optional) | |
1172 | * \param rp BIGNUM with a pre-computed rp value (optioanl), | |
1173 | * see ECDSA_sign_setup | |
1174 | * \param eckey EC_KEY object containing a private EC key | |
1175 | * \return 1 on success and 0 otherwise | |
1176 | */ | |
1177 | int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen, | |
1178 | unsigned char *sig, unsigned int *siglen, | |
1179 | const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey); | |
1180 | ||
1181 | /** Verifies that the given signature is valid ECDSA signature | |
1182 | * of the supplied hash value using the specified public key. | |
1183 | * \param type this parameter is ignored | |
1184 | * \param dgst pointer to the hash value | |
1185 | * \param dgstlen length of the hash value | |
1186 | * \param sig pointer to the DER encoded signature | |
1187 | * \param siglen length of the DER encoded signature | |
1188 | * \param eckey EC_KEY object containing a public EC key | |
1189 | * \return 1 if the signature is valid, 0 if the signature is invalid | |
1190 | * and -1 on error | |
1191 | */ | |
1192 | int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen, | |
1193 | const unsigned char *sig, int siglen, EC_KEY *eckey); | |
7236e3c8 | 1194 | |
cf517a6d DSH |
1195 | /** Returns the maximum length of the DER encoded signature |
1196 | * \param eckey EC_KEY object | |
1197 | * \return numbers of bytes required for the DER encoded signature | |
1198 | */ | |
1199 | int ECDSA_size(const EC_KEY *eckey); | |
1200 | ||
7bb75a5d DSH |
1201 | /********************************************************************/ |
1202 | /* EC_KEY_METHOD constructors, destructors, writers and accessors */ | |
1203 | /********************************************************************/ | |
1204 | ||
f8d7d2d6 DSH |
1205 | EC_KEY_METHOD *EC_KEY_METHOD_new(const EC_KEY_METHOD *meth); |
1206 | void EC_KEY_METHOD_free(EC_KEY_METHOD *meth); | |
1207 | void EC_KEY_METHOD_set_init(EC_KEY_METHOD *meth, | |
1208 | int (*init)(EC_KEY *key), | |
1209 | void (*finish)(EC_KEY *key), | |
1210 | int (*copy)(EC_KEY *dest, const EC_KEY *src), | |
1211 | int (*set_group)(EC_KEY *key, const EC_GROUP *grp), | |
1212 | int (*set_private)(EC_KEY *key, | |
1213 | const BIGNUM *priv_key), | |
1214 | int (*set_public)(EC_KEY *key, | |
1215 | const EC_POINT *pub_key)); | |
1216 | ||
1217 | void EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth, | |
1218 | int (*keygen)(EC_KEY *key)); | |
1219 | ||
1220 | void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth, | |
1221 | int (*ckey)(void *out, | |
1222 | size_t outlen, | |
1223 | const EC_POINT *pub_key, | |
2c61a5ec | 1224 | const EC_KEY *ecdh, |
f8d7d2d6 DSH |
1225 | void *(*KDF) (const void *in, |
1226 | size_t inlen, | |
1227 | void *out, | |
1228 | size_t *outlen))); | |
1229 | ||
1230 | void EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth, | |
1231 | int (*sign)(int type, const unsigned char *dgst, | |
1232 | int dlen, unsigned char *sig, | |
1233 | unsigned int *siglen, | |
1234 | const BIGNUM *kinv, const BIGNUM *r, | |
1235 | EC_KEY *eckey), | |
1236 | int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, | |
1237 | BIGNUM **kinvp, BIGNUM **rp), | |
1238 | ECDSA_SIG *(*sign_sig)(const unsigned char *dgst, | |
1239 | int dgst_len, | |
1240 | const BIGNUM *in_kinv, | |
1241 | const BIGNUM *in_r, | |
1242 | EC_KEY *eckey)); | |
1243 | ||
1244 | void EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth, | |
1245 | int (*verify)(int type, const unsigned | |
1246 | char *dgst, int dgst_len, | |
1247 | const unsigned char *sigbuf, | |
1248 | int sig_len, EC_KEY *eckey), | |
1249 | int (*verify_sig)(const unsigned char *dgst, | |
1250 | int dgst_len, | |
1251 | const ECDSA_SIG *sig, | |
1252 | EC_KEY *eckey)); | |
1253 | ||
1254 | void EC_KEY_METHOD_get_init(EC_KEY_METHOD *meth, | |
1255 | int (**pinit)(EC_KEY *key), | |
1256 | void (**pfinish)(EC_KEY *key), | |
1257 | int (**pcopy)(EC_KEY *dest, const EC_KEY *src), | |
1258 | int (**pset_group)(EC_KEY *key, | |
1259 | const EC_GROUP *grp), | |
1260 | int (**pset_private)(EC_KEY *key, | |
1261 | const BIGNUM *priv_key), | |
1262 | int (**pset_public)(EC_KEY *key, | |
1263 | const EC_POINT *pub_key)); | |
1264 | ||
1265 | void EC_KEY_METHOD_get_keygen(EC_KEY_METHOD *meth, | |
1266 | int (**pkeygen)(EC_KEY *key)); | |
1267 | ||
1268 | void EC_KEY_METHOD_get_compute_key(EC_KEY_METHOD *meth, | |
1269 | int (**pck)(void *out, | |
1270 | size_t outlen, | |
1271 | const EC_POINT *pub_key, | |
2c61a5ec | 1272 | const EC_KEY *ecdh, |
f8d7d2d6 DSH |
1273 | void *(*KDF) (const void *in, |
1274 | size_t inlen, | |
1275 | void *out, | |
1276 | size_t *outlen))); | |
1277 | ||
1278 | void EC_KEY_METHOD_get_sign(EC_KEY_METHOD *meth, | |
1279 | int (**psign)(int type, const unsigned char *dgst, | |
1280 | int dlen, unsigned char *sig, | |
1281 | unsigned int *siglen, | |
1282 | const BIGNUM *kinv, const BIGNUM *r, | |
1283 | EC_KEY *eckey), | |
1284 | int (**psign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, | |
1285 | BIGNUM **kinvp, BIGNUM **rp), | |
1286 | ECDSA_SIG *(**psign_sig)(const unsigned char *dgst, | |
1287 | int dgst_len, | |
1288 | const BIGNUM *in_kinv, | |
1289 | const BIGNUM *in_r, | |
1290 | EC_KEY *eckey)); | |
1291 | ||
1292 | void EC_KEY_METHOD_get_verify(EC_KEY_METHOD *meth, | |
1293 | int (**pverify)(int type, const unsigned | |
1294 | char *dgst, int dgst_len, | |
1295 | const unsigned char *sigbuf, | |
1296 | int sig_len, EC_KEY *eckey), | |
1297 | int (**pverify_sig)(const unsigned char *dgst, | |
1298 | int dgst_len, | |
1299 | const ECDSA_SIG *sig, | |
1300 | EC_KEY *eckey)); | |
1301 | ||
0f113f3e | 1302 | # define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x) |
458c2917 | 1303 | |
0f113f3e MC |
1304 | # ifndef __cplusplus |
1305 | # if defined(__SUNPRO_C) | |
1306 | # if __SUNPRO_C >= 0x520 | |
1307 | # pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) | |
1308 | # endif | |
ad0db060 DSH |
1309 | # endif |
1310 | # endif | |
ad0db060 | 1311 | |
0f113f3e MC |
1312 | # define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \ |
1313 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ | |
1314 | EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ | |
1315 | EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL) | |
1316 | ||
1317 | # define EVP_PKEY_CTX_set_ec_param_enc(ctx, flag) \ | |
1318 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ | |
1319 | EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ | |
1320 | EVP_PKEY_CTRL_EC_PARAM_ENC, flag, NULL) | |
1321 | ||
1322 | # define EVP_PKEY_CTX_set_ecdh_cofactor_mode(ctx, flag) \ | |
1323 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ | |
1324 | EVP_PKEY_OP_DERIVE, \ | |
1325 | EVP_PKEY_CTRL_EC_ECDH_COFACTOR, flag, NULL) | |
1326 | ||
1327 | # define EVP_PKEY_CTX_get_ecdh_cofactor_mode(ctx) \ | |
1328 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ | |
1329 | EVP_PKEY_OP_DERIVE, \ | |
1330 | EVP_PKEY_CTRL_EC_ECDH_COFACTOR, -2, NULL) | |
1331 | ||
1332 | # define EVP_PKEY_CTX_set_ecdh_kdf_type(ctx, kdf) \ | |
1333 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ | |
1334 | EVP_PKEY_OP_DERIVE, \ | |
1335 | EVP_PKEY_CTRL_EC_KDF_TYPE, kdf, NULL) | |
1336 | ||
1337 | # define EVP_PKEY_CTX_get_ecdh_kdf_type(ctx) \ | |
1338 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ | |
1339 | EVP_PKEY_OP_DERIVE, \ | |
1340 | EVP_PKEY_CTRL_EC_KDF_TYPE, -2, NULL) | |
1341 | ||
1342 | # define EVP_PKEY_CTX_set_ecdh_kdf_md(ctx, md) \ | |
1343 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ | |
1344 | EVP_PKEY_OP_DERIVE, \ | |
1345 | EVP_PKEY_CTRL_EC_KDF_MD, 0, (void *)md) | |
1346 | ||
1347 | # define EVP_PKEY_CTX_get_ecdh_kdf_md(ctx, pmd) \ | |
1348 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ | |
1349 | EVP_PKEY_OP_DERIVE, \ | |
1350 | EVP_PKEY_CTRL_GET_EC_KDF_MD, 0, (void *)pmd) | |
1351 | ||
1352 | # define EVP_PKEY_CTX_set_ecdh_kdf_outlen(ctx, len) \ | |
1353 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ | |
1354 | EVP_PKEY_OP_DERIVE, \ | |
1355 | EVP_PKEY_CTRL_EC_KDF_OUTLEN, len, NULL) | |
1356 | ||
1357 | # define EVP_PKEY_CTX_get_ecdh_kdf_outlen(ctx, plen) \ | |
1358 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ | |
1359 | EVP_PKEY_OP_DERIVE, \ | |
1360 | EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN, 0, (void *)plen) | |
1361 | ||
1362 | # define EVP_PKEY_CTX_set0_ecdh_kdf_ukm(ctx, p, plen) \ | |
1363 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ | |
1364 | EVP_PKEY_OP_DERIVE, \ | |
1365 | EVP_PKEY_CTRL_EC_KDF_UKM, plen, (void *)p) | |
1366 | ||
1367 | # define EVP_PKEY_CTX_get0_ecdh_kdf_ukm(ctx, p) \ | |
1368 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ | |
1369 | EVP_PKEY_OP_DERIVE, \ | |
1370 | EVP_PKEY_CTRL_GET_EC_KDF_UKM, 0, (void *)p) | |
1371 | ||
1372 | # define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1) | |
1373 | # define EVP_PKEY_CTRL_EC_PARAM_ENC (EVP_PKEY_ALG_CTRL + 2) | |
1374 | # define EVP_PKEY_CTRL_EC_ECDH_COFACTOR (EVP_PKEY_ALG_CTRL + 3) | |
1375 | # define EVP_PKEY_CTRL_EC_KDF_TYPE (EVP_PKEY_ALG_CTRL + 4) | |
1376 | # define EVP_PKEY_CTRL_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 5) | |
1377 | # define EVP_PKEY_CTRL_GET_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 6) | |
1378 | # define EVP_PKEY_CTRL_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 7) | |
1379 | # define EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 8) | |
1380 | # define EVP_PKEY_CTRL_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 9) | |
1381 | # define EVP_PKEY_CTRL_GET_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 10) | |
25af7a5d | 1382 | /* KDF types */ |
0f113f3e MC |
1383 | # define EVP_PKEY_ECDH_KDF_NONE 1 |
1384 | # define EVP_PKEY_ECDH_KDF_X9_62 2 | |
9ca7047d | 1385 | |
65e81670 | 1386 | /* BEGIN ERROR CODES */ |
0f113f3e MC |
1387 | /* |
1388 | * The following lines are auto generated by the script mkerr.pl. Any changes | |
65e81670 BM |
1389 | * made after this point may be overwritten when the script is next run. |
1390 | */ | |
de10f690 | 1391 | void ERR_load_EC_strings(void); |
6cc5e19d | 1392 | |
65e81670 | 1393 | /* Error codes for the EC functions. */ |
6cc5e19d | 1394 | |
65e81670 | 1395 | /* Function codes. */ |
0f113f3e MC |
1396 | # define EC_F_BN_TO_FELEM 224 |
1397 | # define EC_F_COMPUTE_WNAF 143 | |
1398 | # define EC_F_D2I_ECPARAMETERS 144 | |
1399 | # define EC_F_D2I_ECPKPARAMETERS 145 | |
1400 | # define EC_F_D2I_ECPRIVATEKEY 146 | |
1401 | # define EC_F_DO_EC_KEY_PRINT 221 | |
1402 | # define EC_F_ECDH_CMS_DECRYPT 238 | |
1403 | # define EC_F_ECDH_CMS_SET_SHARED_INFO 239 | |
53e3189d | 1404 | # define EC_F_ECDH_COMPUTE_KEY 246 |
6e73d12e DSH |
1405 | # define EC_F_ECDSA_DO_SIGN_EX 251 |
1406 | # define EC_F_ECDSA_DO_VERIFY 252 | |
89313de5 | 1407 | # define EC_F_ECDSA_SIGN_EX 254 |
8c661f76 | 1408 | # define EC_F_ECDSA_SIGN_SETUP 248 |
89313de5 | 1409 | # define EC_F_ECDSA_VERIFY 253 |
0f113f3e MC |
1410 | # define EC_F_ECKEY_PARAM2TYPE 223 |
1411 | # define EC_F_ECKEY_PARAM_DECODE 212 | |
1412 | # define EC_F_ECKEY_PRIV_DECODE 213 | |
1413 | # define EC_F_ECKEY_PRIV_ENCODE 214 | |
1414 | # define EC_F_ECKEY_PUB_DECODE 215 | |
1415 | # define EC_F_ECKEY_PUB_ENCODE 216 | |
1416 | # define EC_F_ECKEY_TYPE2PARAM 220 | |
1417 | # define EC_F_ECPARAMETERS_PRINT 147 | |
1418 | # define EC_F_ECPARAMETERS_PRINT_FP 148 | |
1419 | # define EC_F_ECPKPARAMETERS_PRINT 149 | |
1420 | # define EC_F_ECPKPARAMETERS_PRINT_FP 150 | |
d2fa70d8 DSH |
1421 | # define EC_F_ECP_NISTZ256_GET_AFFINE 240 |
1422 | # define EC_F_ECP_NISTZ256_MULT_PRECOMPUTE 243 | |
1423 | # define EC_F_ECP_NISTZ256_POINTS_MUL 241 | |
1424 | # define EC_F_ECP_NISTZ256_PRE_COMP_NEW 244 | |
1425 | # define EC_F_ECP_NISTZ256_WINDOWED_MUL 242 | |
0f113f3e MC |
1426 | # define EC_F_ECP_NIST_MOD_192 203 |
1427 | # define EC_F_ECP_NIST_MOD_224 204 | |
1428 | # define EC_F_ECP_NIST_MOD_256 205 | |
1429 | # define EC_F_ECP_NIST_MOD_521 206 | |
1430 | # define EC_F_EC_ASN1_GROUP2CURVE 153 | |
1431 | # define EC_F_EC_ASN1_GROUP2FIELDID 154 | |
1432 | # define EC_F_EC_ASN1_GROUP2PARAMETERS 155 | |
1433 | # define EC_F_EC_ASN1_GROUP2PKPARAMETERS 156 | |
1434 | # define EC_F_EC_ASN1_PARAMETERS2GROUP 157 | |
1435 | # define EC_F_EC_ASN1_PKPARAMETERS2GROUP 158 | |
1436 | # define EC_F_EC_EX_DATA_SET_DATA 211 | |
1437 | # define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY 208 | |
1438 | # define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 159 | |
1439 | # define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE 195 | |
1440 | # define EC_F_EC_GF2M_SIMPLE_OCT2POINT 160 | |
1441 | # define EC_F_EC_GF2M_SIMPLE_POINT2OCT 161 | |
1442 | # define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162 | |
1443 | # define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163 | |
1444 | # define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES 164 | |
1445 | # define EC_F_EC_GFP_MONT_FIELD_DECODE 133 | |
1446 | # define EC_F_EC_GFP_MONT_FIELD_ENCODE 134 | |
1447 | # define EC_F_EC_GFP_MONT_FIELD_MUL 131 | |
1448 | # define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE 209 | |
1449 | # define EC_F_EC_GFP_MONT_FIELD_SQR 132 | |
1450 | # define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 189 | |
1451 | # define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP 135 | |
1452 | # define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE 225 | |
1453 | # define EC_F_EC_GFP_NISTP224_POINTS_MUL 228 | |
1454 | # define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 226 | |
1455 | # define EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE 230 | |
1456 | # define EC_F_EC_GFP_NISTP256_POINTS_MUL 231 | |
1457 | # define EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES 232 | |
1458 | # define EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE 233 | |
1459 | # define EC_F_EC_GFP_NISTP521_POINTS_MUL 234 | |
1460 | # define EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES 235 | |
1461 | # define EC_F_EC_GFP_NIST_FIELD_MUL 200 | |
1462 | # define EC_F_EC_GFP_NIST_FIELD_SQR 201 | |
1463 | # define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 202 | |
1464 | # define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT 165 | |
1465 | # define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE 166 | |
1466 | # define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP 100 | |
1467 | # define EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR 101 | |
1468 | # define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE 102 | |
1469 | # define EC_F_EC_GFP_SIMPLE_OCT2POINT 103 | |
1470 | # define EC_F_EC_GFP_SIMPLE_POINT2OCT 104 | |
1471 | # define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE 137 | |
1472 | # define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES 167 | |
1473 | # define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES_GFP 105 | |
1474 | # define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES 168 | |
1475 | # define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES_GFP 128 | |
1476 | # define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES 169 | |
1477 | # define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES_GFP 129 | |
1478 | # define EC_F_EC_GROUP_CHECK 170 | |
1479 | # define EC_F_EC_GROUP_CHECK_DISCRIMINANT 171 | |
1480 | # define EC_F_EC_GROUP_COPY 106 | |
1481 | # define EC_F_EC_GROUP_GET0_GENERATOR 139 | |
1482 | # define EC_F_EC_GROUP_GET_COFACTOR 140 | |
1483 | # define EC_F_EC_GROUP_GET_CURVE_GF2M 172 | |
1484 | # define EC_F_EC_GROUP_GET_CURVE_GFP 130 | |
1485 | # define EC_F_EC_GROUP_GET_DEGREE 173 | |
1486 | # define EC_F_EC_GROUP_GET_ORDER 141 | |
1487 | # define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS 193 | |
1488 | # define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194 | |
1489 | # define EC_F_EC_GROUP_NEW 108 | |
1490 | # define EC_F_EC_GROUP_NEW_BY_CURVE_NAME 174 | |
1491 | # define EC_F_EC_GROUP_NEW_FROM_DATA 175 | |
1492 | # define EC_F_EC_GROUP_PRECOMPUTE_MULT 142 | |
1493 | # define EC_F_EC_GROUP_SET_CURVE_GF2M 176 | |
1494 | # define EC_F_EC_GROUP_SET_CURVE_GFP 109 | |
1495 | # define EC_F_EC_GROUP_SET_EXTRA_DATA 110 | |
1496 | # define EC_F_EC_GROUP_SET_GENERATOR 111 | |
1497 | # define EC_F_EC_KEY_CHECK_KEY 177 | |
1498 | # define EC_F_EC_KEY_COPY 178 | |
1499 | # define EC_F_EC_KEY_GENERATE_KEY 179 | |
1500 | # define EC_F_EC_KEY_NEW 182 | |
d2fa70d8 | 1501 | # define EC_F_EC_KEY_NEW_METHOD 245 |
d810700b | 1502 | # define EC_F_EC_KEY_OCT2PRIV 255 |
0f113f3e MC |
1503 | # define EC_F_EC_KEY_PRINT 180 |
1504 | # define EC_F_EC_KEY_PRINT_FP 181 | |
d810700b | 1505 | # define EC_F_EC_KEY_PRIV2OCT 256 |
0f113f3e MC |
1506 | # define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES 229 |
1507 | # define EC_F_EC_POINTS_MAKE_AFFINE 136 | |
1508 | # define EC_F_EC_POINT_ADD 112 | |
1509 | # define EC_F_EC_POINT_CMP 113 | |
1510 | # define EC_F_EC_POINT_COPY 114 | |
1511 | # define EC_F_EC_POINT_DBL 115 | |
1512 | # define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 183 | |
1513 | # define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP 116 | |
1514 | # define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP 117 | |
1515 | # define EC_F_EC_POINT_INVERT 210 | |
1516 | # define EC_F_EC_POINT_IS_AT_INFINITY 118 | |
1517 | # define EC_F_EC_POINT_IS_ON_CURVE 119 | |
1518 | # define EC_F_EC_POINT_MAKE_AFFINE 120 | |
1519 | # define EC_F_EC_POINT_MUL 184 | |
1520 | # define EC_F_EC_POINT_NEW 121 | |
1521 | # define EC_F_EC_POINT_OCT2POINT 122 | |
1522 | # define EC_F_EC_POINT_POINT2OCT 123 | |
1523 | # define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 185 | |
1524 | # define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP 124 | |
1525 | # define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 186 | |
1526 | # define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP 125 | |
1527 | # define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 126 | |
1528 | # define EC_F_EC_POINT_SET_TO_INFINITY 127 | |
1529 | # define EC_F_EC_PRE_COMP_DUP 207 | |
1530 | # define EC_F_EC_PRE_COMP_NEW 196 | |
1531 | # define EC_F_EC_WNAF_MUL 187 | |
1532 | # define EC_F_EC_WNAF_PRECOMPUTE_MULT 188 | |
1533 | # define EC_F_I2D_ECPARAMETERS 190 | |
1534 | # define EC_F_I2D_ECPKPARAMETERS 191 | |
1535 | # define EC_F_I2D_ECPRIVATEKEY 192 | |
1536 | # define EC_F_I2O_ECPUBLICKEY 151 | |
1537 | # define EC_F_NISTP224_PRE_COMP_NEW 227 | |
1538 | # define EC_F_NISTP256_PRE_COMP_NEW 236 | |
1539 | # define EC_F_NISTP521_PRE_COMP_NEW 237 | |
0f113f3e MC |
1540 | # define EC_F_O2I_ECPUBLICKEY 152 |
1541 | # define EC_F_OLD_EC_PRIV_DECODE 222 | |
53e3189d | 1542 | # define EC_F_OSSL_ECDH_COMPUTE_KEY 247 |
8c661f76 DSH |
1543 | # define EC_F_OSSL_ECDSA_SIGN_SIG 249 |
1544 | # define EC_F_OSSL_ECDSA_VERIFY_SIG 250 | |
0f113f3e MC |
1545 | # define EC_F_PKEY_EC_CTRL 197 |
1546 | # define EC_F_PKEY_EC_CTRL_STR 198 | |
1547 | # define EC_F_PKEY_EC_DERIVE 217 | |
1548 | # define EC_F_PKEY_EC_KEYGEN 199 | |
1549 | # define EC_F_PKEY_EC_PARAMGEN 219 | |
1550 | # define EC_F_PKEY_EC_SIGN 218 | |
6cc5e19d | 1551 | |
65e81670 | 1552 | /* Reason codes. */ |
0f113f3e MC |
1553 | # define EC_R_ASN1_ERROR 115 |
1554 | # define EC_R_ASN1_UNKNOWN_FIELD 116 | |
8c661f76 | 1555 | # define EC_R_BAD_SIGNATURE 156 |
0f113f3e MC |
1556 | # define EC_R_BIGNUM_OUT_OF_RANGE 144 |
1557 | # define EC_R_BUFFER_TOO_SMALL 100 | |
1558 | # define EC_R_COORDINATES_OUT_OF_RANGE 146 | |
1559 | # define EC_R_D2I_ECPKPARAMETERS_FAILURE 117 | |
1560 | # define EC_R_DECODE_ERROR 142 | |
1561 | # define EC_R_DISCRIMINANT_IS_ZERO 118 | |
1562 | # define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 | |
1563 | # define EC_R_FIELD_TOO_LARGE 143 | |
1564 | # define EC_R_GF2M_NOT_SUPPORTED 147 | |
1565 | # define EC_R_GROUP2PKPARAMETERS_FAILURE 120 | |
1566 | # define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 | |
1567 | # define EC_R_INCOMPATIBLE_OBJECTS 101 | |
1568 | # define EC_R_INVALID_ARGUMENT 112 | |
1569 | # define EC_R_INVALID_COMPRESSED_POINT 110 | |
1570 | # define EC_R_INVALID_COMPRESSION_BIT 109 | |
1571 | # define EC_R_INVALID_CURVE 141 | |
1572 | # define EC_R_INVALID_DIGEST 151 | |
1573 | # define EC_R_INVALID_DIGEST_TYPE 138 | |
1574 | # define EC_R_INVALID_ENCODING 102 | |
1575 | # define EC_R_INVALID_FIELD 103 | |
1576 | # define EC_R_INVALID_FORM 104 | |
1577 | # define EC_R_INVALID_GROUP_ORDER 122 | |
1578 | # define EC_R_INVALID_PENTANOMIAL_BASIS 132 | |
1579 | # define EC_R_INVALID_PRIVATE_KEY 123 | |
1580 | # define EC_R_INVALID_TRINOMIAL_BASIS 137 | |
53e3189d | 1581 | # define EC_R_KDF_FAILED 153 |
0f113f3e MC |
1582 | # define EC_R_KDF_PARAMETER_ERROR 148 |
1583 | # define EC_R_KEYS_NOT_SET 140 | |
1584 | # define EC_R_MISSING_PARAMETERS 124 | |
1585 | # define EC_R_MISSING_PRIVATE_KEY 125 | |
8c661f76 | 1586 | # define EC_R_NEED_NEW_SETUP_VALUES 157 |
0f113f3e MC |
1587 | # define EC_R_NOT_A_NIST_PRIME 135 |
1588 | # define EC_R_NOT_A_SUPPORTED_NIST_PRIME 136 | |
1589 | # define EC_R_NOT_IMPLEMENTED 126 | |
1590 | # define EC_R_NOT_INITIALIZED 111 | |
1591 | # define EC_R_NO_FIELD_MOD 133 | |
1592 | # define EC_R_NO_PARAMETERS_SET 139 | |
53e3189d | 1593 | # define EC_R_NO_PRIVATE_VALUE 154 |
5a6a1029 | 1594 | # define EC_R_OPERATION_NOT_SUPPORTED 152 |
0f113f3e MC |
1595 | # define EC_R_PASSED_NULL_PARAMETER 134 |
1596 | # define EC_R_PEER_KEY_ERROR 149 | |
1597 | # define EC_R_PKPARAMETERS2GROUP_FAILURE 127 | |
53e3189d | 1598 | # define EC_R_POINT_ARITHMETIC_FAILURE 155 |
0f113f3e MC |
1599 | # define EC_R_POINT_AT_INFINITY 106 |
1600 | # define EC_R_POINT_IS_NOT_ON_CURVE 107 | |
8c661f76 | 1601 | # define EC_R_RANDOM_NUMBER_GENERATION_FAILED 158 |
0f113f3e MC |
1602 | # define EC_R_SHARED_INFO_ERROR 150 |
1603 | # define EC_R_SLOT_FULL 108 | |
1604 | # define EC_R_UNDEFINED_GENERATOR 113 | |
1605 | # define EC_R_UNDEFINED_ORDER 128 | |
1606 | # define EC_R_UNKNOWN_GROUP 129 | |
1607 | # define EC_R_UNKNOWN_ORDER 114 | |
1608 | # define EC_R_UNSUPPORTED_FIELD 131 | |
1609 | # define EC_R_WRONG_CURVE_PARAMETERS 145 | |
1610 | # define EC_R_WRONG_ORDER 130 | |
6cc5e19d | 1611 | |
65e81670 BM |
1612 | #ifdef __cplusplus |
1613 | } | |
1614 | #endif | |
5acaa495 | 1615 | #endif |