EC_GROUP_CHECK(3)

πŸ“¦
version 4.4.0 Β· 2 versions
, in arch rolling

πŸ’– 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() 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 πŸ‘€

go touch grass in these other pages, bestie 🌱


πŸ¦‹ 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms