From c27317d514c4ad4eee1ef608f6cff14347a2f424 Mon Sep 17 00:00:00 2001
From: tb <>
Date: Sat, 25 Jan 2025 13:13:57 +0000
Subject: Promote a few functions from EC API to garbage bin

EC_GROUP_method_of() and EC_METHOD_get_field_type() only ever used chained
together as a convoluted means to retrieve the field type of a group. This
is no longer useful since the answer will always be NID_X9_62_prime_field.

EC_POINT_method_of(), EC_GROUP{,_have}_precompute_mult(): exposed by one of
those expose-everything perl XS modules.

ok jsing
---
 src/lib/libcrypto/ec/ec_lib.c | 77 +++++++++++++++++++++++--------------------
 1 file changed, 41 insertions(+), 36 deletions(-)

(limited to 'src')

diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c
index 6b18b82a72..a6259ed581 100644
--- a/src/lib/libcrypto/ec/ec_lib.c
+++ b/src/lib/libcrypto/ec/ec_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ec_lib.c,v 1.115 2025/01/25 10:37:50 tb Exp $ */
+/* $OpenBSD: ec_lib.c,v 1.116 2025/01/25 13:13:57 tb Exp $ */
 /*
  * Originally written by Bodo Moeller for the OpenSSL project.
  */
@@ -222,20 +222,6 @@ EC_GROUP_dup(const EC_GROUP *in_group)
 }
 LCRYPTO_ALIAS(EC_GROUP_dup);
 
-const EC_METHOD *
-EC_GROUP_method_of(const EC_GROUP *group)
-{
-	return group->meth;
-}
-LCRYPTO_ALIAS(EC_GROUP_method_of);
-
-int
-EC_METHOD_get_field_type(const EC_METHOD *meth)
-{
-	return meth->field_type;
-}
-LCRYPTO_ALIAS(EC_METHOD_get_field_type);
-
 /*
  * If there is a user-provided cofactor, sanity check and use it. Otherwise
  * try computing the cofactor from generator order n and field cardinality p.
@@ -903,13 +889,6 @@ EC_POINT_dup(const EC_POINT *in_point, const EC_GROUP *group)
 }
 LCRYPTO_ALIAS(EC_POINT_dup);
 
-const EC_METHOD *
-EC_POINT_method_of(const EC_POINT *point)
-{
-	return point->meth;
-}
-LCRYPTO_ALIAS(EC_POINT_method_of);
-
 int
 EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
 {
@@ -1386,20 +1365,6 @@ EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
 }
 LCRYPTO_ALIAS(EC_POINT_mul);
 
-int
-EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx_in)
-{
-	return 1;
-}
-LCRYPTO_ALIAS(EC_GROUP_precompute_mult);
-
-int
-EC_GROUP_have_precompute_mult(const EC_GROUP *group)
-{
-	return 0;
-}
-LCRYPTO_ALIAS(EC_GROUP_have_precompute_mult);
-
 /*
  * XXX - remove everything below in the next bump
  */
@@ -1440,3 +1405,43 @@ EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
 	return 0;
 }
 LCRYPTO_ALIAS(EC_POINTs_mul);
+
+const EC_METHOD *
+EC_GROUP_method_of(const EC_GROUP *group)
+{
+	ECerror(ERR_R_DISABLED);
+	return NULL;
+}
+LCRYPTO_ALIAS(EC_GROUP_method_of);
+
+int
+EC_METHOD_get_field_type(const EC_METHOD *meth)
+{
+	ECerror(ERR_R_DISABLED);
+	return NID_undef;
+}
+LCRYPTO_ALIAS(EC_METHOD_get_field_type);
+
+const EC_METHOD *
+EC_POINT_method_of(const EC_POINT *point)
+{
+	ECerror(ERR_R_DISABLED);
+	return NULL;
+}
+LCRYPTO_ALIAS(EC_POINT_method_of);
+
+int
+EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx_in)
+{
+	ECerror(ERR_R_DISABLED);
+	return 0;
+}
+LCRYPTO_ALIAS(EC_GROUP_precompute_mult);
+
+int
+EC_GROUP_have_precompute_mult(const EC_GROUP *group)
+{
+	ECerror(ERR_R_DISABLED);
+	return 0;
+}
+LCRYPTO_ALIAS(EC_GROUP_have_precompute_mult);
-- 
cgit v1.2.3-55-g6feb