diff options
Diffstat (limited to 'src/lib/libcrypto/man/EC_GROUP_get_curve_name.3')
-rw-r--r-- | src/lib/libcrypto/man/EC_GROUP_get_curve_name.3 | 266 |
1 files changed, 266 insertions, 0 deletions
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..940aa3c1a1 --- /dev/null +++ b/src/lib/libcrypto/man/EC_GROUP_get_curve_name.3 | |||
@@ -0,0 +1,266 @@ | |||
1 | .\" $OpenBSD: EC_GROUP_get_curve_name.3,v 1.4 2025/06/13 18:34:00 schwarze 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: June 13 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 | .Lb libcrypto | ||
36 | .In openssl/ec.h | ||
37 | .Ft int | ||
38 | .Fo EC_GROUP_get_curve_name | ||
39 | .Fa "const EC_GROUP *group" | ||
40 | .Fc | ||
41 | .Ft void | ||
42 | .Fo EC_GROUP_set_curve_name | ||
43 | .Fa "EC_GROUP *group" | ||
44 | .Fa "int nid" | ||
45 | .Fc | ||
46 | .Ft int | ||
47 | .Fo EC_GROUP_get_asn1_flag | ||
48 | .Fa "const EC_GROUP *group" | ||
49 | .Fc | ||
50 | .Ft void | ||
51 | .Fo EC_GROUP_set_asn1_flag | ||
52 | .Fa "EC_GROUP *group" | ||
53 | .Fa "int flag" | ||
54 | .Fc | ||
55 | .Ft unsigned char * | ||
56 | .Fo EC_GROUP_get0_seed | ||
57 | .Fa "const EC_GROUP *group" | ||
58 | .Fc | ||
59 | .Ft size_t | ||
60 | .Fo EC_GROUP_get_seed_len | ||
61 | .Fa "const EC_GROUP *group" | ||
62 | .Fc | ||
63 | .Ft size_t | ||
64 | .Fo EC_GROUP_set_seed | ||
65 | .Fa "EC_GROUP *group" | ||
66 | .Fa "const unsigned char *seed" | ||
67 | .Fa "size_t len" | ||
68 | .Fc | ||
69 | .Bd -literal | ||
70 | typedef enum { | ||
71 | POINT_CONVERSION_COMPRESSED = 2, | ||
72 | POINT_CONVERSION_UNCOMPRESSED = 4, | ||
73 | POINT_CONVERSION_HYBRID = 6 | ||
74 | } point_conversion_form_t; | ||
75 | |||
76 | .Ed | ||
77 | .Ft point_conversion_form_t | ||
78 | .Fo EC_GROUP_get_point_conversion_form | ||
79 | .Fa "const EC_GROUP *group" | ||
80 | .Fc | ||
81 | .Ft void | ||
82 | .Fo EC_GROUP_set_point_conversion_form | ||
83 | .Fa "EC_GROUP *group" | ||
84 | .Fa "point_conversion_form_t form" | ||
85 | .Fc | ||
86 | .Pp | ||
87 | Deprecated: | ||
88 | .Pp | ||
89 | .Ft int | ||
90 | .Fo EC_GROUP_get_basis_type | ||
91 | .Fa "const EC_GROUP *group" | ||
92 | .Fc | ||
93 | .Sh DESCRIPTION | ||
94 | The functions in this manual affect or allow the inspection of | ||
95 | the details of the ASN.1 encoding produced by the | ||
96 | .Xr i2d_ECPKParameters 3 | ||
97 | family of functions. | ||
98 | Modern applications use named curves and uncompressed point encoding, | ||
99 | which are the default for | ||
100 | .Xr EC_GROUP_new_by_curve_name 3 . | ||
101 | .Pp | ||
102 | In this library, Elliptic curve parameters are either encoded as a | ||
103 | .Em named curve , | ||
104 | using an ASN.1 Object Identifier (OID) to refer to | ||
105 | standardized parameters that need to be built into the library, | ||
106 | or using | ||
107 | .Em explicit curve parameters | ||
108 | where the field, the curve equation, the base point's coordinates | ||
109 | and other data are encoded explicitly. | ||
110 | The | ||
111 | .Em implicitly CA | ||
112 | variant is not supported. | ||
113 | .Pp | ||
114 | .Fn EC_GROUP_get_curve_name | ||
115 | gets the Numerical Identifier (NID) representation of the | ||
116 | ASN.1 Object Identifier used for the named curve encoding of | ||
117 | .Fa group . | ||
118 | .Fn EC_GROUP_set_curve_name | ||
119 | sets it to | ||
120 | .Fa nid . | ||
121 | .Pp | ||
122 | .Fn EC_GROUP_get_asn1_flag | ||
123 | retrieves the value of the | ||
124 | .Fa asn1_flag | ||
125 | member of | ||
126 | .Fa group . | ||
127 | If the bit corresponding to | ||
128 | .Dv OPENSSL_EC_NAMED_CURVE | ||
129 | is set, named curve encoding is used for | ||
130 | .Fa group , | ||
131 | otherwise explicit encoding is used. | ||
132 | .Fn EC_GROUP_set_asn1_flag | ||
133 | sets the | ||
134 | .Fa asn1_flag | ||
135 | member of group to | ||
136 | .Fa flag , | ||
137 | which should be either | ||
138 | .Dv OPENSSL_EC_NAMED_CURVE | ||
139 | to use named curve encoding or | ||
140 | .Dv OPENSSL_EC_EXPLICIT_CURVE | ||
141 | to use explicit encoding. | ||
142 | .Pp | ||
143 | The ASN.1 encoding of explicit curve parameters includes | ||
144 | an optional seed value for parameters generated verifiably at random. | ||
145 | If a seed value is set on | ||
146 | .Fa group , | ||
147 | .Fn EC_GROUP_get0_seed | ||
148 | returns a pointer to the internal byte string whose length is returned by | ||
149 | .Fn EC_GROUP_get_seed_len . | ||
150 | .Pp | ||
151 | .Fn EC_GROUP_set_seed | ||
152 | first clears any seed and length already stored in | ||
153 | .Fa group . | ||
154 | If | ||
155 | .Fa seed | ||
156 | is not | ||
157 | .Dv NULL | ||
158 | and | ||
159 | .Fa len | ||
160 | is not zero, it stores a copy of them in | ||
161 | .Fa group . | ||
162 | The | ||
163 | .Fa seed | ||
164 | should be a random byte string of | ||
165 | .Fa len | ||
166 | at least 20 bytes. | ||
167 | The seed can be unset by passing | ||
168 | .Dv NULL | ||
169 | as a | ||
170 | .Fa seed | ||
171 | and a | ||
172 | .Fa len | ||
173 | of zero. | ||
174 | The library does not perform any computation or validation with this seed, | ||
175 | it only includes it in its ASN.1 encoded parameters, | ||
176 | whether it contains a sensible value or not. | ||
177 | .Pp | ||
178 | Points on an elliptic curve, such as the generator or a public key, | ||
179 | can be encoded in compressed form, uncompressed form, | ||
180 | or in a hybrid form encompassing both, see | ||
181 | .Xr EC_POINT_point2oct 3 . | ||
182 | .Fn EC_GROUP_get_point_conversion_form | ||
183 | retrieves the encoding used for points on | ||
184 | .Fa group | ||
185 | and | ||
186 | .Fn EC_GROUP_set_point_conversion_form | ||
187 | sets it to | ||
188 | .Fa form . | ||
189 | .Pp | ||
190 | The deprecated | ||
191 | .Fn EC_GROUP_get_basis_type | ||
192 | only makes sense for curves over binary fields. | ||
193 | It is provided for compatibility only. | ||
194 | .Sh RETURN VALUES | ||
195 | .Fn EC_GROUP_get_curve_name | ||
196 | returns the NID to be used for named curve encoding of | ||
197 | .Fa group | ||
198 | or | ||
199 | .Dv NID_undef | ||
200 | if no NID is set. | ||
201 | .Pp | ||
202 | .Fn EC_GROUP_get_asn1_flag | ||
203 | returns the value most recently set by | ||
204 | .Fn EC_GROUP_set_asn1_flag | ||
205 | on | ||
206 | .Fa group . | ||
207 | .Pp | ||
208 | .Fn EC_GROUP_get0_seed | ||
209 | returns an internal pointer to the | ||
210 | .Fa seed | ||
211 | on | ||
212 | .Fa group | ||
213 | or | ||
214 | .Dv NULL | ||
215 | if none is set. | ||
216 | .Pp | ||
217 | .Fn EC_GROUP_get_seed_len | ||
218 | returns the byte length of the seed set on | ||
219 | .Fa group | ||
220 | or zero if none is set. | ||
221 | .Pp | ||
222 | .Fn EC_GROUP_set_seed | ||
223 | returns 0 on memory allocation failure. | ||
224 | It returns | ||
225 | .Fa len | ||
226 | on success unless | ||
227 | .Fa seed | ||
228 | is | ||
229 | .Dv NULL | ||
230 | or | ||
231 | .Fa len | ||
232 | is zero, in which case it returns 1. | ||
233 | .Pp | ||
234 | .Fn EC_GROUP_get_point_conversion_form | ||
235 | returns the point conversion form last set by | ||
236 | .Fn EC_GROUP_set_point_conversion_form | ||
237 | on | ||
238 | .Fa group . | ||
239 | .Pp | ||
240 | .Fn EC_GROUP_get_basis_type | ||
241 | always returns | ||
242 | .Dv NID_undef . | ||
243 | .Sh SEE ALSO | ||
244 | .Xr crypto 3 , | ||
245 | .Xr d2i_ECPKParameters 3 , | ||
246 | .Xr EC_GROUP_check 3 , | ||
247 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
248 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
249 | .Xr EC_KEY_METHOD_new 3 , | ||
250 | .Xr EC_KEY_new 3 , | ||
251 | .Xr EC_POINT_add 3 , | ||
252 | .Xr EC_POINT_get_affine_coordinates 3 , | ||
253 | .Xr EC_POINT_new 3 , | ||
254 | .Xr EC_POINT_point2oct 3 , | ||
255 | .Xr ECDH_compute_key 3 , | ||
256 | .Xr ECDSA_SIG_new 3 , | ||
257 | .Xr OBJ_obj2nid 3 | ||
258 | .Sh HISTORY | ||
259 | These functions first appeared in OpenSSL 0.9.8 and have been available since | ||
260 | .Ox 4.5 . | ||
261 | .Sh BUGS | ||
262 | Most of the setters cannot report errors and none of them perform proper | ||
263 | input validation and accept most of the values passed in. | ||
264 | This can result in invalid or nonsensical ASN.1 encoding produced by | ||
265 | .Xr i2d_ECPKParameters 3 | ||
266 | and related functions. | ||