diff options
Diffstat (limited to 'src/lib/libcrypto/ec/ec_lib.c')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 76 |
1 files changed, 5 insertions, 71 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index d961ad0ee4..03c6f3aa90 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.94 2025/01/05 16:07:08 tb Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.95 2025/01/06 10:56:46 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 | */ |
| @@ -908,78 +908,11 @@ EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) | |||
| 908 | LCRYPTO_ALIAS(EC_POINT_set_to_infinity); | 908 | LCRYPTO_ALIAS(EC_POINT_set_to_infinity); |
| 909 | 909 | ||
| 910 | int | 910 | int |
| 911 | EC_POINT_set_Jprojective_coordinates(const EC_GROUP *group, EC_POINT *point, | ||
| 912 | const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx_in) | ||
| 913 | { | ||
| 914 | BN_CTX *ctx; | ||
| 915 | int ret = 0; | ||
| 916 | |||
| 917 | if ((ctx = ctx_in) == NULL) | ||
| 918 | ctx = BN_CTX_new(); | ||
| 919 | if (ctx == NULL) | ||
| 920 | goto err; | ||
| 921 | |||
| 922 | if (group->meth->point_set_Jprojective_coordinates == NULL) { | ||
| 923 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | ||
| 924 | goto err; | ||
| 925 | } | ||
| 926 | if (group->meth != point->meth) { | ||
| 927 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | ||
| 928 | goto err; | ||
| 929 | } | ||
| 930 | if (!group->meth->point_set_Jprojective_coordinates(group, point, | ||
| 931 | x, y, z, ctx)) | ||
| 932 | goto err; | ||
| 933 | |||
| 934 | if (EC_POINT_is_on_curve(group, point, ctx) <= 0) { | ||
| 935 | ECerror(EC_R_POINT_IS_NOT_ON_CURVE); | ||
| 936 | goto err; | ||
| 937 | } | ||
| 938 | |||
| 939 | ret = 1; | ||
| 940 | |||
| 941 | err: | ||
| 942 | if (ctx != ctx_in) | ||
| 943 | BN_CTX_free(ctx); | ||
| 944 | |||
| 945 | return ret; | ||
| 946 | } | ||
| 947 | |||
| 948 | int | ||
| 949 | EC_POINT_get_Jprojective_coordinates(const EC_GROUP *group, | ||
| 950 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx_in) | ||
| 951 | { | ||
| 952 | BN_CTX *ctx; | ||
| 953 | int ret = 0; | ||
| 954 | |||
| 955 | if ((ctx = ctx_in) == NULL) | ||
| 956 | ctx = BN_CTX_new(); | ||
| 957 | if (ctx == NULL) | ||
| 958 | goto err; | ||
| 959 | |||
| 960 | if (group->meth->point_get_Jprojective_coordinates == NULL) { | ||
| 961 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | ||
| 962 | goto err; | ||
| 963 | } | ||
| 964 | if (group->meth != point->meth) { | ||
| 965 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | ||
| 966 | goto err; | ||
| 967 | } | ||
| 968 | ret = group->meth->point_get_Jprojective_coordinates(group, point, | ||
| 969 | x, y, z, ctx); | ||
| 970 | |||
| 971 | err: | ||
| 972 | if (ctx != ctx_in) | ||
| 973 | BN_CTX_free(ctx); | ||
| 974 | |||
| 975 | return ret; | ||
| 976 | } | ||
| 977 | |||
| 978 | int | ||
| 979 | EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *point, | 911 | EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *point, |
| 980 | const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx) | 912 | const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx) |
| 981 | { | 913 | { |
| 982 | return EC_POINT_set_Jprojective_coordinates(group, point, x, y, z, ctx); | 914 | ECerror(ERR_R_DISABLED); |
| 915 | return 0; | ||
| 983 | } | 916 | } |
| 984 | LCRYPTO_ALIAS(EC_POINT_set_Jprojective_coordinates_GFp); | 917 | LCRYPTO_ALIAS(EC_POINT_set_Jprojective_coordinates_GFp); |
| 985 | 918 | ||
| @@ -987,7 +920,8 @@ int | |||
| 987 | EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, | 920 | EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, |
| 988 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx) | 921 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx) |
| 989 | { | 922 | { |
| 990 | return EC_POINT_get_Jprojective_coordinates(group, point, x, y, z, ctx); | 923 | ECerror(ERR_R_DISABLED); |
| 924 | return 0; | ||
| 991 | } | 925 | } |
| 992 | LCRYPTO_ALIAS(EC_POINT_get_Jprojective_coordinates_GFp); | 926 | LCRYPTO_ALIAS(EC_POINT_get_Jprojective_coordinates_GFp); |
| 993 | 927 | ||
