Revert "TEST: make and use a fipsinstall script"
authorRichard Levitte <levitte@openssl.org>
Tue, 21 Apr 2020 10:24:44 +0000 (12:24 +0200)
committerRichard Levitte <levitte@openssl.org>
Tue, 21 Apr 2020 13:43:57 +0000 (15:43 +0200)
Unfortunately, this won't work on MacOS because of system integrity
measures on that platform, which clears DYLD_LIBRARY_PATH before
starting a sub-process executable.

Ref: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html

This reverts commit ae6b654b669638882a6ddce012ff55adc7cf6a82.

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

test/fipsinstall.pl [deleted file]
test/recipes/30-test_evp.t
test/recipes/30-test_evp_fetch_prov.t
test/recipes/90-test_sslprovider.t

diff --git a/test/fipsinstall.pl b/test/fipsinstall.pl
deleted file mode 100644 (file)
index 4891145..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#! /usr/bin/env perl
-
-use strict;
-use warnings;
-
-use File::Spec;
-
-use if $^O eq "VMS", "VMS::Filespec";
-
-my $bldtop_dir;
-
-# First script argument MUST be the build top directory
-BEGIN {
-    $bldtop_dir = $ARGV[0];
-    # 'use lib' needs Unix-ish paths
-    $bldtop_dir = VMS::Filespec::unixpath($bldtop_dir) if $^O eq "VMS";
-}
-
-use lib $bldtop_dir;
-use FindBin;
-use lib "$FindBin::Bin/../Configurations";
-use platform;
-
-my @providers = ($bldtop_dir, 'providers');
-my $fips_cnf = File::Spec->catfile(@providers, 'fipsinstall.cnf');
-my $fips_module = File::Spec->catfile(@providers, platform->dso('fips'));
-my $openssl = File::Spec->catfile($bldtop_dir, 'apps',
-                                  platform->bin('openssl'));
-
-# We create the command like this to make it readable, then massage it with
-# a space replacement regexp to make it usable with system()
-my $cmd = <<_____;
-$openssl fipsinstall \
-    -out "{fips_cnf}" \
-    -module "{fips_module}" \
-    -provider_name "fips" \
-    -mac_name "HMAC" -macopt "digest:SHA256" -macopt "hexkey:00" \
-    -section_name "fips_sect"
-_____
-$cmd =~ s|\s+| |gm;
-$cmd =~ s|{fips_cnf}|$fips_cnf|;
-$cmd =~ s|{fips_module}|$fips_module|;
-
-my $exit = 0;
-system($cmd);
-die "Failed to run '$cmd'\n" if $? == -1;
-# If there was a signal, use it as exit code with high bit set.
-$exit = (($? & 255) | 128) if ($? & 255) != 0;
-# Otherwise, just return fipsinstall's exit code
-$exit = ($? >> 8);
-
-exit($exit);
-
index bf792f21b55562e25c0d49dcd45a28c6e4cb2f52..7263f292904c69b1eda3e14c4696be66c585a6cb 100644 (file)
@@ -79,10 +79,16 @@ plan tests =>
     + scalar(@defltfiles);
 
 unless ($no_fips) {
+    my $infile = bldtop_file('providers', platform->dso('fips'));
     $ENV{OPENSSL_MODULES} = bldtop_dir("providers");
     $ENV{OPENSSL_CONF_INCLUDE} = bldtop_dir("providers");
 
-    ok(run(perltest(['fipsinstall.pl', bldtop_dir()])),
+    ok(run(app(['openssl', 'fipsinstall',
+                '-out', bldtop_file('providers', 'fipsinstall.cnf'),
+                '-module', $infile,
+                '-provider_name', 'fips', '-mac_name', 'HMAC',
+                '-macopt', 'digest:SHA256', '-macopt', 'hexkey:00',
+                '-section_name', 'fips_sect'])),
        "fipsinstall");
 }
 
index 00d71fa3206e2d77217f35ad120ec99d3ea4abef..36c324eeb355558d8fef9e21d9bc5ddace124022 100644 (file)
@@ -47,7 +47,12 @@ my @testdata = (
 
 unless ($no_fips) {
     push @setups, {
-        cmd     => perltest(['fipsinstall.pl', bldtop_dir()]),
+        cmd     => app(['openssl', 'fipsinstall',
+                        '-out', bldtop_file('providers', 'fipsinstall.cnf'),
+                        '-module', bldtop_file('providers', platform->dso('fips')),
+                        '-provider_name', 'fips', '-mac_name', 'HMAC',
+                        '-macopt', 'digest:SHA256', '-macopt', 'hexkey:00',
+                        '-section_name', 'fips_sect']),
         message => "fipsinstall"
     };
     push @testdata, (
index 814eff74cfa3b46300d710a09c7ad93b92c9fef7..f0ff38a38619fbbc310fa0bdd99973247e55d489 100644 (file)
@@ -30,7 +30,12 @@ SKIP: {
     skip "Skipping FIPS installation", 1
         if disabled("fips");
 
-    ok(run(perltest(['fipsinstall.pl', bldtop_dir()])),
+    ok(run(app(['openssl', 'fipsinstall',
+                '-out', bldtop_file('providers', 'fipsinstall.cnf'),
+                '-module', bldtop_file('providers', platform->dso('fips')),
+                '-provider_name', 'fips', '-mac_name', 'HMAC',
+                '-macopt', 'digest:SHA256', '-macopt', 'hexkey:00',
+                '-section_name', 'fips_sect'])),
        "fipsinstall");
 }