summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3
blob: b36d4805303cef6c43e72028c59cead39b0f93fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
.\" $OpenBSD: EC_POINT_get_affine_coordinates.3,v 1.1 2025/04/25 19:57:12 tb Exp $
.\"
.\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: April 25 2025 $
.Dt EC_POINT_GET_AFFINE_COORDINATES 3
.Os
.Sh NAME
.Nm EC_POINT_get_affine_coordinates ,
.Nm EC_POINT_set_affine_coordinates ,
.Nm EC_POINT_set_compressed_coordinates ,
.Nm EC_POINT_set_to_infinity ,
.Nm EC_POINT_get_affine_coordinates_GFp ,
.Nm EC_POINT_set_affine_coordinates_GFp ,
.Nm EC_POINT_set_compressed_coordinates_GFp
.Nd get and set coordinates of elliptic curve points
.Sh SYNOPSIS
.In openssl/bn.h
.In openssl/ec.h
.Pp
.Ft int
.Fo EC_POINT_get_affine_coordinates
.Fa "const EC_GROUP *group"
.Fa "const EC_POINT *point"
.Fa "BIGNUM *x"
.Fa "BIGNUM *y"
.Fa "BN_CTX *ctx"
.Fc
.Ft int
.Fo EC_POINT_set_affine_coordinates
.Fa "const EC_GROUP *group"
.Fa "EC_POINT *point"
.Fa "const BIGNUM *x"
.Fa "const BIGNUM *y"
.Fa "BN_CTX *ctx"
.Fc
.Ft int
.Fo EC_POINT_set_compressed_coordinates
.Fa "const EC_GROUP *group"
.Fa "EC_POINT *point"
.Fa "const BIGNUM *x"
.Fa "int y_bit"
.Fa "BN_CTX *ctx"
.Fc
.Ft int
.Fo EC_POINT_set_to_infinity
.Fa "const EC_GROUP *group"
.Fa "EC_POINT *point"
.Fc
.Pp
Deprecated:
.Pp
.Ft int
.Fo EC_POINT_get_affine_coordinates_GFp
.Fa "const EC_GROUP *group"
.Fa "const EC_POINT *point"
.Fa "BIGNUM *x"
.Fa "BIGNUM *y"
.Fa "BN_CTX *ctx"
.Fc
.Ft int
.Fo EC_POINT_set_affine_coordinates_GFp
.Fa "const EC_GROUP *group"
.Fa "EC_POINT *point"
.Fa "const BIGNUM *x"
.Fa "const BIGNUM *y"
.Fa "BN_CTX *ctx"
.Fc
.Ft int
.Fo EC_POINT_set_compressed_coordinates_GFp
.Fa "const EC_GROUP *group"
.Fa "EC_POINT *point"
.Fa "const BIGNUM *x"
.Fa "int y_bit"
.Fa "BN_CTX *ctx"
.Fc
.Sh DESCRIPTION
.Fn EC_POINT_get_affine_coordinates
assumes that
.Fa point
is a point on
.Fa group ,
calculates its affine coordinates from its internal representation
using the optional
.Fa ctx ,
and copies them into the optional user-provided
.Fa x
and
.Fa y .
.Pp
.Fn EC_POINT_set_affine_coordinates
assumes that
.Fa x
and
.Fa y
are the affine coordinates of a point on
.Fa group ,
converts them into internal representation and sets them on
.Fa point
using the optional
.Fa ctx .
The user-provided
.Fa point
should be the result of
.Fn EC_POINT_new 3
with an argument of
.Fa group .
It then verifies using
.Xr EC_POINT_is_on_curve 3
that
.Fa x
and
.Fa y
are indeed the affine coordinates of a point on
.Fa group .
.Pp
.Fn EC_POINT_set_compressed_coordinates
assumes that
.Fa x
is the x-coordinate and
.Fa y_bit
is the parity bit of a point on
.Fa group
and sets
.Fa point
to the corresponding point on
.Fa group .
It does this by solving the quadratic equation y^2 = x^3 + ax + b using
.Xr BN_mod_sqrt 3
and the optional
.Fa ctx ,
chooses the solution
.Fa y
with parity matching
.Fa y_bit ,
and passes
.Fa x
and
.Fa y
to
.Fn EC_POINT_set_affine_coordinates .
The user-provided
.Fa point
should be the result of
.Fn EC_POINT_new
with argument
.Fa group .
.Pp
.Fn EC_POINT_set_to_infinity
sets
.Fa point
to the internal representation of the point at infinity on
.Fa group .
.Pp
.Fn EC_POINT_get_affine_coordinates_GFp
is a deprecated alias for
.Fn EC_POINT_get_affine_coordinates .
Similarly for
.Fn EC_POINT_set_affine_coordinates_GFp
and
.Fn EC_POINT_set_compressed_coordinates_GFp .
.Sh RETURN VALUES
All these functions return 1 on success and 0 on error.
Error conditions include memory allocation failure,
that
.Fa point
is incompatible with
.Fa group ,
and, for the coordinate setters, that the provided coordinates
do not represent a point on
.Fa group .
.Sh SEE ALSO
.Xr BN_CTX_new 3 ,
.Xr BN_is_zero 3 ,
.Xr BN_mod_sqrt 3 ,
.Xr crypto 3 ,
.Xr d2i_ECPKParameters 3 ,
.Xr EC_GROUP_check 3 ,
.Xr EC_GROUP_get_curve_name 3 ,
.Xr EC_GROUP_new_by_curve_name 3 ,
.Xr EC_GROUP_new_curve_GFp 3 ,
.Xr EC_KEY_METHOD_new 3 ,
.Xr EC_KEY_new 3 ,
.Xr EC_POINT_add 3 ,
.Xr EC_POINT_new 3 ,
.Xr EC_POINT_point2oct 3 ,
.Xr ECDH_compute_key 3 ,
.Xr ECDSA_SIG_new 3
.Sh HISTORY
.Fn EC_POINT_get_affine_coordinates_GFp ,
.Fn EC_POINT_set_affine_coordinates_GFp ,
.Fn EC_POINT_set_compressed_coordinates_GFp ,
and
.Fn EC_POINT_set_to_infinity
first appeared in OpenSSL 0.9.7 and have been available since
.Ox 3.2 .
.Pp
.Fn EC_POINT_get_affine_coordinates ,
.Fn EC_POINT_set_affine_coordinates ,
and
.Fn EC_POINT_set_compressed_coordinates
first appeared in OpenSSL 1.1.1 and have been available since
.Ox 7.0 .