EC_GROUP_CHECK(3)
π EC_GROUP_CHECK(3) π
okay so bestie, you're in the Library Functions Manual and this page is all about EC_GROUP_check_discriminant() and EC_GROUP_check() β two functions that partially check whether your EC_GROUP objects are valid. spoiler: they're deprecated, so read the warning before you get attached π
β¨ NAME β¨
EC_GROUP_check_discriminant(), EC_GROUP_check() β partially check validity of EC_GROUP objects π«Ά
πΈ SYNOPSIS πΈ
it's giving library βlibcryptoβ energy, and you're gonna need these headers:
library βlibcryptoβ #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 π
β οΈ Deprecated alert: 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.
Both functions take an optional ctx argument. it exists so you don't have to pay the cost of repeatedly allocating auxiliary BIGNUM objects β cute efficiency moment β¨
EC_GROUP_check_discriminant() can be called after EC_GROUP_new_curve_GFp(3) to verify that the group's parameters have non-zero discriminant 4a^3 + 27b^2 modulo p. Assuming p is a prime number larger than three, this implies that the Weierstrass equation defines an elliptic curve. math girlie behavior, honestly π₯
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, then verifies that 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. not her skipping the expensive part ππ
π RETURN VALUES π
EC_GROUP_check_discriminant()returns1on success and0on failure. Failure modes include that the discriminant is zero modulopand memory allocation failure.EC_GROUP_check()returns1on success and0on 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 ongroup, for example because a call toEC_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 bygroup.EC_R_UNDEFINED_ORDER"undefined order"β the order set ongroupis zero.EC_R_INVALID_GROUP_ORDER"invalid group order"βgenerator * orderis not the point at infinity.
π SEE ALSO π
go touch grass in these other pages, bestie π±
BN_CTX_new(3)BN_is_zero(3)crypto(3)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. vintage icons, honestly π
π this page was served fresh by Debian on August 26, 2026 β EC_GROUP_CHECK(3), signing off with a little sparkle πβ¨
π¦ where this page comes from
- 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