1EC_POINT_NEW(3) OpenSSL EC_POINT_NEW(3)
2
3
4
6 EC_POINT_set_Jprojective_coordinates_GFp, EC_POINT_point2buf,
7 EC_POINT_new, EC_POINT_free, EC_POINT_clear_free, EC_POINT_copy,
8 EC_POINT_dup, EC_POINT_method_of, EC_POINT_set_to_infinity,
9 EC_POINT_get_Jprojective_coordinates_GFp,
10 EC_POINT_set_affine_coordinates, EC_POINT_get_affine_coordinates,
11 EC_POINT_set_compressed_coordinates,
12 EC_POINT_set_affine_coordinates_GFp,
13 EC_POINT_get_affine_coordinates_GFp,
14 EC_POINT_set_compressed_coordinates_GFp,
15 EC_POINT_set_affine_coordinates_GF2m,
16 EC_POINT_get_affine_coordinates_GF2m,
17 EC_POINT_set_compressed_coordinates_GF2m, EC_POINT_point2oct,
18 EC_POINT_oct2point, EC_POINT_point2bn, EC_POINT_bn2point,
19 EC_POINT_point2hex, EC_POINT_hex2point - Functions for creating,
20 destroying and manipulating EC_POINT objects
21
23 #include <openssl/ec.h>
24
25 EC_POINT *EC_POINT_new(const EC_GROUP *group);
26 void EC_POINT_free(EC_POINT *point);
27 void EC_POINT_clear_free(EC_POINT *point);
28 int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src);
29 EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group);
30 const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);
31 int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point);
32 int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group,
33 EC_POINT *p,
34 const BIGNUM *x, const BIGNUM *y,
35 const BIGNUM *z, BN_CTX *ctx);
36 int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
37 const EC_POINT *p,
38 BIGNUM *x, BIGNUM *y, BIGNUM *z,
39 BN_CTX *ctx);
40 int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p,
41 const BIGNUM *x, const BIGNUM *y,
42 BN_CTX *ctx);
43 int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p,
44 BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
45 int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p,
46 const BIGNUM *x, int y_bit,
47 BN_CTX *ctx);
48 int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
49 const BIGNUM *x, const BIGNUM *y,
50 BN_CTX *ctx);
51 int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
52 const EC_POINT *p,
53 BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
54 int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
55 EC_POINT *p,
56 const BIGNUM *x, int y_bit,
57 BN_CTX *ctx);
58 int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,
59 const BIGNUM *x, const BIGNUM *y,
60 BN_CTX *ctx);
61 int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
62 const EC_POINT *p,
63 BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
64 int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group,
65 EC_POINT *p,
66 const BIGNUM *x, int y_bit,
67 BN_CTX *ctx);
68 size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p,
69 point_conversion_form_t form,
70 unsigned char *buf, size_t len, BN_CTX *ctx);
71 size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point,
72 point_conversion_form_t form,
73 unsigned char **pbuf, BN_CTX *ctx);
74 int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p,
75 const unsigned char *buf, size_t len, BN_CTX *ctx);
76 BIGNUM *EC_POINT_point2bn(const EC_GROUP *group, const EC_POINT *p,
77 point_conversion_form_t form, BIGNUM *bn,
78 BN_CTX *ctx);
79 EC_POINT *EC_POINT_bn2point(const EC_GROUP *group, const BIGNUM *bn,
80 EC_POINT *p, BN_CTX *ctx);
81 char *EC_POINT_point2hex(const EC_GROUP *group, const EC_POINT *p,
82 point_conversion_form_t form, BN_CTX *ctx);
83 EC_POINT *EC_POINT_hex2point(const EC_GROUP *group, const char *hex,
84 EC_POINT *p, BN_CTX *ctx);
85
87 An EC_POINT structure represents a point on a curve. A new point is
88 constructed by calling the function EC_POINT_new() and providing the
89 group object that the point relates to.
90
91 EC_POINT_free() frees the memory associated with the EC_POINT. if
92 point is NULL nothing is done.
93
94 EC_POINT_clear_free() destroys any sensitive data held within the
95 EC_POINT and then frees its memory. If point is NULL nothing is done.
96
97 EC_POINT_copy() copies the point src into dst. Both src and dst must
98 use the same EC_METHOD.
99
100 EC_POINT_dup() creates a new EC_POINT object and copies the content
101 from src to the newly created EC_POINT object.
102
103 EC_POINT_method_of() obtains the EC_METHOD associated with point.
104
105 A valid point on a curve is the special point at infinity. A point is
106 set to be at infinity by calling EC_POINT_set_to_infinity().
107
108 The affine co-ordinates for a point describe a point in terms of its x
109 and y position. The function EC_POINT_set_affine_coordinates() sets the
110 x and y co-ordinates for the point p defined over the curve given in
111 group. The function EC_POINT_get_affine_coordinates() sets x and y,
112 either of which may be NULL, to the corresponding coordinates of p.
113
114 The functions EC_POINT_set_affine_coordinates_GFp() and
115 EC_POINT_set_affine_coordinates_GF2m() are synonyms for
116 EC_POINT_set_affine_coordinates(). They are defined for backwards
117 compatibility only and should not be used.
118
119 The functions EC_POINT_get_affine_coordinates_GFp() and
120 EC_POINT_get_affine_coordinates_GF2m() are synonyms for
121 EC_POINT_get_affine_coordinates(). They are defined for backwards
122 compatibility only and should not be used.
123
124 As well as the affine co-ordinates, a point can alternatively be
125 described in terms of its Jacobian projective co-ordinates (for Fp
126 curves only). Jacobian projective co-ordinates are expressed as three
127 values x, y and z. Working in this co-ordinate system provides more
128 efficient point multiplication operations. A mapping exists between
129 Jacobian projective co-ordinates and affine co-ordinates. A Jacobian
130 projective co-ordinate (x, y, z) can be written as an affine co-
131 ordinate as (x/(z^2), y/(z^3)). Conversion to Jacobian projective from
132 affine co-ordinates is simple. The co-ordinate (x, y) is mapped to (x,
133 y, 1). To set or get the projective co-ordinates use
134 EC_POINT_set_Jprojective_coordinates_GFp() and
135 EC_POINT_get_Jprojective_coordinates_GFp() respectively.
136
137 Points can also be described in terms of their compressed co-ordinates.
138 For a point (x, y), for any given value for x such that the point is on
139 the curve there will only ever be two possible values for y. Therefore
140 a point can be set using the EC_POINT_set_compressed_coordinates()
141 function where x is the x co-ordinate and y_bit is a value 0 or 1 to
142 identify which of the two possible values for y should be used.
143
144 The functions EC_POINT_set_compressed_coordinates_GFp() and
145 EC_POINT_set_compressed_coordinates_GF2m() are synonyms for
146 EC_POINT_set_compressed_coordinates(). They are defined for backwards
147 compatibility only and should not be used.
148
149 In addition EC_POINT can be converted to and from various external
150 representations. The octet form is the binary encoding of the ECPoint
151 structure (as defined in RFC5480 and used in certificates and TLS
152 records): only the content octets are present, the OCTET STRING tag and
153 length are not included. BIGNUM form is the octet form interpreted as a
154 big endian integer converted to a BIGNUM structure. Hexadecimal form is
155 the octet form converted to a NULL terminated character string where
156 each character is one of the printable values 0-9 or A-F (or a-f).
157
158 The functions EC_POINT_point2oct(), EC_POINT_oct2point(),
159 EC_POINT_point2bn(), EC_POINT_bn2point(), EC_POINT_point2hex() and
160 EC_POINT_hex2point() convert from and to EC_POINTs for the formats:
161 octet, BIGNUM and hexadecimal respectively.
162
163 The function EC_POINT_point2oct() must be supplied with a buffer long
164 enough to store the octet form. The return value provides the number of
165 octets stored. Calling the function with a NULL buffer will not
166 perform the conversion but will still return the required buffer
167 length.
168
169 The function EC_POINT_point2buf() allocates a buffer of suitable length
170 and writes an EC_POINT to it in octet format. The allocated buffer is
171 written to *pbuf and its length is returned. The caller must free up
172 the allocated buffer with a call to OPENSSL_free(). Since the allocated
173 buffer value is written to *pbuf the pbuf parameter MUST NOT be NULL.
174
175 The function EC_POINT_point2hex() will allocate sufficient memory to
176 store the hexadecimal string. It is the caller's responsibility to free
177 this memory with a subsequent call to OPENSSL_free().
178
180 EC_POINT_new() and EC_POINT_dup() return the newly allocated EC_POINT
181 or NULL on error.
182
183 The following functions return 1 on success or 0 on error:
184 EC_POINT_copy(), EC_POINT_set_to_infinity(),
185 EC_POINT_set_Jprojective_coordinates_GFp(),
186 EC_POINT_get_Jprojective_coordinates_GFp(),
187 EC_POINT_set_affine_coordinates_GFp(),
188 EC_POINT_get_affine_coordinates_GFp(),
189 EC_POINT_set_compressed_coordinates_GFp(),
190 EC_POINT_set_affine_coordinates_GF2m(),
191 EC_POINT_get_affine_coordinates_GF2m(),
192 EC_POINT_set_compressed_coordinates_GF2m() and EC_POINT_oct2point().
193
194 EC_POINT_method_of returns the EC_METHOD associated with the supplied
195 EC_POINT.
196
197 EC_POINT_point2oct() and EC_POINT_point2buf() return the length of the
198 required buffer or 0 on error.
199
200 EC_POINT_point2bn() returns the pointer to the BIGNUM supplied, or NULL
201 on error.
202
203 EC_POINT_bn2point() returns the pointer to the EC_POINT supplied, or
204 NULL on error.
205
206 EC_POINT_point2hex() returns a pointer to the hex string, or NULL on
207 error.
208
209 EC_POINT_hex2point() returns the pointer to the EC_POINT supplied, or
210 NULL on error.
211
213 crypto(7), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_add(3),
214 EC_KEY_new(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3)
215
217 Copyright 2013-2018 The OpenSSL Project Authors. All Rights Reserved.
218
219 Licensed under the OpenSSL license (the "License"). You may not use
220 this file except in compliance with the License. You can obtain a copy
221 in the file LICENSE in the source distribution or at
222 <https://www.openssl.org/source/license.html>.
223
224
225
2261.1.1 2018-09-11 EC_POINT_NEW(3)