diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2024-10-31 15:37:54 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2024-10-31 15:37:54 +0000 |
commit | a150664d391ca8a1817924e5a42c775a1f0c078c (patch) | |
tree | d6165197c8de1b5955bffb9c6ec8a35fb77b438a /lib | |
parent | a4a7a421eedb4bdef4679eb910ef5282c28735a2 (diff) |
Retire the oct2point and point2oct EC_METHOD members
Both our remaining EC_METHODs use the methods that used to be called
ec_GFp_simple_{oct2point,point2oct}() so there's no need for the function
pointer indirection. Make the public API call them directly.
ok jsing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/ec/ec_convert.c | 22 | ||||
-rw-r--r-- | lib/libcrypto/ec/ec_local.h | 12 | ||||
-rw-r--r-- | lib/libcrypto/ec/ecp_mont.c | 4 | ||||
-rw-r--r-- | lib/libcrypto/ec/ecp_smpl.c | 4 |
4 files changed, 10 insertions, 32 deletions
diff --git a/lib/libcrypto/ec/ec_convert.c b/lib/libcrypto/ec/ec_convert.c index a151850f467..3fdbaf3ce75 100644 --- a/lib/libcrypto/ec/ec_convert.c +++ b/lib/libcrypto/ec/ec_convert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_convert.c,v 1.6 2024/10/31 05:03:57 tb Exp $ */ +/* $OpenBSD: ec_convert.c,v 1.7 2024/10/31 15:37:53 tb Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -218,8 +218,8 @@ ec_oct_get_field_element_cbs(CBS *cbs, const EC_GROUP *group, BIGNUM *bn) return 1; } -size_t -ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, +static size_t +ec_oct_point2oct(const EC_GROUP *group, const EC_POINT *point, point_conversion_form_t conversion_form, unsigned char *buf, size_t len, BN_CTX *ctx) { @@ -308,8 +308,8 @@ ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, return ret; } -int -ec_GFp_simple_oct2point(const EC_GROUP *group, EC_POINT *point, +static int +ec_oct_oct2point(const EC_GROUP *group, EC_POINT *point, const unsigned char *buf, size_t len, BN_CTX *ctx) { CBS cbs; @@ -447,15 +447,11 @@ EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point, if (ctx == NULL) goto err; - if (group->meth->point2oct == NULL) { - ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); - goto err; - } if (group->meth != point->meth) { ECerror(EC_R_INCOMPATIBLE_OBJECTS); goto err; } - ret = group->meth->point2oct(group, point, form, buf, len, ctx); + ret = ec_oct_point2oct(group, point, form, buf, len, ctx); err: if (ctx != ctx_in) @@ -477,15 +473,11 @@ EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, if (ctx == NULL) goto err; - if (group->meth->oct2point == NULL) { - ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); - goto err; - } if (group->meth != point->meth) { ECerror(EC_R_INCOMPATIBLE_OBJECTS); goto err; } - ret = group->meth->oct2point(group, point, buf, len, ctx); + ret = ec_oct_oct2point(group, point, buf, len, ctx); err: if (ctx != ctx_in) diff --git a/lib/libcrypto/ec/ec_local.h b/lib/libcrypto/ec/ec_local.h index 148e94b7668..547705e9a6d 100644 --- a/lib/libcrypto/ec/ec_local.h +++ b/lib/libcrypto/ec/ec_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_local.h,v 1.34 2024/10/30 17:52:34 tb Exp $ */ +/* $OpenBSD: ec_local.h,v 1.35 2024/10/31 15:37:53 tb Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -117,12 +117,6 @@ struct ec_method_st { int (*point_set_compressed_coordinates)(const EC_GROUP *, EC_POINT *, const BIGNUM *x, int y_bit, BN_CTX *); - size_t (*point2oct)(const EC_GROUP *, const EC_POINT *, - point_conversion_form_t form, unsigned char *buf, size_t len, - BN_CTX *); - int (*oct2point)(const EC_GROUP *, EC_POINT *, const unsigned char *buf, - size_t len, BN_CTX *); - int (*add)(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *); int (*dbl)(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, BN_CTX *); @@ -282,10 +276,6 @@ int ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *, const EC_POINT BIGNUM *x, BIGNUM *y, BN_CTX *); int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *, EC_POINT *, const BIGNUM *x, int y_bit, BN_CTX *); -size_t ec_GFp_simple_point2oct(const EC_GROUP *, const EC_POINT *, point_conversion_form_t form, - unsigned char *buf, size_t len, BN_CTX *); -int ec_GFp_simple_oct2point(const EC_GROUP *, EC_POINT *, - const unsigned char *buf, size_t len, BN_CTX *); int ec_GFp_simple_add(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *); int ec_GFp_simple_dbl(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, BN_CTX *); int ec_GFp_simple_invert(const EC_GROUP *, EC_POINT *, BN_CTX *); diff --git a/lib/libcrypto/ec/ecp_mont.c b/lib/libcrypto/ec/ecp_mont.c index 76d1f578ee0..8fd7ebc7b94 100644 --- a/lib/libcrypto/ec/ecp_mont.c +++ b/lib/libcrypto/ec/ecp_mont.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecp_mont.c,v 1.30 2023/07/07 13:54:45 beck Exp $ */ +/* $OpenBSD: ecp_mont.c,v 1.31 2024/10/31 15:37:53 tb Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -243,8 +243,6 @@ static const EC_METHOD ec_GFp_mont_method = { ec_GFp_simple_point_get_affine_coordinates, .point_set_compressed_coordinates = ec_GFp_simple_set_compressed_coordinates, - .point2oct = ec_GFp_simple_point2oct, - .oct2point = ec_GFp_simple_oct2point, .add = ec_GFp_simple_add, .dbl = ec_GFp_simple_dbl, .invert = ec_GFp_simple_invert, diff --git a/lib/libcrypto/ec/ecp_smpl.c b/lib/libcrypto/ec/ecp_smpl.c index 018aedfd4e5..ab796807424 100644 --- a/lib/libcrypto/ec/ecp_smpl.c +++ b/lib/libcrypto/ec/ecp_smpl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecp_smpl.c,v 1.56 2023/08/03 18:53:56 tb Exp $ */ +/* $OpenBSD: ecp_smpl.c,v 1.57 2024/10/31 15:37:53 tb Exp $ */ /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> * for the OpenSSL project. * Includes code written by Bodo Moeller for the OpenSSL project. @@ -1534,8 +1534,6 @@ static const EC_METHOD ec_GFp_simple_method = { ec_GFp_simple_point_get_affine_coordinates, .point_set_compressed_coordinates = ec_GFp_simple_set_compressed_coordinates, - .point2oct = ec_GFp_simple_point2oct, - .oct2point = ec_GFp_simple_oct2point, .add = ec_GFp_simple_add, .dbl = ec_GFp_simple_dbl, .invert = ec_GFp_simple_invert, |