NAME
EC_POINT_get_affine_coordinates
,
EC_POINT_set_affine_coordinates
,
EC_POINT_set_compressed_coordinates
,
EC_POINT_set_to_infinity
,
EC_POINT_get_affine_coordinates_GFp
,
EC_POINT_set_affine_coordinates_GFp
,
EC_POINT_set_compressed_coordinates_GFp
—
get and set coordinates of elliptic
curve points
SYNOPSIS
#include
<openssl/bn.h>
#include <openssl/ec.h>
int
EC_POINT_get_affine_coordinates
(const
EC_GROUP *group, const EC_POINT *point,
BIGNUM *x, BIGNUM *y,
BN_CTX *ctx);
int
EC_POINT_set_affine_coordinates
(const
EC_GROUP *group, EC_POINT *point,
const BIGNUM *x, const BIGNUM
*y, BN_CTX *ctx);
int
EC_POINT_set_compressed_coordinates
(const
EC_GROUP *group, EC_POINT *point,
const BIGNUM *x, int y_bit,
BN_CTX *ctx);
int
EC_POINT_set_to_infinity
(const
EC_GROUP *group, EC_POINT *point);
Deprecated:
int
EC_POINT_get_affine_coordinates_GFp
(const
EC_GROUP *group, const EC_POINT *point,
BIGNUM *x, BIGNUM *y,
BN_CTX *ctx);
int
EC_POINT_set_affine_coordinates_GFp
(const
EC_GROUP *group, EC_POINT *point,
const BIGNUM *x, const BIGNUM
*y, BN_CTX *ctx);
int
EC_POINT_set_compressed_coordinates_GFp
(const
EC_GROUP *group, EC_POINT *point,
const BIGNUM *x, int y_bit,
BN_CTX *ctx);
DESCRIPTION
EC_POINT_get_affine_coordinates
()
assumes that point is a point on
group, calculates its affine coordinates from its
internal representation using the optional ctx, and
copies them into the optional user-provided x and
y.
EC_POINT_set_affine_coordinates
()
assumes that x and y are the
affine coordinates of a point on group, converts them
into internal representation and sets them on point
using the optional ctx. The user-provided
point should be the result of
EC_POINT_new
(3)
with an argument of group. It then verifies using
EC_POINT_is_on_curve(3) that x and
y are indeed the affine coordinates of a point on
group.
EC_POINT_set_compressed_coordinates
()
assumes that x is the x-coordinate and
y_bit is the parity bit of a point on
group and sets point to the
corresponding point on group. It does this by solving
the quadratic equation y^2 = x^3 + ax + b using
BN_mod_sqrt(3) and the optional ctx, chooses
the solution y with parity matching
y_bit, and passes x and
y to
EC_POINT_set_affine_coordinates
(). The user-provided
point should be the result of
EC_POINT_new
() with argument
group.
EC_POINT_set_to_infinity
()
sets point to the internal representation of the point
at infinity on group.
EC_POINT_get_affine_coordinates_GFp
()
is a deprecated alias for
EC_POINT_get_affine_coordinates
(). Similarly for
EC_POINT_set_affine_coordinates_GFp
()
and
EC_POINT_set_compressed_coordinates_GFp
().
RETURN VALUES
All these functions return 1 on success and 0 on error. Error conditions include memory allocation failure, that point is incompatible with group, and, for the coordinate setters, that the provided coordinates do not represent a point on group.
SEE ALSO
BN_CTX_new(3), BN_is_zero(3), BN_mod_sqrt(3), crypto(3), d2i_ECPKParameters(3), EC_GROUP_check(3), EC_GROUP_get_curve_name(3), EC_GROUP_new_by_curve_name(3), EC_GROUP_new_curve_GFp(3), EC_KEY_METHOD_new(3), EC_KEY_new(3), EC_POINT_add(3), EC_POINT_new(3), EC_POINT_point2oct(3), ECDH_compute_key(3), ECDSA_SIG_new(3)
HISTORY
EC_POINT_get_affine_coordinates_GFp
(),
EC_POINT_set_affine_coordinates_GFp
(),
EC_POINT_set_compressed_coordinates_GFp
(), and
EC_POINT_set_to_infinity
() first appeared in OpenSSL
0.9.7 and have been available since OpenBSD 3.2.
EC_POINT_get_affine_coordinates
(),
EC_POINT_set_affine_coordinates
(), and
EC_POINT_set_compressed_coordinates
() first appeared
in OpenSSL 1.1.1 and have been available since OpenBSD
7.0.