diff options
author | tb <> | 2025-03-09 15:33:35 +0000 |
---|---|---|
committer | tb <> | 2025-03-09 15:33:35 +0000 |
commit | 53a919ddf8f4c663b3beca57c18dc025e1f71fa0 (patch) | |
tree | 5ea07c323509da65b5e08fe62e83b6238f547a51 | |
parent | b04c2a1d799fe2ea8751349ab1dc4a8b551ce48d (diff) | |
download | openbsd-53a919ddf8f4c663b3beca57c18dc025e1f71fa0.tar.gz openbsd-53a919ddf8f4c663b3beca57c18dc025e1f71fa0.tar.bz2 openbsd-53a919ddf8f4c663b3beca57c18dc025e1f71fa0.zip |
Unexport EC_METHOD and all API using it
This is an implementation detail and there is no reason to leak it from
the library.
This removes EC_GFp_{mont,simple}_method(), EC_GROUP_{method_of,new}(),
EC_METHOD_get_field_type(), EC_POINT_method_of() from the public API.
EC_GROUP_copy() is now quite useless, so it will go as well.
ok jsing
-rw-r--r-- | src/lib/libcrypto/Symbols.list | 6 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec.h | 12 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 27 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_local.h | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_methods.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/hidden/openssl/ec.h | 8 |
6 files changed, 10 insertions, 56 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index cae2ac924d..647dfa6065 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list | |||
@@ -861,8 +861,6 @@ ECPKParameters_print_fp | |||
861 | ECParameters_dup | 861 | ECParameters_dup |
862 | ECParameters_print | 862 | ECParameters_print |
863 | ECParameters_print_fp | 863 | ECParameters_print_fp |
864 | EC_GFp_mont_method | ||
865 | EC_GFp_simple_method | ||
866 | EC_GROUP_check | 864 | EC_GROUP_check |
867 | EC_GROUP_check_discriminant | 865 | EC_GROUP_check_discriminant |
868 | EC_GROUP_clear_free | 866 | EC_GROUP_clear_free |
@@ -883,8 +881,6 @@ EC_GROUP_get_order | |||
883 | EC_GROUP_get_point_conversion_form | 881 | EC_GROUP_get_point_conversion_form |
884 | EC_GROUP_get_seed_len | 882 | EC_GROUP_get_seed_len |
885 | EC_GROUP_have_precompute_mult | 883 | EC_GROUP_have_precompute_mult |
886 | EC_GROUP_method_of | ||
887 | EC_GROUP_new | ||
888 | EC_GROUP_new_by_curve_name | 884 | EC_GROUP_new_by_curve_name |
889 | EC_GROUP_new_curve_GFp | 885 | EC_GROUP_new_curve_GFp |
890 | EC_GROUP_order_bits | 886 | EC_GROUP_order_bits |
@@ -942,7 +938,6 @@ EC_KEY_set_private_key | |||
942 | EC_KEY_set_public_key | 938 | EC_KEY_set_public_key |
943 | EC_KEY_set_public_key_affine_coordinates | 939 | EC_KEY_set_public_key_affine_coordinates |
944 | EC_KEY_up_ref | 940 | EC_KEY_up_ref |
945 | EC_METHOD_get_field_type | ||
946 | EC_POINT_add | 941 | EC_POINT_add |
947 | EC_POINT_bn2point | 942 | EC_POINT_bn2point |
948 | EC_POINT_clear_free | 943 | EC_POINT_clear_free |
@@ -959,7 +954,6 @@ EC_POINT_invert | |||
959 | EC_POINT_is_at_infinity | 954 | EC_POINT_is_at_infinity |
960 | EC_POINT_is_on_curve | 955 | EC_POINT_is_on_curve |
961 | EC_POINT_make_affine | 956 | EC_POINT_make_affine |
962 | EC_POINT_method_of | ||
963 | EC_POINT_mul | 957 | EC_POINT_mul |
964 | EC_POINT_new | 958 | EC_POINT_new |
965 | EC_POINT_oct2point | 959 | EC_POINT_oct2point |
diff --git a/src/lib/libcrypto/ec/ec.h b/src/lib/libcrypto/ec/ec.h index dd06dcb8b4..0229a4bf41 100644 --- a/src/lib/libcrypto/ec/ec.h +++ b/src/lib/libcrypto/ec/ec.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec.h,v 1.49 2025/01/25 17:59:44 tb Exp $ */ | 1 | /* $OpenBSD: ec.h,v 1.50 2025/03/09 15:33:35 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,23 +95,15 @@ typedef enum { | |||
95 | POINT_CONVERSION_HYBRID = 6 | 95 | POINT_CONVERSION_HYBRID = 6 |
96 | } point_conversion_form_t; | 96 | } point_conversion_form_t; |
97 | 97 | ||
98 | typedef struct ec_method_st EC_METHOD; | ||
99 | typedef struct ec_group_st EC_GROUP; | 98 | typedef struct ec_group_st EC_GROUP; |
100 | typedef struct ec_point_st EC_POINT; | 99 | typedef struct ec_point_st EC_POINT; |
101 | 100 | ||
102 | const EC_METHOD *EC_GFp_simple_method(void); | ||
103 | const EC_METHOD *EC_GFp_mont_method(void); | ||
104 | |||
105 | EC_GROUP *EC_GROUP_new(const EC_METHOD *meth); | ||
106 | void EC_GROUP_free(EC_GROUP *group); | 101 | void EC_GROUP_free(EC_GROUP *group); |
107 | void EC_GROUP_clear_free(EC_GROUP *group); | 102 | void EC_GROUP_clear_free(EC_GROUP *group); |
108 | 103 | ||
109 | int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); | 104 | int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); |
110 | EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); | 105 | EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); |
111 | 106 | ||
112 | const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); | ||
113 | int EC_METHOD_get_field_type(const EC_METHOD *meth); | ||
114 | |||
115 | int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, | 107 | int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, |
116 | const BIGNUM *order, const BIGNUM *cofactor); | 108 | const BIGNUM *order, const BIGNUM *cofactor); |
117 | const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); | 109 | const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); |
@@ -172,8 +164,6 @@ void EC_POINT_clear_free(EC_POINT *point); | |||
172 | int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); | 164 | int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); |
173 | EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); | 165 | EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); |
174 | 166 | ||
175 | const EC_METHOD *EC_POINT_method_of(const EC_POINT *point); | ||
176 | |||
177 | int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); | 167 | int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); |
178 | 168 | ||
179 | int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p, | 169 | int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p, |
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index a6259ed581..874c3f1d45 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.116 2025/01/25 13:13:57 tb Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.117 2025/03/09 15:33:35 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 | */ |
@@ -117,7 +117,6 @@ EC_GROUP_new(const EC_METHOD *meth) | |||
117 | 117 | ||
118 | return NULL; | 118 | return NULL; |
119 | } | 119 | } |
120 | LCRYPTO_ALIAS(EC_GROUP_new); | ||
121 | 120 | ||
122 | void | 121 | void |
123 | EC_GROUP_free(EC_GROUP *group) | 122 | EC_GROUP_free(EC_GROUP *group) |
@@ -1406,30 +1405,6 @@ EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
1406 | } | 1405 | } |
1407 | LCRYPTO_ALIAS(EC_POINTs_mul); | 1406 | LCRYPTO_ALIAS(EC_POINTs_mul); |
1408 | 1407 | ||
1409 | const EC_METHOD * | ||
1410 | EC_GROUP_method_of(const EC_GROUP *group) | ||
1411 | { | ||
1412 | ECerror(ERR_R_DISABLED); | ||
1413 | return NULL; | ||
1414 | } | ||
1415 | LCRYPTO_ALIAS(EC_GROUP_method_of); | ||
1416 | |||
1417 | int | ||
1418 | EC_METHOD_get_field_type(const EC_METHOD *meth) | ||
1419 | { | ||
1420 | ECerror(ERR_R_DISABLED); | ||
1421 | return NID_undef; | ||
1422 | } | ||
1423 | LCRYPTO_ALIAS(EC_METHOD_get_field_type); | ||
1424 | |||
1425 | const EC_METHOD * | ||
1426 | EC_POINT_method_of(const EC_POINT *point) | ||
1427 | { | ||
1428 | ECerror(ERR_R_DISABLED); | ||
1429 | return NULL; | ||
1430 | } | ||
1431 | LCRYPTO_ALIAS(EC_POINT_method_of); | ||
1432 | |||
1433 | int | 1408 | int |
1434 | EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx_in) | 1409 | EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx_in) |
1435 | { | 1410 | { |
diff --git a/src/lib/libcrypto/ec/ec_local.h b/src/lib/libcrypto/ec/ec_local.h index d1e3c1fa4a..9c188c0197 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.65 2025/01/25 13:15:21 tb Exp $ */ | 1 | /* $OpenBSD: ec_local.h,v 1.66 2025/03/09 15:33:35 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 | */ |
@@ -79,7 +79,7 @@ | |||
79 | 79 | ||
80 | __BEGIN_HIDDEN_DECLS | 80 | __BEGIN_HIDDEN_DECLS |
81 | 81 | ||
82 | struct ec_method_st { | 82 | typedef struct ec_method_st { |
83 | int (*group_set_curve)(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, | 83 | int (*group_set_curve)(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, |
84 | const BIGNUM *b, BN_CTX *); | 84 | const BIGNUM *b, BN_CTX *); |
85 | int (*group_get_curve)(const EC_GROUP *, BIGNUM *p, BIGNUM *a, | 85 | int (*group_get_curve)(const EC_GROUP *, BIGNUM *p, BIGNUM *a, |
@@ -124,7 +124,7 @@ struct ec_method_st { | |||
124 | BN_CTX *); | 124 | BN_CTX *); |
125 | int (*field_decode)(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, | 125 | int (*field_decode)(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, |
126 | BN_CTX *); | 126 | BN_CTX *); |
127 | } /* EC_METHOD */; | 127 | } EC_METHOD; |
128 | 128 | ||
129 | struct ec_group_st { | 129 | struct ec_group_st { |
130 | const EC_METHOD *meth; | 130 | const EC_METHOD *meth; |
@@ -170,6 +170,9 @@ struct ec_point_st { | |||
170 | int Z_is_one; /* enable optimized point arithmetics for special case */ | 170 | int Z_is_one; /* enable optimized point arithmetics for special case */ |
171 | } /* EC_POINT */; | 171 | } /* EC_POINT */; |
172 | 172 | ||
173 | const EC_METHOD *EC_GFp_simple_method(void); | ||
174 | const EC_METHOD *EC_GFp_mont_method(void); | ||
175 | |||
173 | /* Compute r = generator * m + point * n in non-constant time. */ | 176 | /* Compute r = generator * m + point * n in non-constant time. */ |
174 | int ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *m, | 177 | int ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *m, |
175 | const EC_POINT *point, const BIGNUM *n, BN_CTX *ctx); | 178 | const EC_POINT *point, const BIGNUM *n, BN_CTX *ctx); |
diff --git a/src/lib/libcrypto/ec/ecp_methods.c b/src/lib/libcrypto/ec/ecp_methods.c index d1d0add538..544c2be4d4 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.43 2025/02/13 11:19:49 tb Exp $ */ | 1 | /* $OpenBSD: ecp_methods.c,v 1.44 2025/03/09 15:33:35 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. |
@@ -1299,7 +1299,6 @@ EC_GFp_simple_method(void) | |||
1299 | { | 1299 | { |
1300 | return &ec_GFp_simple_method; | 1300 | return &ec_GFp_simple_method; |
1301 | } | 1301 | } |
1302 | LCRYPTO_ALIAS(EC_GFp_simple_method); | ||
1303 | 1302 | ||
1304 | static const EC_METHOD ec_GFp_mont_method = { | 1303 | static const EC_METHOD ec_GFp_mont_method = { |
1305 | .group_set_curve = ec_mont_group_set_curve, | 1304 | .group_set_curve = ec_mont_group_set_curve, |
@@ -1325,4 +1324,3 @@ EC_GFp_mont_method(void) | |||
1325 | { | 1324 | { |
1326 | return &ec_GFp_mont_method; | 1325 | return &ec_GFp_mont_method; |
1327 | } | 1326 | } |
1328 | LCRYPTO_ALIAS(EC_GFp_mont_method); | ||
diff --git a/src/lib/libcrypto/hidden/openssl/ec.h b/src/lib/libcrypto/hidden/openssl/ec.h index 0b64474c4b..8ffa017d2d 100644 --- a/src/lib/libcrypto/hidden/openssl/ec.h +++ b/src/lib/libcrypto/hidden/openssl/ec.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec.h,v 1.7 2024/10/22 15:54:33 tb Exp $ */ | 1 | /* $OpenBSD: ec.h,v 1.8 2025/03/09 15:33:35 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2023 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2023 Bob Beck <beck@openbsd.org> |
4 | * | 4 | * |
@@ -25,14 +25,9 @@ | |||
25 | #endif | 25 | #endif |
26 | #include "crypto_namespace.h" | 26 | #include "crypto_namespace.h" |
27 | 27 | ||
28 | LCRYPTO_USED(EC_GFp_simple_method); | ||
29 | LCRYPTO_USED(EC_GFp_mont_method); | ||
30 | LCRYPTO_USED(EC_GROUP_new); | ||
31 | LCRYPTO_USED(EC_GROUP_free); | 28 | LCRYPTO_USED(EC_GROUP_free); |
32 | LCRYPTO_USED(EC_GROUP_copy); | 29 | LCRYPTO_USED(EC_GROUP_copy); |
33 | LCRYPTO_USED(EC_GROUP_dup); | 30 | LCRYPTO_USED(EC_GROUP_dup); |
34 | LCRYPTO_USED(EC_GROUP_method_of); | ||
35 | LCRYPTO_USED(EC_METHOD_get_field_type); | ||
36 | LCRYPTO_USED(EC_GROUP_set_generator); | 31 | LCRYPTO_USED(EC_GROUP_set_generator); |
37 | LCRYPTO_USED(EC_GROUP_get0_generator); | 32 | LCRYPTO_USED(EC_GROUP_get0_generator); |
38 | LCRYPTO_USED(EC_GROUP_get_order); | 33 | LCRYPTO_USED(EC_GROUP_get_order); |
@@ -62,7 +57,6 @@ LCRYPTO_USED(EC_POINT_new); | |||
62 | LCRYPTO_USED(EC_POINT_free); | 57 | LCRYPTO_USED(EC_POINT_free); |
63 | LCRYPTO_USED(EC_POINT_copy); | 58 | LCRYPTO_USED(EC_POINT_copy); |
64 | LCRYPTO_USED(EC_POINT_dup); | 59 | LCRYPTO_USED(EC_POINT_dup); |
65 | LCRYPTO_USED(EC_POINT_method_of); | ||
66 | LCRYPTO_USED(EC_POINT_set_to_infinity); | 60 | LCRYPTO_USED(EC_POINT_set_to_infinity); |
67 | LCRYPTO_USED(EC_POINT_set_affine_coordinates); | 61 | LCRYPTO_USED(EC_POINT_set_affine_coordinates); |
68 | LCRYPTO_USED(EC_POINT_get_affine_coordinates); | 62 | LCRYPTO_USED(EC_POINT_get_affine_coordinates); |