test/recipes/30-test_evp.t: Modify to test with different providers
authorRichard Levitte <levitte@openssl.org>
Wed, 17 Jul 2019 12:26:26 +0000 (14:26 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 26 Jul 2019 16:14:41 +0000 (18:14 +0200)
Different providers will give different results, and we need to test
them all.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9398)

test/default-and-legacy.cnf [new file with mode: 0644]
test/default.cnf [new file with mode: 0644]
test/fips.cnf [new file with mode: 0644]
test/legacy.cnf [new file with mode: 0644]
test/recipes/30-test_evp.t

diff --git a/test/default-and-legacy.cnf b/test/default-and-legacy.cnf
new file mode 100644 (file)
index 0000000..adfa225
--- /dev/null
@@ -0,0 +1,14 @@
+openssl_conf = openssl_init
+
+[openssl_init]
+providers = provider_sect
+
+[provider_sect]
+default = default_sect
+legacy = legacy_sect
+
+[default_sect]
+activate = 1
+
+[legacy_sect]
+activate = 1
diff --git a/test/default.cnf b/test/default.cnf
new file mode 100644 (file)
index 0000000..12da8cb
--- /dev/null
@@ -0,0 +1,10 @@
+openssl_conf = openssl_init
+
+[openssl_init]
+providers = provider_sect
+
+[provider_sect]
+default = default_sect
+
+[default_sect]
+activate = 1
diff --git a/test/fips.cnf b/test/fips.cnf
new file mode 100644 (file)
index 0000000..0578c84
--- /dev/null
@@ -0,0 +1,10 @@
+openssl_conf = openssl_init
+
+[openssl_init]
+providers = provider_sect
+
+[provider_sect]
+fips = fips_sect
+
+[fips_sect]
+activate = 1
diff --git a/test/legacy.cnf b/test/legacy.cnf
new file mode 100644 (file)
index 0000000..60b09a1
--- /dev/null
@@ -0,0 +1,10 @@
+openssl_conf = openssl_init
+
+[openssl_init]
+providers = provider_sect
+
+[provider_sect]
+legacy = legacy_sect
+
+[legacy_sect]
+activate = 1
index c140f1a87e1d5f3791041d824a42a3785cd5afd4..ed21a5f1feb77987ceceaaa7195abb4149e57013 100644 (file)
 use strict;
 use warnings;
 
-use OpenSSL::Test qw(:DEFAULT data_file bldtop_dir);
+use OpenSSL::Test qw(:DEFAULT data_file bldtop_dir srctop_file);
 
 setup("test_evp");
 
-my @files = ( "evpciph.txt", "evpdigest.txt", "evpencod.txt", "evpkdf.txt",
-    "evppkey_kdf.txt", "evpmac.txt", "evppbe.txt", "evppkey.txt",
-    "evppkey_ecc.txt", "evpcase.txt", "evpaessiv.txt", "evpccmcavs.txt" );
+my @configs = qw( default-and-legacy.cnf fips.cnf );
+my @files = qw( evpciph.txt evpdigest.txt evpencod.txt evpkdf.txt
+    evppkey_kdf.txt evpmac.txt evppbe.txt evppkey.txt
+    evppkey_ecc.txt evpcase.txt evpaessiv.txt evpccmcavs.txt );
 
-plan tests => scalar(@files);
+plan tests => scalar(@configs) * scalar(@files);
 
 $ENV{OPENSSL_MODULES} = bldtop_dir("providers");
 
-foreach my $f ( @files ) {
-    ok(run(test(["evp_test", data_file("$f")])),
-       "running evp_test $f");
+foreach (@configs) {
+    $ENV{OPENSSL_CONF} = srctop_file("test", $_);
+
+    foreach my $f ( @files ) {
+        ok(run(test(["evp_test", data_file("$f")])),
+           "running evp_test $f");
+    }
 }