summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ec.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ec/ec.h')
-rw-r--r--src/lib/libcrypto/ec/ec.h58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/lib/libcrypto/ec/ec.h b/src/lib/libcrypto/ec/ec.h
index 9a7c5de8a5..8cafc5522f 100644
--- a/src/lib/libcrypto/ec/ec.h
+++ b/src/lib/libcrypto/ec/ec.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec.h,v 1.29 2022/11/10 16:37:51 jsing Exp $ */ 1/* $OpenBSD: ec.h,v 1.30 2022/12/26 07:18:51 jmc Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -232,7 +232,7 @@ int EC_METHOD_get_field_type(const EC_METHOD *meth);
232 * \param order the order of the group generated by 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 233 * \param cofactor the index of the sub-group generated by the generator
234 * in the group of all points on the elliptic curve. 234 * in the group of all points on the elliptic curve.
235 * \return 1 on success and 0 if an error occured 235 * \return 1 on success and 0 if an error occurred
236 */ 236 */
237int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor); 237int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor);
238 238
@@ -246,7 +246,7 @@ const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group);
246 * \param group EC_GROUP object 246 * \param group EC_GROUP object
247 * \param order BIGNUM to which the order is copied 247 * \param order BIGNUM to which the order is copied
248 * \param ctx BN_CTX object (optional) 248 * \param ctx BN_CTX object (optional)
249 * \return 1 on success and 0 if an error occured 249 * \return 1 on success and 0 if an error occurred
250 */ 250 */
251int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx); 251int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx);
252 252
@@ -256,7 +256,7 @@ int EC_GROUP_order_bits(const EC_GROUP *group);
256 * \param group EC_GROUP object 256 * \param group EC_GROUP object
257 * \param cofactor BIGNUM to which the cofactor is copied 257 * \param cofactor BIGNUM to which the cofactor is copied
258 * \param ctx BN_CTX object (optional) 258 * \param ctx BN_CTX object (optional)
259 * \return 1 on success and 0 if an error occured 259 * \return 1 on success and 0 if an error occurred
260 */ 260 */
261int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx); 261int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx);
262 262
@@ -293,7 +293,7 @@ int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b,
293 * \param a BIGNUM with parameter a of the equation 293 * \param a BIGNUM with parameter a of the equation
294 * \param b BIGNUM with parameter b of the equation 294 * \param b BIGNUM with parameter b of the equation
295 * \param ctx BN_CTX object (optional) 295 * \param ctx BN_CTX object (optional)
296 * \return 1 on success and 0 if an error occured 296 * \return 1 on success and 0 if an error occurred
297 */ 297 */
298int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); 298int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
299 299
@@ -303,7 +303,7 @@ int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, co
303 * \param a BIGNUM for parameter a of the equation 303 * \param a BIGNUM for parameter a of the equation
304 * \param b BIGNUM for parameter b of the equation 304 * \param b BIGNUM for parameter b of the equation
305 * \param ctx BN_CTX object (optional) 305 * \param ctx BN_CTX object (optional)
306 * \return 1 on success and 0 if an error occured 306 * \return 1 on success and 0 if an error occurred
307 */ 307 */
308int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); 308int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);
309 309
@@ -314,7 +314,7 @@ int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *
314 * \param a BIGNUM with parameter a of the equation 314 * \param a BIGNUM with parameter a of the equation
315 * \param b BIGNUM with parameter b of the equation 315 * \param b BIGNUM with parameter b of the equation
316 * \param ctx BN_CTX object (optional) 316 * \param ctx BN_CTX object (optional)
317 * \return 1 on success and 0 if an error occured 317 * \return 1 on success and 0 if an error occurred
318 */ 318 */
319int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); 319int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
320 320
@@ -324,7 +324,7 @@ int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, c
324 * \param a BIGNUM for parameter a of the equation 324 * \param a BIGNUM for parameter a of the equation
325 * \param b BIGNUM for parameter b of the equation 325 * \param b BIGNUM for parameter b of the equation
326 * \param ctx BN_CTX object (optional) 326 * \param ctx BN_CTX object (optional)
327 * \return 1 on success and 0 if an error occured 327 * \return 1 on success and 0 if an error occurred
328 */ 328 */
329int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); 329int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);
330#endif 330#endif
@@ -430,7 +430,7 @@ void EC_POINT_clear_free(EC_POINT *point);
430/** Copies EC_POINT object 430/** Copies EC_POINT object
431 * \param dst destination EC_POINT object 431 * \param dst destination EC_POINT object
432 * \param src source EC_POINT object 432 * \param src source EC_POINT object
433 * \return 1 on success and 0 if an error occured 433 * \return 1 on success and 0 if an error occurred
434 */ 434 */
435int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); 435int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src);
436 436
@@ -451,7 +451,7 @@ const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);
451/** Sets a point to infinity (neutral element) 451/** Sets a point to infinity (neutral element)
452 * \param group underlying EC_GROUP object 452 * \param group underlying EC_GROUP object
453 * \param point EC_POINT to set to infinity 453 * \param point EC_POINT to set to infinity
454 * \return 1 on success and 0 if an error occured 454 * \return 1 on success and 0 if an error occurred
455 */ 455 */
456int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); 456int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point);
457 457
@@ -478,7 +478,7 @@ int EC_POINT_get_Jprojective_coordinates(const EC_GROUP *group,
478 * \param y BIGNUM with the y-coordinate 478 * \param y BIGNUM with the y-coordinate
479 * \param z BIGNUM with the z-coordinate 479 * \param z BIGNUM with the z-coordinate
480 * \param ctx BN_CTX object (optional) 480 * \param ctx BN_CTX object (optional)
481 * \return 1 on success and 0 if an error occured 481 * \return 1 on success and 0 if an error occurred
482 */ 482 */
483int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, 483int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
484 const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx); 484 const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx);
@@ -490,7 +490,7 @@ int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
490 * \param y BIGNUM for the y-coordinate 490 * \param y BIGNUM for the y-coordinate
491 * \param z BIGNUM for the z-coordinate 491 * \param z BIGNUM for the z-coordinate
492 * \param ctx BN_CTX object (optional) 492 * \param ctx BN_CTX object (optional)
493 * \return 1 on success and 0 if an error occured 493 * \return 1 on success and 0 if an error occurred
494 */ 494 */
495int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, 495int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
496 const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx); 496 const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx);
@@ -501,7 +501,7 @@ int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
501 * \param x BIGNUM with the x-coordinate 501 * \param x BIGNUM with the x-coordinate
502 * \param y BIGNUM with the y-coordinate 502 * \param y BIGNUM with the y-coordinate
503 * \param ctx BN_CTX object (optional) 503 * \param ctx BN_CTX object (optional)
504 * \return 1 on success and 0 if an error occured 504 * \return 1 on success and 0 if an error occurred
505 */ 505 */
506int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, 506int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
507 const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx); 507 const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);
@@ -512,7 +512,7 @@ int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
512 * \param x BIGNUM for the x-coordinate 512 * \param x BIGNUM for the x-coordinate
513 * \param y BIGNUM for the y-coordinate 513 * \param y BIGNUM for the y-coordinate
514 * \param ctx BN_CTX object (optional) 514 * \param ctx BN_CTX object (optional)
515 * \return 1 on success and 0 if an error occured 515 * \return 1 on success and 0 if an error occurred
516 */ 516 */
517int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, 517int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
518 const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx); 518 const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
@@ -523,7 +523,7 @@ int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
523 * \param x BIGNUM with x-coordinate 523 * \param x BIGNUM with x-coordinate
524 * \param y_bit integer with the y-Bit (either 0 or 1) 524 * \param y_bit integer with the y-Bit (either 0 or 1)
525 * \param ctx BN_CTX object (optional) 525 * \param ctx BN_CTX object (optional)
526 * \return 1 on success and 0 if an error occured 526 * \return 1 on success and 0 if an error occurred
527 */ 527 */
528int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, 528int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
529 const BIGNUM *x, int y_bit, BN_CTX *ctx); 529 const BIGNUM *x, int y_bit, BN_CTX *ctx);
@@ -535,7 +535,7 @@ int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
535 * \param x BIGNUM with the x-coordinate 535 * \param x BIGNUM with the x-coordinate
536 * \param y BIGNUM with the y-coordinate 536 * \param y BIGNUM with the y-coordinate
537 * \param ctx BN_CTX object (optional) 537 * \param ctx BN_CTX object (optional)
538 * \return 1 on success and 0 if an error occured 538 * \return 1 on success and 0 if an error occurred
539 */ 539 */
540int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, 540int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,
541 const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx); 541 const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);
@@ -546,7 +546,7 @@ int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,
546 * \param x BIGNUM for the x-coordinate 546 * \param x BIGNUM for the x-coordinate
547 * \param y BIGNUM for the y-coordinate 547 * \param y BIGNUM for the y-coordinate
548 * \param ctx BN_CTX object (optional) 548 * \param ctx BN_CTX object (optional)
549 * \return 1 on success and 0 if an error occured 549 * \return 1 on success and 0 if an error occurred
550 */ 550 */
551int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, 551int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
552 const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx); 552 const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
@@ -557,7 +557,7 @@ int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
557 * \param x BIGNUM with x-coordinate 557 * \param x BIGNUM with x-coordinate
558 * \param y_bit integer with the y-Bit (either 0 or 1) 558 * \param y_bit integer with the y-Bit (either 0 or 1)
559 * \param ctx BN_CTX object (optional) 559 * \param ctx BN_CTX object (optional)
560 * \return 1 on success and 0 if an error occured 560 * \return 1 on success and 0 if an error occurred
561 */ 561 */
562int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, 562int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,
563 const BIGNUM *x, int y_bit, BN_CTX *ctx); 563 const BIGNUM *x, int y_bit, BN_CTX *ctx);
@@ -584,7 +584,7 @@ size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p,
584 * \param buf memory buffer with the encoded ec point 584 * \param buf memory buffer with the encoded ec point
585 * \param len length of the encoded ec point 585 * \param len length of the encoded ec point
586 * \param ctx BN_CTX object (optional) 586 * \param ctx BN_CTX object (optional)
587 * \return 1 on success and 0 if an error occured 587 * \return 1 on success and 0 if an error occurred
588 */ 588 */
589int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p, 589int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p,
590 const unsigned char *buf, size_t len, BN_CTX *ctx); 590 const unsigned char *buf, size_t len, BN_CTX *ctx);
@@ -610,7 +610,7 @@ EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *,
610 * \param a EC_POINT object with the first summand 610 * \param a EC_POINT object with the first summand
611 * \param b EC_POINT object with the second summand 611 * \param b EC_POINT object with the second summand
612 * \param ctx BN_CTX object (optional) 612 * \param ctx BN_CTX object (optional)
613 * \return 1 on success and 0 if an error occured 613 * \return 1 on success and 0 if an error occurred
614 */ 614 */
615int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx); 615int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx);
616 616
@@ -619,7 +619,7 @@ int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC
619 * \param r EC_POINT object for the result (r = 2 * a) 619 * \param r EC_POINT object for the result (r = 2 * a)
620 * \param a EC_POINT object 620 * \param a EC_POINT object
621 * \param ctx BN_CTX object (optional) 621 * \param ctx BN_CTX object (optional)
622 * \return 1 on success and 0 if an error occured 622 * \return 1 on success and 0 if an error occurred
623 */ 623 */
624int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx); 624int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx);
625 625
@@ -627,7 +627,7 @@ int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *
627 * \param group underlying EC_GROUP object 627 * \param group underlying EC_GROUP object
628 * \param a EC_POINT object to be inverted (it's used for the result as well) 628 * \param a EC_POINT object to be inverted (it's used for the result as well)
629 * \param ctx BN_CTX object (optional) 629 * \param ctx BN_CTX object (optional)
630 * \return 1 on success and 0 if an error occured 630 * \return 1 on success and 0 if an error occurred
631 */ 631 */
632int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx); 632int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx);
633 633
@@ -662,11 +662,11 @@ int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[],
662 * \param group underlying EC_GROUP object 662 * \param group underlying EC_GROUP object
663 * \param r EC_POINT object for the result 663 * \param r EC_POINT object for the result
664 * \param n BIGNUM with the multiplier for the group generator (optional) 664 * \param n BIGNUM with the multiplier for the group generator (optional)
665 * \param num number futher summands 665 * \param num number further summands
666 * \param p array of size num of EC_POINT objects 666 * \param p array of size num of EC_POINT objects
667 * \param m array of size num of BIGNUM objects 667 * \param m array of size num of BIGNUM objects
668 * \param ctx BN_CTX object (optional) 668 * \param ctx BN_CTX object (optional)
669 * \return 1 on success and 0 if an error occured 669 * \return 1 on success and 0 if an error occurred
670 */ 670 */
671int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, size_t num, const EC_POINT *p[], const BIGNUM *m[], BN_CTX *ctx); 671int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, size_t num, const EC_POINT *p[], const BIGNUM *m[], BN_CTX *ctx);
672 672
@@ -677,14 +677,14 @@ int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, size_t nu
677 * \param q EC_POINT object with the first factor of the second summand 677 * \param q EC_POINT object with the first factor of the second summand
678 * \param m BIGNUM with the second factor of the second summand 678 * \param m BIGNUM with the second factor of the second summand
679 * \param ctx BN_CTX object (optional) 679 * \param ctx BN_CTX object (optional)
680 * \return 1 on success and 0 if an error occured 680 * \return 1 on success and 0 if an error occurred
681 */ 681 */
682int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx); 682int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx);
683 683
684/** Stores multiples of generator for faster point multiplication 684/** Stores multiples of generator for faster point multiplication
685 * \param group EC_GROUP object 685 * \param group EC_GROUP object
686 * \param ctx BN_CTX object (optional) 686 * \param ctx BN_CTX object (optional)
687 * \return 1 on success and 0 if an error occured 687 * \return 1 on success and 0 if an error occurred
688 */ 688 */
689int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); 689int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
690 690
@@ -869,8 +869,8 @@ int EC_KEY_generate_key(EC_KEY *key);
869 */ 869 */
870int EC_KEY_check_key(const EC_KEY *key); 870int EC_KEY_check_key(const EC_KEY *key);
871 871
872/** Sets a public key from affine coordindates performing 872/** Sets a public key from affine coordinates performing
873 * neccessary NIST PKV tests. 873 * necessary NIST PKV tests.
874 * \param key the EC_KEY object 874 * \param key the EC_KEY object
875 * \param x public key x coordinate 875 * \param x public key x coordinate
876 * \param y public key y coordinate 876 * \param y public key y coordinate
@@ -914,7 +914,7 @@ int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out);
914EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len); 914EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len);
915 915
916/** Encodes ec parameter and stores the result in a buffer. 916/** Encodes ec parameter and stores the result in a buffer.
917 * \param key the EC_KEY object with ec paramters to encode 917 * \param key the EC_KEY object with ec parameters to encode
918 * \param out the buffer for the result (if NULL the function returns number 918 * \param out the buffer for the result (if NULL the function returns number
919 * of bytes needed). 919 * of bytes needed).
920 * \return 1 on success and 0 if an error occurred. 920 * \return 1 on success and 0 if an error occurred.