1EC_POINT_new(3) OpenSSL EC_POINT_new(3)
2
3
4
6 EC_POINT_new, EC_POINT_free, EC_POINT_clear_free, EC_POINT_copy,
7 EC_POINT_dup, EC_POINT_method_of, EC_POINT_set_to_infinity,
8 EC_POINT_set_Jprojective_coordinates,
9 EC_POINT_get_Jprojective_coordinates_GFp,
10 EC_POINT_set_affine_coordinates_GFp,
11 EC_POINT_get_affine_coordinates_GFp,
12 EC_POINT_set_compressed_coordinates_GFp,
13 EC_POINT_set_affine_coordinates_GF2m,
14 EC_POINT_get_affine_coordinates_GF2m,
15 EC_POINT_set_compressed_coordinates_GF2m, EC_POINT_point2oct,
16 EC_POINT_oct2point, EC_POINT_point2bn, EC_POINT_bn2point,
17 EC_POINT_point2hex, EC_POINT_hex2point - Functions for creating,
18 destroying and manipulating EC_POINT objects.
19
21 #include <openssl/ec.h>
22 #include <openssl/bn.h>
23
24 EC_POINT *EC_POINT_new(const EC_GROUP *group);
25 void EC_POINT_free(EC_POINT *point);
26 void EC_POINT_clear_free(EC_POINT *point);
27 int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src);
28 EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group);
29 const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);
30 int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point);
31 int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
32 const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx);
33 int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
34 const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx);
35 int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
36 const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);
37 int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
38 const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
39 int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
40 const BIGNUM *x, int y_bit, BN_CTX *ctx);
41 int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,
42 const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);
43 int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
44 const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
45 int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,
46 const BIGNUM *x, int y_bit, BN_CTX *ctx);
47 size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p,
48 point_conversion_form_t form,
49 unsigned char *buf, size_t len, BN_CTX *ctx);
50 int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p,
51 const unsigned char *buf, size_t len, BN_CTX *ctx);
52 BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *,
53 point_conversion_form_t form, BIGNUM *, BN_CTX *);
54 EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *,
55 EC_POINT *, BN_CTX *);
56 char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *,
57 point_conversion_form_t form, BN_CTX *);
58 EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *,
59 EC_POINT *, BN_CTX *);
60
62 An EC_POINT represents a point on a curve. A new point is constructed
63 by calling the function EC_POINT_new and providing the group object
64 that the point relates to.
65
66 EC_POINT_free frees the memory associated with the EC_POINT.
67
68 EC_POINT_clear_free destroys any sensitive data held within the
69 EC_POINT and then frees its memory.
70
71 EC_POINT_copy copies the point src into dst. Both src and dst must use
72 the same EC_METHOD.
73
74 EC_POINT_dup creates a new EC_POINT object and copies the content from
75 src to the newly created EC_POINT object.
76
77 EC_POINT_method_of obtains the EC_METHOD associated with point.
78
79 A valid point on a curve is the special point at infinity. A point is
80 set to be at infinity by calling EC_POINT_set_to_infinity.
81
82 The affine co-ordinates for a point describe a point in terms of its x
83 and y position. The functions EC_POINT_set_affine_coordinates_GFp and
84 EC_POINT_set_affine_coordinates_GF2m set the x and y co-ordinates for
85 the point p defined over the curve given in group.
86
87 As well as the affine co-ordinates, a point can alternatively be
88 described in terms of its Jacobian projective co-ordinates (for Fp
89 curves only). Jacobian projective co-ordinates are expressed as three
90 values x, y and z. Working in this co-ordinate system provides more
91 efficient point multiplication operations. A mapping exists between
92 Jacobian projective co-ordinates and affine co-ordinates. A Jacobian
93 projective co-ordinate (x, y, z) can be written as an affine co-
94 ordinate as (x/(z^2), y/(z^3)). Conversion to Jacobian projective to
95 affine co-ordinates is simple. The co-ordinate (x, y) is mapped to (x,
96 y, 1). To set or get the projective co-ordinates use
97 EC_POINT_set_Jprojective_coordinates_GFp and
98 EC_POINT_get_Jprojective_coordinates_GFp respectively.
99
100 Points can also be described in terms of their compressed co-ordinates.
101 For a point (x, y), for any given value for x such that the point is on
102 the curve there will only ever be two possible values for y. Therefore
103 a point can be set using the EC_POINT_set_compressed_coordinates_GFp
104 and EC_POINT_set_compressed_coordinates_GF2m functions where x is the x
105 co-ordinate and y_bit is a value 0 or 1 to identify which of the two
106 possible values for y should be used.
107
108 In addition EC_POINTs can be converted to and from various external
109 representations. Supported representations are octet strings, BIGNUMs
110 and hexadecimal. Octet strings are stored in a buffer along with an
111 associated buffer length. A point held in a BIGNUM is calculated by
112 converting the point to an octet string and then converting that octet
113 string into a BIGNUM integer. Points in hexadecimal format are stored
114 in a NULL terminated character string where each character is one of
115 the printable values 0-9 or A-F (or a-f).
116
117 The functions EC_POINT_point2oct, EC_POINT_oct2point,
118 EC_POINT_point2bn, EC_POINT_bn2point, EC_POINT_point2hex and
119 EC_POINT_hex2point convert from and to EC_POINTs for the formats: octet
120 string, BIGNUM and hexadecimal respectively.
121
122 The function EC_POINT_point2oct must be supplied with a buffer long
123 enough to store the octet string. The return value provides the number
124 of octets stored. Calling the function with a NULL buffer will not
125 perform the conversion but will still return the required buffer
126 length.
127
128 The function EC_POINT_point2hex will allocate sufficient memory to
129 store the hexadecimal string. It is the caller's responsibility to free
130 this memory with a subsequent call to OPENSSL_free().
131
133 EC_POINT_new and EC_POINT_dup return the newly allocated EC_POINT or
134 NULL on error.
135
136 The following functions return 1 on success or 0 on error:
137 EC_POINT_copy, EC_POINT_set_to_infinity,
138 EC_POINT_set_Jprojective_coordinates_GFp,
139 EC_POINT_get_Jprojective_coordinates_GFp,
140 EC_POINT_set_affine_coordinates_GFp,
141 EC_POINT_get_affine_coordinates_GFp,
142 EC_POINT_set_compressed_coordinates_GFp,
143 EC_POINT_set_affine_coordinates_GF2m,
144 EC_POINT_get_affine_coordinates_GF2m,
145 EC_POINT_set_compressed_coordinates_GF2m and EC_POINT_oct2point.
146
147 EC_POINT_method_of returns the EC_METHOD associated with the supplied
148 EC_POINT.
149
150 EC_POINT_point2oct returns the length of the required buffer, or 0 on
151 error.
152
153 EC_POINT_point2bn returns the pointer to the BIGNUM supplied, or NULL
154 on error.
155
156 EC_POINT_bn2point returns the pointer to the EC_POINT supplied, or NULL
157 on error.
158
159 EC_POINT_point2hex returns a pointer to the hex string, or NULL on
160 error.
161
162 EC_POINT_hex2point returns the pointer to the EC_POINT supplied, or
163 NULL on error.
164
166 crypto(3), ec(3), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_add(3),
167 EC_KEY_new(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3)
168
169
170
1711.0.2o 2019-09-10 EC_POINT_new(3)