---
name: "libressl-EC_POINT_get_affine_coordinates"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-EC_POINT_get_affine_coordinates"
---

# libressl-EC\_POINT\_get\_affine\_coordinates(3)

get and set coordinates of elliptic curve points

## 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

Crypto Library (libcrypto, -lcrypto)

**#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)](/crypto/3.md), 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.
