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