Remove all trace of FIPS_mode functions
[openssl.git] / util / wrap.pl
index 4c3d4713f17f5cfb51abf7c404accf927ae0800e..69be06d3029414ad8cfce8a0262329eceef7bdf2 100755 (executable)
@@ -9,12 +9,15 @@ use File::Spec::Functions;
 my $there = canonpath(catdir(dirname($0), updir()));
 my $std_engines = catdir($there, 'engines');
 my $std_providers = catdir($there, 'providers');
+my $std_openssl_conf = catdir($there, 'apps/openssl.cnf');
 my $unix_shlib_wrap = catfile($there, 'util/shlib_wrap.sh');
 
 $ENV{OPENSSL_ENGINES} = $std_engines
     if ($ENV{OPENSSL_ENGINES} // '') eq '' && -d $std_engines;
 $ENV{OPENSSL_MODULES} = $std_providers
     if ($ENV{OPENSSL_MODULES} // '') eq '' && -d $std_providers;
+$ENV{OPENSSL_CONF} = $std_openssl_conf
+    if ($ENV{OPENSSL_CONF} // '') eq '' && -f $std_openssl_conf;
 
 my $use_system = 0;
 my @cmd;
@@ -35,5 +38,12 @@ my $waitcode = system @cmd;
 # (exitcode << 8 | signalcode)
 die "wrap.pl: Failed to execute '", join(' ', @cmd), "': $!\n"
     if $waitcode == -1;
-exit($? & 255) if ($? & 255) != 0;
+
+# When the subprocess aborted on a signal, mimic what Unix shells do, by
+# converting the signal code to an exit code by setting the high bit.
+# This only happens on Unix flavored operating systems, the others don't
+# have this sort of signaling to date, and simply leave the low byte zero.
+exit(($? & 255) | 128) if ($? & 255) != 0;
+
+# When not a signal, just shift down the subprocess exit code and use that.
 exit($? >> 8);