---
name: "libressl-EC_GROUP_check"
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_GROUP_check"
---

# libressl-EC\_GROUP\_check(3)

partially check validity of EC\_GROUP objects

## NAME

**EC\_GROUP\_check\_discriminant**, **EC\_GROUP\_check** – partially check validity of *EC\_GROUP* objects

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

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

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

Deprecated:

*int*\

**EC\_GROUP\_check\_discriminant**(*const EC\_GROUP \*group*, *BN\_CTX \*ctx*);

*int*\

**EC\_GROUP\_check**(*const EC\_GROUP \*group*, *BN\_CTX \*ctx*);

## DESCRIPTION

These functions are deprecated. Only standardized curves built into the library should be used, see EC\_GROUP\_new\_by\_curve\_name(3). Builtin curves went through far more thorough checking than the minimal, incomplete tests performed by these functions.

These functions have an optional *ctx* argument which is used to avoid the cost of repeated allocation of auxiliary *BIGNUM* objects.

**EC\_GROUP\_check\_discriminant**() can be called after EC\_GROUP\_new\_curve\_GFp(3) to verify that *group*'s parameters have non-zero discriminant 4a^3 + 27b^2 modulo p. Assuming that *p* is a prime number larger than three this implies that the Weierstrass equation defines an elliptic curve.

**EC\_GROUP\_check**() partially verifies that *group* represents an elliptic curve and that *generator* is a point on the curve whose order divides *order*. It checks with **EC\_GROUP\_check\_discriminant**() that the discriminant is non-zero and then verifies that the *order* is non-zero and that the product *generator* \* *order* is the point at infinity. This implies that the *order* set on *group* is an integer multiple of the *generator*'s order. The verification that *p* is a prime and that *order* is equal to the *generator*'s order are skipped because they are too expensive.

## RETURN VALUES

**EC\_GROUP\_check\_discriminant**() returns 1 on success and 0 on failure. Failure modes include that the discriminant is zero modulo *p* and memory allocation failure.

**EC\_GROUP\_check**() returns 1 on success and 0 on failure.

## ERRORS

Diagnostics for **EC\_GROUP\_check**() that can be retrieved with ERR\_get\_error(3), ERR\_GET\_REASON(3), and ERR\_reason\_error\_string(3) include:

- EC\_R\_DISCRIMINANT\_IS\_ZERO "discriminant is zero"

  **EC\_GROUP\_check\_discriminant**() failed because the discriminant is zero or for some other reason.

- EC\_R\_UNDEFINED\_GENERATOR "undefined generator"

  no generator is set on *group*, for example because a call to EC\_GROUP\_set\_generator(3) is missing.

- EC\_R\_POINT\_IS\_NOT\_ON\_CURVE "point is not on curve"

  a generator is set, but it is not a point on the curve represented by *group*.

- EC\_R\_UNDEFINED\_ORDER "undefined order"

  the *order* set on *group* is zero.

- EC\_R\_INVALID\_GROUP\_ORDER "invalid group order"

  *generator* \* *order* is not the point at infinity.

## SEE ALSO

BN\_CTX\_new(3), BN\_is\_zero(3), [crypto(3)](/crypto/3.md), d2i\_ECPKParameters(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\_new(3), EC\_POINT\_point2oct(3), ECDH\_compute\_key(3), ECDSA\_SIG\_new(3)

## HISTORY

**EC\_GROUP\_check**() and **EC\_GROUP\_check\_discriminant**() first appeared in OpenSSL 0.9.8 and have been available since OpenBSD 4.5.
