diff options
Diffstat (limited to 'src/lib/libcrypto/ec/ec_lib.c')
-rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 55 |
1 files changed, 23 insertions, 32 deletions
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 | ||