diff options
author | tb <> | 2025-01-11 13:38:42 +0000 |
---|---|---|
committer | tb <> | 2025-01-11 13:38:42 +0000 |
commit | 28b0d0a86ff16d35928ff812a03e9ae9abb97ac1 (patch) | |
tree | 7212ae9e38ac6f0ff09f3a7a9e0f3da09046e304 /src/lib/libcrypto/ec/ecp_methods.c | |
parent | 8b8ce4611c101986c51d6e37d3113e60d5e1dd58 (diff) | |
download | openbsd-28b0d0a86ff16d35928ff812a03e9ae9abb97ac1.tar.gz openbsd-28b0d0a86ff16d35928ff812a03e9ae9abb97ac1.tar.bz2 openbsd-28b0d0a86ff16d35928ff812a03e9ae9abb97ac1.zip |
Inline ec_point_make_affine() in the public API
Whatever the EC_METHOD, this will always be equivalent to getting and
setting the affine coordinates, so this needs no dedicated method.
Also, this is a function that makes no real sense since a caller should
never need to care about this... As always, our favorite language bindings
thought they might have users who care. This time it's Ruby and Perl.
ok jsing
Diffstat (limited to 'src/lib/libcrypto/ec/ecp_methods.c')
-rw-r--r-- | src/lib/libcrypto/ec/ecp_methods.c | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/src/lib/libcrypto/ec/ecp_methods.c b/src/lib/libcrypto/ec/ecp_methods.c index 9593428870..a2a74334f4 100644 --- a/src/lib/libcrypto/ec/ecp_methods.c +++ b/src/lib/libcrypto/ec/ecp_methods.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_methods.c,v 1.26 2025/01/07 08:30:52 tb Exp $ */ | 1 | /* $OpenBSD: ecp_methods.c,v 1.27 2025/01/11 13:38:42 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. |
@@ -892,38 +892,6 @@ ec_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) | |||
892 | } | 892 | } |
893 | 893 | ||
894 | static int | 894 | static int |
895 | ec_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | ||
896 | { | ||
897 | BIGNUM *x, *y; | ||
898 | int ret = 0; | ||
899 | |||
900 | if (point->Z_is_one || EC_POINT_is_at_infinity(group, point)) | ||
901 | return 1; | ||
902 | |||
903 | BN_CTX_start(ctx); | ||
904 | |||
905 | if ((x = BN_CTX_get(ctx)) == NULL) | ||
906 | goto err; | ||
907 | if ((y = BN_CTX_get(ctx)) == NULL) | ||
908 | goto err; | ||
909 | |||
910 | if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx)) | ||
911 | goto err; | ||
912 | if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx)) | ||
913 | goto err; | ||
914 | if (!point->Z_is_one) { | ||
915 | ECerror(ERR_R_INTERNAL_ERROR); | ||
916 | goto err; | ||
917 | } | ||
918 | ret = 1; | ||
919 | |||
920 | err: | ||
921 | BN_CTX_end(ctx); | ||
922 | |||
923 | return ret; | ||
924 | } | ||
925 | |||
926 | static int | ||
927 | ec_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], | 895 | ec_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], |
928 | BN_CTX *ctx) | 896 | BN_CTX *ctx) |
929 | { | 897 | { |
@@ -1462,7 +1430,6 @@ static const EC_METHOD ec_GFp_simple_method = { | |||
1462 | .invert = ec_invert, | 1430 | .invert = ec_invert, |
1463 | .is_on_curve = ec_is_on_curve, | 1431 | .is_on_curve = ec_is_on_curve, |
1464 | .point_cmp = ec_cmp, | 1432 | .point_cmp = ec_cmp, |
1465 | .make_affine = ec_make_affine, | ||
1466 | .points_make_affine = ec_points_make_affine, | 1433 | .points_make_affine = ec_points_make_affine, |
1467 | .mul_generator_ct = ec_mul_generator_ct, | 1434 | .mul_generator_ct = ec_mul_generator_ct, |
1468 | .mul_single_ct = ec_mul_single_ct, | 1435 | .mul_single_ct = ec_mul_single_ct, |
@@ -1490,7 +1457,6 @@ static const EC_METHOD ec_GFp_mont_method = { | |||
1490 | .invert = ec_invert, | 1457 | .invert = ec_invert, |
1491 | .is_on_curve = ec_is_on_curve, | 1458 | .is_on_curve = ec_is_on_curve, |
1492 | .point_cmp = ec_cmp, | 1459 | .point_cmp = ec_cmp, |
1493 | .make_affine = ec_make_affine, | ||
1494 | .points_make_affine = ec_points_make_affine, | 1460 | .points_make_affine = ec_points_make_affine, |
1495 | .mul_generator_ct = ec_mul_generator_ct, | 1461 | .mul_generator_ct = ec_mul_generator_ct, |
1496 | .mul_single_ct = ec_mul_single_ct, | 1462 | .mul_single_ct = ec_mul_single_ct, |