Commit 5e63272329 for openssl.org

commit 5e632723296e65689146280e4e2a90a42c513305
Author: slontis <shane.lontis@oracle.com>
Date:   Mon Feb 23 16:00:32 2026 +1100

    FIPS: Change EC_GROUP_check() so that it fails for explicit curves.

    Reported by Luigino Camastra (Aisle Research).

    Explicit curves returned a NID of NID_undef (which has a value of 0)
    which resulted in the check >= 0 passing.
    Changing the result to > addresses the issue.
    Note that this is a NON issue in master since explicit curves are
    now disabled by default. Note also that for any EC operation that
    tries to use a loaded EC key, checks that the curve and security
    strength are valid.

    Reviewed-by: Tim Hudson <tjh@openssl.org>
    Reviewed-by: Paul Dale <paul.dale@oracle.com>
    Reviewed-by: Tomas Mraz <tomas@openssl.org>
    MergeDate: Mon Mar  2 19:37:04 2026
    (Merged from https://github.com/openssl/openssl/pull/30138)

diff --git a/crypto/ec/ec_check.c b/crypto/ec/ec_check.c
index a112960021..a95eb913f1 100644
--- a/crypto/ec/ec_check.c
+++ b/crypto/ec/ec_check.c
@@ -50,7 +50,7 @@ int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx)
      * ECC domain parameter validation.
      * See SP800-56A R3 5.5.2 "Assurances of Domain-Parameter Validity" Part 1b.
      */
-    return EC_GROUP_check_named_curve(group, 1, ctx) >= 0 ? 1 : 0;
+    return EC_GROUP_check_named_curve(group, 1, ctx) > 0 ? 1 : 0;
 #else
     int ret = 0;
     const BIGNUM *order;