diff options
Diffstat (limited to 'lib/libcrypto/ec/ec_oct.c')
-rw-r--r-- | lib/libcrypto/ec/ec_oct.c | 66 |
1 files changed, 6 insertions, 60 deletions
diff --git a/lib/libcrypto/ec/ec_oct.c b/lib/libcrypto/ec/ec_oct.c index 0e651991fd1..ef17ec59a59 100644 --- a/lib/libcrypto/ec/ec_oct.c +++ b/lib/libcrypto/ec/ec_oct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_oct.c,v 1.9 2022/11/26 16:08:52 tb Exp $ */ +/* $OpenBSD: ec_oct.c,v 1.10 2023/03/08 04:50:27 jsing Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -74,8 +74,7 @@ int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point, const BIGNUM *x, int y_bit, BN_CTX *ctx) { - if (group->meth->point_set_compressed_coordinates == NULL && - !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) { + if (group->meth->point_set_compressed_coordinates == NULL) { ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } @@ -83,29 +82,8 @@ EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point, ECerror(EC_R_INCOMPATIBLE_OBJECTS); return 0; } - if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) { - if (group->meth->field_type == NID_X9_62_prime_field) - return ec_GFp_simple_set_compressed_coordinates( - group, point, x, y_bit, ctx); - else -#ifdef OPENSSL_NO_EC2M - { - ECerror(EC_R_GF2M_NOT_SUPPORTED); - return 0; - } -#else - return ec_GF2m_simple_set_compressed_coordinates( - group, point, x, y_bit, ctx); -#endif - } - if (!group->meth->point_set_compressed_coordinates(group, point, x, - y_bit, ctx)) - return 0; - if (EC_POINT_is_on_curve(group, point, ctx) <= 0) { - ECerror(EC_R_POINT_IS_NOT_ON_CURVE); - return 0; - } - return 1; + return group->meth->point_set_compressed_coordinates(group, point, + x, y_bit, ctx); } int @@ -129,8 +107,7 @@ EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point, point_conversion_form_t form, unsigned char *buf, size_t len, BN_CTX *ctx) { - if (group->meth->point2oct == 0 - && !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) { + if (group->meth->point2oct == NULL) { ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } @@ -138,21 +115,6 @@ EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point, ECerror(EC_R_INCOMPATIBLE_OBJECTS); return 0; } - if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) { - if (group->meth->field_type == NID_X9_62_prime_field) - return ec_GFp_simple_point2oct(group, point, - form, buf, len, ctx); - else -#ifdef OPENSSL_NO_EC2M - { - ECerror(EC_R_GF2M_NOT_SUPPORTED); - return 0; - } -#else - return ec_GF2m_simple_point2oct(group, point, - form, buf, len, ctx); -#endif - } return group->meth->point2oct(group, point, form, buf, len, ctx); } @@ -160,8 +122,7 @@ int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, const unsigned char *buf, size_t len, BN_CTX *ctx) { - if (group->meth->oct2point == 0 && - !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) { + if (group->meth->oct2point == NULL) { ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } @@ -169,20 +130,5 @@ EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, ECerror(EC_R_INCOMPATIBLE_OBJECTS); return 0; } - if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) { - if (group->meth->field_type == NID_X9_62_prime_field) - return ec_GFp_simple_oct2point(group, point, - buf, len, ctx); - else -#ifdef OPENSSL_NO_EC2M - { - ECerror(EC_R_GF2M_NOT_SUPPORTED); - return 0; - } -#else - return ec_GF2m_simple_oct2point(group, point, - buf, len, ctx); -#endif - } return group->meth->oct2point(group, point, buf, len, ctx); } |