|
|
bf760f |
diff -up openssl-3.0.1/crypto/ec/ec_lib.c.disable_explicit_ec openssl-3.0.1/crypto/ec/ec_lib.c
|
|
|
bf760f |
--- openssl-3.0.1/crypto/ec/ec_lib.c.disable_explicit_ec 2022-02-22 09:08:48.557823665 +0100
|
|
|
bf760f |
+++ openssl-3.0.1/crypto/ec/ec_lib.c 2022-02-22 09:09:26.634133847 +0100
|
|
|
bf760f |
@@ -1458,7 +1458,7 @@ static EC_GROUP *ec_group_explicit_to_na
|
|
|
bf760f |
goto err;
|
|
|
bf760f |
}
|
|
|
bf760f |
} else {
|
|
|
bf760f |
- ret_group = (EC_GROUP *)group;
|
|
|
bf760f |
+ goto err;
|
|
|
bf760f |
}
|
|
|
bf760f |
EC_GROUP_free(dup);
|
|
|
bf760f |
return ret_group;
|
|
|
bf760f |
diff -up openssl-3.0.1/providers/implementations/keymgmt/ec_kmgmt.c.disable_explicit_ec openssl-3.0.1/providers/implementations/keymgmt/ec_kmgmt.c
|
|
|
bf760f |
--- openssl-3.0.1/providers/implementations/keymgmt/ec_kmgmt.c.disable_explicit_ec 2022-02-22 13:04:16.850856612 +0100
|
|
|
bf760f |
+++ openssl-3.0.1/providers/implementations/keymgmt/ec_kmgmt.c 2022-02-22 14:16:19.848369641 +0100
|
|
|
bf760f |
@@ -936,11 +936,8 @@ int ec_validate(const void *keydata, int
|
|
|
bf760f |
if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) {
|
|
|
bf760f |
int flags = EC_KEY_get_flags(eck);
|
|
|
bf760f |
|
|
|
bf760f |
- if ((flags & EC_FLAG_CHECK_NAMED_GROUP) != 0)
|
|
|
bf760f |
- ok = ok && EC_GROUP_check_named_curve(EC_KEY_get0_group(eck),
|
|
|
bf760f |
- (flags & EC_FLAG_CHECK_NAMED_GROUP_NIST) != 0, ctx);
|
|
|
bf760f |
- else
|
|
|
bf760f |
- ok = ok && EC_GROUP_check(EC_KEY_get0_group(eck), ctx);
|
|
|
bf760f |
+ ok = ok && EC_GROUP_check_named_curve(EC_KEY_get0_group(eck),
|
|
|
bf760f |
+ (flags & EC_FLAG_CHECK_NAMED_GROUP_NIST) != 0, ctx);
|
|
|
bf760f |
}
|
|
|
bf760f |
|
|
|
bf760f |
if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) {
|
|
|
bf760f |
@@ -1217,6 +1214,10 @@ static int ec_gen_assign_group(EC_KEY *e
|
|
|
bf760f |
ERR_raise(ERR_LIB_PROV, PROV_R_NO_PARAMETERS_SET);
|
|
|
bf760f |
return 0;
|
|
|
bf760f |
}
|
|
|
bf760f |
+ if (EC_GROUP_get_curve_name(group) == NID_undef) {
|
|
|
bf760f |
+ ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_CURVE);
|
|
|
bf760f |
+ return 0;
|
|
|
bf760f |
+ }
|
|
|
bf760f |
return EC_KEY_set_group(ec, group) > 0;
|
|
|
bf760f |
}
|
|
|
bf760f |
|
|
|
bf760f |
diff -up openssl-3.0.1/providers/common/securitycheck.c.disable_explicit_ec openssl-3.0.1/providers/common/securitycheck.c
|
|
|
bf760f |
--- openssl-3.0.1/providers/common/securitycheck.c.disable_explicit_ec 2022-02-25 11:44:19.554673396 +0100
|
|
|
bf760f |
+++ openssl-3.0.1/providers/common/securitycheck.c 2022-02-25 12:16:38.168610089 +0100
|
|
|
bf760f |
@@ -93,22 +93,22 @@ int ossl_rsa_check_key(OSSL_LIB_CTX *ctx
|
|
|
bf760f |
int ossl_ec_check_key(OSSL_LIB_CTX *ctx, const EC_KEY *ec, int protect)
|
|
|
bf760f |
{
|
|
|
bf760f |
# if !defined(OPENSSL_NO_FIPS_SECURITYCHECKS)
|
|
|
bf760f |
- if (ossl_securitycheck_enabled(ctx)) {
|
|
|
bf760f |
- int nid, strength;
|
|
|
bf760f |
- const char *curve_name;
|
|
|
bf760f |
- const EC_GROUP *group = EC_KEY_get0_group(ec);
|
|
|
bf760f |
+ int nid, strength;
|
|
|
bf760f |
+ const char *curve_name;
|
|
|
bf760f |
+ const EC_GROUP *group = EC_KEY_get0_group(ec);
|
|
|
bf760f |
|
|
|
bf760f |
- if (group == NULL) {
|
|
|
bf760f |
- ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_CURVE, "No group");
|
|
|
bf760f |
- return 0;
|
|
|
bf760f |
- }
|
|
|
bf760f |
- nid = EC_GROUP_get_curve_name(group);
|
|
|
bf760f |
- if (nid == NID_undef) {
|
|
|
bf760f |
- ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_CURVE,
|
|
|
bf760f |
- "Explicit curves are not allowed in fips mode");
|
|
|
bf760f |
- return 0;
|
|
|
bf760f |
- }
|
|
|
bf760f |
+ if (group == NULL) {
|
|
|
bf760f |
+ ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_CURVE, "No group");
|
|
|
bf760f |
+ return 0;
|
|
|
bf760f |
+ }
|
|
|
bf760f |
+ nid = EC_GROUP_get_curve_name(group);
|
|
|
bf760f |
+ if (nid == NID_undef) {
|
|
|
bf760f |
+ ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_CURVE,
|
|
|
bf760f |
+ "Explicit curves are not allowed in this build");
|
|
|
bf760f |
+ return 0;
|
|
|
bf760f |
+ }
|
|
|
bf760f |
|
|
|
bf760f |
+ if (ossl_securitycheck_enabled(ctx)) {
|
|
|
bf760f |
curve_name = EC_curve_nid2nist(nid);
|
|
|
bf760f |
if (curve_name == NULL) {
|
|
|
bf760f |
ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_CURVE,
|