]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
FIPS: Change EC_GROUP_check() so that it fails for explicit curves.
authorslontis <shane.lontis@oracle.com>
Mon, 23 Feb 2026 05:00:32 +0000 (16:00 +1100)
committerTomas Mraz <tomas@openssl.org>
Mon, 2 Mar 2026 19:36:56 +0000 (20:36 +0100)
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)

crypto/ec/ec_check.c

index a112960021952eff8716ee4b81f29b45e99b8b21..a95eb913f107c4a917b7bc8590a97707afa9c786 100644 (file)
@@ -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;