diff options
author | tb <> | 2025-04-25 19:57:12 +0000 |
---|---|---|
committer | tb <> | 2025-04-25 19:57:12 +0000 |
commit | cb56cb39e4330bac5b137be25dddcb89c34eee5e (patch) | |
tree | 861ff688d2e1eb96feb6980c81276954e5ebafe4 /src | |
parent | 120a986cb6f325a834aa58315f1c744f3d9c8165 (diff) | |
download | openbsd-cb56cb39e4330bac5b137be25dddcb89c34eee5e.tar.gz openbsd-cb56cb39e4330bac5b137be25dddcb89c34eee5e.tar.bz2 openbsd-cb56cb39e4330bac5b137be25dddcb89c34eee5e.zip |
Rework EC documentation
This replaces the giant, poor quality and outdated EC_GROUP_copy.3,
EC_GROUP_new.3, and EC_POINT_new.3 manuals with seven new manuals
written from scratch.
* EC_GROUP_new_by_curve_name() is the entry point for builtin curves,
* EC_GROUP_new_curve_GFp() describes lower level API that should not
usually be needed apart from a handful of accessors.
* EC_GROUP_check() contains two functions that applications should not
need because either you know for certain something is an elliptic
curve (so these checks are pointless) or you should not use it.
* EC_GROUP_get_curve_name() describes some low level ASN.1 footguns
and corresponding getters.
* EC_POINT_new() contains the simple EC_POINT allocation and freeing API
* EC_POINT_get_affine_coordinates() contains the coordinate accessors
* EC_POINT_point2oct() is about encoding elliptic curve points
While all this is quite far from perfect, the diff is getting too big
and it will be easier to improve this in tree. It is definitely more
repetitive than I would like it to be.
Reviews, tweaks and general feedback are of course welcome.
discussed with jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/man/EC_GROUP_check.3 | 157 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EC_GROUP_copy.3 | 492 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EC_GROUP_get_curve_name.3 | 264 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EC_GROUP_new.3 | 353 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EC_GROUP_new_by_curve_name.3 | 310 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EC_GROUP_new_curve_GFp.3 | 450 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EC_KEY_METHOD_new.3 | 13 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EC_KEY_new.3 | 21 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EC_POINT_add.3 | 18 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3 | 215 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EC_POINT_new.3 | 506 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EC_POINT_point2oct.3 | 431 | ||||
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 10 |
13 files changed, 1998 insertions, 1242 deletions
diff --git a/src/lib/libcrypto/man/EC_GROUP_check.3 b/src/lib/libcrypto/man/EC_GROUP_check.3 new file mode 100644 index 0000000000..e000be212b --- /dev/null +++ b/src/lib/libcrypto/man/EC_GROUP_check.3 | |||
@@ -0,0 +1,157 @@ | |||
1 | .\" $OpenBSD: EC_GROUP_check.3,v 1.1 2025/04/25 19:57:12 tb Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .Dd $Mdocdate: April 25 2025 $ | ||
18 | .Dt EC_GROUP_CHECK 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm EC_GROUP_check_discriminant , | ||
22 | .Nm EC_GROUP_check | ||
23 | .Nd partially check validity of | ||
24 | .Vt EC_GROUP | ||
25 | objects | ||
26 | .Sh SYNOPSIS | ||
27 | .In openssl/bn.h | ||
28 | .In openssl/ec.h | ||
29 | .Pp | ||
30 | Deprecated: | ||
31 | .Pp | ||
32 | .Ft "int" | ||
33 | .Fo EC_GROUP_check_discriminant | ||
34 | .Fa "const EC_GROUP *group" | ||
35 | .Fa "BN_CTX *ctx" | ||
36 | .Fc | ||
37 | .Ft "int" | ||
38 | .Fo EC_GROUP_check | ||
39 | .Fa "const EC_GROUP *group" | ||
40 | .Fa "BN_CTX *ctx" | ||
41 | .Fc | ||
42 | .Sh DESCRIPTION | ||
43 | These functions are deprecated. | ||
44 | Only standardized curves built into the library should be used, see | ||
45 | .Xr EC_GROUP_new_by_curve_name 3 . | ||
46 | For builtin curves far more thorough checks than the minimal checks | ||
47 | performed by these functions have been performed. | ||
48 | .Pp | ||
49 | These functions have an optional | ||
50 | .Fa ctx | ||
51 | argument which is used to avoid the cost of repeated allocation of | ||
52 | auxiliary | ||
53 | .Vt BIGNUM | ||
54 | objects. | ||
55 | .Pp | ||
56 | .Fn EC_GROUP_check_discriminant | ||
57 | can be called after | ||
58 | .Xr EC_GROUP_new_curve_GFp 3 | ||
59 | to verify that | ||
60 | .Fa group Ns 's | ||
61 | parameters have non-zero discriminant 4a^3 + 27b^2 modulo p. | ||
62 | Assuming that | ||
63 | .Fa p | ||
64 | is a prime number larger than three | ||
65 | this implies that the Weierstrass equation defines an elliptic curve. | ||
66 | .Pp | ||
67 | .Fn EC_GROUP_check | ||
68 | partially verifies that | ||
69 | .Fa group | ||
70 | represents an an elliptic curve and that | ||
71 | .Fa generator | ||
72 | is a point on the curve whose order divides | ||
73 | .Fa order . | ||
74 | It checks with | ||
75 | .Fn EC_GROUP_check_discriminant | ||
76 | that the discriminant is non-zero | ||
77 | and then verifies that that | ||
78 | .Fa order | ||
79 | is non-zero and that the product | ||
80 | .Fa generator No * Fa order | ||
81 | is the point at infinity. | ||
82 | This implies that | ||
83 | .Fa order | ||
84 | is an integer multiple of the | ||
85 | .Fa generator Ns 's | ||
86 | .Fa order . | ||
87 | The verification that | ||
88 | .Fa p | ||
89 | is a prime | ||
90 | and that | ||
91 | .Fa order | ||
92 | is the | ||
93 | .Fa generator Ns 's | ||
94 | order are skipped because they are too expensive. | ||
95 | .Sh RETURN VALUES | ||
96 | .Fn EC_GROUP_check_discriminant | ||
97 | returns 1 on success and 0 on failure. | ||
98 | Failure modes include that the discriminant is zero modulo | ||
99 | .Fa p | ||
100 | and memory allocation failure. | ||
101 | .Pp | ||
102 | .Fn EC_GROUP_check | ||
103 | returns 1 on success and 0 on failure. | ||
104 | .Sh ERRORS | ||
105 | Diagnostics for | ||
106 | .Fn EC_GROUP_check | ||
107 | that can be retrieved with | ||
108 | .Xr ERR_get_error 3 , | ||
109 | .Xr ERR_GET_REASON 3 , | ||
110 | and | ||
111 | .Xr ERR_reason_error_string 3 | ||
112 | include: | ||
113 | .Bl -tag -width Ds | ||
114 | .It Dv EC_R_DISCRIMINANT_IS_ZERO Qq "discriminant is zero" | ||
115 | .Fn EC_GROUP_check_discriminant | ||
116 | failed because the discriminant is zero or for some other reason. | ||
117 | .It Dv EC_R_UNDEFINED_GENERATOR Qq "undefined generator" | ||
118 | no generator is set on | ||
119 | .Fa group , | ||
120 | for example because a call to | ||
121 | .Xr EC_GROUP_set_generator 3 | ||
122 | is missing. | ||
123 | .It Dv EC_R_POINT_IS_NOT_ON_CURVE Qq "point is not on curve" | ||
124 | a generator is set, but it is not a point on the curve represented by | ||
125 | .Fa group . | ||
126 | .It Dv EC_R_UNDEFINED_ORDER Qq "undefined order" | ||
127 | the | ||
128 | .Fa order | ||
129 | set on | ||
130 | .Fa group | ||
131 | is zero. | ||
132 | .It Dv EC_R_INVALID_GROUP_ORDER Qq "invalid group order" | ||
133 | .Fa generator No * Fa order | ||
134 | is not the point at infinity. | ||
135 | .El | ||
136 | .Sh SEE ALSO | ||
137 | .Xr BN_CTX_new 3 , | ||
138 | .Xr BN_is_zero 3 , | ||
139 | .Xr crypto 3 , | ||
140 | .Xr d2i_ECPKParameters 3 , | ||
141 | .Xr EC_GROUP_get_curve_name 3 , | ||
142 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
143 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
144 | .Xr EC_KEY_METHOD_new 3 , | ||
145 | .Xr EC_KEY_new 3 , | ||
146 | .Xr EC_POINT_add 3 , | ||
147 | .Xr EC_POINT_get_affine_coordinates 3 , | ||
148 | .Xr EC_POINT_new 3 , | ||
149 | .Xr EC_POINT_point2oct 3 , | ||
150 | .Xr ECDH_compute_key 3 , | ||
151 | .Xr ECDSA_SIG_new 3 | ||
152 | .Sh HISTORY | ||
153 | .Fn EC_GROUP_check | ||
154 | and | ||
155 | .Fn EC_GROUP_check_discriminant | ||
156 | first appeared in OpenSSL 0.9.8 and have been available since | ||
157 | .Ox 4.5 . | ||
diff --git a/src/lib/libcrypto/man/EC_GROUP_copy.3 b/src/lib/libcrypto/man/EC_GROUP_copy.3 deleted file mode 100644 index 2e5e798236..0000000000 --- a/src/lib/libcrypto/man/EC_GROUP_copy.3 +++ /dev/null | |||
@@ -1,492 +0,0 @@ | |||
1 | .\" $OpenBSD: EC_GROUP_copy.3,v 1.16 2025/03/08 16:40:59 tb Exp $ | ||
2 | .\" full merge up to: OpenSSL d900a015 Oct 8 14:40:42 2015 +0200 | ||
3 | .\" selective merge up to: OpenSSL 24c23e1f Aug 22 10:51:25 2019 +0530 | ||
4 | .\" | ||
5 | .\" This file was written by Matt Caswell <matt@openssl.org>, | ||
6 | .\" Dr. Stephen Henson <steve@openssl.org>, | ||
7 | .\" and Jayaram X Matta <jayaramx.matta@intel.com>. | ||
8 | .\" Copyright (c) 2013, 2015, 2019 The OpenSSL Project. All rights reserved. | ||
9 | .\" | ||
10 | .\" Redistribution and use in source and binary forms, with or without | ||
11 | .\" modification, are permitted provided that the following conditions | ||
12 | .\" are met: | ||
13 | .\" | ||
14 | .\" 1. Redistributions of source code must retain the above copyright | ||
15 | .\" notice, this list of conditions and the following disclaimer. | ||
16 | .\" | ||
17 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
18 | .\" notice, this list of conditions and the following disclaimer in | ||
19 | .\" the documentation and/or other materials provided with the | ||
20 | .\" distribution. | ||
21 | .\" | ||
22 | .\" 3. All advertising materials mentioning features or use of this | ||
23 | .\" software must display the following acknowledgment: | ||
24 | .\" "This product includes software developed by the OpenSSL Project | ||
25 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
26 | .\" | ||
27 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
28 | .\" endorse or promote products derived from this software without | ||
29 | .\" prior written permission. For written permission, please contact | ||
30 | .\" openssl-core@openssl.org. | ||
31 | .\" | ||
32 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
33 | .\" nor may "OpenSSL" appear in their names without prior written | ||
34 | .\" permission of the OpenSSL Project. | ||
35 | .\" | ||
36 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
37 | .\" acknowledgment: | ||
38 | .\" "This product includes software developed by the OpenSSL Project | ||
39 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
40 | .\" | ||
41 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
42 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
44 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
45 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
46 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
47 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
48 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
49 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
50 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
53 | .\" | ||
54 | .Dd $Mdocdate: March 8 2025 $ | ||
55 | .Dt EC_GROUP_COPY 3 | ||
56 | .Os | ||
57 | .Sh NAME | ||
58 | .Nm EC_GROUP_copy , | ||
59 | .Nm EC_GROUP_dup , | ||
60 | .Nm EC_GROUP_set_generator , | ||
61 | .Nm EC_GROUP_get0_generator , | ||
62 | .Nm EC_GROUP_get_order , | ||
63 | .Nm EC_GROUP_order_bits , | ||
64 | .Nm EC_GROUP_get_cofactor , | ||
65 | .Nm EC_GROUP_set_curve_name , | ||
66 | .Nm EC_GROUP_get_curve_name , | ||
67 | .Nm EC_GROUP_set_asn1_flag , | ||
68 | .Nm EC_GROUP_get_asn1_flag , | ||
69 | .Nm EC_GROUP_set_point_conversion_form , | ||
70 | .Nm EC_GROUP_get_point_conversion_form , | ||
71 | .Nm EC_GROUP_get0_seed , | ||
72 | .Nm EC_GROUP_get_seed_len , | ||
73 | .Nm EC_GROUP_set_seed , | ||
74 | .Nm EC_GROUP_get_degree , | ||
75 | .Nm EC_GROUP_check , | ||
76 | .Nm EC_GROUP_check_discriminant , | ||
77 | .Nm EC_GROUP_cmp , | ||
78 | .Nm EC_GROUP_get_basis_type | ||
79 | .Nd manipulate EC_GROUP objects | ||
80 | .Sh SYNOPSIS | ||
81 | .In openssl/ec.h | ||
82 | .In openssl/bn.h | ||
83 | .Ft int | ||
84 | .Fo EC_GROUP_copy | ||
85 | .Fa "EC_GROUP *dst" | ||
86 | .Fa "const EC_GROUP *src" | ||
87 | .Fc | ||
88 | .Ft EC_GROUP * | ||
89 | .Fo EC_GROUP_dup | ||
90 | .Fa "const EC_GROUP *src" | ||
91 | .Fc | ||
92 | .Ft int | ||
93 | .Fo EC_GROUP_set_generator | ||
94 | .Fa "EC_GROUP *group" | ||
95 | .Fa "const EC_POINT *generator" | ||
96 | .Fa "const BIGNUM *order" | ||
97 | .Fa "const BIGNUM *cofactor" | ||
98 | .Fc | ||
99 | .Ft const EC_POINT * | ||
100 | .Fo EC_GROUP_get0_generator | ||
101 | .Fa "const EC_GROUP *group" | ||
102 | .Fc | ||
103 | .Ft int | ||
104 | .Fo EC_GROUP_get_order | ||
105 | .Fa "const EC_GROUP *group" | ||
106 | .Fa "BIGNUM *order" | ||
107 | .Fa "BN_CTX *ctx" | ||
108 | .Fc | ||
109 | .Ft int | ||
110 | .Fo EC_GROUP_order_bits | ||
111 | .Fa "const EC_GROUP *group" | ||
112 | .Fc | ||
113 | .Ft int | ||
114 | .Fo EC_GROUP_get_cofactor | ||
115 | .Fa "const EC_GROUP *group" | ||
116 | .Fa "BIGNUM *cofactor" | ||
117 | .Fa "BN_CTX *ctx" | ||
118 | .Fc | ||
119 | .Ft void | ||
120 | .Fo EC_GROUP_set_curve_name | ||
121 | .Fa "EC_GROUP *group" | ||
122 | .Fa "int nid" | ||
123 | .Fc | ||
124 | .Ft int | ||
125 | .Fo EC_GROUP_get_curve_name | ||
126 | .Fa "const EC_GROUP *group" | ||
127 | .Fc | ||
128 | .Ft void | ||
129 | .Fo EC_GROUP_set_asn1_flag | ||
130 | .Fa "EC_GROUP *group" | ||
131 | .Fa "int flag" | ||
132 | .Fc | ||
133 | .Ft int | ||
134 | .Fo EC_GROUP_get_asn1_flag | ||
135 | .Fa "const EC_GROUP *group" | ||
136 | .Fc | ||
137 | .Ft void | ||
138 | .Fo EC_GROUP_set_point_conversion_form | ||
139 | .Fa "EC_GROUP *group" | ||
140 | .Fa "point_conversion_form_t form" | ||
141 | .Fc | ||
142 | .Ft point_conversion_form_t | ||
143 | .Fo EC_GROUP_get_point_conversion_form | ||
144 | .Fa "const EC_GROUP *" | ||
145 | .Fc | ||
146 | .Ft unsigned char * | ||
147 | .Fo EC_GROUP_get0_seed | ||
148 | .Fa "const EC_GROUP *x" | ||
149 | .Fc | ||
150 | .Ft size_t | ||
151 | .Fo EC_GROUP_get_seed_len | ||
152 | .Fa "const EC_GROUP *" | ||
153 | .Fc | ||
154 | .Ft size_t | ||
155 | .Fo EC_GROUP_set_seed | ||
156 | .Fa "EC_GROUP *" | ||
157 | .Fa "const unsigned char *" | ||
158 | .Fa "size_t len" | ||
159 | .Fc | ||
160 | .Ft int | ||
161 | .Fo EC_GROUP_get_degree | ||
162 | .Fa "const EC_GROUP *group" | ||
163 | .Fc | ||
164 | .Ft int | ||
165 | .Fo EC_GROUP_check | ||
166 | .Fa "const EC_GROUP *group" | ||
167 | .Fa "BN_CTX *ctx" | ||
168 | .Fc | ||
169 | .Ft int | ||
170 | .Fo EC_GROUP_check_discriminant | ||
171 | .Fa "const EC_GROUP *group" | ||
172 | .Fa "BN_CTX *ctx" | ||
173 | .Fc | ||
174 | .Ft int | ||
175 | .Fo EC_GROUP_cmp | ||
176 | .Fa "const EC_GROUP *a" | ||
177 | .Fa "const EC_GROUP *b" | ||
178 | .Fa "BN_CTX *ctx" | ||
179 | .Fc | ||
180 | .Ft int | ||
181 | .Fo EC_GROUP_get_basis_type | ||
182 | .Fa "const EC_GROUP *" | ||
183 | .Fc | ||
184 | .Sh DESCRIPTION | ||
185 | These functions operate on | ||
186 | .Vt EC_GROUP | ||
187 | objects created by the functions described in | ||
188 | .Xr EC_GROUP_new 3 . | ||
189 | .Pp | ||
190 | .Fn EC_GROUP_copy | ||
191 | copies the curve | ||
192 | .Fa src | ||
193 | into | ||
194 | .Fa dst . | ||
195 | Both | ||
196 | .Fa src | ||
197 | and | ||
198 | .Fa dst | ||
199 | must use the same | ||
200 | .Vt EC_METHOD . | ||
201 | .Pp | ||
202 | .Fn EC_GROUP_dup | ||
203 | creates a new | ||
204 | .Vt EC_GROUP | ||
205 | object and copies the content from | ||
206 | .Fa src | ||
207 | to the newly created | ||
208 | .Vt EC_GROUP | ||
209 | object. | ||
210 | .Pp | ||
211 | .Fn EC_GROUP_set_generator | ||
212 | sets curve parameters that must be agreed by all participants using | ||
213 | the curve. | ||
214 | These parameters include the | ||
215 | .Fa generator , | ||
216 | the | ||
217 | .Fa order | ||
218 | and the | ||
219 | .Fa cofactor . | ||
220 | The | ||
221 | .Fa generator | ||
222 | is a well defined point on the curve chosen for cryptographic | ||
223 | operations. | ||
224 | Integers used for point multiplications will be between 0 and | ||
225 | .Fa order No - 1 . | ||
226 | The | ||
227 | .Fa order | ||
228 | multiplied by the | ||
229 | .Fa cofactor | ||
230 | gives the number of points on the curve. | ||
231 | .Pp | ||
232 | .Fn EC_GROUP_get0_generator | ||
233 | returns the generator for the identified | ||
234 | .Fa group . | ||
235 | .Pp | ||
236 | .Fn EC_GROUP_get_order | ||
237 | retrieves the order of the | ||
238 | .Fa group | ||
239 | and copies its value into | ||
240 | .Fa order . | ||
241 | It fails if the order of the | ||
242 | .Fa group | ||
243 | is not set or set to zero. | ||
244 | .Pp | ||
245 | .Fn EC_GROUP_get_cofactor | ||
246 | retrieves the cofactor of the | ||
247 | .Fa group | ||
248 | and copies its value into | ||
249 | .Fa cofactor . | ||
250 | It fails if the cofactor of the | ||
251 | .Fa group | ||
252 | is not set or set to zero. | ||
253 | .Pp | ||
254 | The functions | ||
255 | .Fn EC_GROUP_set_curve_name | ||
256 | and | ||
257 | .Fn EC_GROUP_get_curve_name | ||
258 | set and get the NID for the curve, respectively (see | ||
259 | .Xr EC_GROUP_new 3 ) . | ||
260 | If a curve does not have a NID associated with it, then | ||
261 | .Fn EC_GROUP_get_curve_name | ||
262 | will return | ||
263 | .Dv NID_undef . | ||
264 | .Pp | ||
265 | The asn1_flag value is used to determine whether the curve encoding | ||
266 | uses explicit parameters or a named curve using an ASN.1 OID: | ||
267 | many applications only support the latter form. | ||
268 | If asn1_flag is the default value | ||
269 | .Dv OPENSSL_EC_NAMED_CURVE , | ||
270 | then the named curve form is used and the parameters must have a | ||
271 | corresponding named curve NID set. | ||
272 | If asn1_flags is | ||
273 | .Dv OPENSSL_EC_EXPLICIT_CURVE , | ||
274 | the parameters are explicitly encoded. | ||
275 | The functions | ||
276 | .Fn EC_GROUP_get_asn1_flag | ||
277 | and | ||
278 | .Fn EC_GROUP_set_asn1_flag | ||
279 | get and set the status of the asn1_flag for the curve. | ||
280 | .Pp | ||
281 | The point_conversion_form for a curve controls how | ||
282 | .Vt EC_POINT | ||
283 | data is encoded as ASN.1 as defined in X9.62 (ECDSA). | ||
284 | .Vt point_conversion_form_t | ||
285 | is an enum defined as follows: | ||
286 | .Bd -literal | ||
287 | typedef enum { | ||
288 | /** the point is encoded as z||x, where the octet z specifies | ||
289 | * which solution of the quadratic equation y is */ | ||
290 | POINT_CONVERSION_COMPRESSED = 2, | ||
291 | /** the point is encoded as z||x||y, where z is the octet 0x04 */ | ||
292 | POINT_CONVERSION_UNCOMPRESSED = 4, | ||
293 | /** the point is encoded as z||x||y, where the octet z specifies | ||
294 | * which solution of the quadratic equation y is */ | ||
295 | POINT_CONVERSION_HYBRID = 6 | ||
296 | } point_conversion_form_t; | ||
297 | .Ed | ||
298 | .Pp | ||
299 | For | ||
300 | .Dv POINT_CONVERSION_UNCOMPRESSED | ||
301 | the point is encoded as an octet signifying the UNCOMPRESSED form | ||
302 | has been used followed by the octets for x, followed by the octets | ||
303 | for y. | ||
304 | .Pp | ||
305 | For any given x coordinate for a point on a curve it is possible to | ||
306 | derive two possible y values. | ||
307 | For | ||
308 | .Dv POINT_CONVERSION_COMPRESSED | ||
309 | the point is encoded as an octet signifying that the COMPRESSED | ||
310 | form has been used AND which of the two possible solutions for y | ||
311 | has been used, followed by the octets for x. | ||
312 | .Pp | ||
313 | For | ||
314 | .Dv POINT_CONVERSION_HYBRID | ||
315 | the point is encoded as an octet signifying the HYBRID form has | ||
316 | been used AND which of the two possible solutions for y has been | ||
317 | used, followed by the octets for x, followed by the octets for y. | ||
318 | .Pp | ||
319 | The functions | ||
320 | .Fn EC_GROUP_set_point_conversion_form | ||
321 | and | ||
322 | .Fn EC_GROUP_get_point_conversion_form | ||
323 | set and get the point_conversion_form for the curve, respectively. | ||
324 | .Pp | ||
325 | ANSI X9.62 (ECDSA standard) defines a method of generating the curve | ||
326 | parameter b from a random number. | ||
327 | This provides advantages in that a parameter obtained in this way is | ||
328 | highly unlikely to be susceptible to special purpose attacks, or have | ||
329 | any trapdoors in it. | ||
330 | If the seed is present for a curve then the b parameter was generated in | ||
331 | a verifiable fashion using that seed. | ||
332 | The OpenSSL EC library does not use this seed value but does enable you | ||
333 | to inspect it using | ||
334 | .Fn EC_GROUP_get0_seed . | ||
335 | This returns a pointer to a memory block containing the seed that was | ||
336 | used. | ||
337 | The length of the memory block can be obtained using | ||
338 | .Fn EC_GROUP_get_seed_len . | ||
339 | A number of the builtin curves within the library provide seed values | ||
340 | that can be obtained. | ||
341 | It is also possible to set a custom seed using | ||
342 | .Fn EC_GROUP_set_seed | ||
343 | and passing a pointer to a memory block, along with the length of | ||
344 | the seed. | ||
345 | Again, the EC library will not use this seed value, although it will be | ||
346 | preserved in any ASN.1 based communications. | ||
347 | .Pp | ||
348 | .Fn EC_GROUP_get_degree | ||
349 | gets the degree of the field. | ||
350 | For Fp fields this will be the number of bits in p. | ||
351 | For F2^m fields this will be the value m. | ||
352 | .Pp | ||
353 | The function | ||
354 | .Fn EC_GROUP_check_discriminant | ||
355 | calculates the discriminant for the curve and verifies that it is | ||
356 | valid. | ||
357 | For a curve defined over Fp the discriminant is given by the formula | ||
358 | 4*a^3 + 27*b^2 whilst for F2^m curves the discriminant is simply b. | ||
359 | In either case for the curve to be valid the discriminant must be | ||
360 | non-zero. | ||
361 | .Pp | ||
362 | The function | ||
363 | .Fn EC_GROUP_check | ||
364 | performs a number of checks on a curve to verify that it is valid. | ||
365 | Checks performed include verifying that the discriminant is non-zero; | ||
366 | that a generator has been defined; that the generator is on the curve | ||
367 | and has the correct order. | ||
368 | .Pp | ||
369 | .Fn EC_GROUP_cmp | ||
370 | compares | ||
371 | .Fa a | ||
372 | and | ||
373 | .Fa b | ||
374 | to determine whether they represent the same curve or not. | ||
375 | .Pp | ||
376 | .Fn EC_GROUP_get_basis_type | ||
377 | always returns 0 and is only provided for compatibility. | ||
378 | .Sh RETURN VALUES | ||
379 | The following functions return 1 on success or 0 on error: | ||
380 | .Fn EC_GROUP_copy , | ||
381 | .Fn EC_GROUP_set_generator , | ||
382 | .Fn EC_GROUP_check , | ||
383 | and | ||
384 | .Fn EC_GROUP_check_discriminant . | ||
385 | .Pp | ||
386 | .Fn EC_GROUP_dup | ||
387 | returns a pointer to the duplicated curve or | ||
388 | .Dv NULL | ||
389 | on error. | ||
390 | .Pp | ||
391 | .Fn EC_GROUP_get0_generator | ||
392 | returns the generator for the given curve or | ||
393 | .Dv NULL | ||
394 | on error. | ||
395 | .Pp | ||
396 | .Fn EC_GROUP_get_order | ||
397 | returns 0 if the order is not set or set to zero for the | ||
398 | .Fa group | ||
399 | or if copying into | ||
400 | .Fa order | ||
401 | fails, or 1 otherwise. | ||
402 | .Pp | ||
403 | .Fn EC_GROUP_order_bits | ||
404 | returns the number of bits in the group order. | ||
405 | .Pp | ||
406 | .Fn EC_GROUP_get_cofactor | ||
407 | returns 0 if the cofactor is not set or set to zero for the | ||
408 | .Fa group | ||
409 | or if copying into | ||
410 | .Fa cofactor | ||
411 | fails, or 1 otherwise. | ||
412 | .Pp | ||
413 | .Fn EC_GROUP_get_curve_name | ||
414 | returns the curve name (NID) for the | ||
415 | .Fa group | ||
416 | or | ||
417 | .Dv NID_undef | ||
418 | if no curve name is associated. | ||
419 | .Pp | ||
420 | .Fn EC_GROUP_get_asn1_flag | ||
421 | returns the ASN.1 flag for the specified | ||
422 | .Fa group . | ||
423 | .Pp | ||
424 | .Fn EC_GROUP_get_point_conversion_form | ||
425 | returns the point_conversion_form for the | ||
426 | .Fa group . | ||
427 | .Pp | ||
428 | .Fn EC_GROUP_get_degree | ||
429 | returns the degree for the | ||
430 | .Fa group | ||
431 | or 0 if the operation is not supported | ||
432 | by the underlying group implementation. | ||
433 | .Pp | ||
434 | .Fn EC_GROUP_get0_seed | ||
435 | returns a pointer to the seed that was used to generate the parameter | ||
436 | b, or | ||
437 | .Dv NULL | ||
438 | if the seed is not specified. | ||
439 | .Fn EC_GROUP_get_seed_len | ||
440 | returns the length of the seed or 0 if the seed is not specified. | ||
441 | .Pp | ||
442 | .Fn EC_GROUP_set_seed | ||
443 | returns the length of the seed that has been set. | ||
444 | If the supplied seed is | ||
445 | .Dv NULL | ||
446 | or the supplied seed length is 0, the return value will be 1. | ||
447 | On error 0 is returned. | ||
448 | .Pp | ||
449 | .Fn EC_GROUP_cmp | ||
450 | returns 0 if the curves are equal, 1 if they are not equal, | ||
451 | or -1 on error. | ||
452 | .Pp | ||
453 | .Fn EC_GROUP_get_basis_type | ||
454 | always returns 0. | ||
455 | .Sh SEE ALSO | ||
456 | .Xr d2i_ECPKParameters 3 , | ||
457 | .Xr EC_GROUP_new 3 , | ||
458 | .Xr EC_KEY_new 3 , | ||
459 | .Xr EC_POINT_add 3 , | ||
460 | .Xr EC_POINT_new 3 | ||
461 | .Sh HISTORY | ||
462 | .Fn EC_GROUP_copy , | ||
463 | .Fn EC_GROUP_set_generator , | ||
464 | .Fn EC_GROUP_get0_generator , | ||
465 | .Fn EC_GROUP_get_order , | ||
466 | and | ||
467 | .Fn EC_GROUP_get_cofactor | ||
468 | first appeared in OpenSSL 0.9.7 and have been available since | ||
469 | .Ox 3.2 . | ||
470 | .Pp | ||
471 | .Fn EC_GROUP_dup , | ||
472 | .Fn EC_GROUP_set_curve_name , | ||
473 | .Fn EC_GROUP_get_curve_name , | ||
474 | .Fn EC_GROUP_set_asn1_flag , | ||
475 | .Fn EC_GROUP_get_asn1_flag , | ||
476 | .Fn EC_GROUP_set_point_conversion_form , | ||
477 | .Fn EC_GROUP_get_point_conversion_form , | ||
478 | .Fn EC_GROUP_get0_seed , | ||
479 | .Fn EC_GROUP_get_seed_len , | ||
480 | .Fn EC_GROUP_set_seed , | ||
481 | .Fn EC_GROUP_get_degree , | ||
482 | .Fn EC_GROUP_check , | ||
483 | .Fn EC_GROUP_check_discriminant , | ||
484 | .Fn EC_GROUP_cmp , | ||
485 | and | ||
486 | .Fn EC_GROUP_get_basis_type | ||
487 | first appeared in OpenSSL 0.9.8 and have been available since | ||
488 | .Ox 4.5 . | ||
489 | .Pp | ||
490 | .Fn EC_GROUP_order_bits | ||
491 | first appeared in OpenSSL 1.1.0 and has been available since | ||
492 | .Ox 7.0 . | ||
diff --git a/src/lib/libcrypto/man/EC_GROUP_get_curve_name.3 b/src/lib/libcrypto/man/EC_GROUP_get_curve_name.3 new file mode 100644 index 0000000000..9a131fddfe --- /dev/null +++ b/src/lib/libcrypto/man/EC_GROUP_get_curve_name.3 | |||
@@ -0,0 +1,264 @@ | |||
1 | .\" $OpenBSD: EC_GROUP_get_curve_name.3,v 1.1 2025/04/25 19:57:12 tb Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .Dd $Mdocdate: April 25 2025 $ | ||
18 | .Dt EC_GROUP_GET_CURVE_NAME 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm EC_GROUP_get_curve_name , | ||
22 | .Nm EC_GROUP_set_curve_name , | ||
23 | .Nm EC_GROUP_get_asn1_flag , | ||
24 | .Nm EC_GROUP_set_asn1_flag , | ||
25 | .Nm EC_GROUP_get0_seed , | ||
26 | .Nm EC_GROUP_get_seed_len , | ||
27 | .Nm EC_GROUP_set_seed , | ||
28 | .Nm EC_GROUP_get_point_conversion_form , | ||
29 | .Nm EC_GROUP_set_point_conversion_form , | ||
30 | .Nm EC_GROUP_get_basis_type | ||
31 | .Nd configure and inspect details of the ASN.1 encoding of | ||
32 | .Vt EC_GROUP | ||
33 | and related objects | ||
34 | .Sh SYNOPSIS | ||
35 | .In openssl/ec.h | ||
36 | .Ft int | ||
37 | .Fo EC_GROUP_get_curve_name | ||
38 | .Fa "const EC_GROUP *group" | ||
39 | .Fc | ||
40 | .Ft void | ||
41 | .Fo EC_GROUP_set_curve_name | ||
42 | .Fa "EC_GROUP *group" | ||
43 | .Fa "int nid" | ||
44 | .Fc | ||
45 | .Ft int | ||
46 | .Fo EC_GROUP_get_asn1_flag | ||
47 | .Fa "const EC_GROUP *group" | ||
48 | .Fc | ||
49 | .Ft void | ||
50 | .Fo EC_GROUP_set_asn1_flag | ||
51 | .Fa "EC_GROUP *group" | ||
52 | .Fa "int flag" | ||
53 | .Fc | ||
54 | .Ft "unsigned char *" | ||
55 | .Fo EC_GROUP_get0_seed | ||
56 | .Fa "const EC_GROUP *group" | ||
57 | .Fc | ||
58 | .Ft size_t | ||
59 | .Fo EC_GROUP_get_seed_len | ||
60 | .Fa "const EC_GROUP *group" | ||
61 | .Fc | ||
62 | .Ft size_t | ||
63 | .Fo EC_GROUP_set_seed | ||
64 | .Fa "EC_GROUP *group" | ||
65 | .Fa "const unsigned char *seed" | ||
66 | .Fa "size_t len" | ||
67 | .Fc | ||
68 | .Bd -literal | ||
69 | typedef enum { | ||
70 | POINT_CONVERSION_COMPRESSED = 2, | ||
71 | POINT_CONVERSION_UNCOMPRESSED = 4, | ||
72 | POINT_CONVERSION_HYBRID = 6 | ||
73 | } point_conversion_form_t; | ||
74 | |||
75 | .Ed | ||
76 | .Ft point_conversion_form_t | ||
77 | .Fo EC_GROUP_get_point_conversion_form | ||
78 | .Fa "const EC_GROUP *group" | ||
79 | .Fc | ||
80 | .Fo void | ||
81 | .Ft EC_GROUP_set_point_conversion_form | ||
82 | .Fa "EC_GROUP *group" | ||
83 | .Fa "point_conversion_form_t form" | ||
84 | .Fc | ||
85 | .Pp | ||
86 | Deprecated: | ||
87 | .Ft int | ||
88 | .Fo EC_GROUP_get_basis_type | ||
89 | .Fa "const EC_GROUP *group" | ||
90 | .Fc | ||
91 | .Sh DESCRIPTION | ||
92 | The functions in this manual affect or allow the inspection of | ||
93 | the details of the ASN.1 encoding produced by the | ||
94 | .Xr i2d_ECPKParameters 3 | ||
95 | family of functions. | ||
96 | Modern applications use named curves and uncompressed point encoding, | ||
97 | which are the default for | ||
98 | .Xr EC_GROUP_new_by_curve_name 3 . | ||
99 | .Pp | ||
100 | In this library, Elliptic curve parameters are either encoded as a | ||
101 | .Em named curve , | ||
102 | using an ASN.1 Object Identifier (OID) to refer to | ||
103 | standardized parameters that need to be built into the library, | ||
104 | or using | ||
105 | .Em explicit curve parameters | ||
106 | where the field, the curve equation, the base point's coordinates | ||
107 | and other data are encoded explicitly. | ||
108 | The | ||
109 | .Em implicitly CA | ||
110 | variant is not supported. | ||
111 | .Pp | ||
112 | .Fn EC_GROUP_get_curve_name | ||
113 | gets the Numerical Identifier (NID) representation of the | ||
114 | ASN.1 Object Identifier used for the named curve encoding of | ||
115 | .Fa group . | ||
116 | .Fn EC_GROUP_set_curve_name | ||
117 | sets it to | ||
118 | .Fa nid . | ||
119 | .Pp | ||
120 | .Fn EC_GROUP_get_asn1_flag | ||
121 | retrieves the value of the | ||
122 | .Fa asn1_flag | ||
123 | member of | ||
124 | .Fa group . | ||
125 | If the bit corresponding to | ||
126 | .Dv OPENSSL_EC_NAMED_CURVE | ||
127 | is set, named curve encoding is used for | ||
128 | .Fa group , | ||
129 | otherwise explicit encoding is used. | ||
130 | .Fn EC_GROUP_set_asn1_flag | ||
131 | sets the | ||
132 | .Fa asn1_flag | ||
133 | member of group to | ||
134 | .Fa flag , | ||
135 | which should be either | ||
136 | .Dv OPENSSL_EC_NAMED_CURVE | ||
137 | to use named curve encoding or | ||
138 | .Dv OPENSSL_EC_EXPLICIT_CURVE | ||
139 | to use explicit encoding. | ||
140 | .Pp | ||
141 | The ASN.1 encoding of explicit curve parameters includes | ||
142 | an optional seed value for parameters generated verifiably at random. | ||
143 | If a seed value is set on | ||
144 | .Fa group , | ||
145 | .Fn EC_GROUP_get0_seed | ||
146 | returns a pointer to the internal byte string whose length is returned by | ||
147 | .Fn EC_GROUP_get_seed_len . | ||
148 | .Pp | ||
149 | .Fn EC_GROUP_set_seed | ||
150 | first clears any seed and length already stored in | ||
151 | .Fa group . | ||
152 | If | ||
153 | .Fa seed | ||
154 | is not | ||
155 | .Dv NULL | ||
156 | and | ||
157 | .Fa len | ||
158 | is not zero, it stores a copy of them in | ||
159 | .Fa group . | ||
160 | The | ||
161 | .Fa seed | ||
162 | should be a random byte string of | ||
163 | .Fa len | ||
164 | at least 20 bytes. | ||
165 | The seed can be unset by passing | ||
166 | .Dv NULL | ||
167 | as a | ||
168 | .Fa seed | ||
169 | and a | ||
170 | .Fa len | ||
171 | of zero. | ||
172 | The library does not perform any computation or validation with this seed, | ||
173 | it only includes it in its ASN.1 encoded parameters, | ||
174 | whether it contains a sensible value or not. | ||
175 | .Pp | ||
176 | Points on an elliptic curve, such as the generator or a public key, | ||
177 | can be encoded in compressed form, uncompressed form, | ||
178 | or in a hybrid form encompassing both, see | ||
179 | .Xr EC_POINT_point2oct 3 . | ||
180 | .Fn EC_GROUP_get_point_conversion_form | ||
181 | retrieves the encoding used for points on | ||
182 | .Fa group | ||
183 | and | ||
184 | .Fn EC_GROUP_set_point_conversion_form | ||
185 | sets it to | ||
186 | .Fa form . | ||
187 | .Pp | ||
188 | The deprecated | ||
189 | .Fn EC_GROUP_get_basis_type | ||
190 | only makes sense for curves over binary fields. | ||
191 | It is provided for compatibility only. | ||
192 | .Sh RETURN VALUES | ||
193 | .Fn EC_GROUP_get_curve_name | ||
194 | returns the NID to be used for named curve encoding of | ||
195 | .Fa group | ||
196 | or | ||
197 | .Dv NID_undef | ||
198 | if no NID is set. | ||
199 | .Pp | ||
200 | .Fn EC_GROUP_get_asn1_flag | ||
201 | returns the value most recently set by | ||
202 | .Fn EC_GROUP_set_asn1_flag | ||
203 | on | ||
204 | .Fa group . | ||
205 | .Pp | ||
206 | .Fn EC_GROUP_get0_seed | ||
207 | returns an internal pointer to the | ||
208 | .Fa seed | ||
209 | on | ||
210 | .Fa group | ||
211 | or | ||
212 | .Dv NULL | ||
213 | if none is set. | ||
214 | .Pp | ||
215 | .Fn EC_GROUP_get_seed_len | ||
216 | returns the byte length of the seed set on | ||
217 | .Fa group | ||
218 | or zero if none is set. | ||
219 | .Pp | ||
220 | .Fn EC_GROUP_set_seed | ||
221 | returns 0 on memory allocation failure. | ||
222 | It returns | ||
223 | .Fa len | ||
224 | on success unless | ||
225 | .Fa seed | ||
226 | is | ||
227 | .Dv NULL | ||
228 | or | ||
229 | .Fa len | ||
230 | is zero, in which case it returns 1. | ||
231 | .Pp | ||
232 | .Fn EC_GROUP_get_point_conversion_form | ||
233 | returns the point conversion form last set by | ||
234 | .Fn EC_GROUP_set_point_conversion_form | ||
235 | on | ||
236 | .Fa group . | ||
237 | .Pp | ||
238 | .Fn EC_GROUP_get_basis_type | ||
239 | always returns | ||
240 | .Dv NID_undef . | ||
241 | .Sh SEE ALSO | ||
242 | .Xr crypto 3 , | ||
243 | .Xr d2i_ECPKParameters 3 , | ||
244 | .Xr EC_GROUP_check 3 , | ||
245 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
246 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
247 | .Xr EC_KEY_METHOD_new 3 , | ||
248 | .Xr EC_KEY_new 3 , | ||
249 | .Xr EC_POINT_add 3 , | ||
250 | .Xr EC_POINT_get_affine_coordinates 3 , | ||
251 | .Xr EC_POINT_new 3 , | ||
252 | .Xr EC_POINT_point2oct 3 , | ||
253 | .Xr ECDH_compute_key 3 , | ||
254 | .Xr ECDSA_SIG_new 3 , | ||
255 | .Xr OBJ_obj2nid 3 | ||
256 | .Sh HISTORY | ||
257 | These functions first appeared in OpenSSL 0.9.8 and have been available since | ||
258 | .Ox 4.5 . | ||
259 | .Sh BUGS | ||
260 | Most of the setters cannot report errors and none of them perform proper | ||
261 | input validation and accept most of the values passed in. | ||
262 | This can result in invalid or nonsensical ASN.1 encoding produced by | ||
263 | .Xr i2d_ECPKParameters 3 | ||
264 | and related functions. | ||
diff --git a/src/lib/libcrypto/man/EC_GROUP_new.3 b/src/lib/libcrypto/man/EC_GROUP_new.3 deleted file mode 100644 index 83e3e4c870..0000000000 --- a/src/lib/libcrypto/man/EC_GROUP_new.3 +++ /dev/null | |||
@@ -1,353 +0,0 @@ | |||
1 | .\" $OpenBSD: EC_GROUP_new.3,v 1.18 2025/03/08 16:38:13 tb Exp $ | ||
2 | .\" OpenSSL 6328d367 Sat Jul 4 21:58:30 2020 +0200 | ||
3 | .\" | ||
4 | .\" This file was written by Matt Caswell <matt@openssl.org>. | ||
5 | .\" Copyright (c) 2013 The OpenSSL Project. All rights reserved. | ||
6 | .\" | ||
7 | .\" Redistribution and use in source and binary forms, with or without | ||
8 | .\" modification, are permitted provided that the following conditions | ||
9 | .\" are met: | ||
10 | .\" | ||
11 | .\" 1. Redistributions of source code must retain the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer. | ||
13 | .\" | ||
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
15 | .\" notice, this list of conditions and the following disclaimer in | ||
16 | .\" the documentation and/or other materials provided with the | ||
17 | .\" distribution. | ||
18 | .\" | ||
19 | .\" 3. All advertising materials mentioning features or use of this | ||
20 | .\" software must display the following acknowledgment: | ||
21 | .\" "This product includes software developed by the OpenSSL Project | ||
22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
23 | .\" | ||
24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
25 | .\" endorse or promote products derived from this software without | ||
26 | .\" prior written permission. For written permission, please contact | ||
27 | .\" openssl-core@openssl.org. | ||
28 | .\" | ||
29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
31 | .\" permission of the OpenSSL Project. | ||
32 | .\" | ||
33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
34 | .\" acknowledgment: | ||
35 | .\" "This product includes software developed by the OpenSSL Project | ||
36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
37 | .\" | ||
38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
50 | .\" | ||
51 | .Dd $Mdocdate: March 8 2025 $ | ||
52 | .Dt EC_GROUP_NEW 3 | ||
53 | .Os | ||
54 | .Sh NAME | ||
55 | .Nm EC_GROUP_new , | ||
56 | .Nm EC_GROUP_free , | ||
57 | .Nm EC_GROUP_clear_free , | ||
58 | .Nm EC_GROUP_new_curve_GFp , | ||
59 | .Nm EC_GROUP_new_by_curve_name , | ||
60 | .Nm EC_GROUP_set_curve , | ||
61 | .Nm EC_GROUP_get_curve , | ||
62 | .Nm EC_GROUP_set_curve_GFp , | ||
63 | .Nm EC_GROUP_get_curve_GFp , | ||
64 | .Nm EC_get_builtin_curves , | ||
65 | .Nm EC_curve_nid2nist , | ||
66 | .Nm EC_curve_nist2nid | ||
67 | .Nd create and destroy EC_GROUP objects | ||
68 | .Sh SYNOPSIS | ||
69 | .In openssl/ec.h | ||
70 | .In openssl/bn.h | ||
71 | .Ft EC_GROUP * | ||
72 | .Fo EC_GROUP_new | ||
73 | .Fa "const EC_METHOD *meth" | ||
74 | .Fc | ||
75 | .Ft void | ||
76 | .Fo EC_GROUP_free | ||
77 | .Fa "EC_GROUP *group" | ||
78 | .Fc | ||
79 | .Ft void | ||
80 | .Fo EC_GROUP_clear_free | ||
81 | .Fa "EC_GROUP *group" | ||
82 | .Fc | ||
83 | .Ft EC_GROUP * | ||
84 | .Fo EC_GROUP_new_curve_GFp | ||
85 | .Fa "const BIGNUM *p" | ||
86 | .Fa "const BIGNUM *a" | ||
87 | .Fa "const BIGNUM *b" | ||
88 | .Fa "BN_CTX *ctx" | ||
89 | .Fc | ||
90 | .Ft EC_GROUP * | ||
91 | .Fo EC_GROUP_new_by_curve_name | ||
92 | .Fa "int nid" | ||
93 | .Fc | ||
94 | .Ft int | ||
95 | .Fo EC_GROUP_set_curve | ||
96 | .Fa "EC_GROUP *group" | ||
97 | .Fa "const BIGNUM *p" | ||
98 | .Fa "const BIGNUM *a" | ||
99 | .Fa "const BIGNUM *b" | ||
100 | .Fa "BN_CTX *ctx" | ||
101 | .Fc | ||
102 | .Ft int | ||
103 | .Fo EC_GROUP_get_curve | ||
104 | .Fa "const EC_GROUP *group" | ||
105 | .Fa "BIGNUM *p" | ||
106 | .Fa "BIGNUM *a" | ||
107 | .Fa "BIGNUM *b" | ||
108 | .Fa "BN_CTX *ctx" | ||
109 | .Fc | ||
110 | .Ft int | ||
111 | .Fo EC_GROUP_set_curve_GFp | ||
112 | .Fa "EC_GROUP *group" | ||
113 | .Fa "const BIGNUM *p" | ||
114 | .Fa "const BIGNUM *a" | ||
115 | .Fa "const BIGNUM *b" | ||
116 | .Fa "BN_CTX *ctx" | ||
117 | .Fc | ||
118 | .Ft int | ||
119 | .Fo EC_GROUP_get_curve_GFp | ||
120 | .Fa "const EC_GROUP *group" | ||
121 | .Fa "BIGNUM *p" | ||
122 | .Fa "BIGNUM *a" | ||
123 | .Fa "BIGNUM *b" | ||
124 | .Fa "BN_CTX *ctx" | ||
125 | .Fc | ||
126 | .Ft size_t | ||
127 | .Fo EC_get_builtin_curves | ||
128 | .Fa "EC_builtin_curve *r" | ||
129 | .Fa "size_t nitems" | ||
130 | .Fc | ||
131 | .Ft "const char *" | ||
132 | .Fo EC_curve_nid2nist | ||
133 | .Fa "int nid" | ||
134 | .Fc | ||
135 | .Ft int | ||
136 | .Fo EC_curve_nist2nid | ||
137 | .Fa "const char *name" | ||
138 | .Fc | ||
139 | .Sh DESCRIPTION | ||
140 | The EC library provides functions for performing operations on | ||
141 | elliptic curves in Weierstrass form. | ||
142 | Such curves are defined over the prime field of order | ||
143 | .Fa p | ||
144 | and satisfy the Weierstrass equation with coefficients | ||
145 | .Fa a | ||
146 | and | ||
147 | .Fa b | ||
148 | .Pp | ||
149 | .Dl y^2 = x^3 + ax + b | ||
150 | .Pp | ||
151 | An | ||
152 | .Vt EC_GROUP | ||
153 | structure is used to represent the definition of an elliptic curve. | ||
154 | A new curve can be constructed by calling | ||
155 | .Fn EC_GROUP_new , | ||
156 | using the implementation provided by | ||
157 | .Fa meth . | ||
158 | It is then necessary to call | ||
159 | .Fn EC_GROUP_set_curve | ||
160 | to set the curve parameters. | ||
161 | .Pp | ||
162 | .Fn EC_GROUP_set_curve | ||
163 | sets the curve parameters | ||
164 | .Fa p , | ||
165 | .Fa a , | ||
166 | and | ||
167 | .Fa b , | ||
168 | where | ||
169 | .Fa a | ||
170 | and | ||
171 | .Fa b | ||
172 | represent the coefficients of the curve equation. | ||
173 | .Pp | ||
174 | .Fn EC_GROUP_set_curve_GFp | ||
175 | is a deprecated synonym for | ||
176 | .Fn EC_GROUP_set_curve . | ||
177 | .Pp | ||
178 | .Fn EC_GROUP_get_curve | ||
179 | obtains the previously set curve parameters. | ||
180 | .Pp | ||
181 | .Fn EC_GROUP_get_curve_GFp | ||
182 | is a deprecated synonym for | ||
183 | .Fn EC_GROUP_get_curve . | ||
184 | .Pp | ||
185 | The function | ||
186 | .Fn EC_GROUP_new_curve_GFp | ||
187 | is a shortcut for calling | ||
188 | .Fn EC_GROUP_new | ||
189 | and | ||
190 | .Fn EC_GROUP_set_curve . | ||
191 | An appropriate default implementation method will be used. | ||
192 | .Pp | ||
193 | Whilst the library can be used to create any curve using the functions | ||
194 | described above, there are also a number of predefined curves that are | ||
195 | available. | ||
196 | In order to obtain a list of all of the predefined curves, call the | ||
197 | function | ||
198 | .Fn EC_get_builtin_curves . | ||
199 | The parameter | ||
200 | .Fa r | ||
201 | should be an array of | ||
202 | .Vt EC_builtin_cure | ||
203 | structures of size | ||
204 | .Fa nitems . | ||
205 | The function will populate the | ||
206 | .Fa r | ||
207 | array with information about the builtin curves. | ||
208 | If | ||
209 | .Fa nitems | ||
210 | is less than the total number of curves available, then the first | ||
211 | .Fa nitems | ||
212 | curves will be returned. | ||
213 | Otherwise the total number of curves will be provided. | ||
214 | The return value is the total number of curves available (whether that | ||
215 | number has been populated in | ||
216 | .Fa r | ||
217 | or not). | ||
218 | Passing a | ||
219 | .Dv NULL | ||
220 | .Fa r , | ||
221 | or setting | ||
222 | .Fa nitems | ||
223 | to 0, will do nothing other than return the total number of curves | ||
224 | available. | ||
225 | The | ||
226 | .Vt EC_builtin_curve | ||
227 | structure is defined as follows: | ||
228 | .Bd -literal | ||
229 | typedef struct { | ||
230 | int nid; | ||
231 | const char *comment; | ||
232 | } EC_builtin_curve; | ||
233 | .Ed | ||
234 | .Pp | ||
235 | Each | ||
236 | .Vt EC_builtin_curve | ||
237 | item has a unique integer ID | ||
238 | .Pq Fa nid | ||
239 | and a human readable comment string describing the curve. | ||
240 | .Pp | ||
241 | In order to construct a builtin curve, use the function | ||
242 | .Fn EC_GROUP_new_by_curve_name | ||
243 | and provide the | ||
244 | .Fa nid | ||
245 | of the curve to be constructed. | ||
246 | .Pp | ||
247 | .Fn EC_GROUP_free | ||
248 | frees the memory associated with the | ||
249 | .Vt EC_GROUP . | ||
250 | If | ||
251 | .Fa group | ||
252 | is a | ||
253 | .Dv NULL | ||
254 | pointer, no action occurs. | ||
255 | .Pp | ||
256 | .Fn EC_GROUP_clear_free | ||
257 | destroys any sensitive data held within the | ||
258 | .Vt EC_GROUP | ||
259 | and then frees its memory. | ||
260 | If | ||
261 | .Fa group | ||
262 | is a | ||
263 | .Dv NULL | ||
264 | pointer, no action occurs. | ||
265 | .Pp | ||
266 | Some builtin curves can be identified by their NIST name | ||
267 | in addition to a numerical identifier (NID). | ||
268 | .Fn EC_curve_nid2nist | ||
269 | and | ||
270 | .Fn EC_curve_nist2nid | ||
271 | translate between the two. | ||
272 | The five built-in prime curves are: | ||
273 | .Pp | ||
274 | .Bl -column "NIST name" NID_X9_62_prime256v1 "deprecated in SP800-186" -compact | ||
275 | .It No NIST Fa name Ta Em ASN.1 NID Ta Em notes | ||
276 | .It Qq P-192 Ta Dv NID_X9_62_prime192v1 Ta No deprecated in SP800-186 | ||
277 | .It Qq P-224 Ta Dv NID_secp224r1 Ta | ||
278 | .It Qq P-256 Ta Dv NID_X9_62_prime256v1 Ta | ||
279 | .It Qq P-384 Ta Dv NID_secp384r1 Ta | ||
280 | .It Qq P-521 Ta Dv NID_secp521r1 Ta | ||
281 | .El | ||
282 | .Pp | ||
283 | .Fn EC_curve_nid2nist | ||
284 | and | ||
285 | .Fn EC_curve_nist2nid | ||
286 | also accept the ten binary curves defined in FIPS\& 186-4 | ||
287 | and deprecated in SP800-186, | ||
288 | although they no longer correspond to builtin curves in LibreSSL. | ||
289 | .Sh RETURN VALUES | ||
290 | All | ||
291 | .Fn EC_GROUP_new* | ||
292 | functions return a pointer to the newly constructed group or | ||
293 | .Dv NULL | ||
294 | on error. | ||
295 | .Pp | ||
296 | .Fn EC_get_builtin_curves | ||
297 | returns the number of builtin curves that are available. | ||
298 | .Pp | ||
299 | .Fn EC_curve_nid2nist | ||
300 | returns a string constant containing the NIST name if | ||
301 | .Fa nid | ||
302 | identifies a NIST curve or | ||
303 | .Dv NULL | ||
304 | otherwise. | ||
305 | .Pp | ||
306 | .Fn EC_curve_nist2nid | ||
307 | returns the NID corresponding to the NIST curve | ||
308 | .Fa name , | ||
309 | or | ||
310 | .Dv NID_undef . | ||
311 | .Pp | ||
312 | .Fn EC_GROUP_set_curve , | ||
313 | .Fn EC_GROUP_get_curve , | ||
314 | .Fn EC_GROUP_set_curve_GFp , | ||
315 | and | ||
316 | .Fn EC_GROUP_get_curve_GFp | ||
317 | return 1 on success or 0 on error. | ||
318 | .Sh SEE ALSO | ||
319 | .Xr crypto 3 , | ||
320 | .Xr d2i_ECPKParameters 3 , | ||
321 | .Xr EC_GROUP_copy 3 , | ||
322 | .Xr EC_KEY_new 3 , | ||
323 | .Xr EC_POINT_add 3 , | ||
324 | .Xr EC_POINT_new 3 , | ||
325 | .Xr ECDH_compute_key 3 , | ||
326 | .Xr ECDSA_SIG_new 3 | ||
327 | .Sh HISTORY | ||
328 | .Fn EC_GROUP_new , | ||
329 | .Fn EC_GROUP_free , | ||
330 | .Fn EC_GROUP_clear_free , | ||
331 | .Fn EC_GROUP_new_curve_GFp , | ||
332 | .Fn EC_GROUP_set_curve_GFp , | ||
333 | and | ||
334 | .Fn EC_GROUP_get_curve_GFp | ||
335 | first appeared in OpenSSL 0.9.7 and have been available since | ||
336 | .Ox 3.2 . | ||
337 | .Pp | ||
338 | .Fn EC_GROUP_new_by_curve_name | ||
339 | and | ||
340 | .Fn EC_get_builtin_curves | ||
341 | first appeared in OpenSSL 0.9.8 and have been available since | ||
342 | .Ox 4.5 . | ||
343 | .Fn EC_curve_nid2nist , | ||
344 | and | ||
345 | .Fn EC_curve_nist2nid | ||
346 | first appeared in OpenSSL 1.1.0 and have been available since | ||
347 | .Ox 5.8 . | ||
348 | .Pp | ||
349 | .Fn EC_GROUP_set_curve | ||
350 | and | ||
351 | .Fn EC_GROUP_get_curve | ||
352 | first appeared in OpenSSL 1.1.1 and have been available since | ||
353 | .Ox 7.0 . | ||
diff --git a/src/lib/libcrypto/man/EC_GROUP_new_by_curve_name.3 b/src/lib/libcrypto/man/EC_GROUP_new_by_curve_name.3 new file mode 100644 index 0000000000..128b30eda5 --- /dev/null +++ b/src/lib/libcrypto/man/EC_GROUP_new_by_curve_name.3 | |||
@@ -0,0 +1,310 @@ | |||
1 | .\" $OpenBSD: EC_GROUP_new_by_curve_name.3,v 1.1 2025/04/25 19:57:12 tb Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2024, 2025 Theo Buehler <tb@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .Dd $Mdocdate: April 25 2025 $ | ||
18 | .Dt EC_GROUP_NEW_BY_CURVE_NAME 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm EC_GROUP_new_by_curve_name , | ||
22 | .Nm EC_GROUP_free , | ||
23 | .Nm EC_GROUP_dup , | ||
24 | .Nm EC_GROUP_cmp , | ||
25 | .Nm EC_get_builtin_curves , | ||
26 | .Nm EC_curve_nid2nist , | ||
27 | .Nm EC_curve_nist2nid | ||
28 | .Nd instantiate named curves built into libcrypto | ||
29 | .Sh SYNOPSIS | ||
30 | .In openssl/bn.h | ||
31 | .In openssl/ec.h | ||
32 | .In openssl/objects.h | ||
33 | .Ft "EC_GROUP *" | ||
34 | .Fo EC_GROUP_new_by_curve_name | ||
35 | .Fa "int nid" | ||
36 | .Fc | ||
37 | .Ft void | ||
38 | .Fo EC_GROUP_free | ||
39 | .Fa "EC_GROUP *group" | ||
40 | .Fc | ||
41 | .Ft EC_GROUP * | ||
42 | .Fo EC_GROUP_dup | ||
43 | .Fa "const EC_GROUP *group" | ||
44 | .Fc | ||
45 | .Ft int | ||
46 | .Fo EC_GROUP_cmp | ||
47 | .Fa "const EC_GROUP *group1" | ||
48 | .Fa "const EC_GROUP *group2" | ||
49 | .Fa "BN_CTX *ctx" | ||
50 | .Fc | ||
51 | .Bd -literal | ||
52 | typedef struct { | ||
53 | int nid; | ||
54 | const char *comment; | ||
55 | } EC_builtin_curve; | ||
56 | |||
57 | .Ed | ||
58 | .Ft size_t | ||
59 | .Fo EC_get_builtin_curves | ||
60 | .Fa "EC_builtin_curve *curves" | ||
61 | .Fa "size_t ncurves" | ||
62 | .Fc | ||
63 | .Ft int | ||
64 | .Fo EC_curve_nist2nid | ||
65 | .Fa "const char *name" | ||
66 | .Fc | ||
67 | .Ft "const char *" | ||
68 | .Fo EC_curve_nid2nist | ||
69 | .Fa "int nid" | ||
70 | .Fc | ||
71 | .Sh DESCRIPTION | ||
72 | Most elliptic curves used in cryptographic protocols have a | ||
73 | standardized representation as a | ||
74 | .Em named curve , | ||
75 | where an ASN.1 Object Identifier (OID) is used instead of | ||
76 | detailed domain parameters. | ||
77 | This OID is represented internally by a Numerical Identifier (NID), | ||
78 | and the parameters themselves must be built into the library. | ||
79 | In the EC library the | ||
80 | .Em curve name | ||
81 | refers to this NID. | ||
82 | .Pp | ||
83 | .Fn EC_GROUP_new_by_curve_name | ||
84 | returns a new | ||
85 | .Vt EC_GROUP | ||
86 | object representing the named curve corresponding to | ||
87 | .Fa nid , | ||
88 | using the parameters built into the library. | ||
89 | It is equivalent to passing the appropriate parameters to | ||
90 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
91 | .Xr EC_GROUP_set_curve_name 3 , | ||
92 | .Xr EC_GROUP_set_generator 3 | ||
93 | and | ||
94 | .Xr EC_GROUP_set_seed 3 . | ||
95 | .Pp | ||
96 | .Fn EC_GROUP_free | ||
97 | frees | ||
98 | .Fa group | ||
99 | and all the memory associated with it. | ||
100 | If | ||
101 | .Fa group | ||
102 | is | ||
103 | .Dv NULL , | ||
104 | no action occurs. | ||
105 | .Pp | ||
106 | .Fn EC_GROUP_dup | ||
107 | creates a deep copy of | ||
108 | .Fa group . | ||
109 | .Pp | ||
110 | .Fn EC_GROUP_cmp | ||
111 | is intended to determine whether | ||
112 | .Fa group1 | ||
113 | and | ||
114 | .Fa group2 | ||
115 | represent the same elliptic curve, | ||
116 | making use of the optional | ||
117 | .Fa ctx . | ||
118 | If the curve name is set on both curves, they are compared as integers, | ||
119 | then the prime field, | ||
120 | the coefficients of the Weierstrass equation, | ||
121 | the generators, their order and their cofactors are compared | ||
122 | using | ||
123 | .Xr BN_cmp 3 | ||
124 | or | ||
125 | .Xr EC_POINT_cmp 3 , | ||
126 | respectively. | ||
127 | .Pp | ||
128 | .Fn EC_get_builtin_curves | ||
129 | returns the number of builtin curves. | ||
130 | If | ||
131 | .Fa curves | ||
132 | is | ||
133 | .Dv NULL | ||
134 | or | ||
135 | .Fa ncurves | ||
136 | is zero, it performs no other action. | ||
137 | Otherwise, after reducing | ||
138 | .Fa ncurves | ||
139 | to the number of builtin curves if necessary, | ||
140 | it copies the | ||
141 | .Fa nid | ||
142 | and a pointer to the | ||
143 | .Fa comment | ||
144 | of the first | ||
145 | .Fa ncurves | ||
146 | built-in curves to the array of | ||
147 | .Vt EC_builtin_curve | ||
148 | objects pointed to by | ||
149 | .Fa curves | ||
150 | and leaves the remainder of the array uninitialized. | ||
151 | .Pp | ||
152 | Some curves can be identified by their NIST name | ||
153 | in addition to the numerical identifier (NID). | ||
154 | .Fn EC_curve_nist2nid | ||
155 | and | ||
156 | .Fn EC_curve_nid2nist | ||
157 | translate between the two. | ||
158 | The builtin NIST curves over a prime field are: | ||
159 | .Pp | ||
160 | .Bl -column "NIST name" NID_X9_62_prime256v1 "deprecated in SP800-186" -compact | ||
161 | .It No NIST Fa name Ta Em ASN.1 NID Ta Em notes | ||
162 | .It Qq P-224 Ta Dv NID_secp224r1 Ta | ||
163 | .It Qq P-256 Ta Dv NID_X9_62_prime256v1 Ta also known as secp256r1 | ||
164 | .It Qq P-384 Ta Dv NID_secp384r1 Ta | ||
165 | .It Qq P-521 Ta Dv NID_secp521r1 Ta | ||
166 | .El | ||
167 | .Pp | ||
168 | .Fn EC_curve_nist2nid | ||
169 | and | ||
170 | .Fn EC_curve_nid2nist | ||
171 | also accept the binary curves defined in FIPS\& 186-4 | ||
172 | and deprecated in SP800-186, | ||
173 | as well as | ||
174 | .Qq P-192 | ||
175 | and | ||
176 | .Dv NID_X9_62_prime192v1 , | ||
177 | although all these no longer correspond to builtin curves in LibreSSL. | ||
178 | .Sh RETURN VALUES | ||
179 | .Fn EC_GROUP_new_by_curve_name | ||
180 | returns a newly allocated group or | ||
181 | .Dv NULL | ||
182 | if there is no built-in group with NID | ||
183 | .Fa nid , | ||
184 | or if memory allocation fails. | ||
185 | .Pp | ||
186 | .Fn EC_GROUP_dup | ||
187 | returns a newly allocated group or | ||
188 | .Dv NULL | ||
189 | if memory allocation fails. | ||
190 | .Pp | ||
191 | .Fn EC_GROUP_cmp | ||
192 | returns 1 if the groups are distinct, 0 if the groups are | ||
193 | considered identical and \-1 on memory allocation error. | ||
194 | .Pp | ||
195 | .Fn EC_get_builtin_curves | ||
196 | returns the number of builtin curves. | ||
197 | .Pp | ||
198 | .Fn EC_curve_nid2nist | ||
199 | returns a string constant containing the NIST name if | ||
200 | .Fa nid | ||
201 | identifies a NIST curve or | ||
202 | .Dv NULL | ||
203 | otherwise. | ||
204 | .Pp | ||
205 | .Fn EC_curve_nist2nid | ||
206 | returns the NID corresponding to the NIST curve | ||
207 | .Fa name , | ||
208 | or | ||
209 | .Dv NID_undef . | ||
210 | .Sh EXAMPLES | ||
211 | Print the list of builtin curves, their NIDs, their NIST name and | ||
212 | a comment describing each curve: | ||
213 | .Bd -literal | ||
214 | #include <err.h> | ||
215 | #include <stdio.h> | ||
216 | #include <stdlib.h> | ||
217 | #include <unistd.h> | ||
218 | |||
219 | #include <openssl/ec.h> | ||
220 | |||
221 | int | ||
222 | main(void) | ||
223 | { | ||
224 | EC_builtin_curve *curves; | ||
225 | size_t ncurves, i; | ||
226 | |||
227 | if (pledge("stdio", NULL) == -1) | ||
228 | err(1, "pledge"); | ||
229 | |||
230 | ncurves = EC_get_builtin_curves(NULL, 0); | ||
231 | if ((curves = calloc(ncurves, sizeof(*curves))) == NULL) | ||
232 | err(1, NULL); | ||
233 | (void)EC_get_builtin_curves(curves, ncurves); | ||
234 | |||
235 | printf("curve\etnid\etNIST\etcomment\en"); | ||
236 | for (i = 0; i < ncurves; i++) { | ||
237 | const char *nist_name = EC_curve_nid2nist(curves[i].nid); | ||
238 | |||
239 | printf("%2zu\et%d\et%s\et%s\en", i, curves[i].nid, | ||
240 | nist_name != NULL ? nist_name : "", curves[i].comment); | ||
241 | } | ||
242 | |||
243 | free(curves); | ||
244 | |||
245 | return 0; | ||
246 | } | ||
247 | .Ed | ||
248 | .Sh SEE ALSO | ||
249 | .Xr crypto 3 , | ||
250 | .Xr d2i_ECPKParameters 3 , | ||
251 | .Xr EC_GROUP_check 3 , | ||
252 | .Xr EC_GROUP_get_curve_name 3 , | ||
253 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
254 | .Xr EC_KEY_METHOD_new 3 , | ||
255 | .Xr EC_KEY_new 3 , | ||
256 | .Xr EC_POINT_add 3 , | ||
257 | .Xr EC_POINT_get_affine_coordinates 3 , | ||
258 | .Xr EC_POINT_new 3 , | ||
259 | .Xr EC_POINT_point2oct 3 , | ||
260 | .Xr ECDH_compute_key 3 , | ||
261 | .Xr ECDSA_SIG_new 3 , | ||
262 | .Xr OBJ_nid2obj 3 | ||
263 | .Sh STANDARDS | ||
264 | .Rs | ||
265 | .%T SEC 1: Elliptic Curve Cryptography, Version 2.0 | ||
266 | .%U https://www.secg.org/sec1-v2.pdf | ||
267 | .%D May 21, 2009 | ||
268 | .Re | ||
269 | .Pp | ||
270 | .Rs | ||
271 | .%T SEC 2: Recommended Elliptic Curve Domain Parameters, Version 2.0 | ||
272 | .%U https://www.secg.org/sec2-v2.pdf | ||
273 | .%D Jan 27, 2010 | ||
274 | .Re | ||
275 | .Sh HISTORY | ||
276 | .Fn EC_GROUP_free | ||
277 | first appeared in OpenSSL 0.9.7 and has been available since | ||
278 | .Ox 3.2 . | ||
279 | .Pp | ||
280 | .Fn EC_GROUP_new_by_curve_name , | ||
281 | .Fn EC_GROUP_cmp , | ||
282 | .Fn EC_GROUP_dup , | ||
283 | and | ||
284 | .Fn EC_get_builtin_curves | ||
285 | first appeared in OpenSSL 0.9.8 and have been available since | ||
286 | .Ox 4.5 . | ||
287 | .Pp | ||
288 | .Fn EC_curve_nid2nist | ||
289 | and | ||
290 | .Fn EC_curve_nist2nid | ||
291 | first appeared in OpenSSL 1.1.0 and have been available since | ||
292 | .Ox 5.8 . | ||
293 | .Sh BUGS | ||
294 | .Fn EC_GROUP_cmp | ||
295 | compares the coefficients of the Weierstrass equation as | ||
296 | integers, not as elements of the prime field. | ||
297 | It also treats the generator as mandatory while it is generally | ||
298 | optional in the EC library. | ||
299 | Aspects of the ASN.1 encoding controlled by the functions in | ||
300 | .Xr EC_GROUP_get_asn1_flag 3 , | ||
301 | in particular seed, ASN.1 flag, and point conversion form, | ||
302 | are ignored in the comparison. | ||
303 | Group objects may therefore compare as equal and produce | ||
304 | completely different ASN.1 encodings via | ||
305 | .Xr i2d_ECPKParameters 3 | ||
306 | and related functions. | ||
307 | In fact, either of these encodings might be valid or not, | ||
308 | accepted or rejected by | ||
309 | .Xr d2i_ECPKParameters 3 , | ||
310 | or the encoding might fail on one or both of the group objects. | ||
diff --git a/src/lib/libcrypto/man/EC_GROUP_new_curve_GFp.3 b/src/lib/libcrypto/man/EC_GROUP_new_curve_GFp.3 new file mode 100644 index 0000000000..f13c969c28 --- /dev/null +++ b/src/lib/libcrypto/man/EC_GROUP_new_curve_GFp.3 | |||
@@ -0,0 +1,450 @@ | |||
1 | .\" $OpenBSD: EC_GROUP_new_curve_GFp.3,v 1.1 2025/04/25 19:57:12 tb Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .Dd $Mdocdate: April 25 2025 $ | ||
18 | .Dt EC_GROUP_NEW_CURVE_GFP 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm EC_GROUP_new_curve_GFp , | ||
22 | .Nm EC_GROUP_set_curve , | ||
23 | .Nm EC_GROUP_get_curve , | ||
24 | .Nm EC_GROUP_set_generator , | ||
25 | .Nm EC_GROUP_get0_generator , | ||
26 | .Nm EC_GROUP_get_degree , | ||
27 | .Nm EC_GROUP_get_order , | ||
28 | .Nm EC_GROUP_order_bits , | ||
29 | .Nm EC_GROUP_get_cofactor , | ||
30 | .Nm EC_GROUP_clear_free , | ||
31 | .Nm EC_GROUP_set_curve_GFp , | ||
32 | .Nm EC_GROUP_get_curve_GFp | ||
33 | .Nd define elliptic curves and retrieve information from them | ||
34 | .Sh SYNOPSIS | ||
35 | .In openssl/bn.h | ||
36 | .In openssl/ec.h | ||
37 | .Ft "EC_GROUP *" | ||
38 | .Fo EC_GROUP_new_curve_GFp | ||
39 | .Fa "const BIGNUM *p" | ||
40 | .Fa "const BIGNUM *a" | ||
41 | .Fa "const BIGNUM *b" | ||
42 | .Fa "BN_CTX *ctx" | ||
43 | .Fc | ||
44 | .Ft int | ||
45 | .Fo EC_GROUP_set_curve | ||
46 | .Fa "EC_GROUP *group" | ||
47 | .Fa "const BIGNUM *p" | ||
48 | .Fa "const BIGNUM *a" | ||
49 | .Fa "const BIGNUM *b" | ||
50 | .Fa "BN_CTX *ctx" | ||
51 | .Fc | ||
52 | .Ft int | ||
53 | .Fo EC_GROUP_get_curve | ||
54 | .Fa "const EC_GROUP *group" | ||
55 | .Fa "BIGNUM *p" | ||
56 | .Fa "BIGNUM *a" | ||
57 | .Fa "BIGNUM *b" | ||
58 | .Fa "BN_CTX *ctx" | ||
59 | .Fc | ||
60 | .Ft int | ||
61 | .Fo EC_GROUP_set_generator | ||
62 | .Fa "EC_GROUP *group" | ||
63 | .Fa "const EC_POINT *generator" | ||
64 | .Fa "const BIGNUM *order" | ||
65 | .Fa "const BIGNUM *cofactor" | ||
66 | .Fc | ||
67 | .Ft "const EC_POINT *" | ||
68 | .Fo EC_GROUP_get0_generator | ||
69 | .Fa "const EC_GROUP *group" | ||
70 | .Fc | ||
71 | .Ft int | ||
72 | .Fo EC_GROUP_get_degree | ||
73 | .Fa "const EC_GROUP *" | ||
74 | .Fc | ||
75 | .Ft int | ||
76 | .Fo EC_GROUP_get_order | ||
77 | .Fa "const EC_GROUP *group" | ||
78 | .Fa "BIGNUM *order" | ||
79 | .Fa "BN_CTX *ctx" | ||
80 | .Fc | ||
81 | .Ft int | ||
82 | .Fo EC_GROUP_order_bits | ||
83 | .Fa "const EC_GROUP *group" | ||
84 | .Fc | ||
85 | .Ft int | ||
86 | .Fo EC_GROUP_get_cofactor | ||
87 | .Fa "const EC_GROUP *group" | ||
88 | .Fa "BIGNUM *cofactor" | ||
89 | .Fa "BN_CTX *ctx" | ||
90 | .Fc | ||
91 | .Pp | ||
92 | Deprecated: | ||
93 | .Pp | ||
94 | .Ft void | ||
95 | .Fo EC_GROUP_clear_free | ||
96 | .Fa "EC_GROUP *group" | ||
97 | .Fc | ||
98 | .Ft int | ||
99 | .Fo EC_GROUP_set_curve_GFp | ||
100 | .Fa "EC_GROUP *group" | ||
101 | .Fa "const BIGNUM *p" | ||
102 | .Fa "const BIGNUM *a" | ||
103 | .Fa "const BIGNUM *b" | ||
104 | .Fa "BN_CTX *ctx" | ||
105 | .Fc | ||
106 | .Ft int | ||
107 | .Fo EC_GROUP_get_curve_GFp | ||
108 | .Fa "const EC_GROUP *group" | ||
109 | .Fa "BIGNUM *p" | ||
110 | .Fa "BIGNUM *a" | ||
111 | .Fa "BIGNUM *b" | ||
112 | .Fa "BN_CTX *ctx" | ||
113 | .Fc | ||
114 | .Sh DESCRIPTION | ||
115 | With the exception of the getters | ||
116 | the functions in this manual should not be used. | ||
117 | Use | ||
118 | .Xr EC_GROUP_new_by_curve_name 3 | ||
119 | instead. | ||
120 | .Pp | ||
121 | The EC library uses | ||
122 | .Vt EC_GROUP | ||
123 | objects to represent | ||
124 | elliptic curves in Weierstrass form. | ||
125 | These curves are defined over the prime field of order | ||
126 | .Fa p | ||
127 | via the Weierstrass equation | ||
128 | .Dl y^2 = x^3 + ax + b | ||
129 | where | ||
130 | .Fa a | ||
131 | and | ||
132 | .Fa b | ||
133 | are such that the discriminant 4a^3 - 27b^2 is non-zero. | ||
134 | .Pp | ||
135 | The points on an elliptic curve form a group. | ||
136 | Cryptographic applications usually depend on the choice of a | ||
137 | .Fa generator | ||
138 | whose multiples form a cyclic subgroup of a certain | ||
139 | .Fa order . | ||
140 | By Lagrange's theorem, the number of points on the elliptic curve is | ||
141 | the product of | ||
142 | .Fa order | ||
143 | and another integer called the | ||
144 | .Fa cofactor . | ||
145 | Hasse's theorem is the inequality | ||
146 | .Dl | Ns Fa order No * Fa cofactor No - (p + 1)| <= 2 sqrt(p) | ||
147 | which implies an upper bound on | ||
148 | .Fa order | ||
149 | in terms of | ||
150 | .Fa p | ||
151 | and allows the computation of | ||
152 | .Fa cofactor | ||
153 | provided that | ||
154 | .Fa order | ||
155 | is large enough. | ||
156 | .Pp | ||
157 | .Fn EC_GROUP_new_curve_GFp | ||
158 | instantiates a new | ||
159 | .Vt EC_GROUP | ||
160 | object over the prime field of size | ||
161 | .Fa p | ||
162 | with Weierstrass equation given by the coefficients | ||
163 | .Fa a | ||
164 | and | ||
165 | .Fa b . | ||
166 | The optional | ||
167 | .Fa ctx | ||
168 | is used to transform the other arguments into internal representation. | ||
169 | It is the caller's responsibility to ensure that | ||
170 | .Fa p | ||
171 | is a prime number greater than three and that | ||
172 | the discriminant is non-zero. | ||
173 | This can be done with | ||
174 | .Xr EC_GROUP_check_discriminant 3 | ||
175 | or as part of | ||
176 | .Xr EC_GROUP_check 3 | ||
177 | after | ||
178 | .Fn EC_GROUP_set_generator . | ||
179 | .Pp | ||
180 | .Fn EC_GROUP_set_curve | ||
181 | sets the curve parameters of | ||
182 | .Fa group | ||
183 | to | ||
184 | .Fa p , | ||
185 | .Fa a , | ||
186 | .Fa b | ||
187 | using the optional | ||
188 | .Fa ctx | ||
189 | and the comments in | ||
190 | .Fn EC_GROUP_new_curve_GFp | ||
191 | apply. | ||
192 | Existing | ||
193 | .Fa generator , | ||
194 | .Fa order , | ||
195 | or | ||
196 | .Fa cofactor | ||
197 | on | ||
198 | .Fa group | ||
199 | are left unmodified and become most likely invalid. | ||
200 | They must therefore be set to legitimate values using | ||
201 | .Fn EC_GROUP_set_generator . | ||
202 | .Pp | ||
203 | .Fn EC_GROUP_get_curve | ||
204 | copies the curve parameters of | ||
205 | .Fa group | ||
206 | into the caller-owned | ||
207 | .Fa p , | ||
208 | .Fa a , | ||
209 | and | ||
210 | .Fa b , | ||
211 | possibly making use of the | ||
212 | .Fa ctx | ||
213 | for conversion from internal representations. | ||
214 | Except for | ||
215 | .Fa group , | ||
216 | all arguments are optional. | ||
217 | .Pp | ||
218 | .Fn EC_GROUP_set_generator | ||
219 | performs sanity checks based on Hasse's theorem | ||
220 | and copies | ||
221 | .Fa generator , | ||
222 | .Fa order | ||
223 | and the optional | ||
224 | .Fa cofactor | ||
225 | into | ||
226 | .Fa group , | ||
227 | replacing all existing entries. | ||
228 | It is the caller's responsibility to ensure that | ||
229 | .Fa generator | ||
230 | is a point on the curve and that | ||
231 | .Fa order | ||
232 | is its order, | ||
233 | which can partially be accomplished with a subsequent call to | ||
234 | .Xr EC_GROUP_check 3 . | ||
235 | If | ||
236 | .Fa cofactor | ||
237 | is | ||
238 | .Dv NULL , | ||
239 | it can be computed on curves of cryptographic interest, | ||
240 | in which case | ||
241 | .Fa cofactor | ||
242 | is set to the computed value, otherwise it is set to zero. | ||
243 | .Pp | ||
244 | .Fn EC_GROUP_get0_generator | ||
245 | returns an internal pointer to the | ||
246 | .Fa group Ns 's | ||
247 | .Fa generator , | ||
248 | which may be | ||
249 | .Dv NULL | ||
250 | if no generator was set. | ||
251 | .Pp | ||
252 | .Fn EC_GROUP_get_degree | ||
253 | returns the bit length of the prime | ||
254 | .Fa p | ||
255 | set on | ||
256 | .Fa group . | ||
257 | .Pp | ||
258 | .Fn EC_GROUP_get_order | ||
259 | copies the value of the | ||
260 | .Fa group Ns 's | ||
261 | .Fa order | ||
262 | into the caller-owned | ||
263 | .Fa order , | ||
264 | returning failure if the | ||
265 | .Fa group Ns 's | ||
266 | .Fa order | ||
267 | is zero. | ||
268 | The | ||
269 | .Fa ctx | ||
270 | argument is ignored. | ||
271 | .Pp | ||
272 | .Fn EC_GROUP_order_bits | ||
273 | returns the number of bits in the | ||
274 | .Fa group Ns 's | ||
275 | .Fa order , | ||
276 | which is the result of calling | ||
277 | .Xr BN_num_bits 3 | ||
278 | on | ||
279 | .Fa order . | ||
280 | Unlike | ||
281 | .Fn EC_GROUP_get_order , | ||
282 | it does not fail if | ||
283 | .Fa order | ||
284 | is zero. | ||
285 | .Pp | ||
286 | .Fn EC_GROUP_get_cofactor | ||
287 | copies the value of the | ||
288 | .Fa group Ns 's | ||
289 | .Fa cofactor | ||
290 | into the caller-owned | ||
291 | .Fa cofactor , | ||
292 | returning failure if the | ||
293 | .Fa group Ns 's | ||
294 | .Fa cofactor | ||
295 | is zero. | ||
296 | The | ||
297 | .Fa ctx | ||
298 | argument is ignored. | ||
299 | .Pp | ||
300 | The deprecated | ||
301 | .Fn EC_GROUP_clear_free | ||
302 | uses | ||
303 | .Xr explicit_bzero 3 | ||
304 | and | ||
305 | .Xr freezero 3 | ||
306 | to clear and free all data associated with | ||
307 | .Fa group . | ||
308 | If | ||
309 | .Fa group | ||
310 | is | ||
311 | .Dv NULL , | ||
312 | no action occurs. | ||
313 | Since there is no secret data in | ||
314 | .Fa group , | ||
315 | this API is useless. | ||
316 | In LibreSSL, | ||
317 | .Xr EC_GROUP_free 3 | ||
318 | and | ||
319 | .Fn EC_GROUP_clear_free | ||
320 | behave identically. | ||
321 | .Pp | ||
322 | .Fn EC_GROUP_set_curve_GFp | ||
323 | and | ||
324 | .Fn EC_GROUP_get_curve_GFp | ||
325 | are deprecated aliases for | ||
326 | .Fn EC_GROUP_set_curve | ||
327 | and | ||
328 | .Fn EC_GROUP_get_curve , | ||
329 | respectively. | ||
330 | .Sh RETURN VALUES | ||
331 | .Fn EC_GROUP_new_curve_GFp | ||
332 | returns a newly allocated group or | ||
333 | .Dv NULL | ||
334 | if memory allocation fails, | ||
335 | or if some minimal sanity checks on | ||
336 | .Fa p , | ||
337 | .Fa a , | ||
338 | and | ||
339 | .Fa b | ||
340 | fail. | ||
341 | .Pp | ||
342 | .Fn EC_GROUP_set_curve | ||
343 | and | ||
344 | .Fn EC_GROUP_set_curve_GFp | ||
345 | return 1 on success and 0 on failure. | ||
346 | Failure conditions include that | ||
347 | .Fa p | ||
348 | is smaller than or equal to three, or even, or | ||
349 | memory allocation failure. | ||
350 | .Pp | ||
351 | .Fn EC_GROUP_get_curve | ||
352 | and | ||
353 | .Fn EC_GROUP_get_curve_GFp | ||
354 | return 1 on success and 0 on memory allocation failure. | ||
355 | .Pp | ||
356 | .Fn EC_GROUP_set_generator | ||
357 | returns 1 on success and 0 on memory allocation failure, or if | ||
358 | .Fa order | ||
359 | or | ||
360 | .Fa cofactor | ||
361 | are larger than Hasse's theorem allows. | ||
362 | .Fn EC_GROUP_get0_generator | ||
363 | returns an internal pointer to the | ||
364 | .Fa generator | ||
365 | or | ||
366 | .Dv NULL | ||
367 | if none was set on | ||
368 | .Fa group . | ||
369 | .Pp | ||
370 | .Fn EC_GROUP_get_order | ||
371 | returns 1 on success or 0 on memory allocation failure or if the | ||
372 | .Fa group Ns 's | ||
373 | order is set to | ||
374 | .Fa zero . | ||
375 | .Pp | ||
376 | .Fn EC_GROUP_get_degree , | ||
377 | .Fn EC_GROUP_order_bits , | ||
378 | and | ||
379 | .Fn EC_GROUP_get_cofactor | ||
380 | return the number of bits in the | ||
381 | .Fa group Ns 's | ||
382 | .Fa p , | ||
383 | .Fa order , | ||
384 | and | ||
385 | .Fa cofactor , | ||
386 | respectively. | ||
387 | .Sh SEE ALSO | ||
388 | .Xr BN_new 3 , | ||
389 | .Xr BN_num_bits 3 , | ||
390 | .Xr crypto 3 , | ||
391 | .Xr d2i_ECPKParameters 3 , | ||
392 | .Xr EC_GROUP_check 3 , | ||
393 | .Xr EC_GROUP_get_curve_name 3 , | ||
394 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
395 | .Xr EC_KEY_METHOD_new 3 , | ||
396 | .Xr EC_KEY_new 3 , | ||
397 | .Xr EC_POINT_add 3 , | ||
398 | .Xr EC_POINT_get_affine_coordinates 3 , | ||
399 | .Xr EC_POINT_new 3 , | ||
400 | .Xr EC_POINT_point2oct 3 , | ||
401 | .Xr ECDH_compute_key 3 , | ||
402 | .Xr ECDSA_SIG_new 3 | ||
403 | .Sh STANDARDS | ||
404 | .Rs | ||
405 | .%T SEC 1: Elliptic Curve Cryptography, Version 2.0 | ||
406 | .%U https://www.secg.org/sec1-v2.pdf | ||
407 | .%D May 21, 2009 | ||
408 | .Re | ||
409 | .Pp | ||
410 | .Rs | ||
411 | .%T SEC 2: Recommended Elliptic Curve Domain Parameters, Version 2.0 | ||
412 | .%U https://www.secg.org/sec2-v2.pdf | ||
413 | .%D Jan 27, 2010 | ||
414 | .Re | ||
415 | .Sh HISTORY | ||
416 | .Fn EC_GROUP_new_curve_GFp , | ||
417 | .Fn EC_GROUP_clear_free , | ||
418 | .Fn EC_GROUP_set_curve_GFp , | ||
419 | .Fn EC_GROUP_get_curve_GFp , | ||
420 | .Fn EC_GROUP_set_generator , | ||
421 | .Fn EC_GROUP_get0_generator , | ||
422 | .Fn EC_GROUP_get_order , | ||
423 | and | ||
424 | .Fn EC_GROUP_get_cofactor | ||
425 | first appeared in OpenSSL 0.9.7 and | ||
426 | have been available since | ||
427 | .Ox 3.2 . | ||
428 | .Pp | ||
429 | .Fn EC_GROUP_get_degree | ||
430 | first appeared in OpenSSL 0.9.8 and | ||
431 | has been available since | ||
432 | .Ox 4.5 . | ||
433 | .Pp | ||
434 | .Fn EC_GROUP_set_curve , | ||
435 | .Fn EC_GROUP_get_curve , | ||
436 | and | ||
437 | .Fn EC_GROUP_order_bits | ||
438 | first appeared in OpenSSL 1.1.1 and | ||
439 | have been available since | ||
440 | .Ox 7.0 | ||
441 | .Sh BUGS | ||
442 | Too many. | ||
443 | The API is unergonomic and the design is very poor even by | ||
444 | OpenSSL's standards. | ||
445 | Naming is inconsistent, especially in regards to the _GFp suffix | ||
446 | and the _get_ infix. | ||
447 | Function signatures are inconsistent. | ||
448 | In particular, functions that should have a | ||
449 | .Vt BN_CTX | ||
450 | argument don't have one and functions that don't need it have one. | ||
diff --git a/src/lib/libcrypto/man/EC_KEY_METHOD_new.3 b/src/lib/libcrypto/man/EC_KEY_METHOD_new.3 index 79c16ef014..5f5795d5cc 100644 --- a/src/lib/libcrypto/man/EC_KEY_METHOD_new.3 +++ b/src/lib/libcrypto/man/EC_KEY_METHOD_new.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: EC_KEY_METHOD_new.3,v 1.4 2024/07/21 08:36:43 tb Exp $ | 1 | .\" $OpenBSD: EC_KEY_METHOD_new.3,v 1.5 2025/04/25 19:57:12 tb Exp $ |
2 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> | 2 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> |
3 | .\" | 3 | .\" |
4 | .\" Permission to use, copy, modify, and distribute this software for any | 4 | .\" Permission to use, copy, modify, and distribute this software for any |
@@ -13,7 +13,7 @@ | |||
13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | .\" | 15 | .\" |
16 | .Dd $Mdocdate: July 21 2024 $ | 16 | .Dd $Mdocdate: April 25 2025 $ |
17 | .Dt EC_KEY_METHOD_NEW 3 | 17 | .Dt EC_KEY_METHOD_NEW 3 |
18 | .Os | 18 | .Os |
19 | .Sh NAME | 19 | .Sh NAME |
@@ -312,7 +312,16 @@ returns 1 for success or 0 for failure. | |||
312 | returns the EC_KEY implementation used by the given | 312 | returns the EC_KEY implementation used by the given |
313 | .Fa key . | 313 | .Fa key . |
314 | .Sh SEE ALSO | 314 | .Sh SEE ALSO |
315 | .Xr crypto 3 , | ||
316 | .Xr EC_GROUP_check 3 , | ||
317 | .Xr EC_GROUP_get_curve_name 3 , | ||
318 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
319 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
315 | .Xr EC_KEY_new 3 , | 320 | .Xr EC_KEY_new 3 , |
321 | .Xr EC_POINT_add 3 , | ||
322 | .Xr EC_POINT_get_affine_coordinates 3 , | ||
323 | .Xr EC_POINT_new 3 , | ||
324 | .Xr EC_POINT_point2oct 3 , | ||
316 | .Xr ECDSA_sign 3 | 325 | .Xr ECDSA_sign 3 |
317 | .Sh HISTORY | 326 | .Sh HISTORY |
318 | These functions first appeared in OpenSSL 1.1.0 | 327 | These functions first appeared in OpenSSL 1.1.0 |
diff --git a/src/lib/libcrypto/man/EC_KEY_new.3 b/src/lib/libcrypto/man/EC_KEY_new.3 index c24cb080ef..a2592a20ae 100644 --- a/src/lib/libcrypto/man/EC_KEY_new.3 +++ b/src/lib/libcrypto/man/EC_KEY_new.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: EC_KEY_new.3,v 1.21 2025/03/08 16:38:13 tb Exp $ | 1 | .\" $OpenBSD: EC_KEY_new.3,v 1.22 2025/04/25 19:57:12 tb Exp $ |
2 | .\" full merge up to: OpenSSL 3aef36ff Jan 5 13:06:03 2016 -0500 | 2 | .\" full merge up to: OpenSSL 3aef36ff Jan 5 13:06:03 2016 -0500 |
3 | .\" partial merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 3 | .\" partial merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
4 | .\" | 4 | .\" |
@@ -49,7 +49,7 @@ | |||
49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
51 | .\" | 51 | .\" |
52 | .Dd $Mdocdate: March 8 2025 $ | 52 | .Dd $Mdocdate: April 25 2025 $ |
53 | .Dt EC_KEY_NEW 3 | 53 | .Dt EC_KEY_NEW 3 |
54 | .Os | 54 | .Os |
55 | .Sh NAME | 55 | .Sh NAME |
@@ -234,7 +234,7 @@ and supplying the | |||
234 | .Fa nid | 234 | .Fa nid |
235 | of the associated curve. | 235 | of the associated curve. |
236 | Refer to | 236 | Refer to |
237 | .Xr EC_GROUP_new 3 | 237 | .Xr EC_GROUP_new_by_curve_name 3 |
238 | for a description of curve names. | 238 | for a description of curve names. |
239 | This function simply wraps calls to | 239 | This function simply wraps calls to |
240 | .Fn EC_KEY_new | 240 | .Fn EC_KEY_new |
@@ -357,7 +357,7 @@ The format of the external representation of the public key written by | |||
357 | such as whether it is stored in a compressed form or not, | 357 | such as whether it is stored in a compressed form or not, |
358 | is described by the point_conversion_form. | 358 | is described by the point_conversion_form. |
359 | See | 359 | See |
360 | .Xr EC_GROUP_copy 3 | 360 | .Xr EC_POINT_point2oct 3 |
361 | for a description of point_conversion_form. | 361 | for a description of point_conversion_form. |
362 | .Pp | 362 | .Pp |
363 | When reading a private key encoded without an associated public key, | 363 | When reading a private key encoded without an associated public key, |
@@ -378,7 +378,7 @@ and | |||
378 | get and set the point_conversion_form for the | 378 | get and set the point_conversion_form for the |
379 | .Fa key . | 379 | .Fa key . |
380 | For a description of point_conversion_form refer to | 380 | For a description of point_conversion_form refer to |
381 | .Xr EC_GROUP_copy 3 . | 381 | .Xr EC_POINT_point2oct 3 . |
382 | .Pp | 382 | .Pp |
383 | .Fn EC_KEY_set_flags | 383 | .Fn EC_KEY_set_flags |
384 | sets the flags in the | 384 | sets the flags in the |
@@ -407,7 +407,7 @@ sets the asn1_flag on the underlying | |||
407 | .Vt EC_GROUP | 407 | .Vt EC_GROUP |
408 | object (if set). | 408 | object (if set). |
409 | Refer to | 409 | Refer to |
410 | .Xr EC_GROUP_copy 3 | 410 | .Xr EC_GROUP_get_curve_name 3 |
411 | for further information on the asn1_flag. | 411 | for further information on the asn1_flag. |
412 | .Pp | 412 | .Pp |
413 | .Fn EC_KEY_precompute_mult | 413 | .Fn EC_KEY_precompute_mult |
@@ -488,11 +488,14 @@ returns the point_conversion_form for the | |||
488 | .Vt EC_KEY . | 488 | .Vt EC_KEY . |
489 | .Sh SEE ALSO | 489 | .Sh SEE ALSO |
490 | .Xr d2i_ECPKParameters 3 , | 490 | .Xr d2i_ECPKParameters 3 , |
491 | .Xr EC_GROUP_copy 3 , | 491 | .Xr EC_GROUP_check 3 , |
492 | .Xr EC_GROUP_new 3 , | 492 | .Xr EC_GROUP_get_curve_name 3 , |
493 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
494 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
493 | .Xr EC_KEY_METHOD_new 3 , | 495 | .Xr EC_KEY_METHOD_new 3 , |
494 | .Xr EC_POINT_add 3 , | 496 | .Xr EC_POINT_add 3 , |
495 | .Xr EC_POINT_new 3 , | 497 | .Xr EC_POINT_get_affine_coordinates 3 , |
498 | .Xr EC_POINT_point2oct 3 , | ||
496 | .Xr ECDH_compute_key 3 , | 499 | .Xr ECDH_compute_key 3 , |
497 | .Xr ECDSA_SIG_new 3 , | 500 | .Xr ECDSA_SIG_new 3 , |
498 | .Xr EVP_PKEY_set1_EC_KEY 3 | 501 | .Xr EVP_PKEY_set1_EC_KEY 3 |
diff --git a/src/lib/libcrypto/man/EC_POINT_add.3 b/src/lib/libcrypto/man/EC_POINT_add.3 index cc35499c0e..9c75f0dcd3 100644 --- a/src/lib/libcrypto/man/EC_POINT_add.3 +++ b/src/lib/libcrypto/man/EC_POINT_add.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: EC_POINT_add.3,v 1.15 2025/03/08 16:48:22 tb Exp $ | 1 | .\" $OpenBSD: EC_POINT_add.3,v 1.16 2025/04/25 19:57:12 tb Exp $ |
2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
3 | .\" | 3 | .\" |
4 | .\" This file was written by Matt Caswell <matt@openssl.org>. | 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. |
@@ -48,7 +48,7 @@ | |||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
50 | .\" | 50 | .\" |
51 | .Dd $Mdocdate: March 8 2025 $ | 51 | .Dd $Mdocdate: April 25 2025 $ |
52 | .Dt EC_POINT_ADD 3 | 52 | .Dt EC_POINT_ADD 3 |
53 | .Os | 53 | .Os |
54 | .Sh NAME | 54 | .Sh NAME |
@@ -177,7 +177,7 @@ in which case the result is just | |||
177 | .Dl q * m. | 177 | .Dl q * m. |
178 | .Pp | 178 | .Pp |
179 | See | 179 | See |
180 | .Xr EC_GROUP_copy 3 | 180 | .Xr EC_GROUP_new_curve_GFp 3 |
181 | for information about the generator. | 181 | for information about the generator. |
182 | .Sh RETURN VALUES | 182 | .Sh RETURN VALUES |
183 | The following functions return 1 on success or 0 on error: | 183 | The following functions return 1 on success or 0 on error: |
@@ -197,11 +197,17 @@ returns 1 if the point is on the curve, 0 if not, or -1 on error. | |||
197 | .Fn EC_POINT_cmp | 197 | .Fn EC_POINT_cmp |
198 | returns 1 if the points are not equal, 0 if they are, or -1 on error. | 198 | returns 1 if the points are not equal, 0 if they are, or -1 on error. |
199 | .Sh SEE ALSO | 199 | .Sh SEE ALSO |
200 | .Xr crypto 3 , | ||
200 | .Xr d2i_ECPKParameters 3 , | 201 | .Xr d2i_ECPKParameters 3 , |
201 | .Xr EC_GROUP_copy 3 , | 202 | .Xr EC_GROUP_check 3 , |
202 | .Xr EC_GROUP_new 3 , | 203 | .Xr EC_GROUP_get_curve_name 3 , |
204 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
205 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
206 | .Xr EC_KEY_METHOD_new 3 , | ||
203 | .Xr EC_KEY_new 3 , | 207 | .Xr EC_KEY_new 3 , |
204 | .Xr EC_POINT_new 3 | 208 | .Xr EC_POINT_get_affine_coordinates 3 , |
209 | .Xr EC_POINT_new 3 , | ||
210 | .Xr EC_POINT_point2oct 3 | ||
205 | .Sh HISTORY | 211 | .Sh HISTORY |
206 | .Fn EC_POINT_add , | 212 | .Fn EC_POINT_add , |
207 | .Fn EC_POINT_dbl , | 213 | .Fn EC_POINT_dbl , |
diff --git a/src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3 b/src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3 new file mode 100644 index 0000000000..b36d480530 --- /dev/null +++ b/src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3 | |||
@@ -0,0 +1,215 @@ | |||
1 | .\" $OpenBSD: EC_POINT_get_affine_coordinates.3,v 1.1 2025/04/25 19:57:12 tb Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .Dd $Mdocdate: April 25 2025 $ | ||
18 | .Dt EC_POINT_GET_AFFINE_COORDINATES 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm EC_POINT_get_affine_coordinates , | ||
22 | .Nm EC_POINT_set_affine_coordinates , | ||
23 | .Nm EC_POINT_set_compressed_coordinates , | ||
24 | .Nm EC_POINT_set_to_infinity , | ||
25 | .Nm EC_POINT_get_affine_coordinates_GFp , | ||
26 | .Nm EC_POINT_set_affine_coordinates_GFp , | ||
27 | .Nm EC_POINT_set_compressed_coordinates_GFp | ||
28 | .Nd get and set coordinates of elliptic curve points | ||
29 | .Sh SYNOPSIS | ||
30 | .In openssl/bn.h | ||
31 | .In openssl/ec.h | ||
32 | .Pp | ||
33 | .Ft int | ||
34 | .Fo EC_POINT_get_affine_coordinates | ||
35 | .Fa "const EC_GROUP *group" | ||
36 | .Fa "const EC_POINT *point" | ||
37 | .Fa "BIGNUM *x" | ||
38 | .Fa "BIGNUM *y" | ||
39 | .Fa "BN_CTX *ctx" | ||
40 | .Fc | ||
41 | .Ft int | ||
42 | .Fo EC_POINT_set_affine_coordinates | ||
43 | .Fa "const EC_GROUP *group" | ||
44 | .Fa "EC_POINT *point" | ||
45 | .Fa "const BIGNUM *x" | ||
46 | .Fa "const BIGNUM *y" | ||
47 | .Fa "BN_CTX *ctx" | ||
48 | .Fc | ||
49 | .Ft int | ||
50 | .Fo EC_POINT_set_compressed_coordinates | ||
51 | .Fa "const EC_GROUP *group" | ||
52 | .Fa "EC_POINT *point" | ||
53 | .Fa "const BIGNUM *x" | ||
54 | .Fa "int y_bit" | ||
55 | .Fa "BN_CTX *ctx" | ||
56 | .Fc | ||
57 | .Ft int | ||
58 | .Fo EC_POINT_set_to_infinity | ||
59 | .Fa "const EC_GROUP *group" | ||
60 | .Fa "EC_POINT *point" | ||
61 | .Fc | ||
62 | .Pp | ||
63 | Deprecated: | ||
64 | .Pp | ||
65 | .Ft int | ||
66 | .Fo EC_POINT_get_affine_coordinates_GFp | ||
67 | .Fa "const EC_GROUP *group" | ||
68 | .Fa "const EC_POINT *point" | ||
69 | .Fa "BIGNUM *x" | ||
70 | .Fa "BIGNUM *y" | ||
71 | .Fa "BN_CTX *ctx" | ||
72 | .Fc | ||
73 | .Ft int | ||
74 | .Fo EC_POINT_set_affine_coordinates_GFp | ||
75 | .Fa "const EC_GROUP *group" | ||
76 | .Fa "EC_POINT *point" | ||
77 | .Fa "const BIGNUM *x" | ||
78 | .Fa "const BIGNUM *y" | ||
79 | .Fa "BN_CTX *ctx" | ||
80 | .Fc | ||
81 | .Ft int | ||
82 | .Fo EC_POINT_set_compressed_coordinates_GFp | ||
83 | .Fa "const EC_GROUP *group" | ||
84 | .Fa "EC_POINT *point" | ||
85 | .Fa "const BIGNUM *x" | ||
86 | .Fa "int y_bit" | ||
87 | .Fa "BN_CTX *ctx" | ||
88 | .Fc | ||
89 | .Sh DESCRIPTION | ||
90 | .Fn EC_POINT_get_affine_coordinates | ||
91 | assumes that | ||
92 | .Fa point | ||
93 | is a point on | ||
94 | .Fa group , | ||
95 | calculates its affine coordinates from its internal representation | ||
96 | using the optional | ||
97 | .Fa ctx , | ||
98 | and copies them into the optional user-provided | ||
99 | .Fa x | ||
100 | and | ||
101 | .Fa y . | ||
102 | .Pp | ||
103 | .Fn EC_POINT_set_affine_coordinates | ||
104 | assumes that | ||
105 | .Fa x | ||
106 | and | ||
107 | .Fa y | ||
108 | are the affine coordinates of a point on | ||
109 | .Fa group , | ||
110 | converts them into internal representation and sets them on | ||
111 | .Fa point | ||
112 | using the optional | ||
113 | .Fa ctx . | ||
114 | The user-provided | ||
115 | .Fa point | ||
116 | should be the result of | ||
117 | .Fn EC_POINT_new 3 | ||
118 | with an argument of | ||
119 | .Fa group . | ||
120 | It then verifies using | ||
121 | .Xr EC_POINT_is_on_curve 3 | ||
122 | that | ||
123 | .Fa x | ||
124 | and | ||
125 | .Fa y | ||
126 | are indeed the affine coordinates of a point on | ||
127 | .Fa group . | ||
128 | .Pp | ||
129 | .Fn EC_POINT_set_compressed_coordinates | ||
130 | assumes that | ||
131 | .Fa x | ||
132 | is the x-coordinate and | ||
133 | .Fa y_bit | ||
134 | is the parity bit of a point on | ||
135 | .Fa group | ||
136 | and sets | ||
137 | .Fa point | ||
138 | to the corresponding point on | ||
139 | .Fa group . | ||
140 | It does this by solving the quadratic equation y^2 = x^3 + ax + b using | ||
141 | .Xr BN_mod_sqrt 3 | ||
142 | and the optional | ||
143 | .Fa ctx , | ||
144 | chooses the solution | ||
145 | .Fa y | ||
146 | with parity matching | ||
147 | .Fa y_bit , | ||
148 | and passes | ||
149 | .Fa x | ||
150 | and | ||
151 | .Fa y | ||
152 | to | ||
153 | .Fn EC_POINT_set_affine_coordinates . | ||
154 | The user-provided | ||
155 | .Fa point | ||
156 | should be the result of | ||
157 | .Fn EC_POINT_new | ||
158 | with argument | ||
159 | .Fa group . | ||
160 | .Pp | ||
161 | .Fn EC_POINT_set_to_infinity | ||
162 | sets | ||
163 | .Fa point | ||
164 | to the internal representation of the point at infinity on | ||
165 | .Fa group . | ||
166 | .Pp | ||
167 | .Fn EC_POINT_get_affine_coordinates_GFp | ||
168 | is a deprecated alias for | ||
169 | .Fn EC_POINT_get_affine_coordinates . | ||
170 | Similarly for | ||
171 | .Fn EC_POINT_set_affine_coordinates_GFp | ||
172 | and | ||
173 | .Fn EC_POINT_set_compressed_coordinates_GFp . | ||
174 | .Sh RETURN VALUES | ||
175 | All these functions return 1 on success and 0 on error. | ||
176 | Error conditions include memory allocation failure, | ||
177 | that | ||
178 | .Fa point | ||
179 | is incompatible with | ||
180 | .Fa group , | ||
181 | and, for the coordinate setters, that the provided coordinates | ||
182 | do not represent a point on | ||
183 | .Fa group . | ||
184 | .Sh SEE ALSO | ||
185 | .Xr BN_CTX_new 3 , | ||
186 | .Xr BN_is_zero 3 , | ||
187 | .Xr BN_mod_sqrt 3 , | ||
188 | .Xr crypto 3 , | ||
189 | .Xr d2i_ECPKParameters 3 , | ||
190 | .Xr EC_GROUP_check 3 , | ||
191 | .Xr EC_GROUP_get_curve_name 3 , | ||
192 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
193 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
194 | .Xr EC_KEY_METHOD_new 3 , | ||
195 | .Xr EC_KEY_new 3 , | ||
196 | .Xr EC_POINT_add 3 , | ||
197 | .Xr EC_POINT_new 3 , | ||
198 | .Xr EC_POINT_point2oct 3 , | ||
199 | .Xr ECDH_compute_key 3 , | ||
200 | .Xr ECDSA_SIG_new 3 | ||
201 | .Sh HISTORY | ||
202 | .Fn EC_POINT_get_affine_coordinates_GFp , | ||
203 | .Fn EC_POINT_set_affine_coordinates_GFp , | ||
204 | .Fn EC_POINT_set_compressed_coordinates_GFp , | ||
205 | and | ||
206 | .Fn EC_POINT_set_to_infinity | ||
207 | first appeared in OpenSSL 0.9.7 and have been available since | ||
208 | .Ox 3.2 . | ||
209 | .Pp | ||
210 | .Fn EC_POINT_get_affine_coordinates , | ||
211 | .Fn EC_POINT_set_affine_coordinates , | ||
212 | and | ||
213 | .Fn EC_POINT_set_compressed_coordinates | ||
214 | first appeared in OpenSSL 1.1.1 and have been available since | ||
215 | .Ox 7.0 . | ||
diff --git a/src/lib/libcrypto/man/EC_POINT_new.3 b/src/lib/libcrypto/man/EC_POINT_new.3 index db6280fce7..cfc988f294 100644 --- a/src/lib/libcrypto/man/EC_POINT_new.3 +++ b/src/lib/libcrypto/man/EC_POINT_new.3 | |||
@@ -1,54 +1,20 @@ | |||
1 | .\" $OpenBSD: EC_POINT_new.3,v 1.17 2025/03/08 17:04:07 tb Exp $ | 1 | .\" $OpenBSD: EC_POINT_new.3,v 1.18 2025/04/25 19:57:12 tb Exp $ |
2 | .\" full merge up to: OpenSSL 50db8163 Jul 30 16:56:41 2018 +0100 | ||
3 | .\" | 2 | .\" |
4 | .\" This file was written by Matt Caswell <matt@openssl.org>. | 3 | .\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org> |
5 | .\" Copyright (c) 2013, 2016 The OpenSSL Project. All rights reserved. | ||
6 | .\" | 4 | .\" |
7 | .\" Redistribution and use in source and binary forms, with or without | 5 | .\" Permission to use, copy, modify, and distribute this software for any |
8 | .\" modification, are permitted provided that the following conditions | 6 | .\" purpose with or without fee is hereby granted, provided that the above |
9 | .\" are met: | 7 | .\" copyright notice and this permission notice appear in all copies. |
10 | .\" | 8 | .\" |
11 | .\" 1. Redistributions of source code must retain the above copyright | 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
12 | .\" notice, this list of conditions and the following disclaimer. | 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
13 | .\" | 16 | .\" |
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | 17 | .Dd $Mdocdate: April 25 2025 $ |
15 | .\" notice, this list of conditions and the following disclaimer in | ||
16 | .\" the documentation and/or other materials provided with the | ||
17 | .\" distribution. | ||
18 | .\" | ||
19 | .\" 3. All advertising materials mentioning features or use of this | ||
20 | .\" software must display the following acknowledgment: | ||
21 | .\" "This product includes software developed by the OpenSSL Project | ||
22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
23 | .\" | ||
24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
25 | .\" endorse or promote products derived from this software without | ||
26 | .\" prior written permission. For written permission, please contact | ||
27 | .\" openssl-core@openssl.org. | ||
28 | .\" | ||
29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
31 | .\" permission of the OpenSSL Project. | ||
32 | .\" | ||
33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
34 | .\" acknowledgment: | ||
35 | .\" "This product includes software developed by the OpenSSL Project | ||
36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
37 | .\" | ||
38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
50 | .\" | ||
51 | .Dd $Mdocdate: March 8 2025 $ | ||
52 | .Dt EC_POINT_NEW 3 | 18 | .Dt EC_POINT_NEW 3 |
53 | .Os | 19 | .Os |
54 | .Sh NAME | 20 | .Sh NAME |
@@ -56,163 +22,56 @@ | |||
56 | .Nm EC_POINT_free , | 22 | .Nm EC_POINT_free , |
57 | .Nm EC_POINT_clear_free , | 23 | .Nm EC_POINT_clear_free , |
58 | .Nm EC_POINT_copy , | 24 | .Nm EC_POINT_copy , |
59 | .Nm EC_POINT_dup , | 25 | .Nm EC_POINT_dup |
60 | .Nm EC_POINT_set_to_infinity , | 26 | .Nd allocate, free and copy elliptic curve points |
61 | .Nm EC_POINT_set_affine_coordinates , | ||
62 | .Nm EC_POINT_set_affine_coordinates_GFp , | ||
63 | .Nm EC_POINT_get_affine_coordinates , | ||
64 | .Nm EC_POINT_get_affine_coordinates_GFp , | ||
65 | .Nm EC_POINT_set_compressed_coordinates , | ||
66 | .Nm EC_POINT_set_compressed_coordinates_GFp , | ||
67 | .Nm EC_POINT_point2oct , | ||
68 | .Nm EC_POINT_oct2point , | ||
69 | .Nm EC_POINT_point2bn , | ||
70 | .Nm EC_POINT_bn2point , | ||
71 | .Nm EC_POINT_point2hex , | ||
72 | .Nm EC_POINT_hex2point | ||
73 | .Nd create, destroy, and manipulate EC_POINT objects | ||
74 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
75 | .In openssl/ec.h | 28 | .In openssl/ec.h |
76 | .In openssl/bn.h | 29 | .Pp |
77 | .Ft EC_POINT * | 30 | .Ft "EC_POINT *" |
78 | .Fo EC_POINT_new | 31 | .Fo EC_POINT_new |
79 | .Fa "const EC_GROUP *group" | 32 | .Fa "const EC_GROUP *group" |
80 | .Fc | 33 | .Fc |
81 | .Ft void | 34 | .Ft "void" |
82 | .Fo EC_POINT_free | 35 | .Fo EC_POINT_free |
83 | .Fa "EC_POINT *point" | 36 | .Fa "EC_POINT *point" |
84 | .Fc | 37 | .Fc |
85 | .Ft void | 38 | .Ft "void" |
86 | .Fo EC_POINT_clear_free | 39 | .Fo EC_POINT_clear_free |
87 | .Fa "EC_POINT *point" | 40 | .Fa "EC_POINT *point" |
88 | .Fc | 41 | .Fc |
89 | .Ft int | 42 | .Ft "int" |
90 | .Fo EC_POINT_copy | 43 | .Fo EC_POINT_copy |
91 | .Fa "EC_POINT *dst" | 44 | .Fa "EC_POINT *dst" |
92 | .Fa "const EC_POINT *src" | 45 | .Fa "const EC_POINT *src" |
93 | .Fc | 46 | .Fc |
94 | .Ft EC_POINT * | 47 | .Ft "EC_POINT *" |
95 | .Fo EC_POINT_dup | 48 | .Fo EC_POINT_dup |
96 | .Fa "const EC_POINT *src" | 49 | .Fa "const EC_POINT *point" |
97 | .Fa "const EC_GROUP *group" | ||
98 | .Fc | ||
99 | .Ft int | ||
100 | .Fo EC_POINT_set_to_infinity | ||
101 | .Fa "const EC_GROUP *group" | ||
102 | .Fa "EC_POINT *point" | ||
103 | .Fc | ||
104 | .Ft int | ||
105 | .Fo EC_POINT_set_affine_coordinates | ||
106 | .Fa "const EC_GROUP *group" | ||
107 | .Fa "EC_POINT *p" | ||
108 | .Fa "const BIGNUM *x" | ||
109 | .Fa "const BIGNUM *y" | ||
110 | .Fa "BN_CTX *ctx" | ||
111 | .Fc | ||
112 | .Ft int | ||
113 | .Fo EC_POINT_set_affine_coordinates_GFp | ||
114 | .Fa "const EC_GROUP *group" | ||
115 | .Fa "EC_POINT *p" | ||
116 | .Fa "const BIGNUM *x" | ||
117 | .Fa "const BIGNUM *y" | ||
118 | .Fa "BN_CTX *ctx" | ||
119 | .Fc | ||
120 | .Ft int | ||
121 | .Fo EC_POINT_get_affine_coordinates | ||
122 | .Fa "const EC_GROUP *group" | ||
123 | .Fa "const EC_POINT *p" | ||
124 | .Fa "BIGNUM *x" | ||
125 | .Fa "BIGNUM *y" | ||
126 | .Fa "BN_CTX *ctx" | ||
127 | .Fc | ||
128 | .Ft int | ||
129 | .Fo EC_POINT_get_affine_coordinates_GFp | ||
130 | .Fa "const EC_GROUP *group" | ||
131 | .Fa "const EC_POINT *p" | ||
132 | .Fa "BIGNUM *x" | ||
133 | .Fa "BIGNUM *y" | ||
134 | .Fa "BN_CTX *ctx" | ||
135 | .Fc | ||
136 | .Ft int | ||
137 | .Fo EC_POINT_set_compressed_coordinates | ||
138 | .Fa "const EC_GROUP *group" | ||
139 | .Fa "EC_POINT *p" | ||
140 | .Fa "const BIGNUM *x" | ||
141 | .Fa "int y_bit" | ||
142 | .Fa "BN_CTX *ctx" | ||
143 | .Fc | ||
144 | .Ft int | ||
145 | .Fo EC_POINT_set_compressed_coordinates_GFp | ||
146 | .Fa "const EC_GROUP *group" | ||
147 | .Fa "EC_POINT *p" | ||
148 | .Fa "const BIGNUM *x" | ||
149 | .Fa "int y_bit" | ||
150 | .Fa "BN_CTX *ctx" | ||
151 | .Fc | ||
152 | .Ft size_t | ||
153 | .Fo EC_POINT_point2oct | ||
154 | .Fa "const EC_GROUP *group" | 50 | .Fa "const EC_GROUP *group" |
155 | .Fa "const EC_POINT *p" | ||
156 | .Fa "point_conversion_form_t form" | ||
157 | .Fa "unsigned char *buf" | ||
158 | .Fa "size_t len" | ||
159 | .Fa "BN_CTX *ctx" | ||
160 | .Fc | ||
161 | .Ft int | ||
162 | .Fo EC_POINT_oct2point | ||
163 | .Fa "const EC_GROUP *group" | ||
164 | .Fa "EC_POINT *p" | ||
165 | .Fa "const unsigned char *buf" | ||
166 | .Fa "size_t len" | ||
167 | .Fa "BN_CTX *ctx" | ||
168 | .Fc | ||
169 | .Ft BIGNUM * | ||
170 | .Fo EC_POINT_point2bn | ||
171 | .Fa "const EC_GROUP *" | ||
172 | .Fa "const EC_POINT *" | ||
173 | .Fa "point_conversion_form_t form" | ||
174 | .Fa "BIGNUM *" | ||
175 | .Fa "BN_CTX *" | ||
176 | .Fc | ||
177 | .Ft EC_POINT * | ||
178 | .Fo EC_POINT_bn2point | ||
179 | .Fa "const EC_GROUP *" | ||
180 | .Fa "const BIGNUM *" | ||
181 | .Fa "EC_POINT *" | ||
182 | .Fa "BN_CTX *" | ||
183 | .Fc | ||
184 | .Ft char * | ||
185 | .Fo EC_POINT_point2hex | ||
186 | .Fa "const EC_GROUP *" | ||
187 | .Fa "const EC_POINT *" | ||
188 | .Fa "point_conversion_form_t form" | ||
189 | .Fa "BN_CTX *" | ||
190 | .Fc | ||
191 | .Ft EC_POINT * | ||
192 | .Fo EC_POINT_hex2point | ||
193 | .Fa "const EC_GROUP *" | ||
194 | .Fa "const char *" | ||
195 | .Fa "EC_POINT *" | ||
196 | .Fa "BN_CTX *" | ||
197 | .Fc | 51 | .Fc |
198 | .Sh DESCRIPTION | 52 | .Sh DESCRIPTION |
199 | An | 53 | An |
200 | .Vt EC_POINT | 54 | .Vt EC_POINT |
201 | represents a point on a curve. | 55 | object holds a point on the elliptic curve represented by an |
202 | A curve is represented by an | 56 | .Vt EC_GROUP . |
203 | .Vt EC_GROUP | 57 | The details of the internal representation depend on the group |
204 | object created by the functions described in | 58 | and should never be an application's concern since the EC library |
205 | .Xr EC_GROUP_new 3 . | 59 | has API to set a point's coordinates, |
60 | .Xr EC_POINT_set_affine_coordinates 3 . | ||
206 | .Pp | 61 | .Pp |
207 | A new point is constructed by calling the function | ||
208 | .Fn EC_POINT_new | 62 | .Fn EC_POINT_new |
209 | and providing the | 63 | allocates and initializes an |
210 | .Fa group | 64 | .Vt EC_POINT |
211 | object that the point relates to. | 65 | object to be used with the |
66 | .Fa group . | ||
67 | Before explicitly setting its coordinates, the returned | ||
68 | .Vt EC_POINT | ||
69 | is invalid. | ||
212 | .Pp | 70 | .Pp |
213 | .Fn EC_POINT_free | 71 | .Fn EC_POINT_free |
214 | frees the memory associated with the | 72 | frees |
215 | .Vt EC_POINT . | 73 | .Fa point |
74 | and all memory associated with it. | ||
216 | If | 75 | If |
217 | .Fa point | 76 | .Fa point |
218 | is a | 77 | is a |
@@ -220,236 +79,129 @@ is a | |||
220 | pointer, no action occurs. | 79 | pointer, no action occurs. |
221 | .Pp | 80 | .Pp |
222 | .Fn EC_POINT_clear_free | 81 | .Fn EC_POINT_clear_free |
223 | destroys any sensitive data held within the | 82 | is intended to destroy sensitive data held in |
224 | .Vt EC_POINT | ||
225 | and then frees its memory. | ||
226 | If | ||
227 | .Fa point | 83 | .Fa point |
228 | is a | 84 | in addition to freeing all memory associated with it. |
229 | .Dv NULL | 85 | Since elliptic curve points usually hold public data, this |
230 | pointer, no action occurs. | 86 | is rarely needed. |
87 | In LibreSSL, | ||
88 | .Fn EC_POINT_free | ||
89 | and | ||
90 | .Fn EC_POINT_clear_free | ||
91 | behave identically. | ||
231 | .Pp | 92 | .Pp |
232 | .Fn EC_POINT_copy | 93 | .Fn EC_POINT_copy |
233 | copies the point | 94 | copies the internal representation of |
234 | .Fa src | 95 | .Fa src |
235 | into | 96 | into |
236 | .Fa dst . | 97 | .Fa dst . |
237 | Both | 98 | If |
238 | .Fa src | 99 | .Fa src |
239 | and | 100 | and |
240 | .Fa dst | 101 | .Fa dst |
241 | must use the same | 102 | are identical, no action occurs. |
242 | .Vt EC_METHOD . | 103 | Both |
243 | .Pp | ||
244 | .Fn EC_POINT_dup | ||
245 | creates a new | ||
246 | .Vt EC_POINT | ||
247 | object and copies the content from | ||
248 | .Fa src | 104 | .Fa src |
249 | to the newly created | ||
250 | .Vt EC_POINT | ||
251 | object. | ||
252 | .Pp | ||
253 | A valid point on a curve is the special point at infinity. | ||
254 | A point is set to be at infinity by calling | ||
255 | .Fn EC_POINT_set_to_infinity . | ||
256 | .Pp | ||
257 | The affine coordinates for a point describe a point in terms of its | ||
258 | .Fa x | ||
259 | and | ||
260 | .Fa y | ||
261 | position. | ||
262 | The function | ||
263 | .Fn EC_POINT_set_affine_coordinates | ||
264 | sets the | ||
265 | .Fa x | ||
266 | and | ||
267 | .Fa y | ||
268 | coordinates for the point | ||
269 | .Fa p | ||
270 | defined over the curve given in | ||
271 | .Fa group . | ||
272 | The function | ||
273 | .Fn EC_POINT_get_affine_coordinates | ||
274 | sets | ||
275 | .Fa x | ||
276 | and | ||
277 | .Fa y , | ||
278 | either of which may be | ||
279 | .Dv NULL , | ||
280 | to the corresponding coordinates of | ||
281 | .Fa p . | ||
282 | .Pp | ||
283 | The functions | ||
284 | .Fn EC_POINT_set_affine_coordinates_GFp | ||
285 | is a deprecated synonym for | ||
286 | .Fn EC_POINT_set_affine_coordinates | ||
287 | and the function | ||
288 | .Fn EC_POINT_get_affine_coordinates_GFp | ||
289 | is a deprecated synonym for | ||
290 | .Fn EC_POINT_get_affine_coordinates . | ||
291 | .Pp | ||
292 | Points can also be described in terms of their compressed coordinates. | ||
293 | For a point | ||
294 | .Pq Fa x , y , | ||
295 | for any given value for | ||
296 | .Fa x | ||
297 | such that the point is on the curve, there will only ever be two | ||
298 | possible values for | ||
299 | .Fa y . | ||
300 | Therefore, a point can be set using the | ||
301 | .Fn EC_POINT_set_compressed_coordinates | ||
302 | function where | ||
303 | .Fa x | ||
304 | is the x coordinate and | ||
305 | .Fa y_bit | ||
306 | is a value 0 or 1 to identify which of the two possible values for y | ||
307 | should be used. | ||
308 | .Pp | ||
309 | The functions | ||
310 | .Fn EC_POINT_set_compressed_coordinates_GFp | ||
311 | is a deprecated synonym for | ||
312 | .Fn EC_POINT_set_compressed_coordinates . | ||
313 | .Pp | ||
314 | In addition | ||
315 | .Vt EC_POINT Ns s | ||
316 | can be converted to and from various external representations. | ||
317 | Supported representations are octet strings, | ||
318 | .Vt BIGNUM Ns s , | ||
319 | and hexadecimal. | ||
320 | The format of the external representation is described by the | ||
321 | point_conversion_form. | ||
322 | See | ||
323 | .Xr EC_GROUP_copy 3 | ||
324 | for a description of point_conversion_form. | ||
325 | Octet strings are stored in a buffer along with an associated buffer | ||
326 | length. | ||
327 | A point held in a | ||
328 | .Vt BIGNUM | ||
329 | is calculated by converting the point to an octet string and then | ||
330 | converting that octet string into a | ||
331 | .Vt BIGNUM | ||
332 | integer. | ||
333 | Points in hexadecimal format are stored in a NUL terminated character | ||
334 | string where each character is one of the printable values 0-9 or A-F | ||
335 | (or a-f). | ||
336 | .Pp | ||
337 | The functions | ||
338 | .Fn EC_POINT_point2oct , | ||
339 | .Fn EC_POINT_oct2point , | ||
340 | .Fn EC_POINT_point2bn , | ||
341 | .Fn EC_POINT_bn2point , | ||
342 | .Fn EC_POINT_point2hex , | ||
343 | and | 105 | and |
344 | .Fn EC_POINT_hex2point | 106 | .Fa dst |
345 | convert from and to | 107 | should be the result of |
346 | .Vt EC_POINT Ns s | 108 | .Fn EC_POINT_new |
347 | for the formats octet string, | 109 | with the same |
348 | .Vt BIGNUM , | 110 | .Fa group |
349 | and hexadecimal, respectively. | 111 | argument, although |
350 | .Pp | 112 | .Fn EC_POINT_copy |
351 | The function | 113 | cannot check that. |
352 | .Fn EC_POINT_point2oct | ||
353 | must be supplied with a | ||
354 | .Fa buf | ||
355 | long enough to store the octet string. | ||
356 | The return value provides the number of octets stored. | ||
357 | Calling the function with a | ||
358 | .Dv NULL | ||
359 | .Fa buf | ||
360 | will not perform the conversion but will still return the required | ||
361 | buffer length. | ||
362 | .Pp | 114 | .Pp |
363 | The function | 115 | .Fn EC_POINT_dup |
364 | .Fn EC_POINT_point2hex | 116 | creates a deep copy of |
365 | will allocate sufficient memory to store the hexadecimal string. | 117 | .Fa point |
366 | It is the caller's responsibility to free this memory with a subsequent | 118 | by combining |
367 | call to | 119 | .Fn EC_POINT_new |
368 | .Xr free 3 . | 120 | with |
121 | .Fn EC_GROUP_copy . | ||
369 | .Sh RETURN VALUES | 122 | .Sh RETURN VALUES |
370 | .Fn EC_POINT_new | 123 | .Fn EC_POINT_new |
371 | and | 124 | returns a newly allocated |
372 | .Fn EC_POINT_dup | ||
373 | return the newly allocated | ||
374 | .Vt EC_POINT | 125 | .Vt EC_POINT |
375 | or | 126 | or |
376 | .Dv NULL | 127 | .Dv NULL |
377 | on error. | 128 | on memory allocation failure. |
378 | .Pp | 129 | .Pp |
379 | The following functions return 1 on success or 0 on error: | 130 | .Fn EC_POINT_copy |
380 | .Fn EC_POINT_copy , | 131 | returns 1 on success or 0 on error. |
381 | .Fn EC_POINT_set_to_infinity , | 132 | Error conditions include memory allocation failure and that |
382 | .Fn EC_POINT_set_affine_coordinates , | 133 | .Fa dst |
383 | .Fn EC_POINT_set_affine_coordinates_GFp , | 134 | is incompatible with the group on which |
384 | .Fn EC_POINT_get_affine_coordinates , | 135 | .Fa src |
385 | .Fn EC_POINT_get_affine_coordinates_GFp , | 136 | is defined. |
386 | .Fn EC_POINT_set_compressed_coordinates , | ||
387 | .Fn EC_POINT_set_compressed_coordinates_GFp , | ||
388 | and | ||
389 | .Fn EC_POINT_oct2point . | ||
390 | .Pp | ||
391 | .Fn EC_POINT_point2oct | ||
392 | returns the length of the required buffer, or 0 on error. | ||
393 | .Pp | ||
394 | .Fn EC_POINT_point2bn | ||
395 | returns the pointer to the | ||
396 | .Vt BIGNUM | ||
397 | supplied or | ||
398 | .Dv NULL | ||
399 | on error. | ||
400 | .Pp | ||
401 | .Fn EC_POINT_bn2point | ||
402 | returns the pointer to the | ||
403 | .Vt EC_POINT | ||
404 | supplied or | ||
405 | .Dv NULL | ||
406 | on error. | ||
407 | .Pp | ||
408 | .Fn EC_POINT_point2hex | ||
409 | returns a pointer to the hex string or | ||
410 | .Dv NULL | ||
411 | on error. | ||
412 | .Pp | 137 | .Pp |
413 | .Fn EC_POINT_hex2point | 138 | .Fn EC_POINT_dup |
414 | returns the pointer to the | 139 | returns a newly allocated |
415 | .Vt EC_POINT | 140 | .Vt EC_POINT |
416 | supplied or | 141 | or |
417 | .Dv NULL | 142 | .Dv NULL |
418 | on error. | 143 | on failure. |
144 | Error conditions include memory allocation failure or that | ||
145 | .Fa group | ||
146 | is incompatible with | ||
147 | .Fa src . | ||
419 | .Sh SEE ALSO | 148 | .Sh SEE ALSO |
149 | .Xr BN_CTX_new 3 , | ||
150 | .Xr BN_is_zero 3 , | ||
151 | .Xr crypto 3 , | ||
420 | .Xr d2i_ECPKParameters 3 , | 152 | .Xr d2i_ECPKParameters 3 , |
421 | .Xr EC_GROUP_copy 3 , | 153 | .Xr EC_GROUP_check 3 , |
422 | .Xr EC_GROUP_new 3 , | 154 | .Xr EC_GROUP_get_curve_name 3 , |
155 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
156 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
157 | .Xr EC_KEY_METHOD_new 3 , | ||
423 | .Xr EC_KEY_new 3 , | 158 | .Xr EC_KEY_new 3 , |
424 | .Xr EC_POINT_add 3 , | 159 | .Xr EC_POINT_add 3 , |
425 | .Xr ECDH_compute_key 3 | 160 | .Xr EC_POINT_get_affine_coordinates 3 , |
161 | .Xr EC_POINT_point2oct 3 , | ||
162 | .Xr ECDH_compute_key 3 , | ||
163 | .Xr ECDSA_SIG_new 3 | ||
426 | .Sh HISTORY | 164 | .Sh HISTORY |
427 | .Fn EC_POINT_new , | 165 | .Fn EC_POINT_new , |
428 | .Fn EC_POINT_free , | 166 | .Fn EC_POINT_free , |
429 | .Fn EC_POINT_clear_free , | 167 | .Fn EC_POINT_clear_free , |
430 | .Fn EC_POINT_copy , | ||
431 | .Fn EC_POINT_set_to_infinity , | ||
432 | .Fn EC_POINT_set_affine_coordinates_GFp , | ||
433 | .Fn EC_POINT_get_affine_coordinates_GFp , | ||
434 | .Fn EC_POINT_set_compressed_coordinates_GFp , | ||
435 | .Fn EC_POINT_point2oct , | ||
436 | and | 168 | and |
437 | .Fn EC_POINT_oct2point | 169 | .Fn EC_POINT_copy |
438 | first appeared in OpenSSL 0.9.7 and have been available since | 170 | first appeared in OpenSSL 0.9.7 and have been available since |
439 | .Ox 3.2 . | 171 | .Ox 3.2 . |
440 | .Pp | 172 | .Pp |
441 | .Fn EC_POINT_dup , | 173 | .Fn EC_POINT_dup |
442 | .Fn EC_POINT_point2bn , | 174 | first appeared in OpenSSL 0.9.8 and has been available since |
443 | .Fn EC_POINT_bn2point , | ||
444 | .Fn EC_POINT_point2hex , | ||
445 | and | ||
446 | .Fn EC_POINT_hex2point | ||
447 | first appeared in OpenSSL 0.9.8 and have been available since | ||
448 | .Ox 4.5 . | 175 | .Ox 4.5 . |
449 | .Pp | 176 | .Sh BUGS |
450 | .Fn EC_POINT_set_affine_coordinates , | 177 | A fundamental flaw in the OpenSSL API toolkit is that |
451 | .Fn EC_POINT_get_affine_coordinates , | 178 | .Fn *_new |
179 | functions usually create invalid objects that are tricky to | ||
180 | turn into valid objects. | ||
181 | A fundamental flaw in the EC library is that | ||
182 | .Vt EC_POINT | ||
183 | objects do not hold a reference to the group they live on | ||
184 | despite the fact that | ||
185 | .Fn EC_POINT_new | ||
186 | has a | ||
187 | .Fa group | ||
188 | argument. | ||
189 | This is difficult to fix because | ||
190 | .Vt EC_GROUP | ||
191 | objects are not reference counted and | ||
192 | because of const qualifiers in the API. | ||
193 | This is the root cause for various contortions in the EC library | ||
194 | and API. | ||
195 | This has security implications because not | ||
196 | only does the library not know whether an | ||
197 | .Fa EC_POINT | ||
198 | object represents a valid point, | ||
199 | even if it did know that it would not know on what curve. | ||
200 | .Pp | ||
201 | The signature of | ||
202 | .Fn EC_GROUP_dup | ||
203 | is bizarre and the order of | ||
204 | .Fa point | ||
452 | and | 205 | and |
453 | .Fn EC_POINT_set_compressed_coordinates | 206 | .Fa group |
454 | first appeared in OpenSSL 1.1.1 and have been available since | 207 | is inconsistent with the rest of the EC API. |
455 | .Ox 7.0 . | ||
diff --git a/src/lib/libcrypto/man/EC_POINT_point2oct.3 b/src/lib/libcrypto/man/EC_POINT_point2oct.3 new file mode 100644 index 0000000000..d0663670ee --- /dev/null +++ b/src/lib/libcrypto/man/EC_POINT_point2oct.3 | |||
@@ -0,0 +1,431 @@ | |||
1 | .\" $OpenBSD: EC_POINT_point2oct.3,v 1.1 2025/04/25 19:57:12 tb Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .Dd $Mdocdate: April 25 2025 $ | ||
18 | .Dt EC_POINT_POINT2OCT 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm EC_POINT_point2oct , | ||
22 | .Nm EC_POINT_oct2point , | ||
23 | .Nm EC_POINT_point2bn , | ||
24 | .Nm EC_POINT_bn2point , | ||
25 | .Nm EC_POINT_point2hex , | ||
26 | .Nm EC_POINT_hex2point | ||
27 | .Nd encode and decode elliptic curve points | ||
28 | .Sh SYNOPSIS | ||
29 | .In openssl/bn.h | ||
30 | .In openssl/ec.h | ||
31 | .Bd -literal | ||
32 | typedef enum { | ||
33 | POINT_CONVERSION_COMPRESSED = 2, | ||
34 | POINT_CONVERSION_UNCOMPRESSED = 4, | ||
35 | POINT_CONVERSION_HYBRID = 6 | ||
36 | } point_conversion_form_t; | ||
37 | |||
38 | .Ed | ||
39 | .Ft size_t | ||
40 | .Fo EC_POINT_point2oct | ||
41 | .Fa "const EC_GROUP *group" | ||
42 | .Fa "const EC_POINT *point" | ||
43 | .Fa "point_conversion_form_t form" | ||
44 | .Fa "unsigned char *buf" | ||
45 | .Fa "size_t len" | ||
46 | .Fa "BN_CTX *ctx" | ||
47 | .Fc | ||
48 | .Ft int | ||
49 | .Fo EC_POINT_oct2point | ||
50 | .Fa "const EC_GROUP *group" | ||
51 | .Fa "EC_POINT *point" | ||
52 | .Fa "const unsigned char *buf" | ||
53 | .Fa "size_t len" | ||
54 | .Fa "BN_CTX *ctx" | ||
55 | .Fc | ||
56 | .Ft "BIGNUM *" | ||
57 | .Fo EC_POINT_point2bn | ||
58 | .Fa "const EC_GROUP *group" | ||
59 | .Fa "const EC_POINT *point" | ||
60 | .Fa "point_conversion_form_t form" | ||
61 | .Fa "BIGNUM *bn" | ||
62 | .Fa "BN_CTX *ctx" | ||
63 | .Fc | ||
64 | .Ft "EC_POINT *" | ||
65 | .Fo EC_POINT_bn2point | ||
66 | .Fa "const EC_GROUP *group" | ||
67 | .Fa "const BIGNUM *bn" | ||
68 | .Fa "EC_POINT *point" | ||
69 | .Fa "BN_CTX *ctx" | ||
70 | .Fc | ||
71 | .Ft "char *" | ||
72 | .Fo EC_POINT_point2hex | ||
73 | .Fa "const EC_GROUP *group" | ||
74 | .Fa "const EC_POINT *point" | ||
75 | .Fa "point_conversion_form_t form" | ||
76 | .Fa "BN_CTX *ctx" | ||
77 | .Fc | ||
78 | .Ft "EC_POINT *" | ||
79 | .Fo EC_POINT_hex2point | ||
80 | .Fa "const EC_GROUP *group" | ||
81 | .Fa "const char *hex" | ||
82 | .Fa "EC_POINT *point" | ||
83 | .Fa "BN_CTX *ctx" | ||
84 | .Fc | ||
85 | .Sh DESCRIPTION | ||
86 | The | ||
87 | .Fa ctx | ||
88 | argument of all functions in this manual is optional. | ||
89 | .Pp | ||
90 | An | ||
91 | .Vt EC_POINT | ||
92 | object represents a point on the elliptic curve given by an | ||
93 | .Vt EC_GROUP | ||
94 | object. | ||
95 | It is either the point at infinity or it has a representation | ||
96 | (x, y) in standard affine coordinates, | ||
97 | in which case it satisfies the curve's Weierstrass equation | ||
98 | .Dl y^2 = x^3 + ax + b | ||
99 | in the prime field of size p. | ||
100 | Thus, y is a square root of x^3 + ax + b. | ||
101 | Since p > 3 is odd, p - y is another square root | ||
102 | with different parity, unless y is zero. | ||
103 | Point compression uses that x and the parity of y are enough | ||
104 | to compute y using | ||
105 | .Xr BN_mod_sqrt 3 . | ||
106 | .Pp | ||
107 | Field elements are represented as non-negative integers < p | ||
108 | in big-endian 2-complement form, zero-padded on the left to the byte | ||
109 | length l of p. | ||
110 | If X and Y are the representations of x and y, respectively, and P is | ||
111 | the parity bit of y, the three encodings of the point (x, y) are | ||
112 | the byte strings: | ||
113 | .Bl -column "EncodingX" "CompressedX" "UncompressedX" "Hybrid" -offset indent -compact | ||
114 | .It Ta Em Compressed Ta Em Uncompressed Ta Em Hybrid | ||
115 | .It Encoding Ta 2+P || X Ta 4 || X || Y Ta 6+P || X || Y | ||
116 | .It Length Ta 1 + l Ta 1 + 2l Ta 1 + 2l | ||
117 | .El | ||
118 | where the first octet is the point conversion form | ||
119 | combined with the parity bit in the compressed and hybrid encodings. | ||
120 | The point at infinity is encoded as a single zero byte. | ||
121 | .Pp | ||
122 | .Fn EC_POINT_point2oct | ||
123 | converts | ||
124 | .Fa point | ||
125 | into the octet string encoding of type | ||
126 | .Fa form . | ||
127 | It assumes without checking that | ||
128 | .Fa point | ||
129 | is a point on the elliptic curve represented by | ||
130 | .Fa group | ||
131 | and operates in two modes depending on the | ||
132 | .Fa buf | ||
133 | argument. | ||
134 | If | ||
135 | .Fa buf | ||
136 | is | ||
137 | .Dv NULL , | ||
138 | .Fn EC_POINT_point2oct | ||
139 | returns the length of | ||
140 | .Fa point Ns 's | ||
141 | encoding of type | ||
142 | .Fa form | ||
143 | and ignores the | ||
144 | .Fa len | ||
145 | and | ||
146 | .Fa ctx | ||
147 | arguments. | ||
148 | If | ||
149 | .Fa buf | ||
150 | is not | ||
151 | .Dv NULL | ||
152 | and its length | ||
153 | .Fa len | ||
154 | is sufficiently big, | ||
155 | .Fn EC_POINT_point2oct 3 | ||
156 | writes the | ||
157 | .Fa point Ns 's | ||
158 | encoding of type | ||
159 | .Fa form | ||
160 | to | ||
161 | .Fa buf | ||
162 | and returns the number of bytes written. | ||
163 | Unless | ||
164 | .Fa point | ||
165 | is the point at infinity, the coordinates to be encoded are calculated using | ||
166 | .Xr EC_POINT_get_affine_coordinates 3 . | ||
167 | .Pp | ||
168 | .Fn EC_POINT_oct2point | ||
169 | decodes the octet string representation of a point on | ||
170 | .Fa group | ||
171 | in | ||
172 | .Fa buf | ||
173 | of size | ||
174 | .Fa len | ||
175 | and, if it represents a point on | ||
176 | .Fa group , | ||
177 | sets it on the caller-provided | ||
178 | .Fa point | ||
179 | using | ||
180 | .Xr EC_POINT_set_to_infinity 3 | ||
181 | .Xr EC_POINT_set_compressed_coordinates 3 , | ||
182 | or | ||
183 | .Xr EC_POINT_set_affine_coordinates 3 . | ||
184 | For hybrid encoding the consistency of | ||
185 | the parity bit in the leading octet is verified. | ||
186 | .Pp | ||
187 | .Fn EC_POINT_point2bn | ||
188 | returns a | ||
189 | .Vt BIGNUM | ||
190 | containing the encoding of type | ||
191 | .Fa form | ||
192 | of the | ||
193 | .Fa point | ||
194 | on | ||
195 | .Fa group . | ||
196 | If | ||
197 | .Fa bn | ||
198 | is | ||
199 | .Dv NULL , | ||
200 | this | ||
201 | .Vt BIGNUM | ||
202 | is newly allocated, otherwise the result is copied into | ||
203 | .Fa bn | ||
204 | and returned. | ||
205 | .Fn EC_POINT_point2bn | ||
206 | is equivalent to | ||
207 | .Fn EC_POINT_point2oct | ||
208 | followed by | ||
209 | .Xr BN_bin2bn 3 . | ||
210 | .Pp | ||
211 | .Fn EC_POINT_bn2point | ||
212 | assumes that | ||
213 | .Fa bn | ||
214 | contains the encoding of a point on | ||
215 | .Fa group . | ||
216 | If | ||
217 | .Fa point | ||
218 | is | ||
219 | .Dv NULL , | ||
220 | the result is placed in a newly allocated | ||
221 | .Vt EC_POINT , | ||
222 | otherwise the result is placed in | ||
223 | .Fa point | ||
224 | which is then returned. | ||
225 | .Fn EC_POINT_bn2point | ||
226 | is equivalent to | ||
227 | .Xr BN_bn2bin 3 | ||
228 | followed by | ||
229 | .Fn EC_POINT_oct2point . | ||
230 | .Pp | ||
231 | .Fn EC_POINT_point2hex | ||
232 | returns a printable string containing the hexadecimal encoding of | ||
233 | the point encoding of type | ||
234 | .Fa form | ||
235 | of the | ||
236 | .Fa point | ||
237 | on | ||
238 | .Fa group . | ||
239 | The string must be freed by the caller using | ||
240 | .Xr free 3 . | ||
241 | .Fn EC_POINT_point2hex | ||
242 | is equivalent to | ||
243 | .Fn EC_POINT_point2bn | ||
244 | followed by | ||
245 | .Fn BN_bn2hex 3 . | ||
246 | .Pp | ||
247 | .Fn EC_POINT_hex2point | ||
248 | interprets | ||
249 | .Fa hex | ||
250 | as a hexadecimal encoding of the point encoding of a point on | ||
251 | .Fa group . | ||
252 | If | ||
253 | .Fa point | ||
254 | is | ||
255 | .Dv NULL , | ||
256 | the result is returned in a newly allocated | ||
257 | .Vt EC_POINT , | ||
258 | otherwise the result is copied into | ||
259 | .Fa point , | ||
260 | which is then returned. | ||
261 | .Fn EC_POINT_hex2point | ||
262 | is equivalent to | ||
263 | .Xr BN_hex2bn 3 | ||
264 | followed by | ||
265 | .Fn EC_POINT_bn2point . | ||
266 | .Sh RETURN VALUES | ||
267 | If | ||
268 | .Fa buf | ||
269 | is | ||
270 | .Dv NULL , | ||
271 | .Fn EC_POINT_point2oct | ||
272 | returns the length needed to encode the | ||
273 | .Fa point | ||
274 | on | ||
275 | .Fa group , | ||
276 | or 0 on error. | ||
277 | If | ||
278 | .Fa buf | ||
279 | is not | ||
280 | .Dv NULL , | ||
281 | .Fn EC_POINT_point2oct | ||
282 | returns the number of bytes written to | ||
283 | .Fa buf | ||
284 | or 0 on error. | ||
285 | Error conditions include that | ||
286 | .Fa form | ||
287 | is invalid, | ||
288 | .Fa len | ||
289 | is too small, and memory allocation failure. | ||
290 | .Pp | ||
291 | .Fn EC_POINT_oct2point | ||
292 | returns 1 on success and 0 on error. | ||
293 | Error conditions include invalid encoding, | ||
294 | .Fa buf | ||
295 | does not represent a point on | ||
296 | .Fa group , | ||
297 | or memory allocation failure. | ||
298 | .Pp | ||
299 | .Fn EC_POINT_point2bn | ||
300 | returns a | ||
301 | .Vt BIGNUM | ||
302 | containing the encoding of | ||
303 | .Fa point | ||
304 | or | ||
305 | .Dv NULL | ||
306 | on error. | ||
307 | The returned | ||
308 | .Vt BIGNUM | ||
309 | is either | ||
310 | .Fa in_bn | ||
311 | or a newly allocated one which must be freed by the caller. | ||
312 | Error conditions include those of | ||
313 | .Fn EC_POINT_point2oct , | ||
314 | .Xr BN_bn2bin 3 , | ||
315 | or memory allocation failure. | ||
316 | .Pp | ||
317 | .Fn EC_POINT_bn2point | ||
318 | returns an | ||
319 | .Vt EC_POINT | ||
320 | corresponding to the encoding in | ||
321 | .Fa bn | ||
322 | or | ||
323 | .Dv NULL | ||
324 | on error. | ||
325 | The returned | ||
326 | .Vt EC_POINT | ||
327 | is either | ||
328 | .Fa in_point | ||
329 | or a newly allocated one which must be freed by the caller. | ||
330 | Error conditions include those of | ||
331 | .Xr BN_bn2bin 3 , | ||
332 | .Fn EC_POINT_oct2point , | ||
333 | or memory allocation failure. | ||
334 | .Pp | ||
335 | .Fn EC_POINT_point2hex | ||
336 | returns a newly allocated string or | ||
337 | .Dv NULL | ||
338 | on error. | ||
339 | Error conditions include those of | ||
340 | .Fn EC_POINT_point2bn | ||
341 | or | ||
342 | .Xr BN_bn2hex 3 . | ||
343 | .Pp | ||
344 | .Fn EC_POINT_hex2point | ||
345 | returns an | ||
346 | .Vt EC_POINT | ||
347 | containing the decoded point on | ||
348 | .Fa group | ||
349 | or | ||
350 | .Dv NULL | ||
351 | on error. | ||
352 | The returned | ||
353 | .Vt EC_POINT | ||
354 | is either | ||
355 | .Fa in_point | ||
356 | or a newly allocated one which must be freed by the caller. | ||
357 | Error conditions are those of | ||
358 | .Xr BN_hex2bn 3 , | ||
359 | or | ||
360 | .Fn EC_POINT_bn2point . | ||
361 | .Sh SEE ALSO | ||
362 | .Xr BN_mod_sqrt 3 , | ||
363 | .Xr BN_new 3 , | ||
364 | .Xr BN_num_bits 3 , | ||
365 | .Xr crypto 3 , | ||
366 | .Xr d2i_ECPKParameters 3 , | ||
367 | .Xr EC_GROUP_check 3 , | ||
368 | .Xr EC_GROUP_get_curve_name 3 , | ||
369 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
370 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
371 | .Xr EC_KEY_METHOD_new 3 , | ||
372 | .Xr EC_KEY_new 3 , | ||
373 | .Xr EC_POINT_add 3 , | ||
374 | .Xr EC_POINT_get_affine_coordinates 3 , | ||
375 | .Xr EC_POINT_new 3 , | ||
376 | .Xr ECDH_compute_key 3 , | ||
377 | .Xr ECDSA_SIG_new 3 | ||
378 | .Sh STANDARDS | ||
379 | .Rs | ||
380 | .%T SEC 1: Elliptic Curve Cryptography, Version 2.0 | ||
381 | .%U https://www.secg.org/sec1-v2.pdf | ||
382 | .%D May 21, 2009 | ||
383 | .Re | ||
384 | .Sh HISTORY | ||
385 | .Fn EC_POINT_point2oct | ||
386 | and | ||
387 | .Fn EC_POINT_oct2point | ||
388 | first appeared in OpenSSL 0.9.7 and have been available since | ||
389 | .Ox 3.2 . | ||
390 | .Pp | ||
391 | .Fn EC_POINT_point2bn , | ||
392 | .Fn EC_POINT_bn2point , | ||
393 | .Fn EC_POINT_point2hex , | ||
394 | and | ||
395 | .Fn EC_POINT_hex2point | ||
396 | first appeared in OpenSSL 0.9.8 and have been available since | ||
397 | .Ox 4.5 . | ||
398 | .Sh BUGS | ||
399 | The | ||
400 | .Vt point_conversion_form_t | ||
401 | is not properly exposed in the API. | ||
402 | There is no representation for the point at infinity nor is there | ||
403 | an API interface for the parity bit, | ||
404 | forcing applications to invent their own and do bit twiddling in buffers. | ||
405 | .Pp | ||
406 | The poorly chosen signatures of the functions in this manual result | ||
407 | in an unergonomic API, particularly so for | ||
408 | .Fn EC_POINT_point2oct | ||
409 | and | ||
410 | .Fn EC_POINT_oct2point . | ||
411 | Due to fundamental misdesign in the EC library, | ||
412 | points are not directly linked to the curve they live on. | ||
413 | Adding checks that | ||
414 | .Fa point | ||
415 | lives on | ||
416 | .Fa group | ||
417 | is too expensive and intrusive, so it is and will continue to be easy | ||
418 | to make the EC_POINT_point2* API output nonsense. | ||
419 | .Pp | ||
420 | .Fn EC_POINT_point2bn | ||
421 | and | ||
422 | .Fn EC_POINT_bn2point | ||
423 | make no sense. | ||
424 | They abuse | ||
425 | .Vt BIGNUM | ||
426 | as a vector type, which is in poor taste. | ||
427 | .Pp | ||
428 | .Fn EC_POINT_point2hex | ||
429 | and | ||
430 | .Fn EC_POINT_hex2point | ||
431 | use a non-standard encoding format. | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 9f3d448432..b8dfe86d49 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.307 2025/03/08 17:12:55 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.308 2025/04/25 19:57:12 tb Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
4 | 4 | ||
@@ -133,12 +133,16 @@ MAN= \ | |||
133 | DSA_size.3 \ | 133 | DSA_size.3 \ |
134 | ECDH_compute_key.3 \ | 134 | ECDH_compute_key.3 \ |
135 | ECDSA_SIG_new.3 \ | 135 | ECDSA_SIG_new.3 \ |
136 | EC_GROUP_copy.3 \ | 136 | EC_GROUP_check.3 \ |
137 | EC_GROUP_new.3 \ | 137 | EC_GROUP_get_curve_name.3 \ |
138 | EC_GROUP_new_by_curve_name.3 \ | ||
139 | EC_GROUP_new_curve_GFp.3 \ | ||
138 | EC_KEY_METHOD_new.3 \ | 140 | EC_KEY_METHOD_new.3 \ |
139 | EC_KEY_new.3 \ | 141 | EC_KEY_new.3 \ |
140 | EC_POINT_add.3 \ | 142 | EC_POINT_add.3 \ |
143 | EC_POINT_get_affine_coordinates.3 \ | ||
141 | EC_POINT_new.3 \ | 144 | EC_POINT_new.3 \ |
145 | EC_POINT_point2oct.3 \ | ||
142 | ENGINE_new.3 \ | 146 | ENGINE_new.3 \ |
143 | ERR.3 \ | 147 | ERR.3 \ |
144 | ERR_GET_LIB.3 \ | 148 | ERR_GET_LIB.3 \ |