summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2025-01-06 14:29:33 +0000
committertb <>2025-01-06 14:29:33 +0000
commit90c4ea11168e40751810b5d56e83de147872a6ed (patch)
treecdb4b90b5a3dcb2fc4df6ecb16adad31b105882a
parentbccd8f34fd0625e0ba24fcec5cdec580ca31aaea (diff)
downloadopenbsd-90c4ea11168e40751810b5d56e83de147872a6ed.tar.gz
openbsd-90c4ea11168e40751810b5d56e83de147872a6ed.tar.bz2
openbsd-90c4ea11168e40751810b5d56e83de147872a6ed.zip
Remove get_order_bits() and get_degree() methods
The degree made some sense when EC2M was a thing in libcrypto. Fortunately that's not the case anymore. The order handler never made sense. ok jsing
-rw-r--r--src/lib/libcrypto/ec/ec_lib.c16
-rw-r--r--src/lib/libcrypto/ec/ec_local.h5
-rw-r--r--src/lib/libcrypto/ec/ecp_methods.c12
3 files changed, 5 insertions, 28 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c
index f97144ea91..3c5a7d5c34 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.100 2025/01/06 14:25:10 tb Exp $ */ 1/* $OpenBSD: ec_lib.c,v 1.101 2025/01/06 14:29:33 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 */
@@ -404,7 +404,7 @@ EC_GROUP_get0_order(const EC_GROUP *group)
404int 404int
405EC_GROUP_order_bits(const EC_GROUP *group) 405EC_GROUP_order_bits(const EC_GROUP *group)
406{ 406{
407 return group->meth->group_order_bits(group); 407 return BN_num_bits(group->order);
408} 408}
409LCRYPTO_ALIAS(EC_GROUP_order_bits); 409LCRYPTO_ALIAS(EC_GROUP_order_bits);
410 410
@@ -592,11 +592,7 @@ LCRYPTO_ALIAS(EC_GROUP_new_curve_GFp);
592int 592int
593EC_GROUP_get_degree(const EC_GROUP *group) 593EC_GROUP_get_degree(const EC_GROUP *group)
594{ 594{
595 if (group->meth->group_get_degree == NULL) { 595 return BN_num_bits(group->p);
596 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
597 return 0;
598 }
599 return group->meth->group_get_degree(group);
600} 596}
601LCRYPTO_ALIAS(EC_GROUP_get_degree); 597LCRYPTO_ALIAS(EC_GROUP_get_degree);
602 598
@@ -1385,9 +1381,3 @@ EC_GROUP_have_precompute_mult(const EC_GROUP *group)
1385 return 0; 1381 return 0;
1386} 1382}
1387LCRYPTO_ALIAS(EC_GROUP_have_precompute_mult); 1383LCRYPTO_ALIAS(EC_GROUP_have_precompute_mult);
1388
1389int
1390ec_group_simple_order_bits(const EC_GROUP *group)
1391{
1392 return BN_num_bits(group->order);
1393}
diff --git a/src/lib/libcrypto/ec/ec_local.h b/src/lib/libcrypto/ec/ec_local.h
index fad66eb4ec..1201f6ef39 100644
--- a/src/lib/libcrypto/ec/ec_local.h
+++ b/src/lib/libcrypto/ec/ec_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_local.h,v 1.50 2025/01/06 14:10:32 tb Exp $ */ 1/* $OpenBSD: ec_local.h,v 1.51 2025/01/06 14:29:33 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 */
@@ -95,8 +95,6 @@ struct ec_method_st {
95 int (*group_get_curve)(const EC_GROUP *, BIGNUM *p, BIGNUM *a, 95 int (*group_get_curve)(const EC_GROUP *, BIGNUM *p, BIGNUM *a,
96 BIGNUM *b, BN_CTX *); 96 BIGNUM *b, BN_CTX *);
97 97
98 int (*group_get_degree)(const EC_GROUP *);
99 int (*group_order_bits)(const EC_GROUP *);
100 int (*group_check_discriminant)(const EC_GROUP *, BN_CTX *); 98 int (*group_check_discriminant)(const EC_GROUP *, BN_CTX *);
101 99
102 int (*point_set_affine_coordinates)(const EC_GROUP *, EC_POINT *, 100 int (*point_set_affine_coordinates)(const EC_GROUP *, EC_POINT *,
@@ -201,7 +199,6 @@ struct ec_point_st {
201int ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *m, 199int ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *m,
202 const EC_POINT *point, const BIGNUM *n, BN_CTX *ctx); 200 const EC_POINT *point, const BIGNUM *n, BN_CTX *ctx);
203 201
204int ec_group_simple_order_bits(const EC_GROUP *group);
205int ec_group_is_builtin_curve(const EC_GROUP *group, int *out_nid); 202int ec_group_is_builtin_curve(const EC_GROUP *group, int *out_nid);
206int ec_group_get_field_type(const EC_GROUP *group); 203int ec_group_get_field_type(const EC_GROUP *group);
207 204
diff --git a/src/lib/libcrypto/ec/ecp_methods.c b/src/lib/libcrypto/ec/ecp_methods.c
index 042db054a8..d68022f5e6 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.23 2025/01/06 14:22:55 tb Exp $ */ 1/* $OpenBSD: ecp_methods.c,v 1.24 2025/01/06 14:29:33 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.
@@ -167,12 +167,6 @@ ec_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b,
167} 167}
168 168
169static int 169static int
170ec_group_get_degree(const EC_GROUP *group)
171{
172 return BN_num_bits(group->p);
173}
174
175static int
176ec_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) 170ec_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
177{ 171{
178 BIGNUM *p, *a, *b, *discriminant; 172 BIGNUM *p, *a, *b, *discriminant;
@@ -1520,8 +1514,6 @@ static const EC_METHOD ec_GFp_simple_method = {
1520 .field_type = NID_X9_62_prime_field, 1514 .field_type = NID_X9_62_prime_field,
1521 .group_set_curve = ec_group_set_curve, 1515 .group_set_curve = ec_group_set_curve,
1522 .group_get_curve = ec_group_get_curve, 1516 .group_get_curve = ec_group_get_curve,
1523 .group_get_degree = ec_group_get_degree,
1524 .group_order_bits = ec_group_simple_order_bits,
1525 .group_check_discriminant = ec_group_check_discriminant, 1517 .group_check_discriminant = ec_group_check_discriminant,
1526 .point_set_affine_coordinates = ec_point_set_affine_coordinates, 1518 .point_set_affine_coordinates = ec_point_set_affine_coordinates,
1527 .point_get_affine_coordinates = ec_point_get_affine_coordinates, 1519 .point_get_affine_coordinates = ec_point_get_affine_coordinates,
@@ -1551,8 +1543,6 @@ static const EC_METHOD ec_GFp_mont_method = {
1551 .field_type = NID_X9_62_prime_field, 1543 .field_type = NID_X9_62_prime_field,
1552 .group_set_curve = ec_mont_group_set_curve, 1544 .group_set_curve = ec_mont_group_set_curve,
1553 .group_get_curve = ec_group_get_curve, 1545 .group_get_curve = ec_group_get_curve,
1554 .group_get_degree = ec_group_get_degree,
1555 .group_order_bits = ec_group_simple_order_bits,
1556 .group_check_discriminant = ec_group_check_discriminant, 1546 .group_check_discriminant = ec_group_check_discriminant,
1557 .point_set_affine_coordinates = ec_point_set_affine_coordinates, 1547 .point_set_affine_coordinates = ec_point_set_affine_coordinates,
1558 .point_get_affine_coordinates = ec_point_get_affine_coordinates, 1548 .point_get_affine_coordinates = ec_point_get_affine_coordinates,