diff options
Diffstat (limited to 'src/lib/libcrypto/ec')
-rw-r--r-- | src/lib/libcrypto/ec/ec.h | 12 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec2_oct.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec2_smpl.c | 14 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_curve.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_key.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_lcl.h | 6 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 55 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp224.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp256.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp521.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_nistz256.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_oct.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_smpl.c | 6 |
13 files changed, 72 insertions, 71 deletions
diff --git a/src/lib/libcrypto/ec/ec.h b/src/lib/libcrypto/ec/ec.h index a6ae3e3ac3..ebd80b91fd 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.19 2021/04/20 17:04:13 tb Exp $ */ | 1 | /* $OpenBSD: ec.h,v 1.20 2021/04/20 17:16:37 tb 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 | */ |
@@ -478,6 +478,12 @@ int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, | |||
478 | int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, | 478 | int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, |
479 | const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx); | 479 | const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx); |
480 | 480 | ||
481 | #if defined(LIBRESSL_INTERNAL) | ||
482 | int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p, | ||
483 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx); | ||
484 | int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p, | ||
485 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx); | ||
486 | #else | ||
481 | /** Sets the affine coordinates of a EC_POINT over GFp | 487 | /** Sets the affine coordinates of a EC_POINT over GFp |
482 | * \param group underlying EC_GROUP object | 488 | * \param group underlying EC_GROUP object |
483 | * \param p EC_POINT object | 489 | * \param p EC_POINT object |
@@ -499,6 +505,7 @@ int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, | |||
499 | */ | 505 | */ |
500 | int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, | 506 | int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, |
501 | const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx); | 507 | const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx); |
508 | #endif | ||
502 | 509 | ||
503 | /** Sets the x9.62 compressed coordinates of a EC_POINT over GFp | 510 | /** Sets the x9.62 compressed coordinates of a EC_POINT over GFp |
504 | * \param group underlying EC_GROUP object | 511 | * \param group underlying EC_GROUP object |
@@ -510,7 +517,9 @@ int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, | |||
510 | */ | 517 | */ |
511 | int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, | 518 | int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, |
512 | const BIGNUM *x, int y_bit, BN_CTX *ctx); | 519 | const BIGNUM *x, int y_bit, BN_CTX *ctx); |
520 | |||
513 | #ifndef OPENSSL_NO_EC2M | 521 | #ifndef OPENSSL_NO_EC2M |
522 | #if !defined(LIBRESSL_INTERNAL) | ||
514 | /** Sets the affine coordinates of a EC_POINT over GF2m | 523 | /** Sets the affine coordinates of a EC_POINT over GF2m |
515 | * \param group underlying EC_GROUP object | 524 | * \param group underlying EC_GROUP object |
516 | * \param p EC_POINT object | 525 | * \param p EC_POINT object |
@@ -532,6 +541,7 @@ int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, | |||
532 | */ | 541 | */ |
533 | int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, | 542 | int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, |
534 | const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx); | 543 | const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx); |
544 | #endif | ||
535 | 545 | ||
536 | /** Sets the x9.62 compressed coordinates of a EC_POINT over GF2m | 546 | /** Sets the x9.62 compressed coordinates of a EC_POINT over GF2m |
537 | * \param group underlying EC_GROUP object | 547 | * \param group underlying EC_GROUP object |
diff --git a/src/lib/libcrypto/ec/ec2_oct.c b/src/lib/libcrypto/ec/ec2_oct.c index 9cd1dddfa1..28eb7a01b6 100644 --- a/src/lib/libcrypto/ec/ec2_oct.c +++ b/src/lib/libcrypto/ec/ec2_oct.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_oct.c,v 1.13 2021/04/19 17:06:37 tb Exp $ */ | 1 | /* $OpenBSD: ec2_oct.c,v 1.14 2021/04/20 17:16:37 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -152,7 +152,7 @@ ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point | |||
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx)) | 155 | if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx)) |
156 | goto err; | 156 | goto err; |
157 | 157 | ||
158 | ret = 1; | 158 | ret = 1; |
@@ -221,7 +221,7 @@ ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, | |||
221 | if ((yxi = BN_CTX_get(ctx)) == NULL) | 221 | if ((yxi = BN_CTX_get(ctx)) == NULL) |
222 | goto err; | 222 | goto err; |
223 | 223 | ||
224 | if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx)) | 224 | if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx)) |
225 | goto err; | 225 | goto err; |
226 | 226 | ||
227 | buf[0] = form; | 227 | buf[0] = form; |
@@ -400,10 +400,10 @@ ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, | |||
400 | } | 400 | } |
401 | } | 401 | } |
402 | /* | 402 | /* |
403 | * EC_POINT_set_affine_coordinates_GF2m checks that the | 403 | * EC_POINT_set_affine_coordinates checks that the |
404 | * point is on the curve as required by X9.62. | 404 | * point is on the curve as required by X9.62. |
405 | */ | 405 | */ |
406 | if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx)) | 406 | if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx)) |
407 | goto err; | 407 | goto err; |
408 | } | 408 | } |
409 | 409 | ||
diff --git a/src/lib/libcrypto/ec/ec2_smpl.c b/src/lib/libcrypto/ec/ec2_smpl.c index 936cee4898..f99615a0d5 100644 --- a/src/lib/libcrypto/ec/ec2_smpl.c +++ b/src/lib/libcrypto/ec/ec2_smpl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_smpl.c,v 1.21 2018/11/05 20:18:21 tb Exp $ */ | 1 | /* $OpenBSD: ec2_smpl.c,v 1.22 2021/04/20 17:16:37 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -483,7 +483,7 @@ ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | |||
483 | if (!BN_copy(y0, &a->Y)) | 483 | if (!BN_copy(y0, &a->Y)) |
484 | goto err; | 484 | goto err; |
485 | } else { | 485 | } else { |
486 | if (!EC_POINT_get_affine_coordinates_GF2m(group, a, x0, y0, ctx)) | 486 | if (!EC_POINT_get_affine_coordinates(group, a, x0, y0, ctx)) |
487 | goto err; | 487 | goto err; |
488 | } | 488 | } |
489 | if (b->Z_is_one) { | 489 | if (b->Z_is_one) { |
@@ -492,7 +492,7 @@ ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | |||
492 | if (!BN_copy(y1, &b->Y)) | 492 | if (!BN_copy(y1, &b->Y)) |
493 | goto err; | 493 | goto err; |
494 | } else { | 494 | } else { |
495 | if (!EC_POINT_get_affine_coordinates_GF2m(group, b, x1, y1, ctx)) | 495 | if (!EC_POINT_get_affine_coordinates(group, b, x1, y1, ctx)) |
496 | goto err; | 496 | goto err; |
497 | } | 497 | } |
498 | 498 | ||
@@ -541,7 +541,7 @@ ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | |||
541 | if (!BN_GF2m_add(y2, y2, y1)) | 541 | if (!BN_GF2m_add(y2, y2, y1)) |
542 | goto err; | 542 | goto err; |
543 | 543 | ||
544 | if (!EC_POINT_set_affine_coordinates_GF2m(group, r, x2, y2, ctx)) | 544 | if (!EC_POINT_set_affine_coordinates(group, r, x2, y2, ctx)) |
545 | goto err; | 545 | goto err; |
546 | 546 | ||
547 | ret = 1; | 547 | ret = 1; |
@@ -684,9 +684,9 @@ ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, | |||
684 | if ((bY = BN_CTX_get(ctx)) == NULL) | 684 | if ((bY = BN_CTX_get(ctx)) == NULL) |
685 | goto err; | 685 | goto err; |
686 | 686 | ||
687 | if (!EC_POINT_get_affine_coordinates_GF2m(group, a, aX, aY, ctx)) | 687 | if (!EC_POINT_get_affine_coordinates(group, a, aX, aY, ctx)) |
688 | goto err; | 688 | goto err; |
689 | if (!EC_POINT_get_affine_coordinates_GF2m(group, b, bX, bY, ctx)) | 689 | if (!EC_POINT_get_affine_coordinates(group, b, bX, bY, ctx)) |
690 | goto err; | 690 | goto err; |
691 | ret = ((BN_cmp(aX, bX) == 0) && BN_cmp(aY, bY) == 0) ? 0 : 1; | 691 | ret = ((BN_cmp(aX, bX) == 0) && BN_cmp(aY, bY) == 0) ? 0 : 1; |
692 | 692 | ||
@@ -720,7 +720,7 @@ ec_GF2m_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ct | |||
720 | if ((y = BN_CTX_get(ctx)) == NULL) | 720 | if ((y = BN_CTX_get(ctx)) == NULL) |
721 | goto err; | 721 | goto err; |
722 | 722 | ||
723 | if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx)) | 723 | if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx)) |
724 | goto err; | 724 | goto err; |
725 | if (!BN_copy(&point->X, x)) | 725 | if (!BN_copy(&point->X, x)) |
726 | goto err; | 726 | goto err; |
diff --git a/src/lib/libcrypto/ec/ec_curve.c b/src/lib/libcrypto/ec/ec_curve.c index 84a565d437..b575f7bac2 100644 --- a/src/lib/libcrypto/ec/ec_curve.c +++ b/src/lib/libcrypto/ec/ec_curve.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_curve.c,v 1.20 2020/06/05 17:12:09 jsing Exp $ */ | 1 | /* $OpenBSD: ec_curve.c,v 1.21 2021/04/20 17:16:37 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -3373,7 +3373,7 @@ ec_group_new_from_data(const ec_list_element curve) | |||
3373 | ECerror(ERR_R_BN_LIB); | 3373 | ECerror(ERR_R_BN_LIB); |
3374 | goto err; | 3374 | goto err; |
3375 | } | 3375 | } |
3376 | if (!EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx)) { | 3376 | if (!EC_POINT_set_affine_coordinates(group, P, x, y, ctx)) { |
3377 | ECerror(ERR_R_EC_LIB); | 3377 | ECerror(ERR_R_EC_LIB); |
3378 | goto err; | 3378 | goto err; |
3379 | } | 3379 | } |
diff --git a/src/lib/libcrypto/ec/ec_key.c b/src/lib/libcrypto/ec/ec_key.c index 1d0a03ac88..348156e680 100644 --- a/src/lib/libcrypto/ec/ec_key.c +++ b/src/lib/libcrypto/ec/ec_key.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_key.c,v 1.24 2019/01/19 01:12:48 tb Exp $ */ | 1 | /* $OpenBSD: ec_key.c,v 1.25 2021/04/20 17:16:37 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -408,19 +408,19 @@ EC_KEY_set_public_key_affine_coordinates(EC_KEY * key, BIGNUM * x, BIGNUM * y) | |||
408 | 408 | ||
409 | #ifndef OPENSSL_NO_EC2M | 409 | #ifndef OPENSSL_NO_EC2M |
410 | if (is_char_two) { | 410 | if (is_char_two) { |
411 | if (!EC_POINT_set_affine_coordinates_GF2m(key->group, point, | 411 | if (!EC_POINT_set_affine_coordinates(key->group, point, |
412 | x, y, ctx)) | 412 | x, y, ctx)) |
413 | goto err; | 413 | goto err; |
414 | if (!EC_POINT_get_affine_coordinates_GF2m(key->group, point, | 414 | if (!EC_POINT_get_affine_coordinates(key->group, point, |
415 | tx, ty, ctx)) | 415 | tx, ty, ctx)) |
416 | goto err; | 416 | goto err; |
417 | } else | 417 | } else |
418 | #endif | 418 | #endif |
419 | { | 419 | { |
420 | if (!EC_POINT_set_affine_coordinates_GFp(key->group, point, | 420 | if (!EC_POINT_set_affine_coordinates(key->group, point, |
421 | x, y, ctx)) | 421 | x, y, ctx)) |
422 | goto err; | 422 | goto err; |
423 | if (!EC_POINT_get_affine_coordinates_GFp(key->group, point, | 423 | if (!EC_POINT_get_affine_coordinates(key->group, point, |
424 | tx, ty, ctx)) | 424 | tx, ty, ctx)) |
425 | goto err; | 425 | goto err; |
426 | } | 426 | } |
diff --git a/src/lib/libcrypto/ec/ec_lcl.h b/src/lib/libcrypto/ec/ec_lcl.h index f689428852..4addc860ed 100644 --- a/src/lib/libcrypto/ec/ec_lcl.h +++ b/src/lib/libcrypto/ec/ec_lcl.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_lcl.h,v 1.14 2021/04/20 17:04:13 tb Exp $ */ | 1 | /* $OpenBSD: ec_lcl.h,v 1.15 2021/04/20 17:16:37 tb 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 | */ |
@@ -124,8 +124,8 @@ struct ec_method_st { | |||
124 | /* used by EC_POINT_set_to_infinity, | 124 | /* used by EC_POINT_set_to_infinity, |
125 | * EC_POINT_set_Jprojective_coordinates_GFp, | 125 | * EC_POINT_set_Jprojective_coordinates_GFp, |
126 | * EC_POINT_get_Jprojective_coordinates_GFp, | 126 | * EC_POINT_get_Jprojective_coordinates_GFp, |
127 | * EC_POINT_set_affine_coordinates_GFp, ..._GF2m, | 127 | * EC_POINT_set_affine_coordinates, |
128 | * EC_POINT_get_affine_coordinates_GFp, ..._GF2m, | 128 | * EC_POINT_get_affine_coordinates, |
129 | * EC_POINT_set_compressed_coordinates_GFp, ..._GF2m: | 129 | * EC_POINT_set_compressed_coordinates_GFp, ..._GF2m: |
130 | */ | 130 | */ |
131 | int (*point_set_to_infinity)(const EC_GROUP *, EC_POINT *); | 131 | int (*point_set_to_infinity)(const EC_GROUP *, EC_POINT *); |
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index c39c4d1a05..b4112a1c11 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_lib.c,v 1.35 2021/04/20 17:06:17 tb Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.36 2021/04/20 17:16:37 tb 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 | */ |
@@ -954,9 +954,8 @@ EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, | |||
954 | return group->meth->point_get_Jprojective_coordinates_GFp(group, point, x, y, z, ctx); | 954 | return group->meth->point_get_Jprojective_coordinates_GFp(group, point, x, y, z, ctx); |
955 | } | 955 | } |
956 | 956 | ||
957 | 957 | int | |
958 | int | 958 | EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point, |
959 | EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *point, | ||
960 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) | 959 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) |
961 | { | 960 | { |
962 | if (group->meth->point_set_affine_coordinates == 0) { | 961 | if (group->meth->point_set_affine_coordinates == 0) { |
@@ -976,31 +975,24 @@ EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *point, | |||
976 | return 1; | 975 | return 1; |
977 | } | 976 | } |
978 | 977 | ||
978 | int | ||
979 | EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *point, | ||
980 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) | ||
981 | { | ||
982 | return EC_POINT_set_affine_coordinates(group, point, x, y, ctx); | ||
983 | } | ||
984 | |||
979 | #ifndef OPENSSL_NO_EC2M | 985 | #ifndef OPENSSL_NO_EC2M |
980 | int | 986 | int |
981 | EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *point, | 987 | EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *point, |
982 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) | 988 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) |
983 | { | 989 | { |
984 | if (group->meth->point_set_affine_coordinates == 0) { | 990 | return EC_POINT_set_affine_coordinates(group, point, x, y, ctx); |
985 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | ||
986 | return 0; | ||
987 | } | ||
988 | if (group->meth != point->meth) { | ||
989 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | ||
990 | return 0; | ||
991 | } | ||
992 | if (!group->meth->point_set_affine_coordinates(group, point, x, y, ctx)) | ||
993 | return 0; | ||
994 | if (EC_POINT_is_on_curve(group, point, ctx) <= 0) { | ||
995 | ECerror(EC_R_POINT_IS_NOT_ON_CURVE); | ||
996 | return 0; | ||
997 | } | ||
998 | return 1; | ||
999 | } | 991 | } |
1000 | #endif | 992 | #endif |
1001 | 993 | ||
1002 | int | 994 | int |
1003 | EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_POINT *point, | 995 | EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point, |
1004 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx) | 996 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx) |
1005 | { | 997 | { |
1006 | if (group->meth->point_get_affine_coordinates == 0) { | 998 | if (group->meth->point_get_affine_coordinates == 0) { |
@@ -1014,20 +1006,19 @@ EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_POINT *point | |||
1014 | return group->meth->point_get_affine_coordinates(group, point, x, y, ctx); | 1006 | return group->meth->point_get_affine_coordinates(group, point, x, y, ctx); |
1015 | } | 1007 | } |
1016 | 1008 | ||
1009 | int | ||
1010 | EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_POINT *point, | ||
1011 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx) | ||
1012 | { | ||
1013 | return EC_POINT_get_affine_coordinates(group, point, x, y, ctx); | ||
1014 | } | ||
1015 | |||
1017 | #ifndef OPENSSL_NO_EC2M | 1016 | #ifndef OPENSSL_NO_EC2M |
1018 | int | 1017 | int |
1019 | EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, const EC_POINT *point, | 1018 | EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, const EC_POINT *point, |
1020 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx) | 1019 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx) |
1021 | { | 1020 | { |
1022 | if (group->meth->point_get_affine_coordinates == 0) { | 1021 | return EC_POINT_get_affine_coordinates(group, point, x, y, ctx); |
1023 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | ||
1024 | return 0; | ||
1025 | } | ||
1026 | if (group->meth != point->meth) { | ||
1027 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | ||
1028 | return 0; | ||
1029 | } | ||
1030 | return group->meth->point_get_affine_coordinates(group, point, x, y, ctx); | ||
1031 | } | 1022 | } |
1032 | #endif | 1023 | #endif |
1033 | 1024 | ||
diff --git a/src/lib/libcrypto/ec/ecp_nistp224.c b/src/lib/libcrypto/ec/ecp_nistp224.c index 21b431a097..c5fc738a02 100644 --- a/src/lib/libcrypto/ec/ecp_nistp224.c +++ b/src/lib/libcrypto/ec/ecp_nistp224.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_nistp224.c,v 1.23 2018/11/05 20:18:21 tb Exp $ */ | 1 | /* $OpenBSD: ecp_nistp224.c,v 1.24 2021/04/20 17:16:37 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Emilia Kasper (Google) for the OpenSSL project. | 3 | * Written by Emilia Kasper (Google) for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -1577,7 +1577,7 @@ ec_GFp_nistp224_precompute_mult(EC_GROUP * group, BN_CTX * ctx) | |||
1577 | goto err; | 1577 | goto err; |
1578 | BN_bin2bn(nistp224_curve_params[3], sizeof(felem_bytearray), x); | 1578 | BN_bin2bn(nistp224_curve_params[3], sizeof(felem_bytearray), x); |
1579 | BN_bin2bn(nistp224_curve_params[4], sizeof(felem_bytearray), y); | 1579 | BN_bin2bn(nistp224_curve_params[4], sizeof(felem_bytearray), y); |
1580 | if (!EC_POINT_set_affine_coordinates_GFp(group, generator, x, y, ctx)) | 1580 | if (!EC_POINT_set_affine_coordinates(group, generator, x, y, ctx)) |
1581 | goto err; | 1581 | goto err; |
1582 | if ((pre = nistp224_pre_comp_new()) == NULL) | 1582 | if ((pre = nistp224_pre_comp_new()) == NULL) |
1583 | goto err; | 1583 | goto err; |
diff --git a/src/lib/libcrypto/ec/ecp_nistp256.c b/src/lib/libcrypto/ec/ecp_nistp256.c index fc68b6cd8d..38e87ecd03 100644 --- a/src/lib/libcrypto/ec/ecp_nistp256.c +++ b/src/lib/libcrypto/ec/ecp_nistp256.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_nistp256.c,v 1.22 2018/11/05 20:18:21 tb Exp $ */ | 1 | /* $OpenBSD: ecp_nistp256.c,v 1.23 2021/04/20 17:16:37 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Adam Langley (Google) for the OpenSSL project | 3 | * Written by Adam Langley (Google) for the OpenSSL project |
4 | */ | 4 | */ |
@@ -2131,7 +2131,7 @@ ec_GFp_nistp256_precompute_mult(EC_GROUP * group, BN_CTX * ctx) | |||
2131 | goto err; | 2131 | goto err; |
2132 | BN_bin2bn(nistp256_curve_params[3], sizeof(felem_bytearray), x); | 2132 | BN_bin2bn(nistp256_curve_params[3], sizeof(felem_bytearray), x); |
2133 | BN_bin2bn(nistp256_curve_params[4], sizeof(felem_bytearray), y); | 2133 | BN_bin2bn(nistp256_curve_params[4], sizeof(felem_bytearray), y); |
2134 | if (!EC_POINT_set_affine_coordinates_GFp(group, generator, x, y, ctx)) | 2134 | if (!EC_POINT_set_affine_coordinates(group, generator, x, y, ctx)) |
2135 | goto err; | 2135 | goto err; |
2136 | if ((pre = nistp256_pre_comp_new()) == NULL) | 2136 | if ((pre = nistp256_pre_comp_new()) == NULL) |
2137 | goto err; | 2137 | goto err; |
diff --git a/src/lib/libcrypto/ec/ecp_nistp521.c b/src/lib/libcrypto/ec/ecp_nistp521.c index e085610cbc..e5ccbb1b21 100644 --- a/src/lib/libcrypto/ec/ecp_nistp521.c +++ b/src/lib/libcrypto/ec/ecp_nistp521.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_nistp521.c,v 1.23 2018/11/05 20:18:21 tb Exp $ */ | 1 | /* $OpenBSD: ecp_nistp521.c,v 1.24 2021/04/20 17:16:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Adam Langley (Google) for the OpenSSL project | 3 | * Written by Adam Langley (Google) for the OpenSSL project |
4 | */ | 4 | */ |
@@ -2019,7 +2019,7 @@ ec_GFp_nistp521_precompute_mult(EC_GROUP * group, BN_CTX * ctx) | |||
2019 | goto err; | 2019 | goto err; |
2020 | BN_bin2bn(nistp521_curve_params[3], sizeof(felem_bytearray), x); | 2020 | BN_bin2bn(nistp521_curve_params[3], sizeof(felem_bytearray), x); |
2021 | BN_bin2bn(nistp521_curve_params[4], sizeof(felem_bytearray), y); | 2021 | BN_bin2bn(nistp521_curve_params[4], sizeof(felem_bytearray), y); |
2022 | if (!EC_POINT_set_affine_coordinates_GFp(group, generator, x, y, ctx)) | 2022 | if (!EC_POINT_set_affine_coordinates(group, generator, x, y, ctx)) |
2023 | goto err; | 2023 | goto err; |
2024 | if ((pre = nistp521_pre_comp_new()) == NULL) | 2024 | if ((pre = nistp521_pre_comp_new()) == NULL) |
2025 | goto err; | 2025 | goto err; |
diff --git a/src/lib/libcrypto/ec/ecp_nistz256.c b/src/lib/libcrypto/ec/ecp_nistz256.c index 71e0835e70..13c4cd2f34 100644 --- a/src/lib/libcrypto/ec/ecp_nistz256.c +++ b/src/lib/libcrypto/ec/ecp_nistz256.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_nistz256.c,v 1.7 2018/11/05 20:18:21 tb Exp $ */ | 1 | /* $OpenBSD: ecp_nistz256.c,v 1.8 2021/04/20 17:16:38 tb Exp $ */ |
2 | /* Copyright (c) 2014, Intel Corporation. | 2 | /* Copyright (c) 2014, Intel Corporation. |
3 | * | 3 | * |
4 | * Permission to use, copy, modify, and/or distribute this software for any | 4 | * Permission to use, copy, modify, and/or distribute this software for any |
@@ -744,7 +744,7 @@ ecp_nistz256_set_from_affine(EC_POINT *out, const EC_GROUP *group, | |||
744 | y.neg = 0; | 744 | y.neg = 0; |
745 | y.flags = BN_FLG_STATIC_DATA; | 745 | y.flags = BN_FLG_STATIC_DATA; |
746 | 746 | ||
747 | ret = EC_POINT_set_affine_coordinates_GFp(group, out, &x, &y, ctx); | 747 | ret = EC_POINT_set_affine_coordinates(group, out, &x, &y, ctx); |
748 | 748 | ||
749 | return ret; | 749 | return ret; |
750 | } | 750 | } |
diff --git a/src/lib/libcrypto/ec/ecp_oct.c b/src/lib/libcrypto/ec/ecp_oct.c index 29d9990546..901220483c 100644 --- a/src/lib/libcrypto/ec/ecp_oct.c +++ b/src/lib/libcrypto/ec/ecp_oct.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_oct.c,v 1.12 2020/12/04 08:55:30 tb Exp $ */ | 1 | /* $OpenBSD: ecp_oct.c,v 1.13 2021/04/20 17:16:38 tb Exp $ */ |
2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
3 | * for the OpenSSL project. | 3 | * for the OpenSSL project. |
4 | * Includes code written by Bodo Moeller for the OpenSSL project. | 4 | * Includes code written by Bodo Moeller for the OpenSSL project. |
@@ -185,7 +185,7 @@ ec_GFp_simple_set_compressed_coordinates(const EC_GROUP * group, | |||
185 | ECerror(ERR_R_INTERNAL_ERROR); | 185 | ECerror(ERR_R_INTERNAL_ERROR); |
186 | goto err; | 186 | goto err; |
187 | } | 187 | } |
188 | if (!EC_POINT_set_affine_coordinates_GFp(group, point, x, y, ctx)) | 188 | if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx)) |
189 | goto err; | 189 | goto err; |
190 | 190 | ||
191 | ret = 1; | 191 | ret = 1; |
@@ -246,7 +246,7 @@ ec_GFp_simple_point2oct(const EC_GROUP * group, const EC_POINT * point, point_co | |||
246 | if ((y = BN_CTX_get(ctx)) == NULL) | 246 | if ((y = BN_CTX_get(ctx)) == NULL) |
247 | goto err; | 247 | goto err; |
248 | 248 | ||
249 | if (!EC_POINT_get_affine_coordinates_GFp(group, point, x, y, ctx)) | 249 | if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx)) |
250 | goto err; | 250 | goto err; |
251 | 251 | ||
252 | if ((form == POINT_CONVERSION_COMPRESSED || form == POINT_CONVERSION_HYBRID) && BN_is_odd(y)) | 252 | if ((form == POINT_CONVERSION_COMPRESSED || form == POINT_CONVERSION_HYBRID) && BN_is_odd(y)) |
@@ -382,10 +382,10 @@ ec_GFp_simple_oct2point(const EC_GROUP * group, EC_POINT * point, | |||
382 | } | 382 | } |
383 | } | 383 | } |
384 | /* | 384 | /* |
385 | * EC_POINT_set_affine_coordinates_GFp checks that the point is | 385 | * EC_POINT_set_affine_coordinates checks that the point is |
386 | * on the curve as required by X9.62. | 386 | * on the curve as required by X9.62. |
387 | */ | 387 | */ |
388 | if (!EC_POINT_set_affine_coordinates_GFp(group, point, x, y, ctx)) | 388 | if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx)) |
389 | goto err; | 389 | goto err; |
390 | } | 390 | } |
391 | 391 | ||
diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c index 3957bd154c..e1fd9007c7 100644 --- a/src/lib/libcrypto/ec/ecp_smpl.c +++ b/src/lib/libcrypto/ec/ecp_smpl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_smpl.c,v 1.29 2018/11/15 05:53:31 tb Exp $ */ | 1 | /* $OpenBSD: ecp_smpl.c,v 1.30 2021/04/20 17:16:38 tb Exp $ */ |
2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
3 | * for the OpenSSL project. | 3 | * for the OpenSSL project. |
4 | * Includes code written by Bodo Moeller for the OpenSSL project. | 4 | * Includes code written by Bodo Moeller for the OpenSSL project. |
@@ -1209,9 +1209,9 @@ ec_GFp_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx | |||
1209 | if ((y = BN_CTX_get(ctx)) == NULL) | 1209 | if ((y = BN_CTX_get(ctx)) == NULL) |
1210 | goto err; | 1210 | goto err; |
1211 | 1211 | ||
1212 | if (!EC_POINT_get_affine_coordinates_GFp(group, point, x, y, ctx)) | 1212 | if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx)) |
1213 | goto err; | 1213 | goto err; |
1214 | if (!EC_POINT_set_affine_coordinates_GFp(group, point, x, y, ctx)) | 1214 | if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx)) |
1215 | goto err; | 1215 | goto err; |
1216 | if (!point->Z_is_one) { | 1216 | if (!point->Z_is_one) { |
1217 | ECerror(ERR_R_INTERNAL_ERROR); | 1217 | ECerror(ERR_R_INTERNAL_ERROR); |