LIBRESSL-EC_POINT_GET_AFFINE_COORDINATES(3)
π EC_POINT_GET_AFFINE_COOR(3) π
okay so this is a page from the libcrypto library β elliptic curve point coordinates, get 'em and set 'em. bestie, this is the math-y one, but we're gonna get through it together π«Ά
β¨ 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 β literally just getting and setting the coordinates of elliptic curve points π
πΈ SYNOPSIS πΈ
so first, the library and the headers, no cap:
library βlibcryptoβ #include <openssl/bn.h>
#include <openssl/ec.h>
then the actual functions, and yes we're listing all of them because every single one matters:
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);
and now the deprecated girlies, they're giving legacy, they're giving "still works but why" π:
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 π¦
okay so let's go through these one by one, because each one is doing its own little thing and they all deserve their moment.
EC_POINT_get_affine_coordinates() β it assumes 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. the way it just trusts you that point belongs to groupβ¦ main character energy fr π₯
EC_POINT_set_affine_coordinates() β this one assumes 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. then it verifies using EC_POINT_is_on_curve(3) that x and y are indeed the affine coordinates of a point on group. yes she double-checks, she's thorough, we stan a careful queen π
EC_POINT_set_compressed_coordinates() β this one assumes 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. how? by solving the quadratic equation y^2 = x^3 + ax + b using BN_mod_sqrt(3) and the optional ctx, choosing the solution y with parity matching y_bit, and passing x and y to EC_POINT_set_affine_coordinates(). it's giving "I did the math so you don't have to" π 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. that's it. that's the whole vibe. iconic, minimal, no notes π
EC_POINT_get_affine_coordinates_GFp() β deprecated alias for EC_POINT_get_affine_coordinates(). similarly for EC_POINT_set_affine_coordinates_GFp() and EC_POINT_set_compressed_coordinates_GFp(). they're legacy, bestie, use the new ones π
π RETURN VALUES π
all these functions return 1 on success and 0 on error. that's the whole system, binary, no in-between, no "it depends" π«Ά
error conditions include:
- memory allocation failure
- that
pointis incompatible withgroup - and, for the coordinate setters, that the provided coordinates do not represent a point on
group
ngl, if a coordinate setter hands you back a 0, it's probably because the coordinates you gave it aren't actually on the curve. she checked. she said no. π
β SEE ALSO β
go read these next, they're all in the same friend group:
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. ancient. legendary. still here. π
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. the newer batch, the glow-up versions β¨
aaaand that's the page, bestie! π§ this one's from Debian, dated June 8, 202 (yes it's cut off in the source, don't come for me π), for EC_POINT_GET_AFFINE_COORDINATES(3). go forth and coordinate your points responsibly ππ
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2025 Theo Buehler <tb@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms