1 | /*
|
---|
2 | * Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.
|
---|
3 | * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
---|
4 | *
|
---|
5 | * Licensed under the Apache License 2.0 (the "License"). You may not use
|
---|
6 | * this file except in compliance with the License. You can obtain a copy
|
---|
7 | * in the file LICENSE in the source distribution or at
|
---|
8 | * https://www.openssl.org/source/license.html
|
---|
9 | */
|
---|
10 |
|
---|
11 | #ifndef OPENSSL_EC_H
|
---|
12 | # define OPENSSL_EC_H
|
---|
13 | # pragma once
|
---|
14 |
|
---|
15 | # include <openssl/macros.h>
|
---|
16 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
17 | # define HEADER_EC_H
|
---|
18 | # endif
|
---|
19 |
|
---|
20 | # include <openssl/opensslconf.h>
|
---|
21 | # include <openssl/types.h>
|
---|
22 |
|
---|
23 | # ifdef __cplusplus
|
---|
24 | extern "C" {
|
---|
25 | # endif
|
---|
26 |
|
---|
27 | /* Values for EVP_PKEY_CTX_set_ec_param_enc() */
|
---|
28 | # define OPENSSL_EC_EXPLICIT_CURVE 0x000
|
---|
29 | # define OPENSSL_EC_NAMED_CURVE 0x001
|
---|
30 |
|
---|
31 | int EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid);
|
---|
32 | int EVP_PKEY_CTX_set_ec_param_enc(EVP_PKEY_CTX *ctx, int param_enc);
|
---|
33 | int EVP_PKEY_CTX_set_ecdh_cofactor_mode(EVP_PKEY_CTX *ctx, int cofactor_mode);
|
---|
34 | int EVP_PKEY_CTX_get_ecdh_cofactor_mode(EVP_PKEY_CTX *ctx);
|
---|
35 |
|
---|
36 | int EVP_PKEY_CTX_set_ecdh_kdf_type(EVP_PKEY_CTX *ctx, int kdf);
|
---|
37 | int EVP_PKEY_CTX_get_ecdh_kdf_type(EVP_PKEY_CTX *ctx);
|
---|
38 |
|
---|
39 | int EVP_PKEY_CTX_set_ecdh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
|
---|
40 | int EVP_PKEY_CTX_get_ecdh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);
|
---|
41 |
|
---|
42 | int EVP_PKEY_CTX_set_ecdh_kdf_outlen(EVP_PKEY_CTX *ctx, int len);
|
---|
43 | int EVP_PKEY_CTX_get_ecdh_kdf_outlen(EVP_PKEY_CTX *ctx, int *len);
|
---|
44 |
|
---|
45 | int EVP_PKEY_CTX_set0_ecdh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char *ukm,
|
---|
46 | int len);
|
---|
47 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
48 | OSSL_DEPRECATEDIN_3_0
|
---|
49 | int EVP_PKEY_CTX_get0_ecdh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char **ukm);
|
---|
50 | # endif
|
---|
51 |
|
---|
52 | # define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1)
|
---|
53 | # define EVP_PKEY_CTRL_EC_PARAM_ENC (EVP_PKEY_ALG_CTRL + 2)
|
---|
54 | # define EVP_PKEY_CTRL_EC_ECDH_COFACTOR (EVP_PKEY_ALG_CTRL + 3)
|
---|
55 | # define EVP_PKEY_CTRL_EC_KDF_TYPE (EVP_PKEY_ALG_CTRL + 4)
|
---|
56 | # define EVP_PKEY_CTRL_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 5)
|
---|
57 | # define EVP_PKEY_CTRL_GET_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 6)
|
---|
58 | # define EVP_PKEY_CTRL_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 7)
|
---|
59 | # define EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 8)
|
---|
60 | # define EVP_PKEY_CTRL_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 9)
|
---|
61 | # define EVP_PKEY_CTRL_GET_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 10)
|
---|
62 |
|
---|
63 | /* KDF types */
|
---|
64 | # define EVP_PKEY_ECDH_KDF_NONE 1
|
---|
65 | # define EVP_PKEY_ECDH_KDF_X9_63 2
|
---|
66 | /*
|
---|
67 | * The old name for EVP_PKEY_ECDH_KDF_X9_63
|
---|
68 | * The ECDH KDF specification has been mistakenly attributed to ANSI X9.62,
|
---|
69 | * it is actually specified in ANSI X9.63.
|
---|
70 | * This identifier is retained for backwards compatibility
|
---|
71 | */
|
---|
72 | # define EVP_PKEY_ECDH_KDF_X9_62 EVP_PKEY_ECDH_KDF_X9_63
|
---|
73 |
|
---|
74 | /** Enum for the point conversion form as defined in X9.62 (ECDSA)
|
---|
75 | * for the encoding of a elliptic curve point (x,y) */
|
---|
76 | typedef enum {
|
---|
77 | /** the point is encoded as z||x, where the octet z specifies
|
---|
78 | * which solution of the quadratic equation y is */
|
---|
79 | POINT_CONVERSION_COMPRESSED = 2,
|
---|
80 | /** the point is encoded as z||x||y, where z is the octet 0x04 */
|
---|
81 | POINT_CONVERSION_UNCOMPRESSED = 4,
|
---|
82 | /** the point is encoded as z||x||y, where the octet z specifies
|
---|
83 | * which solution of the quadratic equation y is */
|
---|
84 | POINT_CONVERSION_HYBRID = 6
|
---|
85 | } point_conversion_form_t;
|
---|
86 |
|
---|
87 | const char *OSSL_EC_curve_nid2name(int nid);
|
---|
88 |
|
---|
89 | # ifndef OPENSSL_NO_EC
|
---|
90 | # include <openssl/asn1.h>
|
---|
91 | # include <openssl/symhacks.h>
|
---|
92 | # ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
---|
93 | # include <openssl/bn.h>
|
---|
94 | # endif
|
---|
95 | # include <openssl/ecerr.h>
|
---|
96 |
|
---|
97 | # ifndef OPENSSL_ECC_MAX_FIELD_BITS
|
---|
98 | # define OPENSSL_ECC_MAX_FIELD_BITS 661
|
---|
99 | # endif
|
---|
100 |
|
---|
101 | # include <openssl/params.h>
|
---|
102 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
103 | typedef struct ec_method_st EC_METHOD;
|
---|
104 | # endif
|
---|
105 | typedef struct ec_group_st EC_GROUP;
|
---|
106 | typedef struct ec_point_st EC_POINT;
|
---|
107 | typedef struct ecpk_parameters_st ECPKPARAMETERS;
|
---|
108 | typedef struct ec_parameters_st ECPARAMETERS;
|
---|
109 |
|
---|
110 | /********************************************************************/
|
---|
111 | /* EC_METHODs for curves over GF(p) */
|
---|
112 | /********************************************************************/
|
---|
113 |
|
---|
114 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
115 | /** Returns the basic GFp ec methods which provides the basis for the
|
---|
116 | * optimized methods.
|
---|
117 | * \return EC_METHOD object
|
---|
118 | */
|
---|
119 | OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GFp_simple_method(void);
|
---|
120 |
|
---|
121 | /** Returns GFp methods using montgomery multiplication.
|
---|
122 | * \return EC_METHOD object
|
---|
123 | */
|
---|
124 | OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GFp_mont_method(void);
|
---|
125 |
|
---|
126 | /** Returns GFp methods using optimized methods for NIST recommended curves
|
---|
127 | * \return EC_METHOD object
|
---|
128 | */
|
---|
129 | OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GFp_nist_method(void);
|
---|
130 |
|
---|
131 | # ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
|
---|
132 | /** Returns 64-bit optimized methods for nistp224
|
---|
133 | * \return EC_METHOD object
|
---|
134 | */
|
---|
135 | OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GFp_nistp224_method(void);
|
---|
136 |
|
---|
137 | /** Returns 64-bit optimized methods for nistp256
|
---|
138 | * \return EC_METHOD object
|
---|
139 | */
|
---|
140 | OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GFp_nistp256_method(void);
|
---|
141 |
|
---|
142 | /** Returns 64-bit optimized methods for nistp521
|
---|
143 | * \return EC_METHOD object
|
---|
144 | */
|
---|
145 | OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GFp_nistp521_method(void);
|
---|
146 | # endif /* OPENSSL_NO_EC_NISTP_64_GCC_128 */
|
---|
147 |
|
---|
148 | # ifndef OPENSSL_NO_EC2M
|
---|
149 | /********************************************************************/
|
---|
150 | /* EC_METHOD for curves over GF(2^m) */
|
---|
151 | /********************************************************************/
|
---|
152 |
|
---|
153 | /** Returns the basic GF2m ec method
|
---|
154 | * \return EC_METHOD object
|
---|
155 | */
|
---|
156 | OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GF2m_simple_method(void);
|
---|
157 |
|
---|
158 | # endif
|
---|
159 |
|
---|
160 | /********************************************************************/
|
---|
161 | /* EC_GROUP functions */
|
---|
162 | /********************************************************************/
|
---|
163 |
|
---|
164 | /**
|
---|
165 | * Creates a new EC_GROUP object
|
---|
166 | * \param meth EC_METHOD to use
|
---|
167 | * \return newly created EC_GROUP object or NULL in case of an error.
|
---|
168 | */
|
---|
169 | OSSL_DEPRECATEDIN_3_0 EC_GROUP *EC_GROUP_new(const EC_METHOD *meth);
|
---|
170 |
|
---|
171 | /** Clears and frees a EC_GROUP object
|
---|
172 | * \param group EC_GROUP object to be cleared and freed.
|
---|
173 | */
|
---|
174 | OSSL_DEPRECATEDIN_3_0 void EC_GROUP_clear_free(EC_GROUP *group);
|
---|
175 |
|
---|
176 | /** Returns the EC_METHOD of the EC_GROUP object.
|
---|
177 | * \param group EC_GROUP object
|
---|
178 | * \return EC_METHOD used in this EC_GROUP object.
|
---|
179 | */
|
---|
180 | OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group);
|
---|
181 |
|
---|
182 | /** Returns the field type of the EC_METHOD.
|
---|
183 | * \param meth EC_METHOD object
|
---|
184 | * \return NID of the underlying field type OID.
|
---|
185 | */
|
---|
186 | OSSL_DEPRECATEDIN_3_0 int EC_METHOD_get_field_type(const EC_METHOD *meth);
|
---|
187 | # endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
---|
188 |
|
---|
189 | /** Frees a EC_GROUP object
|
---|
190 | * \param group EC_GROUP object to be freed.
|
---|
191 | */
|
---|
192 | void EC_GROUP_free(EC_GROUP *group);
|
---|
193 |
|
---|
194 | /** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD.
|
---|
195 | * \param dst destination EC_GROUP object
|
---|
196 | * \param src source EC_GROUP object
|
---|
197 | * \return 1 on success and 0 if an error occurred.
|
---|
198 | */
|
---|
199 | int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src);
|
---|
200 |
|
---|
201 | /** Creates a new EC_GROUP object and copies the content
|
---|
202 | * form src to the newly created EC_KEY object
|
---|
203 | * \param src source EC_GROUP object
|
---|
204 | * \return newly created EC_GROUP object or NULL in case of an error.
|
---|
205 | */
|
---|
206 | EC_GROUP *EC_GROUP_dup(const EC_GROUP *src);
|
---|
207 |
|
---|
208 | /** Sets the generator and its order/cofactor of a EC_GROUP object.
|
---|
209 | * \param group EC_GROUP object
|
---|
210 | * \param generator EC_POINT object with the generator.
|
---|
211 | * \param order the order of the group generated by the generator.
|
---|
212 | * \param cofactor the index of the sub-group generated by the generator
|
---|
213 | * in the group of all points on the elliptic curve.
|
---|
214 | * \return 1 on success and 0 if an error occurred
|
---|
215 | */
|
---|
216 | int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,
|
---|
217 | const BIGNUM *order, const BIGNUM *cofactor);
|
---|
218 |
|
---|
219 | /** Returns the generator of a EC_GROUP object.
|
---|
220 | * \param group EC_GROUP object
|
---|
221 | * \return the currently used generator (possibly NULL).
|
---|
222 | */
|
---|
223 | const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group);
|
---|
224 |
|
---|
225 | /** Returns the montgomery data for order(Generator)
|
---|
226 | * \param group EC_GROUP object
|
---|
227 | * \return the currently used montgomery data (possibly NULL).
|
---|
228 | */
|
---|
229 | BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group);
|
---|
230 |
|
---|
231 | /** Gets the order of a EC_GROUP
|
---|
232 | * \param group EC_GROUP object
|
---|
233 | * \param order BIGNUM to which the order is copied
|
---|
234 | * \param ctx unused
|
---|
235 | * \return 1 on success and 0 if an error occurred
|
---|
236 | */
|
---|
237 | int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx);
|
---|
238 |
|
---|
239 | /** Gets the order of an EC_GROUP
|
---|
240 | * \param group EC_GROUP object
|
---|
241 | * \return the group order
|
---|
242 | */
|
---|
243 | const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group);
|
---|
244 |
|
---|
245 | /** Gets the number of bits of the order of an EC_GROUP
|
---|
246 | * \param group EC_GROUP object
|
---|
247 | * \return number of bits of group order.
|
---|
248 | */
|
---|
249 | int EC_GROUP_order_bits(const EC_GROUP *group);
|
---|
250 |
|
---|
251 | /** Gets the cofactor of a EC_GROUP
|
---|
252 | * \param group EC_GROUP object
|
---|
253 | * \param cofactor BIGNUM to which the cofactor is copied
|
---|
254 | * \param ctx unused
|
---|
255 | * \return 1 on success and 0 if an error occurred
|
---|
256 | */
|
---|
257 | int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor,
|
---|
258 | BN_CTX *ctx);
|
---|
259 |
|
---|
260 | /** Gets the cofactor of an EC_GROUP
|
---|
261 | * \param group EC_GROUP object
|
---|
262 | * \return the group cofactor
|
---|
263 | */
|
---|
264 | const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group);
|
---|
265 |
|
---|
266 | /** Sets the name of a EC_GROUP object
|
---|
267 | * \param group EC_GROUP object
|
---|
268 | * \param nid NID of the curve name OID
|
---|
269 | */
|
---|
270 | void EC_GROUP_set_curve_name(EC_GROUP *group, int nid);
|
---|
271 |
|
---|
272 | /** Returns the curve name of a EC_GROUP object
|
---|
273 | * \param group EC_GROUP object
|
---|
274 | * \return NID of the curve name OID or 0 if not set.
|
---|
275 | */
|
---|
276 | int EC_GROUP_get_curve_name(const EC_GROUP *group);
|
---|
277 |
|
---|
278 | /** Gets the field of an EC_GROUP
|
---|
279 | * \param group EC_GROUP object
|
---|
280 | * \return the group field
|
---|
281 | */
|
---|
282 | const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group);
|
---|
283 |
|
---|
284 | /** Returns the field type of the EC_GROUP.
|
---|
285 | * \param group EC_GROUP object
|
---|
286 | * \return NID of the underlying field type OID.
|
---|
287 | */
|
---|
288 | int EC_GROUP_get_field_type(const EC_GROUP *group);
|
---|
289 |
|
---|
290 | void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);
|
---|
291 | int EC_GROUP_get_asn1_flag(const EC_GROUP *group);
|
---|
292 |
|
---|
293 | void EC_GROUP_set_point_conversion_form(EC_GROUP *group,
|
---|
294 | point_conversion_form_t form);
|
---|
295 | point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *);
|
---|
296 |
|
---|
297 | unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x);
|
---|
298 | size_t EC_GROUP_get_seed_len(const EC_GROUP *);
|
---|
299 | size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len);
|
---|
300 |
|
---|
301 | /** Sets the parameters of an ec curve defined by y^2 = x^3 + a*x + b (for GFp)
|
---|
302 | * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m)
|
---|
303 | * \param group EC_GROUP object
|
---|
304 | * \param p BIGNUM with the prime number (GFp) or the polynomial
|
---|
305 | * defining the underlying field (GF2m)
|
---|
306 | * \param a BIGNUM with parameter a of the equation
|
---|
307 | * \param b BIGNUM with parameter b of the equation
|
---|
308 | * \param ctx BN_CTX object (optional)
|
---|
309 | * \return 1 on success and 0 if an error occurred
|
---|
310 | */
|
---|
311 | int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
|
---|
312 | const BIGNUM *b, BN_CTX *ctx);
|
---|
313 |
|
---|
314 | /** Gets the parameters of the ec curve defined by y^2 = x^3 + a*x + b (for GFp)
|
---|
315 | * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m)
|
---|
316 | * \param group EC_GROUP object
|
---|
317 | * \param p BIGNUM with the prime number (GFp) or the polynomial
|
---|
318 | * defining the underlying field (GF2m)
|
---|
319 | * \param a BIGNUM for parameter a of the equation
|
---|
320 | * \param b BIGNUM for parameter b of the equation
|
---|
321 | * \param ctx BN_CTX object (optional)
|
---|
322 | * \return 1 on success and 0 if an error occurred
|
---|
323 | */
|
---|
324 | int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b,
|
---|
325 | BN_CTX *ctx);
|
---|
326 |
|
---|
327 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
328 | /** Sets the parameters of an ec curve. Synonym for EC_GROUP_set_curve
|
---|
329 | * \param group EC_GROUP object
|
---|
330 | * \param p BIGNUM with the prime number (GFp) or the polynomial
|
---|
331 | * defining the underlying field (GF2m)
|
---|
332 | * \param a BIGNUM with parameter a of the equation
|
---|
333 | * \param b BIGNUM with parameter b of the equation
|
---|
334 | * \param ctx BN_CTX object (optional)
|
---|
335 | * \return 1 on success and 0 if an error occurred
|
---|
336 | */
|
---|
337 | OSSL_DEPRECATEDIN_3_0 int EC_GROUP_set_curve_GFp(EC_GROUP *group,
|
---|
338 | const BIGNUM *p,
|
---|
339 | const BIGNUM *a,
|
---|
340 | const BIGNUM *b,
|
---|
341 | BN_CTX *ctx);
|
---|
342 |
|
---|
343 | /** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve
|
---|
344 | * \param group EC_GROUP object
|
---|
345 | * \param p BIGNUM with the prime number (GFp) or the polynomial
|
---|
346 | * defining the underlying field (GF2m)
|
---|
347 | * \param a BIGNUM for parameter a of the equation
|
---|
348 | * \param b BIGNUM for parameter b of the equation
|
---|
349 | * \param ctx BN_CTX object (optional)
|
---|
350 | * \return 1 on success and 0 if an error occurred
|
---|
351 | */
|
---|
352 | OSSL_DEPRECATEDIN_3_0 int EC_GROUP_get_curve_GFp(const EC_GROUP *group,
|
---|
353 | BIGNUM *p,
|
---|
354 | BIGNUM *a, BIGNUM *b,
|
---|
355 | BN_CTX *ctx);
|
---|
356 |
|
---|
357 | # ifndef OPENSSL_NO_EC2M
|
---|
358 | /** Sets the parameter of an ec curve. Synonym for EC_GROUP_set_curve
|
---|
359 | * \param group EC_GROUP object
|
---|
360 | * \param p BIGNUM with the prime number (GFp) or the polynomial
|
---|
361 | * defining the underlying field (GF2m)
|
---|
362 | * \param a BIGNUM with parameter a of the equation
|
---|
363 | * \param b BIGNUM with parameter b of the equation
|
---|
364 | * \param ctx BN_CTX object (optional)
|
---|
365 | * \return 1 on success and 0 if an error occurred
|
---|
366 | */
|
---|
367 | OSSL_DEPRECATEDIN_3_0 int EC_GROUP_set_curve_GF2m(EC_GROUP *group,
|
---|
368 | const BIGNUM *p,
|
---|
369 | const BIGNUM *a,
|
---|
370 | const BIGNUM *b,
|
---|
371 | BN_CTX *ctx);
|
---|
372 |
|
---|
373 | /** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve
|
---|
374 | * \param group EC_GROUP object
|
---|
375 | * \param p BIGNUM with the prime number (GFp) or the polynomial
|
---|
376 | * defining the underlying field (GF2m)
|
---|
377 | * \param a BIGNUM for parameter a of the equation
|
---|
378 | * \param b BIGNUM for parameter b of the equation
|
---|
379 | * \param ctx BN_CTX object (optional)
|
---|
380 | * \return 1 on success and 0 if an error occurred
|
---|
381 | */
|
---|
382 | OSSL_DEPRECATEDIN_3_0 int EC_GROUP_get_curve_GF2m(const EC_GROUP *group,
|
---|
383 | BIGNUM *p,
|
---|
384 | BIGNUM *a, BIGNUM *b,
|
---|
385 | BN_CTX *ctx);
|
---|
386 | # endif /* OPENSSL_NO_EC2M */
|
---|
387 | # endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
---|
388 |
|
---|
389 | /** Returns the number of bits needed to represent a field element
|
---|
390 | * \param group EC_GROUP object
|
---|
391 | * \return number of bits needed to represent a field element
|
---|
392 | */
|
---|
393 | int EC_GROUP_get_degree(const EC_GROUP *group);
|
---|
394 |
|
---|
395 | /** Checks whether the parameter in the EC_GROUP define a valid ec group
|
---|
396 | * \param group EC_GROUP object
|
---|
397 | * \param ctx BN_CTX object (optional)
|
---|
398 | * \return 1 if group is a valid ec group and 0 otherwise
|
---|
399 | */
|
---|
400 | int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx);
|
---|
401 |
|
---|
402 | /** Checks whether the discriminant of the elliptic curve is zero or not
|
---|
403 | * \param group EC_GROUP object
|
---|
404 | * \param ctx BN_CTX object (optional)
|
---|
405 | * \return 1 if the discriminant is not zero and 0 otherwise
|
---|
406 | */
|
---|
407 | int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx);
|
---|
408 |
|
---|
409 | /** Compares two EC_GROUP objects
|
---|
410 | * \param a first EC_GROUP object
|
---|
411 | * \param b second EC_GROUP object
|
---|
412 | * \param ctx BN_CTX object (optional)
|
---|
413 | * \return 0 if the groups are equal, 1 if not, or -1 on error
|
---|
414 | */
|
---|
415 | int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx);
|
---|
416 |
|
---|
417 | /*
|
---|
418 | * EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() after
|
---|
419 | * choosing an appropriate EC_METHOD
|
---|
420 | */
|
---|
421 |
|
---|
422 | /** Creates a new EC_GROUP object with the specified parameters defined
|
---|
423 | * over GFp (defined by the equation y^2 = x^3 + a*x + b)
|
---|
424 | * \param p BIGNUM with the prime number
|
---|
425 | * \param a BIGNUM with the parameter a of the equation
|
---|
426 | * \param b BIGNUM with the parameter b of the equation
|
---|
427 | * \param ctx BN_CTX object (optional)
|
---|
428 | * \return newly created EC_GROUP object with the specified parameters
|
---|
429 | */
|
---|
430 | EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a,
|
---|
431 | const BIGNUM *b, BN_CTX *ctx);
|
---|
432 | # ifndef OPENSSL_NO_EC2M
|
---|
433 | /** Creates a new EC_GROUP object with the specified parameters defined
|
---|
434 | * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b)
|
---|
435 | * \param p BIGNUM with the polynomial defining the underlying field
|
---|
436 | * \param a BIGNUM with the parameter a of the equation
|
---|
437 | * \param b BIGNUM with the parameter b of the equation
|
---|
438 | * \param ctx BN_CTX object (optional)
|
---|
439 | * \return newly created EC_GROUP object with the specified parameters
|
---|
440 | */
|
---|
441 | EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a,
|
---|
442 | const BIGNUM *b, BN_CTX *ctx);
|
---|
443 | # endif
|
---|
444 |
|
---|
445 | /**
|
---|
446 | * Creates a EC_GROUP object with a curve specified by parameters.
|
---|
447 | * The parameters may be explicit or a named curve,
|
---|
448 | * \param params A list of parameters describing the group.
|
---|
449 | * \param libctx The associated library context or NULL for the default
|
---|
450 | * context
|
---|
451 | * \param propq A property query string
|
---|
452 | * \return newly created EC_GROUP object with specified parameters or NULL
|
---|
453 | * if an error occurred
|
---|
454 | */
|
---|
455 | EC_GROUP *EC_GROUP_new_from_params(const OSSL_PARAM params[],
|
---|
456 | OSSL_LIB_CTX *libctx, const char *propq);
|
---|
457 |
|
---|
458 | /**
|
---|
459 | * Creates a EC_GROUP object with a curve specified by a NID
|
---|
460 | * \param libctx The associated library context or NULL for the default
|
---|
461 | * context
|
---|
462 | * \param propq A property query string
|
---|
463 | * \param nid NID of the OID of the curve name
|
---|
464 | * \return newly created EC_GROUP object with specified curve or NULL
|
---|
465 | * if an error occurred
|
---|
466 | */
|
---|
467 | EC_GROUP *EC_GROUP_new_by_curve_name_ex(OSSL_LIB_CTX *libctx, const char *propq,
|
---|
468 | int nid);
|
---|
469 |
|
---|
470 | /**
|
---|
471 | * Creates a EC_GROUP object with a curve specified by a NID. Same as
|
---|
472 | * EC_GROUP_new_by_curve_name_ex but the libctx and propq are always
|
---|
473 | * NULL.
|
---|
474 | * \param nid NID of the OID of the curve name
|
---|
475 | * \return newly created EC_GROUP object with specified curve or NULL
|
---|
476 | * if an error occurred
|
---|
477 | */
|
---|
478 | EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
|
---|
479 |
|
---|
480 | /** Creates a new EC_GROUP object from an ECPARAMETERS object
|
---|
481 | * \param params pointer to the ECPARAMETERS object
|
---|
482 | * \return newly created EC_GROUP object with specified curve or NULL
|
---|
483 | * if an error occurred
|
---|
484 | */
|
---|
485 | EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params);
|
---|
486 |
|
---|
487 | /** Creates an ECPARAMETERS object for the given EC_GROUP object.
|
---|
488 | * \param group pointer to the EC_GROUP object
|
---|
489 | * \param params pointer to an existing ECPARAMETERS object or NULL
|
---|
490 | * \return pointer to the new ECPARAMETERS object or NULL
|
---|
491 | * if an error occurred.
|
---|
492 | */
|
---|
493 | ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group,
|
---|
494 | ECPARAMETERS *params);
|
---|
495 |
|
---|
496 | /** Creates a new EC_GROUP object from an ECPKPARAMETERS object
|
---|
497 | * \param params pointer to an existing ECPKPARAMETERS object, or NULL
|
---|
498 | * \return newly created EC_GROUP object with specified curve, or NULL
|
---|
499 | * if an error occurred
|
---|
500 | */
|
---|
501 | EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params);
|
---|
502 |
|
---|
503 | /** Creates an ECPKPARAMETERS object for the given EC_GROUP object.
|
---|
504 | * \param group pointer to the EC_GROUP object
|
---|
505 | * \param params pointer to an existing ECPKPARAMETERS object or NULL
|
---|
506 | * \return pointer to the new ECPKPARAMETERS object or NULL
|
---|
507 | * if an error occurred.
|
---|
508 | */
|
---|
509 | ECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group,
|
---|
510 | ECPKPARAMETERS *params);
|
---|
511 |
|
---|
512 | /********************************************************************/
|
---|
513 | /* handling of internal curves */
|
---|
514 | /********************************************************************/
|
---|
515 |
|
---|
516 | typedef struct {
|
---|
517 | int nid;
|
---|
518 | const char *comment;
|
---|
519 | } EC_builtin_curve;
|
---|
520 |
|
---|
521 | /*
|
---|
522 | * EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number of all
|
---|
523 | * available curves or zero if a error occurred. In case r is not zero,
|
---|
524 | * nitems EC_builtin_curve structures are filled with the data of the first
|
---|
525 | * nitems internal groups
|
---|
526 | */
|
---|
527 | size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);
|
---|
528 |
|
---|
529 | const char *EC_curve_nid2nist(int nid);
|
---|
530 | int EC_curve_nist2nid(const char *name);
|
---|
531 | int EC_GROUP_check_named_curve(const EC_GROUP *group, int nist_only,
|
---|
532 | BN_CTX *ctx);
|
---|
533 |
|
---|
534 | /********************************************************************/
|
---|
535 | /* EC_POINT functions */
|
---|
536 | /********************************************************************/
|
---|
537 |
|
---|
538 | /** Creates a new EC_POINT object for the specified EC_GROUP
|
---|
539 | * \param group EC_GROUP the underlying EC_GROUP object
|
---|
540 | * \return newly created EC_POINT object or NULL if an error occurred
|
---|
541 | */
|
---|
542 | EC_POINT *EC_POINT_new(const EC_GROUP *group);
|
---|
543 |
|
---|
544 | /** Frees a EC_POINT object
|
---|
545 | * \param point EC_POINT object to be freed
|
---|
546 | */
|
---|
547 | void EC_POINT_free(EC_POINT *point);
|
---|
548 |
|
---|
549 | /** Clears and frees a EC_POINT object
|
---|
550 | * \param point EC_POINT object to be cleared and freed
|
---|
551 | */
|
---|
552 | void EC_POINT_clear_free(EC_POINT *point);
|
---|
553 |
|
---|
554 | /** Copies EC_POINT object
|
---|
555 | * \param dst destination EC_POINT object
|
---|
556 | * \param src source EC_POINT object
|
---|
557 | * \return 1 on success and 0 if an error occurred
|
---|
558 | */
|
---|
559 | int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src);
|
---|
560 |
|
---|
561 | /** Creates a new EC_POINT object and copies the content of the supplied
|
---|
562 | * EC_POINT
|
---|
563 | * \param src source EC_POINT object
|
---|
564 | * \param group underlying the EC_GROUP object
|
---|
565 | * \return newly created EC_POINT object or NULL if an error occurred
|
---|
566 | */
|
---|
567 | EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group);
|
---|
568 |
|
---|
569 | /** Sets a point to infinity (neutral element)
|
---|
570 | * \param group underlying EC_GROUP object
|
---|
571 | * \param point EC_POINT to set to infinity
|
---|
572 | * \return 1 on success and 0 if an error occurred
|
---|
573 | */
|
---|
574 | int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point);
|
---|
575 |
|
---|
576 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
577 | /** Returns the EC_METHOD used in EC_POINT object
|
---|
578 | * \param point EC_POINT object
|
---|
579 | * \return the EC_METHOD used
|
---|
580 | */
|
---|
581 | OSSL_DEPRECATEDIN_3_0 const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);
|
---|
582 |
|
---|
583 | /** Sets the jacobian projective coordinates of a EC_POINT over GFp
|
---|
584 | * \param group underlying EC_GROUP object
|
---|
585 | * \param p EC_POINT object
|
---|
586 | * \param x BIGNUM with the x-coordinate
|
---|
587 | * \param y BIGNUM with the y-coordinate
|
---|
588 | * \param z BIGNUM with the z-coordinate
|
---|
589 | * \param ctx BN_CTX object (optional)
|
---|
590 | * \return 1 on success and 0 if an error occurred
|
---|
591 | */
|
---|
592 | OSSL_DEPRECATEDIN_3_0 int EC_POINT_set_Jprojective_coordinates_GFp
|
---|
593 | (const EC_GROUP *group, EC_POINT *p,
|
---|
594 | const BIGNUM *x, const BIGNUM *y, const BIGNUM *z,
|
---|
595 | BN_CTX *ctx);
|
---|
596 |
|
---|
597 | /** Gets the jacobian projective coordinates of a EC_POINT over GFp
|
---|
598 | * \param group underlying EC_GROUP object
|
---|
599 | * \param p EC_POINT object
|
---|
600 | * \param x BIGNUM for the x-coordinate
|
---|
601 | * \param y BIGNUM for the y-coordinate
|
---|
602 | * \param z BIGNUM for the z-coordinate
|
---|
603 | * \param ctx BN_CTX object (optional)
|
---|
604 | * \return 1 on success and 0 if an error occurred
|
---|
605 | */
|
---|
606 | OSSL_DEPRECATEDIN_3_0 int EC_POINT_get_Jprojective_coordinates_GFp
|
---|
607 | (const EC_GROUP *group, const EC_POINT *p,
|
---|
608 | BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx);
|
---|
609 | # endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
---|
610 |
|
---|
611 | /** Sets the affine coordinates of an EC_POINT
|
---|
612 | * \param group underlying EC_GROUP object
|
---|
613 | * \param p EC_POINT object
|
---|
614 | * \param x BIGNUM with the x-coordinate
|
---|
615 | * \param y BIGNUM with the y-coordinate
|
---|
616 | * \param ctx BN_CTX object (optional)
|
---|
617 | * \return 1 on success and 0 if an error occurred
|
---|
618 | */
|
---|
619 | int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p,
|
---|
620 | const BIGNUM *x, const BIGNUM *y,
|
---|
621 | BN_CTX *ctx);
|
---|
622 |
|
---|
623 | /** Gets the affine coordinates of an EC_POINT.
|
---|
624 | * \param group underlying EC_GROUP object
|
---|
625 | * \param p EC_POINT object
|
---|
626 | * \param x BIGNUM for the x-coordinate
|
---|
627 | * \param y BIGNUM for the y-coordinate
|
---|
628 | * \param ctx BN_CTX object (optional)
|
---|
629 | * \return 1 on success and 0 if an error occurred
|
---|
630 | */
|
---|
631 | int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p,
|
---|
632 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
|
---|
633 |
|
---|
634 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
635 | /** Sets the affine coordinates of an EC_POINT. A synonym of
|
---|
636 | * EC_POINT_set_affine_coordinates
|
---|
637 | * \param group underlying EC_GROUP object
|
---|
638 | * \param p EC_POINT object
|
---|
639 | * \param x BIGNUM with the x-coordinate
|
---|
640 | * \param y BIGNUM with the y-coordinate
|
---|
641 | * \param ctx BN_CTX object (optional)
|
---|
642 | * \return 1 on success and 0 if an error occurred
|
---|
643 | */
|
---|
644 | OSSL_DEPRECATEDIN_3_0 int EC_POINT_set_affine_coordinates_GFp
|
---|
645 | (const EC_GROUP *group, EC_POINT *p,
|
---|
646 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);
|
---|
647 |
|
---|
648 | /** Gets the affine coordinates of an EC_POINT. A synonym of
|
---|
649 | * EC_POINT_get_affine_coordinates
|
---|
650 | * \param group underlying EC_GROUP object
|
---|
651 | * \param p EC_POINT object
|
---|
652 | * \param x BIGNUM for the x-coordinate
|
---|
653 | * \param y BIGNUM for the y-coordinate
|
---|
654 | * \param ctx BN_CTX object (optional)
|
---|
655 | * \return 1 on success and 0 if an error occurred
|
---|
656 | */
|
---|
657 | OSSL_DEPRECATEDIN_3_0 int EC_POINT_get_affine_coordinates_GFp
|
---|
658 | (const EC_GROUP *group, const EC_POINT *p,
|
---|
659 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
|
---|
660 | # endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
---|
661 |
|
---|
662 | /** Sets the x9.62 compressed coordinates of a EC_POINT
|
---|
663 | * \param group underlying EC_GROUP object
|
---|
664 | * \param p EC_POINT object
|
---|
665 | * \param x BIGNUM with x-coordinate
|
---|
666 | * \param y_bit integer with the y-Bit (either 0 or 1)
|
---|
667 | * \param ctx BN_CTX object (optional)
|
---|
668 | * \return 1 on success and 0 if an error occurred
|
---|
669 | */
|
---|
670 | int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p,
|
---|
671 | const BIGNUM *x, int y_bit,
|
---|
672 | BN_CTX *ctx);
|
---|
673 |
|
---|
674 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
675 | /** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of
|
---|
676 | * EC_POINT_set_compressed_coordinates
|
---|
677 | * \param group underlying EC_GROUP object
|
---|
678 | * \param p EC_POINT object
|
---|
679 | * \param x BIGNUM with x-coordinate
|
---|
680 | * \param y_bit integer with the y-Bit (either 0 or 1)
|
---|
681 | * \param ctx BN_CTX object (optional)
|
---|
682 | * \return 1 on success and 0 if an error occurred
|
---|
683 | */
|
---|
684 | OSSL_DEPRECATEDIN_3_0 int EC_POINT_set_compressed_coordinates_GFp
|
---|
685 | (const EC_GROUP *group, EC_POINT *p,
|
---|
686 | const BIGNUM *x, int y_bit, BN_CTX *ctx);
|
---|
687 | # ifndef OPENSSL_NO_EC2M
|
---|
688 | /** Sets the affine coordinates of an EC_POINT. A synonym of
|
---|
689 | * EC_POINT_set_affine_coordinates
|
---|
690 | * \param group underlying EC_GROUP object
|
---|
691 | * \param p EC_POINT object
|
---|
692 | * \param x BIGNUM with the x-coordinate
|
---|
693 | * \param y BIGNUM with the y-coordinate
|
---|
694 | * \param ctx BN_CTX object (optional)
|
---|
695 | * \return 1 on success and 0 if an error occurred
|
---|
696 | */
|
---|
697 | OSSL_DEPRECATEDIN_3_0 int EC_POINT_set_affine_coordinates_GF2m
|
---|
698 | (const EC_GROUP *group, EC_POINT *p,
|
---|
699 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);
|
---|
700 |
|
---|
701 | /** Gets the affine coordinates of an EC_POINT. A synonym of
|
---|
702 | * EC_POINT_get_affine_coordinates
|
---|
703 | * \param group underlying EC_GROUP object
|
---|
704 | * \param p EC_POINT object
|
---|
705 | * \param x BIGNUM for the x-coordinate
|
---|
706 | * \param y BIGNUM for the y-coordinate
|
---|
707 | * \param ctx BN_CTX object (optional)
|
---|
708 | * \return 1 on success and 0 if an error occurred
|
---|
709 | */
|
---|
710 | OSSL_DEPRECATEDIN_3_0 int EC_POINT_get_affine_coordinates_GF2m
|
---|
711 | (const EC_GROUP *group, const EC_POINT *p,
|
---|
712 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
|
---|
713 |
|
---|
714 | /** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of
|
---|
715 | * EC_POINT_set_compressed_coordinates
|
---|
716 | * \param group underlying EC_GROUP object
|
---|
717 | * \param p EC_POINT object
|
---|
718 | * \param x BIGNUM with x-coordinate
|
---|
719 | * \param y_bit integer with the y-Bit (either 0 or 1)
|
---|
720 | * \param ctx BN_CTX object (optional)
|
---|
721 | * \return 1 on success and 0 if an error occurred
|
---|
722 | */
|
---|
723 | OSSL_DEPRECATEDIN_3_0 int EC_POINT_set_compressed_coordinates_GF2m
|
---|
724 | (const EC_GROUP *group, EC_POINT *p,
|
---|
725 | const BIGNUM *x, int y_bit, BN_CTX *ctx);
|
---|
726 | # endif
|
---|
727 | # endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
---|
728 |
|
---|
729 | /** Encodes a EC_POINT object to a octet string
|
---|
730 | * \param group underlying EC_GROUP object
|
---|
731 | * \param p EC_POINT object
|
---|
732 | * \param form point conversion form
|
---|
733 | * \param buf memory buffer for the result. If NULL the function returns
|
---|
734 | * required buffer size.
|
---|
735 | * \param len length of the memory buffer
|
---|
736 | * \param ctx BN_CTX object (optional)
|
---|
737 | * \return the length of the encoded octet string or 0 if an error occurred
|
---|
738 | */
|
---|
739 | size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p,
|
---|
740 | point_conversion_form_t form,
|
---|
741 | unsigned char *buf, size_t len, BN_CTX *ctx);
|
---|
742 |
|
---|
743 | /** Decodes a EC_POINT from a octet string
|
---|
744 | * \param group underlying EC_GROUP object
|
---|
745 | * \param p EC_POINT object
|
---|
746 | * \param buf memory buffer with the encoded ec point
|
---|
747 | * \param len length of the encoded ec point
|
---|
748 | * \param ctx BN_CTX object (optional)
|
---|
749 | * \return 1 on success and 0 if an error occurred
|
---|
750 | */
|
---|
751 | int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p,
|
---|
752 | const unsigned char *buf, size_t len, BN_CTX *ctx);
|
---|
753 |
|
---|
754 | /** Encodes an EC_POINT object to an allocated octet string
|
---|
755 | * \param group underlying EC_GROUP object
|
---|
756 | * \param point EC_POINT object
|
---|
757 | * \param form point conversion form
|
---|
758 | * \param pbuf returns pointer to allocated buffer
|
---|
759 | * \param ctx BN_CTX object (optional)
|
---|
760 | * \return the length of the encoded octet string or 0 if an error occurred
|
---|
761 | */
|
---|
762 | size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point,
|
---|
763 | point_conversion_form_t form,
|
---|
764 | unsigned char **pbuf, BN_CTX *ctx);
|
---|
765 |
|
---|
766 | /* other interfaces to point2oct/oct2point: */
|
---|
767 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
768 | OSSL_DEPRECATEDIN_3_0 BIGNUM *EC_POINT_point2bn(const EC_GROUP *,
|
---|
769 | const EC_POINT *,
|
---|
770 | point_conversion_form_t form,
|
---|
771 | BIGNUM *, BN_CTX *);
|
---|
772 | OSSL_DEPRECATEDIN_3_0 EC_POINT *EC_POINT_bn2point(const EC_GROUP *,
|
---|
773 | const BIGNUM *,
|
---|
774 | EC_POINT *, BN_CTX *);
|
---|
775 | # endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
---|
776 |
|
---|
777 | char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *,
|
---|
778 | point_conversion_form_t form, BN_CTX *);
|
---|
779 | EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *,
|
---|
780 | EC_POINT *, BN_CTX *);
|
---|
781 |
|
---|
782 | /********************************************************************/
|
---|
783 | /* functions for doing EC_POINT arithmetic */
|
---|
784 | /********************************************************************/
|
---|
785 |
|
---|
786 | /** Computes the sum of two EC_POINT
|
---|
787 | * \param group underlying EC_GROUP object
|
---|
788 | * \param r EC_POINT object for the result (r = a + b)
|
---|
789 | * \param a EC_POINT object with the first summand
|
---|
790 | * \param b EC_POINT object with the second summand
|
---|
791 | * \param ctx BN_CTX object (optional)
|
---|
792 | * \return 1 on success and 0 if an error occurred
|
---|
793 | */
|
---|
794 | int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
|
---|
795 | const EC_POINT *b, BN_CTX *ctx);
|
---|
796 |
|
---|
797 | /** Computes the double of a EC_POINT
|
---|
798 | * \param group underlying EC_GROUP object
|
---|
799 | * \param r EC_POINT object for the result (r = 2 * a)
|
---|
800 | * \param a EC_POINT object
|
---|
801 | * \param ctx BN_CTX object (optional)
|
---|
802 | * \return 1 on success and 0 if an error occurred
|
---|
803 | */
|
---|
804 | int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
|
---|
805 | BN_CTX *ctx);
|
---|
806 |
|
---|
807 | /** Computes the inverse of a EC_POINT
|
---|
808 | * \param group underlying EC_GROUP object
|
---|
809 | * \param a EC_POINT object to be inverted (it's used for the result as well)
|
---|
810 | * \param ctx BN_CTX object (optional)
|
---|
811 | * \return 1 on success and 0 if an error occurred
|
---|
812 | */
|
---|
813 | int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx);
|
---|
814 |
|
---|
815 | /** Checks whether the point is the neutral element of the group
|
---|
816 | * \param group the underlying EC_GROUP object
|
---|
817 | * \param p EC_POINT object
|
---|
818 | * \return 1 if the point is the neutral element and 0 otherwise
|
---|
819 | */
|
---|
820 | int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p);
|
---|
821 |
|
---|
822 | /** Checks whether the point is on the curve
|
---|
823 | * \param group underlying EC_GROUP object
|
---|
824 | * \param point EC_POINT object to check
|
---|
825 | * \param ctx BN_CTX object (optional)
|
---|
826 | * \return 1 if the point is on the curve, 0 if not, or -1 on error
|
---|
827 | */
|
---|
828 | int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
|
---|
829 | BN_CTX *ctx);
|
---|
830 |
|
---|
831 | /** Compares two EC_POINTs
|
---|
832 | * \param group underlying EC_GROUP object
|
---|
833 | * \param a first EC_POINT object
|
---|
834 | * \param b second EC_POINT object
|
---|
835 | * \param ctx BN_CTX object (optional)
|
---|
836 | * \return 1 if the points are not equal, 0 if they are, or -1 on error
|
---|
837 | */
|
---|
838 | int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b,
|
---|
839 | BN_CTX *ctx);
|
---|
840 |
|
---|
841 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
842 | OSSL_DEPRECATEDIN_3_0 int EC_POINT_make_affine(const EC_GROUP *group,
|
---|
843 | EC_POINT *point, BN_CTX *ctx);
|
---|
844 | OSSL_DEPRECATEDIN_3_0 int EC_POINTs_make_affine(const EC_GROUP *group, size_t num,
|
---|
845 | EC_POINT *points[], BN_CTX *ctx);
|
---|
846 |
|
---|
847 | /** Computes r = generator * n + sum_{i=0}^{num-1} p[i] * m[i]
|
---|
848 | * \param group underlying EC_GROUP object
|
---|
849 | * \param r EC_POINT object for the result
|
---|
850 | * \param n BIGNUM with the multiplier for the group generator (optional)
|
---|
851 | * \param num number further summands
|
---|
852 | * \param p array of size num of EC_POINT objects
|
---|
853 | * \param m array of size num of BIGNUM objects
|
---|
854 | * \param ctx BN_CTX object (optional)
|
---|
855 | * \return 1 on success and 0 if an error occurred
|
---|
856 | */
|
---|
857 | OSSL_DEPRECATEDIN_3_0 int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r,
|
---|
858 | const BIGNUM *n, size_t num,
|
---|
859 | const EC_POINT *p[], const BIGNUM *m[],
|
---|
860 | BN_CTX *ctx);
|
---|
861 | # endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
---|
862 |
|
---|
863 | /** Computes r = generator * n + q * m
|
---|
864 | * \param group underlying EC_GROUP object
|
---|
865 | * \param r EC_POINT object for the result
|
---|
866 | * \param n BIGNUM with the multiplier for the group generator (optional)
|
---|
867 | * \param q EC_POINT object with the first factor of the second summand
|
---|
868 | * \param m BIGNUM with the second factor of the second summand
|
---|
869 | * \param ctx BN_CTX object (optional)
|
---|
870 | * \return 1 on success and 0 if an error occurred
|
---|
871 | */
|
---|
872 | int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n,
|
---|
873 | const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx);
|
---|
874 |
|
---|
875 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
876 | /** Stores multiples of generator for faster point multiplication
|
---|
877 | * \param group EC_GROUP object
|
---|
878 | * \param ctx BN_CTX object (optional)
|
---|
879 | * \return 1 on success and 0 if an error occurred
|
---|
880 | */
|
---|
881 | OSSL_DEPRECATEDIN_3_0 int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
|
---|
882 |
|
---|
883 | /** Reports whether a precomputation has been done
|
---|
884 | * \param group EC_GROUP object
|
---|
885 | * \return 1 if a pre-computation has been done and 0 otherwise
|
---|
886 | */
|
---|
887 | OSSL_DEPRECATEDIN_3_0 int EC_GROUP_have_precompute_mult(const EC_GROUP *group);
|
---|
888 | # endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
---|
889 |
|
---|
890 | /********************************************************************/
|
---|
891 | /* ASN1 stuff */
|
---|
892 | /********************************************************************/
|
---|
893 |
|
---|
894 | DECLARE_ASN1_ITEM(ECPKPARAMETERS)
|
---|
895 | DECLARE_ASN1_ALLOC_FUNCTIONS(ECPKPARAMETERS)
|
---|
896 | DECLARE_ASN1_ITEM(ECPARAMETERS)
|
---|
897 | DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS)
|
---|
898 |
|
---|
899 | /*
|
---|
900 | * EC_GROUP_get_basis_type() returns the NID of the basis type used to
|
---|
901 | * represent the field elements
|
---|
902 | */
|
---|
903 | int EC_GROUP_get_basis_type(const EC_GROUP *);
|
---|
904 | # ifndef OPENSSL_NO_EC2M
|
---|
905 | int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k);
|
---|
906 | int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1,
|
---|
907 | unsigned int *k2, unsigned int *k3);
|
---|
908 | # endif
|
---|
909 |
|
---|
910 | EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len);
|
---|
911 | int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out);
|
---|
912 |
|
---|
913 | # define d2i_ECPKParameters_bio(bp,x) \
|
---|
914 | ASN1_d2i_bio_of(EC_GROUP, NULL, d2i_ECPKParameters, bp, x)
|
---|
915 | # define i2d_ECPKParameters_bio(bp,x) \
|
---|
916 | ASN1_i2d_bio_of(EC_GROUP, i2d_ECPKParameters, bp, x)
|
---|
917 | # define d2i_ECPKParameters_fp(fp,x) \
|
---|
918 | (EC_GROUP *)ASN1_d2i_fp(NULL, (d2i_of_void *)d2i_ECPKParameters, (fp), \
|
---|
919 | (void **)(x))
|
---|
920 | # define i2d_ECPKParameters_fp(fp,x) \
|
---|
921 | ASN1_i2d_fp((i2d_of_void *)i2d_ECPKParameters, (fp), (void *)(x))
|
---|
922 |
|
---|
923 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
924 | OSSL_DEPRECATEDIN_3_0 int ECPKParameters_print(BIO *bp, const EC_GROUP *x,
|
---|
925 | int off);
|
---|
926 | # ifndef OPENSSL_NO_STDIO
|
---|
927 | OSSL_DEPRECATEDIN_3_0 int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x,
|
---|
928 | int off);
|
---|
929 | # endif
|
---|
930 | # endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
---|
931 |
|
---|
932 | /********************************************************************/
|
---|
933 | /* EC_KEY functions */
|
---|
934 | /********************************************************************/
|
---|
935 |
|
---|
936 | /* some values for the encoding_flag */
|
---|
937 | # define EC_PKEY_NO_PARAMETERS 0x001
|
---|
938 | # define EC_PKEY_NO_PUBKEY 0x002
|
---|
939 |
|
---|
940 | /* some values for the flags field */
|
---|
941 | # define EC_FLAG_SM2_RANGE 0x0004
|
---|
942 | # define EC_FLAG_COFACTOR_ECDH 0x1000
|
---|
943 | # define EC_FLAG_CHECK_NAMED_GROUP 0x2000
|
---|
944 | # define EC_FLAG_CHECK_NAMED_GROUP_NIST 0x4000
|
---|
945 | # define EC_FLAG_CHECK_NAMED_GROUP_MASK \
|
---|
946 | (EC_FLAG_CHECK_NAMED_GROUP | EC_FLAG_CHECK_NAMED_GROUP_NIST)
|
---|
947 |
|
---|
948 | /* Deprecated flags - it was using 0x01..0x02 */
|
---|
949 | # define EC_FLAG_NON_FIPS_ALLOW 0x0000
|
---|
950 | # define EC_FLAG_FIPS_CHECKED 0x0000
|
---|
951 |
|
---|
952 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
953 | /**
|
---|
954 | * Creates a new EC_KEY object.
|
---|
955 | * \param ctx The library context for to use for this EC_KEY. May be NULL in
|
---|
956 | * which case the default library context is used.
|
---|
957 | * \return EC_KEY object or NULL if an error occurred.
|
---|
958 | */
|
---|
959 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new_ex(OSSL_LIB_CTX *ctx, const char *propq);
|
---|
960 |
|
---|
961 | /**
|
---|
962 | * Creates a new EC_KEY object. Same as calling EC_KEY_new_ex with a
|
---|
963 | * NULL library context
|
---|
964 | * \return EC_KEY object or NULL if an error occurred.
|
---|
965 | */
|
---|
966 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new(void);
|
---|
967 |
|
---|
968 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_get_flags(const EC_KEY *key);
|
---|
969 |
|
---|
970 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_set_flags(EC_KEY *key, int flags);
|
---|
971 |
|
---|
972 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_clear_flags(EC_KEY *key, int flags);
|
---|
973 |
|
---|
974 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_decoded_from_explicit_params(const EC_KEY *key);
|
---|
975 |
|
---|
976 | /**
|
---|
977 | * Creates a new EC_KEY object using a named curve as underlying
|
---|
978 | * EC_GROUP object.
|
---|
979 | * \param ctx The library context for to use for this EC_KEY. May be NULL in
|
---|
980 | * which case the default library context is used.
|
---|
981 | * \param propq Any property query string
|
---|
982 | * \param nid NID of the named curve.
|
---|
983 | * \return EC_KEY object or NULL if an error occurred.
|
---|
984 | */
|
---|
985 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new_by_curve_name_ex(OSSL_LIB_CTX *ctx,
|
---|
986 | const char *propq,
|
---|
987 | int nid);
|
---|
988 |
|
---|
989 | /**
|
---|
990 | * Creates a new EC_KEY object using a named curve as underlying
|
---|
991 | * EC_GROUP object. Same as calling EC_KEY_new_by_curve_name_ex with a NULL
|
---|
992 | * library context and property query string.
|
---|
993 | * \param nid NID of the named curve.
|
---|
994 | * \return EC_KEY object or NULL if an error occurred.
|
---|
995 | */
|
---|
996 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new_by_curve_name(int nid);
|
---|
997 |
|
---|
998 | /** Frees a EC_KEY object.
|
---|
999 | * \param key EC_KEY object to be freed.
|
---|
1000 | */
|
---|
1001 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
|
---|
1002 |
|
---|
1003 | /** Copies a EC_KEY object.
|
---|
1004 | * \param dst destination EC_KEY object
|
---|
1005 | * \param src src EC_KEY object
|
---|
1006 | * \return dst or NULL if an error occurred.
|
---|
1007 | */
|
---|
1008 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src);
|
---|
1009 |
|
---|
1010 | /** Creates a new EC_KEY object and copies the content from src to it.
|
---|
1011 | * \param src the source EC_KEY object
|
---|
1012 | * \return newly created EC_KEY object or NULL if an error occurred.
|
---|
1013 | */
|
---|
1014 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_dup(const EC_KEY *src);
|
---|
1015 |
|
---|
1016 | /** Increases the internal reference count of a EC_KEY object.
|
---|
1017 | * \param key EC_KEY object
|
---|
1018 | * \return 1 on success and 0 if an error occurred.
|
---|
1019 | */
|
---|
1020 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_up_ref(EC_KEY *key);
|
---|
1021 |
|
---|
1022 | /** Returns the ENGINE object of a EC_KEY object
|
---|
1023 | * \param eckey EC_KEY object
|
---|
1024 | * \return the ENGINE object (possibly NULL).
|
---|
1025 | */
|
---|
1026 | OSSL_DEPRECATEDIN_3_0 ENGINE *EC_KEY_get0_engine(const EC_KEY *eckey);
|
---|
1027 |
|
---|
1028 | /** Returns the EC_GROUP object of a EC_KEY object
|
---|
1029 | * \param key EC_KEY object
|
---|
1030 | * \return the EC_GROUP object (possibly NULL).
|
---|
1031 | */
|
---|
1032 | OSSL_DEPRECATEDIN_3_0 const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key);
|
---|
1033 |
|
---|
1034 | /** Sets the EC_GROUP of a EC_KEY object.
|
---|
1035 | * \param key EC_KEY object
|
---|
1036 | * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY
|
---|
1037 | * object will use an own copy of the EC_GROUP).
|
---|
1038 | * \return 1 on success and 0 if an error occurred.
|
---|
1039 | */
|
---|
1040 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group);
|
---|
1041 |
|
---|
1042 | /** Returns the private key of a EC_KEY object.
|
---|
1043 | * \param key EC_KEY object
|
---|
1044 | * \return a BIGNUM with the private key (possibly NULL).
|
---|
1045 | */
|
---|
1046 | OSSL_DEPRECATEDIN_3_0 const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key);
|
---|
1047 |
|
---|
1048 | /** Sets the private key of a EC_KEY object.
|
---|
1049 | * \param key EC_KEY object
|
---|
1050 | * \param prv BIGNUM with the private key (note: the EC_KEY object
|
---|
1051 | * will use an own copy of the BIGNUM).
|
---|
1052 | * \return 1 on success and 0 if an error occurred.
|
---|
1053 | */
|
---|
1054 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv);
|
---|
1055 |
|
---|
1056 | /** Returns the public key of a EC_KEY object.
|
---|
1057 | * \param key the EC_KEY object
|
---|
1058 | * \return a EC_POINT object with the public key (possibly NULL)
|
---|
1059 | */
|
---|
1060 | OSSL_DEPRECATEDIN_3_0 const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);
|
---|
1061 |
|
---|
1062 | /** Sets the public key of a EC_KEY object.
|
---|
1063 | * \param key EC_KEY object
|
---|
1064 | * \param pub EC_POINT object with the public key (note: the EC_KEY object
|
---|
1065 | * will use an own copy of the EC_POINT object).
|
---|
1066 | * \return 1 on success and 0 if an error occurred.
|
---|
1067 | */
|
---|
1068 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);
|
---|
1069 |
|
---|
1070 | OSSL_DEPRECATEDIN_3_0 unsigned EC_KEY_get_enc_flags(const EC_KEY *key);
|
---|
1071 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags);
|
---|
1072 | OSSL_DEPRECATEDIN_3_0 point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key);
|
---|
1073 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_set_conv_form(EC_KEY *eckey,
|
---|
1074 | point_conversion_form_t cform);
|
---|
1075 | # endif /*OPENSSL_NO_DEPRECATED_3_0 */
|
---|
1076 |
|
---|
1077 | # define EC_KEY_get_ex_new_index(l, p, newf, dupf, freef) \
|
---|
1078 | CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_EC_KEY, l, p, newf, dupf, freef)
|
---|
1079 |
|
---|
1080 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
1081 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_ex_data(EC_KEY *key, int idx, void *arg);
|
---|
1082 | OSSL_DEPRECATEDIN_3_0 void *EC_KEY_get_ex_data(const EC_KEY *key, int idx);
|
---|
1083 |
|
---|
1084 | /* wrapper functions for the underlying EC_GROUP object */
|
---|
1085 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag);
|
---|
1086 |
|
---|
1087 | /** Creates a table of pre-computed multiples of the generator to
|
---|
1088 | * accelerate further EC_KEY operations.
|
---|
1089 | * \param key EC_KEY object
|
---|
1090 | * \param ctx BN_CTX object (optional)
|
---|
1091 | * \return 1 on success and 0 if an error occurred.
|
---|
1092 | */
|
---|
1093 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx);
|
---|
1094 |
|
---|
1095 | /** Creates a new ec private (and optional a new public) key.
|
---|
1096 | * \param key EC_KEY object
|
---|
1097 | * \return 1 on success and 0 if an error occurred.
|
---|
1098 | */
|
---|
1099 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_generate_key(EC_KEY *key);
|
---|
1100 |
|
---|
1101 | /** Verifies that a private and/or public key is valid.
|
---|
1102 | * \param key the EC_KEY object
|
---|
1103 | * \return 1 on success and 0 otherwise.
|
---|
1104 | */
|
---|
1105 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_check_key(const EC_KEY *key);
|
---|
1106 |
|
---|
1107 | /** Indicates if an EC_KEY can be used for signing.
|
---|
1108 | * \param eckey the EC_KEY object
|
---|
1109 | * \return 1 if can can sign and 0 otherwise.
|
---|
1110 | */
|
---|
1111 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_can_sign(const EC_KEY *eckey);
|
---|
1112 |
|
---|
1113 | /** Sets a public key from affine coordinates performing
|
---|
1114 | * necessary NIST PKV tests.
|
---|
1115 | * \param key the EC_KEY object
|
---|
1116 | * \param x public key x coordinate
|
---|
1117 | * \param y public key y coordinate
|
---|
1118 | * \return 1 on success and 0 otherwise.
|
---|
1119 | */
|
---|
1120 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key,
|
---|
1121 | BIGNUM *x,
|
---|
1122 | BIGNUM *y);
|
---|
1123 |
|
---|
1124 | /** Encodes an EC_KEY public key to an allocated octet string
|
---|
1125 | * \param key key to encode
|
---|
1126 | * \param form point conversion form
|
---|
1127 | * \param pbuf returns pointer to allocated buffer
|
---|
1128 | * \param ctx BN_CTX object (optional)
|
---|
1129 | * \return the length of the encoded octet string or 0 if an error occurred
|
---|
1130 | */
|
---|
1131 | OSSL_DEPRECATEDIN_3_0 size_t EC_KEY_key2buf(const EC_KEY *key,
|
---|
1132 | point_conversion_form_t form,
|
---|
1133 | unsigned char **pbuf, BN_CTX *ctx);
|
---|
1134 |
|
---|
1135 | /** Decodes a EC_KEY public key from a octet string
|
---|
1136 | * \param key key to decode
|
---|
1137 | * \param buf memory buffer with the encoded ec point
|
---|
1138 | * \param len length of the encoded ec point
|
---|
1139 | * \param ctx BN_CTX object (optional)
|
---|
1140 | * \return 1 on success and 0 if an error occurred
|
---|
1141 | */
|
---|
1142 |
|
---|
1143 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf,
|
---|
1144 | size_t len, BN_CTX *ctx);
|
---|
1145 |
|
---|
1146 | /** Decodes an EC_KEY private key from an octet string
|
---|
1147 | * \param key key to decode
|
---|
1148 | * \param buf memory buffer with the encoded private key
|
---|
1149 | * \param len length of the encoded key
|
---|
1150 | * \return 1 on success and 0 if an error occurred
|
---|
1151 | */
|
---|
1152 |
|
---|
1153 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_oct2priv(EC_KEY *key, const unsigned char *buf,
|
---|
1154 | size_t len);
|
---|
1155 |
|
---|
1156 | /** Encodes a EC_KEY private key to an octet string
|
---|
1157 | * \param key key to encode
|
---|
1158 | * \param buf memory buffer for the result. If NULL the function returns
|
---|
1159 | * required buffer size.
|
---|
1160 | * \param len length of the memory buffer
|
---|
1161 | * \return the length of the encoded octet string or 0 if an error occurred
|
---|
1162 | */
|
---|
1163 |
|
---|
1164 | OSSL_DEPRECATEDIN_3_0 size_t EC_KEY_priv2oct(const EC_KEY *key,
|
---|
1165 | unsigned char *buf, size_t len);
|
---|
1166 |
|
---|
1167 | /** Encodes an EC_KEY private key to an allocated octet string
|
---|
1168 | * \param eckey key to encode
|
---|
1169 | * \param pbuf returns pointer to allocated buffer
|
---|
1170 | * \return the length of the encoded octet string or 0 if an error occurred
|
---|
1171 | */
|
---|
1172 | OSSL_DEPRECATEDIN_3_0 size_t EC_KEY_priv2buf(const EC_KEY *eckey,
|
---|
1173 | unsigned char **pbuf);
|
---|
1174 |
|
---|
1175 | /********************************************************************/
|
---|
1176 | /* de- and encoding functions for SEC1 ECPrivateKey */
|
---|
1177 | /********************************************************************/
|
---|
1178 |
|
---|
1179 | /** Decodes a private key from a memory buffer.
|
---|
1180 | * \param key a pointer to a EC_KEY object which should be used (or NULL)
|
---|
1181 | * \param in pointer to memory with the DER encoded private key
|
---|
1182 | * \param len length of the DER encoded private key
|
---|
1183 | * \return the decoded private key or NULL if an error occurred.
|
---|
1184 | */
|
---|
1185 | OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECPrivateKey(EC_KEY **key,
|
---|
1186 | const unsigned char **in,
|
---|
1187 | long len);
|
---|
1188 |
|
---|
1189 | /** Encodes a private key object and stores the result in a buffer.
|
---|
1190 | * \param key the EC_KEY object to encode
|
---|
1191 | * \param out the buffer for the result (if NULL the function returns number
|
---|
1192 | * of bytes needed).
|
---|
1193 | * \return 1 on success and 0 if an error occurred.
|
---|
1194 | */
|
---|
1195 | OSSL_DEPRECATEDIN_3_0 int i2d_ECPrivateKey(const EC_KEY *key,
|
---|
1196 | unsigned char **out);
|
---|
1197 |
|
---|
1198 | /********************************************************************/
|
---|
1199 | /* de- and encoding functions for EC parameters */
|
---|
1200 | /********************************************************************/
|
---|
1201 |
|
---|
1202 | /** Decodes ec parameter from a memory buffer.
|
---|
1203 | * \param key a pointer to a EC_KEY object which should be used (or NULL)
|
---|
1204 | * \param in pointer to memory with the DER encoded ec parameters
|
---|
1205 | * \param len length of the DER encoded ec parameters
|
---|
1206 | * \return a EC_KEY object with the decoded parameters or NULL if an error
|
---|
1207 | * occurred.
|
---|
1208 | */
|
---|
1209 | OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECParameters(EC_KEY **key,
|
---|
1210 | const unsigned char **in,
|
---|
1211 | long len);
|
---|
1212 |
|
---|
1213 | /** Encodes ec parameter and stores the result in a buffer.
|
---|
1214 | * \param key the EC_KEY object with ec parameters to encode
|
---|
1215 | * \param out the buffer for the result (if NULL the function returns number
|
---|
1216 | * of bytes needed).
|
---|
1217 | * \return 1 on success and 0 if an error occurred.
|
---|
1218 | */
|
---|
1219 | OSSL_DEPRECATEDIN_3_0 int i2d_ECParameters(const EC_KEY *key,
|
---|
1220 | unsigned char **out);
|
---|
1221 |
|
---|
1222 | /********************************************************************/
|
---|
1223 | /* de- and encoding functions for EC public key */
|
---|
1224 | /* (octet string, not DER -- hence 'o2i' and 'i2o') */
|
---|
1225 | /********************************************************************/
|
---|
1226 |
|
---|
1227 | /** Decodes an ec public key from a octet string.
|
---|
1228 | * \param key a pointer to a EC_KEY object which should be used
|
---|
1229 | * \param in memory buffer with the encoded public key
|
---|
1230 | * \param len length of the encoded public key
|
---|
1231 | * \return EC_KEY object with decoded public key or NULL if an error
|
---|
1232 | * occurred.
|
---|
1233 | */
|
---|
1234 | OSSL_DEPRECATEDIN_3_0 EC_KEY *o2i_ECPublicKey(EC_KEY **key,
|
---|
1235 | const unsigned char **in, long len);
|
---|
1236 |
|
---|
1237 | /** Encodes an ec public key in an octet string.
|
---|
1238 | * \param key the EC_KEY object with the public key
|
---|
1239 | * \param out the buffer for the result (if NULL the function returns number
|
---|
1240 | * of bytes needed).
|
---|
1241 | * \return 1 on success and 0 if an error occurred
|
---|
1242 | */
|
---|
1243 | OSSL_DEPRECATEDIN_3_0 int i2o_ECPublicKey(const EC_KEY *key, unsigned char **out);
|
---|
1244 |
|
---|
1245 | /** Prints out the ec parameters on human readable form.
|
---|
1246 | * \param bp BIO object to which the information is printed
|
---|
1247 | * \param key EC_KEY object
|
---|
1248 | * \return 1 on success and 0 if an error occurred
|
---|
1249 | */
|
---|
1250 | OSSL_DEPRECATEDIN_3_0 int ECParameters_print(BIO *bp, const EC_KEY *key);
|
---|
1251 |
|
---|
1252 | /** Prints out the contents of a EC_KEY object
|
---|
1253 | * \param bp BIO object to which the information is printed
|
---|
1254 | * \param key EC_KEY object
|
---|
1255 | * \param off line offset
|
---|
1256 | * \return 1 on success and 0 if an error occurred
|
---|
1257 | */
|
---|
1258 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_print(BIO *bp, const EC_KEY *key, int off);
|
---|
1259 |
|
---|
1260 | # ifndef OPENSSL_NO_STDIO
|
---|
1261 | /** Prints out the ec parameters on human readable form.
|
---|
1262 | * \param fp file descriptor to which the information is printed
|
---|
1263 | * \param key EC_KEY object
|
---|
1264 | * \return 1 on success and 0 if an error occurred
|
---|
1265 | */
|
---|
1266 | OSSL_DEPRECATEDIN_3_0 int ECParameters_print_fp(FILE *fp, const EC_KEY *key);
|
---|
1267 |
|
---|
1268 | /** Prints out the contents of a EC_KEY object
|
---|
1269 | * \param fp file descriptor to which the information is printed
|
---|
1270 | * \param key EC_KEY object
|
---|
1271 | * \param off line offset
|
---|
1272 | * \return 1 on success and 0 if an error occurred
|
---|
1273 | */
|
---|
1274 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off);
|
---|
1275 | # endif /* OPENSSL_NO_STDIO */
|
---|
1276 |
|
---|
1277 | OSSL_DEPRECATEDIN_3_0 const EC_KEY_METHOD *EC_KEY_OpenSSL(void);
|
---|
1278 | OSSL_DEPRECATEDIN_3_0 const EC_KEY_METHOD *EC_KEY_get_default_method(void);
|
---|
1279 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_set_default_method(const EC_KEY_METHOD *meth);
|
---|
1280 | OSSL_DEPRECATEDIN_3_0 const EC_KEY_METHOD *EC_KEY_get_method(const EC_KEY *key);
|
---|
1281 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth);
|
---|
1282 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new_method(ENGINE *engine);
|
---|
1283 |
|
---|
1284 | /** The old name for ecdh_KDF_X9_63
|
---|
1285 | * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62,
|
---|
1286 | * it is actually specified in ANSI X9.63.
|
---|
1287 | * This identifier is retained for backwards compatibility
|
---|
1288 | */
|
---|
1289 | OSSL_DEPRECATEDIN_3_0 int ECDH_KDF_X9_62(unsigned char *out, size_t outlen,
|
---|
1290 | const unsigned char *Z, size_t Zlen,
|
---|
1291 | const unsigned char *sinfo,
|
---|
1292 | size_t sinfolen, const EVP_MD *md);
|
---|
1293 |
|
---|
1294 | OSSL_DEPRECATEDIN_3_0 int ECDH_compute_key(void *out, size_t outlen,
|
---|
1295 | const EC_POINT *pub_key,
|
---|
1296 | const EC_KEY *ecdh,
|
---|
1297 | void *(*KDF)(const void *in,
|
---|
1298 | size_t inlen, void *out,
|
---|
1299 | size_t *outlen));
|
---|
1300 | # endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
---|
1301 |
|
---|
1302 | typedef struct ECDSA_SIG_st ECDSA_SIG;
|
---|
1303 |
|
---|
1304 | /** Allocates and initialize a ECDSA_SIG structure
|
---|
1305 | * \return pointer to a ECDSA_SIG structure or NULL if an error occurred
|
---|
1306 | */
|
---|
1307 | ECDSA_SIG *ECDSA_SIG_new(void);
|
---|
1308 |
|
---|
1309 | /** frees a ECDSA_SIG structure
|
---|
1310 | * \param sig pointer to the ECDSA_SIG structure
|
---|
1311 | */
|
---|
1312 | void ECDSA_SIG_free(ECDSA_SIG *sig);
|
---|
1313 |
|
---|
1314 | /** i2d_ECDSA_SIG encodes content of ECDSA_SIG (note: this function modifies *pp
|
---|
1315 | * (*pp += length of the DER encoded signature)).
|
---|
1316 | * \param sig pointer to the ECDSA_SIG object
|
---|
1317 | * \param pp pointer to a unsigned char pointer for the output or NULL
|
---|
1318 | * \return the length of the DER encoded ECDSA_SIG object or a negative value
|
---|
1319 | * on error
|
---|
1320 | */
|
---|
1321 | DECLARE_ASN1_ENCODE_FUNCTIONS_only(ECDSA_SIG, ECDSA_SIG)
|
---|
1322 |
|
---|
1323 | /** d2i_ECDSA_SIG decodes an ECDSA signature (note: this function modifies *pp
|
---|
1324 | * (*pp += len)).
|
---|
1325 | * \param sig pointer to ECDSA_SIG pointer (may be NULL)
|
---|
1326 | * \param pp memory buffer with the DER encoded signature
|
---|
1327 | * \param len length of the buffer
|
---|
1328 | * \return pointer to the decoded ECDSA_SIG structure (or NULL)
|
---|
1329 | */
|
---|
1330 |
|
---|
1331 | /** Accessor for r and s fields of ECDSA_SIG
|
---|
1332 | * \param sig pointer to ECDSA_SIG structure
|
---|
1333 | * \param pr pointer to BIGNUM pointer for r (may be NULL)
|
---|
1334 | * \param ps pointer to BIGNUM pointer for s (may be NULL)
|
---|
1335 | */
|
---|
1336 | void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);
|
---|
1337 |
|
---|
1338 | /** Accessor for r field of ECDSA_SIG
|
---|
1339 | * \param sig pointer to ECDSA_SIG structure
|
---|
1340 | */
|
---|
1341 | const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig);
|
---|
1342 |
|
---|
1343 | /** Accessor for s field of ECDSA_SIG
|
---|
1344 | * \param sig pointer to ECDSA_SIG structure
|
---|
1345 | */
|
---|
1346 | const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig);
|
---|
1347 |
|
---|
1348 | /** Setter for r and s fields of ECDSA_SIG
|
---|
1349 | * \param sig pointer to ECDSA_SIG structure
|
---|
1350 | * \param r pointer to BIGNUM for r
|
---|
1351 | * \param s pointer to BIGNUM for s
|
---|
1352 | */
|
---|
1353 | int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s);
|
---|
1354 |
|
---|
1355 | # ifndef OPENSSL_NO_DEPRECATED_3_0
|
---|
1356 | /** Computes the ECDSA signature of the given hash value using
|
---|
1357 | * the supplied private key and returns the created signature.
|
---|
1358 | * \param dgst pointer to the hash value
|
---|
1359 | * \param dgst_len length of the hash value
|
---|
1360 | * \param eckey EC_KEY object containing a private EC key
|
---|
1361 | * \return pointer to a ECDSA_SIG structure or NULL if an error occurred
|
---|
1362 | */
|
---|
1363 | OSSL_DEPRECATEDIN_3_0 ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst,
|
---|
1364 | int dgst_len, EC_KEY *eckey);
|
---|
1365 |
|
---|
1366 | /** Computes ECDSA signature of a given hash value using the supplied
|
---|
1367 | * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
|
---|
1368 | * \param dgst pointer to the hash value to sign
|
---|
1369 | * \param dgstlen length of the hash value
|
---|
1370 | * \param kinv BIGNUM with a pre-computed inverse k (optional)
|
---|
1371 | * \param rp BIGNUM with a pre-computed rp value (optional),
|
---|
1372 | * see ECDSA_sign_setup
|
---|
1373 | * \param eckey EC_KEY object containing a private EC key
|
---|
1374 | * \return pointer to a ECDSA_SIG structure or NULL if an error occurred
|
---|
1375 | */
|
---|
1376 | OSSL_DEPRECATEDIN_3_0 ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst,
|
---|
1377 | int dgstlen, const BIGNUM *kinv,
|
---|
1378 | const BIGNUM *rp, EC_KEY *eckey);
|
---|
1379 |
|
---|
1380 | /** Verifies that the supplied signature is a valid ECDSA
|
---|
1381 | * signature of the supplied hash value using the supplied public key.
|
---|
1382 | * \param dgst pointer to the hash value
|
---|
1383 | * \param dgst_len length of the hash value
|
---|
1384 | * \param sig ECDSA_SIG structure
|
---|
1385 | * \param eckey EC_KEY object containing a public EC key
|
---|
1386 | * \return 1 if the signature is valid, 0 if the signature is invalid
|
---|
1387 | * and -1 on error
|
---|
1388 | */
|
---|
1389 | OSSL_DEPRECATEDIN_3_0 int ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
|
---|
1390 | const ECDSA_SIG *sig, EC_KEY *eckey);
|
---|
1391 |
|
---|
1392 | /** Precompute parts of the signing operation
|
---|
1393 | * \param eckey EC_KEY object containing a private EC key
|
---|
1394 | * \param ctx BN_CTX object (optional)
|
---|
1395 | * \param kinv BIGNUM pointer for the inverse of k
|
---|
1396 | * \param rp BIGNUM pointer for x coordinate of k * generator
|
---|
1397 | * \return 1 on success and 0 otherwise
|
---|
1398 | */
|
---|
1399 | OSSL_DEPRECATEDIN_3_0 int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx,
|
---|
1400 | BIGNUM **kinv, BIGNUM **rp);
|
---|
1401 |
|
---|
1402 | /** Computes ECDSA signature of a given hash value using the supplied
|
---|
1403 | * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
|
---|
1404 | * \param type this parameter is ignored
|
---|
1405 | * \param dgst pointer to the hash value to sign
|
---|
1406 | * \param dgstlen length of the hash value
|
---|
1407 | * \param sig memory for the DER encoded created signature
|
---|
1408 | * \param siglen pointer to the length of the returned signature
|
---|
1409 | * \param eckey EC_KEY object containing a private EC key
|
---|
1410 | * \return 1 on success and 0 otherwise
|
---|
1411 | */
|
---|
1412 | OSSL_DEPRECATEDIN_3_0 int ECDSA_sign(int type, const unsigned char *dgst,
|
---|
1413 | int dgstlen, unsigned char *sig,
|
---|
1414 | unsigned int *siglen, EC_KEY *eckey);
|
---|
1415 |
|
---|
1416 | /** Computes ECDSA signature of a given hash value using the supplied
|
---|
1417 | * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
|
---|
1418 | * \param type this parameter is ignored
|
---|
1419 | * \param dgst pointer to the hash value to sign
|
---|
1420 | * \param dgstlen length of the hash value
|
---|
1421 | * \param sig buffer to hold the DER encoded signature
|
---|
1422 | * \param siglen pointer to the length of the returned signature
|
---|
1423 | * \param kinv BIGNUM with a pre-computed inverse k (optional)
|
---|
1424 | * \param rp BIGNUM with a pre-computed rp value (optional),
|
---|
1425 | * see ECDSA_sign_setup
|
---|
1426 | * \param eckey EC_KEY object containing a private EC key
|
---|
1427 | * \return 1 on success and 0 otherwise
|
---|
1428 | */
|
---|
1429 | OSSL_DEPRECATEDIN_3_0 int ECDSA_sign_ex(int type, const unsigned char *dgst,
|
---|
1430 | int dgstlen, unsigned char *sig,
|
---|
1431 | unsigned int *siglen, const BIGNUM *kinv,
|
---|
1432 | const BIGNUM *rp, EC_KEY *eckey);
|
---|
1433 |
|
---|
1434 | /** Verifies that the given signature is valid ECDSA signature
|
---|
1435 | * of the supplied hash value using the specified public key.
|
---|
1436 | * \param type this parameter is ignored
|
---|
1437 | * \param dgst pointer to the hash value
|
---|
1438 | * \param dgstlen length of the hash value
|
---|
1439 | * \param sig pointer to the DER encoded signature
|
---|
1440 | * \param siglen length of the DER encoded signature
|
---|
1441 | * \param eckey EC_KEY object containing a public EC key
|
---|
1442 | * \return 1 if the signature is valid, 0 if the signature is invalid
|
---|
1443 | * and -1 on error
|
---|
1444 | */
|
---|
1445 | OSSL_DEPRECATEDIN_3_0 int ECDSA_verify(int type, const unsigned char *dgst,
|
---|
1446 | int dgstlen, const unsigned char *sig,
|
---|
1447 | int siglen, EC_KEY *eckey);
|
---|
1448 |
|
---|
1449 | /** Returns the maximum length of the DER encoded signature
|
---|
1450 | * \param eckey EC_KEY object
|
---|
1451 | * \return numbers of bytes required for the DER encoded signature
|
---|
1452 | */
|
---|
1453 | OSSL_DEPRECATEDIN_3_0 int ECDSA_size(const EC_KEY *eckey);
|
---|
1454 |
|
---|
1455 | /********************************************************************/
|
---|
1456 | /* EC_KEY_METHOD constructors, destructors, writers and accessors */
|
---|
1457 | /********************************************************************/
|
---|
1458 |
|
---|
1459 | OSSL_DEPRECATEDIN_3_0 EC_KEY_METHOD *EC_KEY_METHOD_new(const EC_KEY_METHOD *meth);
|
---|
1460 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_free(EC_KEY_METHOD *meth);
|
---|
1461 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_set_init
|
---|
1462 | (EC_KEY_METHOD *meth,
|
---|
1463 | int (*init)(EC_KEY *key),
|
---|
1464 | void (*finish)(EC_KEY *key),
|
---|
1465 | int (*copy)(EC_KEY *dest, const EC_KEY *src),
|
---|
1466 | int (*set_group)(EC_KEY *key, const EC_GROUP *grp),
|
---|
1467 | int (*set_private)(EC_KEY *key, const BIGNUM *priv_key),
|
---|
1468 | int (*set_public)(EC_KEY *key, const EC_POINT *pub_key));
|
---|
1469 |
|
---|
1470 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth,
|
---|
1471 | int (*keygen)(EC_KEY *key));
|
---|
1472 |
|
---|
1473 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_set_compute_key
|
---|
1474 | (EC_KEY_METHOD *meth,
|
---|
1475 | int (*ckey)(unsigned char **psec, size_t *pseclen,
|
---|
1476 | const EC_POINT *pub_key, const EC_KEY *ecdh));
|
---|
1477 |
|
---|
1478 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_set_sign
|
---|
1479 | (EC_KEY_METHOD *meth,
|
---|
1480 | int (*sign)(int type, const unsigned char *dgst,
|
---|
1481 | int dlen, unsigned char *sig,
|
---|
1482 | unsigned int *siglen,
|
---|
1483 | const BIGNUM *kinv, const BIGNUM *r,
|
---|
1484 | EC_KEY *eckey),
|
---|
1485 | int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in,
|
---|
1486 | BIGNUM **kinvp, BIGNUM **rp),
|
---|
1487 | ECDSA_SIG *(*sign_sig)(const unsigned char *dgst,
|
---|
1488 | int dgst_len,
|
---|
1489 | const BIGNUM *in_kinv,
|
---|
1490 | const BIGNUM *in_r,
|
---|
1491 | EC_KEY *eckey));
|
---|
1492 |
|
---|
1493 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_set_verify
|
---|
1494 | (EC_KEY_METHOD *meth,
|
---|
1495 | int (*verify)(int type, const unsigned
|
---|
1496 | char *dgst, int dgst_len,
|
---|
1497 | const unsigned char *sigbuf,
|
---|
1498 | int sig_len, EC_KEY *eckey),
|
---|
1499 | int (*verify_sig)(const unsigned char *dgst,
|
---|
1500 | int dgst_len, const ECDSA_SIG *sig,
|
---|
1501 | EC_KEY *eckey));
|
---|
1502 |
|
---|
1503 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_get_init
|
---|
1504 | (const EC_KEY_METHOD *meth,
|
---|
1505 | int (**pinit)(EC_KEY *key),
|
---|
1506 | void (**pfinish)(EC_KEY *key),
|
---|
1507 | int (**pcopy)(EC_KEY *dest, const EC_KEY *src),
|
---|
1508 | int (**pset_group)(EC_KEY *key, const EC_GROUP *grp),
|
---|
1509 | int (**pset_private)(EC_KEY *key, const BIGNUM *priv_key),
|
---|
1510 | int (**pset_public)(EC_KEY *key, const EC_POINT *pub_key));
|
---|
1511 |
|
---|
1512 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_get_keygen
|
---|
1513 | (const EC_KEY_METHOD *meth, int (**pkeygen)(EC_KEY *key));
|
---|
1514 |
|
---|
1515 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_get_compute_key
|
---|
1516 | (const EC_KEY_METHOD *meth,
|
---|
1517 | int (**pck)(unsigned char **psec,
|
---|
1518 | size_t *pseclen,
|
---|
1519 | const EC_POINT *pub_key,
|
---|
1520 | const EC_KEY *ecdh));
|
---|
1521 |
|
---|
1522 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_get_sign
|
---|
1523 | (const EC_KEY_METHOD *meth,
|
---|
1524 | int (**psign)(int type, const unsigned char *dgst,
|
---|
1525 | int dlen, unsigned char *sig,
|
---|
1526 | unsigned int *siglen,
|
---|
1527 | const BIGNUM *kinv, const BIGNUM *r,
|
---|
1528 | EC_KEY *eckey),
|
---|
1529 | int (**psign_setup)(EC_KEY *eckey, BN_CTX *ctx_in,
|
---|
1530 | BIGNUM **kinvp, BIGNUM **rp),
|
---|
1531 | ECDSA_SIG *(**psign_sig)(const unsigned char *dgst,
|
---|
1532 | int dgst_len,
|
---|
1533 | const BIGNUM *in_kinv,
|
---|
1534 | const BIGNUM *in_r,
|
---|
1535 | EC_KEY *eckey));
|
---|
1536 |
|
---|
1537 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_METHOD_get_verify
|
---|
1538 | (const EC_KEY_METHOD *meth,
|
---|
1539 | int (**pverify)(int type, const unsigned
|
---|
1540 | char *dgst, int dgst_len,
|
---|
1541 | const unsigned char *sigbuf,
|
---|
1542 | int sig_len, EC_KEY *eckey),
|
---|
1543 | int (**pverify_sig)(const unsigned char *dgst,
|
---|
1544 | int dgst_len,
|
---|
1545 | const ECDSA_SIG *sig,
|
---|
1546 | EC_KEY *eckey));
|
---|
1547 | # endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
---|
1548 |
|
---|
1549 | # define EVP_EC_gen(curve) \
|
---|
1550 | EVP_PKEY_Q_keygen(NULL, NULL, "EC", (char *)(strstr(curve, "")))
|
---|
1551 | # define ECParameters_dup(x) ASN1_dup_of(EC_KEY, i2d_ECParameters, \
|
---|
1552 | d2i_ECParameters, x)
|
---|
1553 |
|
---|
1554 | # ifndef __cplusplus
|
---|
1555 | # if defined(__SUNPRO_C)
|
---|
1556 | # if __SUNPRO_C >= 0x520
|
---|
1557 | # pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE)
|
---|
1558 | # endif
|
---|
1559 | # endif
|
---|
1560 | # endif
|
---|
1561 |
|
---|
1562 | # endif
|
---|
1563 | # ifdef __cplusplus
|
---|
1564 | }
|
---|
1565 | # endif
|
---|
1566 | #endif
|
---|