diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2019-06-05 08:24:16 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2019-06-25 12:00:25 +1000 |
commit | 10c25644e362381844e0089504f0db42f029d855 (patch) | |
tree | fd1342f8f753b944e76adc1f5ceb53ef72c4d794 /crypto/ec/ec_check.c | |
parent | be1dc984e1a5938170188cbdb6e536f1e7ac1656 (diff) |
EC only uses approved curves in FIPS mode.
Once there are buildable fips tests, some tests that are data driven
from files will need to be modified to exclude non approved curves in
fips mode.
These changes were tested by temporarily adding #define FIPS_MODE 1 to
all the modified source files.
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9081)
Diffstat (limited to 'crypto/ec/ec_check.c')
-rw-r--r-- | crypto/ec/ec_check.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/ec/ec_check.c b/crypto/ec/ec_check.c index 097d7e1cc5..315b9fd4df 100644 --- a/crypto/ec/ec_check.c +++ b/crypto/ec/ec_check.c @@ -22,6 +22,13 @@ int EC_GROUP_check_named_curve(const EC_GROUP *group, int nist_only) int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx) { +#ifdef FIPS_MODE + /* + * 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) >= 0 ? 1 : 0; +#else int ret = 0; const BIGNUM *order; BN_CTX *new_ctx = NULL; @@ -84,4 +91,5 @@ int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx) BN_CTX_free(new_ctx); EC_POINT_free(point); return ret; +#endif /* FIPS_MODE */ } |