---
name: "libressl-EC_POINT_new"
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_new"
---

# libressl-EC\_POINT\_new(3)

allocate, free and copy elliptic curve points

## NAME

**EC\_POINT\_new**, **EC\_POINT\_free**, **EC\_POINT\_clear\_free**, **EC\_POINT\_copy**, **EC\_POINT\_dup** – allocate, free and copy elliptic curve points

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/ec.h\>**

*EC\_POINT* *\**\

**EC\_POINT\_new**(*const EC\_GROUP \*group*);

*void*\

**EC\_POINT\_free**(*EC\_POINT \*point*);

*void*\

**EC\_POINT\_clear\_free**(*EC\_POINT \*point*);

*int*\

**EC\_POINT\_copy**(*EC\_POINT \*dst*, *const EC\_POINT \*src*);

*EC\_POINT* *\**\

**EC\_POINT\_dup**(*const EC\_POINT \*point*, *const EC\_GROUP \*group*);

## DESCRIPTION

An *EC\_POINT* object holds a point on the elliptic curve represented by an *EC\_GROUP*. The details of the internal representation depend on the group and should never be an application's concern since the EC library has API to set a point's coordinates, EC\_POINT\_set\_affine\_coordinates(3).

**EC\_POINT\_new**() allocates and initializes an *EC\_POINT* object to be used with the *group*. Before explicitly setting its coordinates, the returned *EC\_POINT* is invalid.

**EC\_POINT\_free**() frees *point* and all memory associated with it. If *point* is a NULL pointer, no action occurs.

**EC\_POINT\_clear\_free**() is intended to destroy sensitive data held in *point* in addition to freeing all memory associated with it. Since elliptic curve points usually hold public data, this is rarely needed. In LibreSSL, **EC\_POINT\_free**() and **EC\_POINT\_clear\_free**() behave identically.

**EC\_POINT\_copy**() copies the internal representation of *src* into *dst*. If *src* and *dst* are identical, no action occurs. Both *src* and *dst* should be the result of **EC\_POINT\_new**() with the same *group* argument, although **EC\_POINT\_copy**() cannot check that.

**EC\_POINT\_dup**() creates a deep copy of *point* by combining **EC\_POINT\_new**() with **EC\_GROUP\_copy**().

## RETURN VALUES

**EC\_POINT\_new**() returns a newly allocated *EC\_POINT* or NULL on memory allocation failure.

**EC\_POINT\_copy**() returns 1 on success or 0 on error. Error conditions include memory allocation failure and that *dst* is incompatible with the group on which *src* is defined.

**EC\_POINT\_dup**() returns a newly allocated *EC\_POINT* or NULL on failure. Error conditions include memory allocation failure or that *group* is incompatible with *src*.

## SEE ALSO

BN\_CTX\_new(3), BN\_is\_zero(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\_get\_affine\_coordinates(3), EC\_POINT\_point2oct(3), ECDH\_compute\_key(3), ECDSA\_SIG\_new(3)

## HISTORY

**EC\_POINT\_new**(), **EC\_POINT\_free**(), **EC\_POINT\_clear\_free**(), and **EC\_POINT\_copy**() first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 3.2.

**EC\_POINT\_dup**() first appeared in OpenSSL 0.9.8 and has been available since OpenBSD 4.5.

## BUGS

A fundamental flaw in the OpenSSL API toolkit is that **\*\_new**() functions usually create invalid objects that are tricky to turn into valid objects. One specific flaw in the EC library internals is that *EC\_POINT* objects do not hold a reference to the group they live on despite the fact that **EC\_POINT\_new**() has a *group* argument. This is difficult to fix because *EC\_GROUP* objects are not reference counted and because of const qualifiers in the API. This is the root cause for various contortions in the EC library and API and there are security implications because not only does the library not know whether an *EC\_POINT* object represents a valid point, even if it did know that it would still not know on what curve.

The signature of **EC\_GROUP\_dup**() is bizarre and the order of *point* and *group* is inconsistent with the rest of the EC API.
