summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2025-01-06 14:10:32 +0000
committertb <>2025-01-06 14:10:32 +0000
commit31e21337bdcd445b6ecbcb0fa4e05e90bbc45f3e (patch)
tree50f1e670da065b506a4ec987a0eb85de475db533
parent050d7b63aec03af589ab579b9e557e982b8fd285 (diff)
downloadopenbsd-31e21337bdcd445b6ecbcb0fa4e05e90bbc45f3e.tar.gz
openbsd-31e21337bdcd445b6ecbcb0fa4e05e90bbc45f3e.tar.bz2
openbsd-31e21337bdcd445b6ecbcb0fa4e05e90bbc45f3e.zip
Use a slightly more sensible order in ec_local.h
-rw-r--r--src/lib/libcrypto/ec/ec_local.h69
1 files changed, 33 insertions, 36 deletions
diff --git a/src/lib/libcrypto/ec/ec_local.h b/src/lib/libcrypto/ec/ec_local.h
index c74bb05d9a..fad66eb4ec 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.49 2025/01/06 12:35:14 jsing Exp $ */ 1/* $OpenBSD: ec_local.h,v 1.50 2025/01/06 14:10:32 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 */
@@ -184,25 +184,6 @@ struct ec_group_st {
184 BN_MONT_CTX *mont_ctx; 184 BN_MONT_CTX *mont_ctx;
185} /* EC_GROUP */; 185} /* EC_GROUP */;
186 186
187struct ec_key_st {
188 const EC_KEY_METHOD *meth;
189
190 int version;
191
192 EC_GROUP *group;
193
194 EC_POINT *pub_key;
195 BIGNUM *priv_key;
196
197 unsigned int enc_flag;
198 point_conversion_form_t conv_form;
199
200 int references;
201 int flags;
202
203 CRYPTO_EX_DATA ex_data;
204} /* EC_KEY */;
205
206struct ec_point_st { 187struct ec_point_st {
207 const EC_METHOD *meth; 188 const EC_METHOD *meth;
208 189
@@ -221,8 +202,20 @@ int ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *m,
221 const EC_POINT *point, const BIGNUM *n, BN_CTX *ctx); 202 const EC_POINT *point, const BIGNUM *n, BN_CTX *ctx);
222 203
223int ec_group_simple_order_bits(const EC_GROUP *group); 204int ec_group_simple_order_bits(const EC_GROUP *group);
205int ec_group_is_builtin_curve(const EC_GROUP *group, int *out_nid);
206int ec_group_get_field_type(const EC_GROUP *group);
207
208/*
209 * Wrappers around the unergonomic EC_POINT_{oct2point,point2oct}().
210 */
211int ec_point_from_octets(const EC_GROUP *group, const unsigned char *buf,
212 size_t buf_len, EC_POINT **out_point, uint8_t *out_form, BN_CTX *ctx_in);
213int ec_point_to_octets(const EC_GROUP *group, const EC_POINT *point, int form,
214 unsigned char **out_buf, size_t *len, BN_CTX *ctx_in);
224 215
225/* EC_METHOD definitions */ 216/* Public API in OpenSSL */
217const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group);
218const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group);
226 219
227struct ec_key_method_st { 220struct ec_key_method_st {
228 const char *name; 221 const char *name;
@@ -252,6 +245,25 @@ struct ec_key_method_st {
252 245
253#define EC_KEY_METHOD_DYNAMIC 1 246#define EC_KEY_METHOD_DYNAMIC 1
254 247
248struct ec_key_st {
249 const EC_KEY_METHOD *meth;
250
251 int version;
252
253 EC_GROUP *group;
254
255 EC_POINT *pub_key;
256 BIGNUM *priv_key;
257
258 unsigned int enc_flag;
259 point_conversion_form_t conv_form;
260
261 int references;
262 int flags;
263
264 CRYPTO_EX_DATA ex_data;
265} /* EC_KEY */;
266
255int eckey_compute_pubkey(EC_KEY *eckey); 267int eckey_compute_pubkey(EC_KEY *eckey);
256int ec_key_gen(EC_KEY *eckey); 268int ec_key_gen(EC_KEY *eckey);
257int ecdh_compute_key(unsigned char **out, size_t *out_len, 269int ecdh_compute_key(unsigned char **out, size_t *out_len,
@@ -267,19 +279,4 @@ int ecdsa_verify_sig(const unsigned char *dgst, int dgst_len,
267int ecdh_KDF_X9_63(unsigned char *out, size_t outlen, const unsigned char *Z, 279int ecdh_KDF_X9_63(unsigned char *out, size_t outlen, const unsigned char *Z,
268 size_t Zlen, const unsigned char *sinfo, size_t sinfolen, const EVP_MD *md); 280 size_t Zlen, const unsigned char *sinfo, size_t sinfolen, const EVP_MD *md);
269 281
270int ec_group_is_builtin_curve(const EC_GROUP *group, int *out_nid);
271int ec_group_get_field_type(const EC_GROUP *group);
272
273/*
274 * Wrappers around the unergonomic EC_POINT_{oct2point,point2oct}().
275 */
276int ec_point_from_octets(const EC_GROUP *group, const unsigned char *buf,
277 size_t buf_len, EC_POINT **out_point, uint8_t *out_form, BN_CTX *ctx_in);
278int ec_point_to_octets(const EC_GROUP *group, const EC_POINT *point, int form,
279 unsigned char **out_buf, size_t *len, BN_CTX *ctx_in);
280
281/* Public API in OpenSSL */
282const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group);
283const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group);
284
285__END_HIDDEN_DECLS 282__END_HIDDEN_DECLS