diff options
author | tb <> | 2021-04-20 17:16:38 +0000 |
---|---|---|
committer | tb <> | 2021-04-20 17:16:38 +0000 |
commit | 67e97261c2453d56f2a373d1f3023d6538995dd5 (patch) | |
tree | 5887c8db20a9739a2d144ce6d009f6f18b6f49f1 /src/lib | |
parent | 3b87dc9794809a607c59f25dd5d25a8dd1b9e453 (diff) | |
download | openbsd-67e97261c2453d56f2a373d1f3023d6538995dd5.tar.gz openbsd-67e97261c2453d56f2a373d1f3023d6538995dd5.tar.bz2 openbsd-67e97261c2453d56f2a373d1f3023d6538995dd5.zip |
Prepare to provide EC_POINT_{g,s}et_affine_coordinates
Similar to part of OpenSSL commit 8e3cced75fb5fee5da59ebef9605d403a999391b
ok jsing
Diffstat (limited to 'src/lib')
-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 | ||||
-rw-r--r-- | src/lib/libcrypto/ecdh/ech_key.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/ecdsa/ecs_ossl.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/gost/gostr341001.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/gost/gostr341001_ameth.c | 7 | ||||
-rw-r--r-- | src/lib/libcrypto/gost/gostr341001_key.c | 6 |
18 files changed, 90 insertions, 92 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); |
diff --git a/src/lib/libcrypto/ecdh/ech_key.c b/src/lib/libcrypto/ecdh/ech_key.c index 378912cacb..c82002ea46 100644 --- a/src/lib/libcrypto/ecdh/ech_key.c +++ b/src/lib/libcrypto/ecdh/ech_key.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ech_key.c,v 1.9 2019/01/19 01:12:48 tb Exp $ */ | 1 | /* $OpenBSD: ech_key.c,v 1.10 2021/04/20 17:16:38 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -142,16 +142,14 @@ ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, | |||
142 | 142 | ||
143 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == | 143 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == |
144 | NID_X9_62_prime_field) { | 144 | NID_X9_62_prime_field) { |
145 | if (!EC_POINT_get_affine_coordinates_GFp(group, tmp, x, y, | 145 | if (!EC_POINT_get_affine_coordinates(group, tmp, x, y, ctx)) { |
146 | ctx)) { | ||
147 | ECDHerror(ECDH_R_POINT_ARITHMETIC_FAILURE); | 146 | ECDHerror(ECDH_R_POINT_ARITHMETIC_FAILURE); |
148 | goto err; | 147 | goto err; |
149 | } | 148 | } |
150 | } | 149 | } |
151 | #ifndef OPENSSL_NO_EC2M | 150 | #ifndef OPENSSL_NO_EC2M |
152 | else { | 151 | else { |
153 | if (!EC_POINT_get_affine_coordinates_GF2m(group, tmp, x, y, | 152 | if (!EC_POINT_get_affine_coordinates(group, tmp, x, y, ctx)) { |
154 | ctx)) { | ||
155 | ECDHerror(ECDH_R_POINT_ARITHMETIC_FAILURE); | 153 | ECDHerror(ECDH_R_POINT_ARITHMETIC_FAILURE); |
156 | goto err; | 154 | goto err; |
157 | } | 155 | } |
diff --git a/src/lib/libcrypto/ecdsa/ecs_ossl.c b/src/lib/libcrypto/ecdsa/ecs_ossl.c index 8a6685de58..aa97a3ad73 100644 --- a/src/lib/libcrypto/ecdsa/ecs_ossl.c +++ b/src/lib/libcrypto/ecdsa/ecs_ossl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecs_ossl.c,v 1.20 2019/06/04 18:15:27 tb Exp $ */ | 1 | /* $OpenBSD: ecs_ossl.c,v 1.21 2021/04/20 17:16:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project | 3 | * Written by Nils Larsch for the OpenSSL project |
4 | */ | 4 | */ |
@@ -207,7 +207,7 @@ ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | |||
207 | } | 207 | } |
208 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == | 208 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == |
209 | NID_X9_62_prime_field) { | 209 | NID_X9_62_prime_field) { |
210 | if (!EC_POINT_get_affine_coordinates_GFp(group, point, | 210 | if (!EC_POINT_get_affine_coordinates(group, point, |
211 | X, NULL, ctx)) { | 211 | X, NULL, ctx)) { |
212 | ECDSAerror(ERR_R_EC_LIB); | 212 | ECDSAerror(ERR_R_EC_LIB); |
213 | goto err; | 213 | goto err; |
@@ -215,7 +215,7 @@ ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | |||
215 | } | 215 | } |
216 | #ifndef OPENSSL_NO_EC2M | 216 | #ifndef OPENSSL_NO_EC2M |
217 | else { /* NID_X9_62_characteristic_two_field */ | 217 | else { /* NID_X9_62_characteristic_two_field */ |
218 | if (!EC_POINT_get_affine_coordinates_GF2m(group, point, | 218 | if (!EC_POINT_get_affine_coordinates(group, point, |
219 | X, NULL, ctx)) { | 219 | X, NULL, ctx)) { |
220 | ECDSAerror(ERR_R_EC_LIB); | 220 | ECDSAerror(ERR_R_EC_LIB); |
221 | goto err; | 221 | goto err; |
@@ -523,7 +523,7 @@ ecdsa_do_verify(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *sig, | |||
523 | } | 523 | } |
524 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == | 524 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == |
525 | NID_X9_62_prime_field) { | 525 | NID_X9_62_prime_field) { |
526 | if (!EC_POINT_get_affine_coordinates_GFp(group, point, X, NULL, | 526 | if (!EC_POINT_get_affine_coordinates(group, point, X, NULL, |
527 | ctx)) { | 527 | ctx)) { |
528 | ECDSAerror(ERR_R_EC_LIB); | 528 | ECDSAerror(ERR_R_EC_LIB); |
529 | goto err; | 529 | goto err; |
@@ -531,7 +531,7 @@ ecdsa_do_verify(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *sig, | |||
531 | } | 531 | } |
532 | #ifndef OPENSSL_NO_EC2M | 532 | #ifndef OPENSSL_NO_EC2M |
533 | else { /* NID_X9_62_characteristic_two_field */ | 533 | else { /* NID_X9_62_characteristic_two_field */ |
534 | if (!EC_POINT_get_affine_coordinates_GF2m(group, point, X, NULL, | 534 | if (!EC_POINT_get_affine_coordinates(group, point, X, NULL, |
535 | ctx)) { | 535 | ctx)) { |
536 | ECDSAerror(ERR_R_EC_LIB); | 536 | ECDSAerror(ERR_R_EC_LIB); |
537 | goto err; | 537 | goto err; |
diff --git a/src/lib/libcrypto/gost/gostr341001.c b/src/lib/libcrypto/gost/gostr341001.c index ba70d5f1fc..bfbd032161 100644 --- a/src/lib/libcrypto/gost/gostr341001.c +++ b/src/lib/libcrypto/gost/gostr341001.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: gostr341001.c,v 1.7 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: gostr341001.c,v 1.8 2021/04/20 17:16:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
4 | * Copyright (c) 2005-2006 Cryptocom LTD | 4 | * Copyright (c) 2005-2006 Cryptocom LTD |
@@ -206,7 +206,7 @@ gost2001_do_sign(BIGNUM *md, GOST_KEY *eckey) | |||
206 | GOSTerror(ERR_R_EC_LIB); | 206 | GOSTerror(ERR_R_EC_LIB); |
207 | goto err; | 207 | goto err; |
208 | } | 208 | } |
209 | if (EC_POINT_get_affine_coordinates_GFp(group, C, X, | 209 | if (EC_POINT_get_affine_coordinates(group, C, X, |
210 | NULL, ctx) == 0) { | 210 | NULL, ctx) == 0) { |
211 | GOSTerror(ERR_R_EC_LIB); | 211 | GOSTerror(ERR_R_EC_LIB); |
212 | goto err; | 212 | goto err; |
@@ -304,7 +304,7 @@ gost2001_do_verify(BIGNUM *md, ECDSA_SIG *sig, GOST_KEY *ec) | |||
304 | GOSTerror(ERR_R_EC_LIB); | 304 | GOSTerror(ERR_R_EC_LIB); |
305 | goto err; | 305 | goto err; |
306 | } | 306 | } |
307 | if (EC_POINT_get_affine_coordinates_GFp(group, C, X, NULL, ctx) == 0) { | 307 | if (EC_POINT_get_affine_coordinates(group, C, X, NULL, ctx) == 0) { |
308 | GOSTerror(ERR_R_EC_LIB); | 308 | GOSTerror(ERR_R_EC_LIB); |
309 | goto err; | 309 | goto err; |
310 | } | 310 | } |
@@ -354,7 +354,7 @@ VKO_compute_key(BIGNUM *X, BIGNUM *Y, const GOST_KEY *pkey, GOST_KEY *priv_key, | |||
354 | goto err; | 354 | goto err; |
355 | if (EC_POINT_mul(group, pnt, NULL, pub_key, p, ctx) == 0) | 355 | if (EC_POINT_mul(group, pnt, NULL, pub_key, p, ctx) == 0) |
356 | goto err; | 356 | goto err; |
357 | if (EC_POINT_get_affine_coordinates_GFp(group, pnt, X, Y, ctx) == 0) | 357 | if (EC_POINT_get_affine_coordinates(group, pnt, X, Y, ctx) == 0) |
358 | goto err; | 358 | goto err; |
359 | ok = 1; | 359 | ok = 1; |
360 | 360 | ||
diff --git a/src/lib/libcrypto/gost/gostr341001_ameth.c b/src/lib/libcrypto/gost/gostr341001_ameth.c index 27a95f2069..294b654d4f 100644 --- a/src/lib/libcrypto/gost/gostr341001_ameth.c +++ b/src/lib/libcrypto/gost/gostr341001_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: gostr341001_ameth.c,v 1.16 2020/06/05 17:17:22 jsing Exp $ */ | 1 | /* $OpenBSD: gostr341001_ameth.c,v 1.17 2021/04/20 17:16:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
4 | * Copyright (c) 2005-2006 Cryptocom LTD | 4 | * Copyright (c) 2005-2006 Cryptocom LTD |
@@ -290,7 +290,7 @@ pub_encode_gost01(X509_PUBKEY *pub, const EVP_PKEY *pk) | |||
290 | goto err; | 290 | goto err; |
291 | } | 291 | } |
292 | 292 | ||
293 | if (EC_POINT_get_affine_coordinates_GFp(GOST_KEY_get0_group(ec), | 293 | if (EC_POINT_get_affine_coordinates(GOST_KEY_get0_group(ec), |
294 | pub_key, X, Y, NULL) == 0) { | 294 | pub_key, X, Y, NULL) == 0) { |
295 | GOSTerror(ERR_R_EC_LIB); | 295 | GOSTerror(ERR_R_EC_LIB); |
296 | goto err; | 296 | goto err; |
@@ -352,8 +352,7 @@ pub_print_gost01(BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx) | |||
352 | goto err; | 352 | goto err; |
353 | pubkey = GOST_KEY_get0_public_key(pkey->pkey.gost); | 353 | pubkey = GOST_KEY_get0_public_key(pkey->pkey.gost); |
354 | group = GOST_KEY_get0_group(pkey->pkey.gost); | 354 | group = GOST_KEY_get0_group(pkey->pkey.gost); |
355 | if (EC_POINT_get_affine_coordinates_GFp(group, pubkey, X, Y, | 355 | if (EC_POINT_get_affine_coordinates(group, pubkey, X, Y, ctx) == 0) { |
356 | ctx) == 0) { | ||
357 | GOSTerror(ERR_R_EC_LIB); | 356 | GOSTerror(ERR_R_EC_LIB); |
358 | goto err; | 357 | goto err; |
359 | } | 358 | } |
diff --git a/src/lib/libcrypto/gost/gostr341001_key.c b/src/lib/libcrypto/gost/gostr341001_key.c index 0af39f21bf..d5d885c257 100644 --- a/src/lib/libcrypto/gost/gostr341001_key.c +++ b/src/lib/libcrypto/gost/gostr341001_key.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: gostr341001_key.c,v 1.8 2017/05/02 03:59:44 deraadt Exp $ */ | 1 | /* $OpenBSD: gostr341001_key.c,v 1.9 2021/04/20 17:16:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
4 | * Copyright (c) 2005-2006 Cryptocom LTD | 4 | * Copyright (c) 2005-2006 Cryptocom LTD |
@@ -201,10 +201,10 @@ GOST_KEY_set_public_key_affine_coordinates(GOST_KEY *key, BIGNUM *x, BIGNUM *y) | |||
201 | goto err; | 201 | goto err; |
202 | if ((ty = BN_CTX_get(ctx)) == NULL) | 202 | if ((ty = BN_CTX_get(ctx)) == NULL) |
203 | goto err; | 203 | goto err; |
204 | if (EC_POINT_set_affine_coordinates_GFp(key->group, point, x, y, | 204 | if (EC_POINT_set_affine_coordinates(key->group, point, x, y, |
205 | ctx) == 0) | 205 | ctx) == 0) |
206 | goto err; | 206 | goto err; |
207 | if (EC_POINT_get_affine_coordinates_GFp(key->group, point, tx, ty, | 207 | if (EC_POINT_get_affine_coordinates(key->group, point, tx, ty, |
208 | ctx) == 0) | 208 | ctx) == 0) |
209 | goto err; | 209 | goto err; |
210 | /* | 210 | /* |