summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3')
-rw-r--r--src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3216
1 files changed, 216 insertions, 0 deletions
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..76ef516307
--- /dev/null
+++ b/src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3
@@ -0,0 +1,216 @@
1.\" $OpenBSD: EC_POINT_get_affine_coordinates.3,v 1.2 2025/06/08 22:40:29 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 8 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.Lb libcrypto
31.In openssl/bn.h
32.In openssl/ec.h
33.Pp
34.Ft int
35.Fo EC_POINT_get_affine_coordinates
36.Fa "const EC_GROUP *group"
37.Fa "const EC_POINT *point"
38.Fa "BIGNUM *x"
39.Fa "BIGNUM *y"
40.Fa "BN_CTX *ctx"
41.Fc
42.Ft int
43.Fo EC_POINT_set_affine_coordinates
44.Fa "const EC_GROUP *group"
45.Fa "EC_POINT *point"
46.Fa "const BIGNUM *x"
47.Fa "const BIGNUM *y"
48.Fa "BN_CTX *ctx"
49.Fc
50.Ft int
51.Fo EC_POINT_set_compressed_coordinates
52.Fa "const EC_GROUP *group"
53.Fa "EC_POINT *point"
54.Fa "const BIGNUM *x"
55.Fa "int y_bit"
56.Fa "BN_CTX *ctx"
57.Fc
58.Ft int
59.Fo EC_POINT_set_to_infinity
60.Fa "const EC_GROUP *group"
61.Fa "EC_POINT *point"
62.Fc
63.Pp
64Deprecated:
65.Pp
66.Ft int
67.Fo EC_POINT_get_affine_coordinates_GFp
68.Fa "const EC_GROUP *group"
69.Fa "const EC_POINT *point"
70.Fa "BIGNUM *x"
71.Fa "BIGNUM *y"
72.Fa "BN_CTX *ctx"
73.Fc
74.Ft int
75.Fo EC_POINT_set_affine_coordinates_GFp
76.Fa "const EC_GROUP *group"
77.Fa "EC_POINT *point"
78.Fa "const BIGNUM *x"
79.Fa "const BIGNUM *y"
80.Fa "BN_CTX *ctx"
81.Fc
82.Ft int
83.Fo EC_POINT_set_compressed_coordinates_GFp
84.Fa "const EC_GROUP *group"
85.Fa "EC_POINT *point"
86.Fa "const BIGNUM *x"
87.Fa "int y_bit"
88.Fa "BN_CTX *ctx"
89.Fc
90.Sh DESCRIPTION
91.Fn EC_POINT_get_affine_coordinates
92assumes that
93.Fa point
94is a point on
95.Fa group ,
96calculates its affine coordinates from its internal representation
97using the optional
98.Fa ctx ,
99and copies them into the optional user-provided
100.Fa x
101and
102.Fa y .
103.Pp
104.Fn EC_POINT_set_affine_coordinates
105assumes that
106.Fa x
107and
108.Fa y
109are the affine coordinates of a point on
110.Fa group ,
111converts them into internal representation and sets them on
112.Fa point
113using the optional
114.Fa ctx .
115The user-provided
116.Fa point
117should be the result of
118.Fn EC_POINT_new 3
119with an argument of
120.Fa group .
121It then verifies using
122.Xr EC_POINT_is_on_curve 3
123that
124.Fa x
125and
126.Fa y
127are indeed the affine coordinates of a point on
128.Fa group .
129.Pp
130.Fn EC_POINT_set_compressed_coordinates
131assumes that
132.Fa x
133is the x-coordinate and
134.Fa y_bit
135is the parity bit of a point on
136.Fa group
137and sets
138.Fa point
139to the corresponding point on
140.Fa group .
141It does this by solving the quadratic equation y^2 = x^3 + ax + b using
142.Xr BN_mod_sqrt 3
143and the optional
144.Fa ctx ,
145chooses the solution
146.Fa y
147with parity matching
148.Fa y_bit ,
149and passes
150.Fa x
151and
152.Fa y
153to
154.Fn EC_POINT_set_affine_coordinates .
155The user-provided
156.Fa point
157should be the result of
158.Fn EC_POINT_new
159with argument
160.Fa group .
161.Pp
162.Fn EC_POINT_set_to_infinity
163sets
164.Fa point
165to the internal representation of the point at infinity on
166.Fa group .
167.Pp
168.Fn EC_POINT_get_affine_coordinates_GFp
169is a deprecated alias for
170.Fn EC_POINT_get_affine_coordinates .
171Similarly for
172.Fn EC_POINT_set_affine_coordinates_GFp
173and
174.Fn EC_POINT_set_compressed_coordinates_GFp .
175.Sh RETURN VALUES
176All these functions return 1 on success and 0 on error.
177Error conditions include memory allocation failure,
178that
179.Fa point
180is incompatible with
181.Fa group ,
182and, for the coordinate setters, that the provided coordinates
183do not represent a point on
184.Fa group .
185.Sh SEE ALSO
186.Xr BN_CTX_new 3 ,
187.Xr BN_is_zero 3 ,
188.Xr BN_mod_sqrt 3 ,
189.Xr crypto 3 ,
190.Xr d2i_ECPKParameters 3 ,
191.Xr EC_GROUP_check 3 ,
192.Xr EC_GROUP_get_curve_name 3 ,
193.Xr EC_GROUP_new_by_curve_name 3 ,
194.Xr EC_GROUP_new_curve_GFp 3 ,
195.Xr EC_KEY_METHOD_new 3 ,
196.Xr EC_KEY_new 3 ,
197.Xr EC_POINT_add 3 ,
198.Xr EC_POINT_new 3 ,
199.Xr EC_POINT_point2oct 3 ,
200.Xr ECDH_compute_key 3 ,
201.Xr ECDSA_SIG_new 3
202.Sh HISTORY
203.Fn EC_POINT_get_affine_coordinates_GFp ,
204.Fn EC_POINT_set_affine_coordinates_GFp ,
205.Fn EC_POINT_set_compressed_coordinates_GFp ,
206and
207.Fn EC_POINT_set_to_infinity
208first appeared in OpenSSL 0.9.7 and have been available since
209.Ox 3.2 .
210.Pp
211.Fn EC_POINT_get_affine_coordinates ,
212.Fn EC_POINT_set_affine_coordinates ,
213and
214.Fn EC_POINT_set_compressed_coordinates
215first appeared in OpenSSL 1.1.1 and have been available since
216.Ox 7.0 .