Blame SOURCES/0013-FIPS-provider-explicit-ec.patch

727bdf
diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c
727bdf
index 78dc69082fab..8a86c9108d0d 100644
727bdf
--- a/providers/implementations/keymgmt/ec_kmgmt.c
727bdf
+++ b/providers/implementations/keymgmt/ec_kmgmt.c
727bdf
@@ -470,9 +470,6 @@ int ec_export(void *keydata, int selection, OSSL_CALLBACK *param_cb,
727bdf
     if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0
727bdf
             && (selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) == 0)
727bdf
         return 0;
727bdf
-    if ((selection & OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS) != 0
727bdf
-            && (selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0)
727bdf
-        return 0;
727bdf
 
727bdf
     tmpl = OSSL_PARAM_BLD_new();
727bdf
     if (tmpl == NULL)
727bdf
diff --git a/test/recipes/15-test_ecparam.t b/test/recipes/15-test_ecparam.t
727bdf
index 766524e8cfa9..80bac6741290 100644
727bdf
--- a/test/recipes/15-test_ecparam.t
727bdf
+++ b/test/recipes/15-test_ecparam.t
727bdf
@@ -13,7 +13,7 @@ use warnings;
727bdf
 use File::Spec;
727bdf
 use File::Compare qw/compare_text/;
727bdf
 use OpenSSL::Glob;
727bdf
-use OpenSSL::Test qw/:DEFAULT data_file/;
727bdf
+use OpenSSL::Test qw/:DEFAULT data_file srctop_file bldtop_dir/;
727bdf
 use OpenSSL::Test::Utils;
727bdf
 
727bdf
 setup("test_ecparam");
727bdf
@@ -25,7 +25,7 @@ my @valid = glob(data_file("valid", "*.pem"));
727bdf
 my @noncanon = glob(data_file("noncanon", "*.pem"));
727bdf
 my @invalid = glob(data_file("invalid", "*.pem"));
727bdf
 
727bdf
-plan tests => 11;
727bdf
+plan tests => 12;
727bdf
 
727bdf
 sub checkload {
727bdf
     my $files = shift; # List of files
727bdf
@@ -59,6 +59,8 @@ sub checkcompare {
727bdf
     }
727bdf
 }
727bdf
 
727bdf
+my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
727bdf
+
727bdf
 subtest "Check loading valid parameters by ecparam with -check" => sub {
727bdf
     plan tests => scalar(@valid);
727bdf
     checkload(\@valid, 1, "ecparam", "-check");
727bdf
@@ -113,3 +115,31 @@ subtest "Check pkeyparam does not change the parameter file on output" => sub {
727bdf
     plan tests => 2 * scalar(@valid);
727bdf
     checkcompare(\@valid, "pkeyparam");
727bdf
 };
727bdf
+
727bdf
+subtest "Check loading of fips and non-fips params" => sub {
727bdf
+    plan skip_all => "FIPS is disabled"
727bdf
+        if $no_fips;
727bdf
+    plan tests => 3;
727bdf
+
727bdf
+    my $fipsconf = srctop_file("test", "fips-and-base.cnf");
727bdf
+    my $defaultconf = srctop_file("test", "default.cnf");
727bdf
+
727bdf
+    $ENV{OPENSSL_CONF} = $fipsconf;
727bdf
+
727bdf
+    ok(run(app(['openssl', 'ecparam',
727bdf
+                '-in', data_file('valid', 'secp384r1-explicit.pem'),
727bdf
+                '-check'])),
727bdf
+       "Loading explicitly encoded valid curve");
727bdf
+
727bdf
+    ok(run(app(['openssl', 'ecparam',
727bdf
+                '-in', data_file('valid', 'secp384r1-named.pem'),
727bdf
+                '-check'])),
727bdf
+       "Loading named valid curve");
727bdf
+
727bdf
+    ok(!run(app(['openssl', 'ecparam',
727bdf
+                '-in', data_file('valid', 'secp112r1-named.pem'),
727bdf
+                '-check'])),
727bdf
+       "Fail loading named non-fips curve");
727bdf
+
727bdf
+    $ENV{OPENSSL_CONF} = $defaultconf;
727bdf
+};