summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/EC_GROUP_get_curve_name.3
diff options
context:
space:
mode:
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.3266
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
33and 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
70typedef 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
87Deprecated:
88.Pp
89.Ft int
90.Fo EC_GROUP_get_basis_type
91.Fa "const EC_GROUP *group"
92.Fc
93.Sh DESCRIPTION
94The functions in this manual affect or allow the inspection of
95the details of the ASN.1 encoding produced by the
96.Xr i2d_ECPKParameters 3
97family of functions.
98Modern applications use named curves and uncompressed point encoding,
99which are the default for
100.Xr EC_GROUP_new_by_curve_name 3 .
101.Pp
102In this library, Elliptic curve parameters are either encoded as a
103.Em named curve ,
104using an ASN.1 Object Identifier (OID) to refer to
105standardized parameters that need to be built into the library,
106or using
107.Em explicit curve parameters
108where the field, the curve equation, the base point's coordinates
109and other data are encoded explicitly.
110The
111.Em implicitly CA
112variant is not supported.
113.Pp
114.Fn EC_GROUP_get_curve_name
115gets the Numerical Identifier (NID) representation of the
116ASN.1 Object Identifier used for the named curve encoding of
117.Fa group .
118.Fn EC_GROUP_set_curve_name
119sets it to
120.Fa nid .
121.Pp
122.Fn EC_GROUP_get_asn1_flag
123retrieves the value of the
124.Fa asn1_flag
125member of
126.Fa group .
127If the bit corresponding to
128.Dv OPENSSL_EC_NAMED_CURVE
129is set, named curve encoding is used for
130.Fa group ,
131otherwise explicit encoding is used.
132.Fn EC_GROUP_set_asn1_flag
133sets the
134.Fa asn1_flag
135member of group to
136.Fa flag ,
137which should be either
138.Dv OPENSSL_EC_NAMED_CURVE
139to use named curve encoding or
140.Dv OPENSSL_EC_EXPLICIT_CURVE
141to use explicit encoding.
142.Pp
143The ASN.1 encoding of explicit curve parameters includes
144an optional seed value for parameters generated verifiably at random.
145If a seed value is set on
146.Fa group ,
147.Fn EC_GROUP_get0_seed
148returns 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
152first clears any seed and length already stored in
153.Fa group .
154If
155.Fa seed
156is not
157.Dv NULL
158and
159.Fa len
160is not zero, it stores a copy of them in
161.Fa group .
162The
163.Fa seed
164should be a random byte string of
165.Fa len
166at least 20 bytes.
167The seed can be unset by passing
168.Dv NULL
169as a
170.Fa seed
171and a
172.Fa len
173of zero.
174The library does not perform any computation or validation with this seed,
175it only includes it in its ASN.1 encoded parameters,
176whether it contains a sensible value or not.
177.Pp
178Points on an elliptic curve, such as the generator or a public key,
179can be encoded in compressed form, uncompressed form,
180or in a hybrid form encompassing both, see
181.Xr EC_POINT_point2oct 3 .
182.Fn EC_GROUP_get_point_conversion_form
183retrieves the encoding used for points on
184.Fa group
185and
186.Fn EC_GROUP_set_point_conversion_form
187sets it to
188.Fa form .
189.Pp
190The deprecated
191.Fn EC_GROUP_get_basis_type
192only makes sense for curves over binary fields.
193It is provided for compatibility only.
194.Sh RETURN VALUES
195.Fn EC_GROUP_get_curve_name
196returns the NID to be used for named curve encoding of
197.Fa group
198or
199.Dv NID_undef
200if no NID is set.
201.Pp
202.Fn EC_GROUP_get_asn1_flag
203returns the value most recently set by
204.Fn EC_GROUP_set_asn1_flag
205on
206.Fa group .
207.Pp
208.Fn EC_GROUP_get0_seed
209returns an internal pointer to the
210.Fa seed
211on
212.Fa group
213or
214.Dv NULL
215if none is set.
216.Pp
217.Fn EC_GROUP_get_seed_len
218returns the byte length of the seed set on
219.Fa group
220or zero if none is set.
221.Pp
222.Fn EC_GROUP_set_seed
223returns 0 on memory allocation failure.
224It returns
225.Fa len
226on success unless
227.Fa seed
228is
229.Dv NULL
230or
231.Fa len
232is zero, in which case it returns 1.
233.Pp
234.Fn EC_GROUP_get_point_conversion_form
235returns the point conversion form last set by
236.Fn EC_GROUP_set_point_conversion_form
237on
238.Fa group .
239.Pp
240.Fn EC_GROUP_get_basis_type
241always 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
259These functions first appeared in OpenSSL 0.9.8 and have been available since
260.Ox 4.5 .
261.Sh BUGS
262Most of the setters cannot report errors and none of them perform proper
263input validation and accept most of the values passed in.
264This can result in invalid or nonsensical ASN.1 encoding produced by
265.Xr i2d_ECPKParameters 3
266and related functions.