RT468: SSL_CTX_sess_set_cache_size wrong
[openssl.git] / util / fipslink.pl
index 8b6fbad..4a88fc6 100644 (file)
@@ -33,14 +33,24 @@ check_hash($sha1_exe, "fipscanister.lib");
 
 print "Integrity check OK\n";
 
-print "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c\n";
-system "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c";
-die "First stage Compile failure" if $? != 0;
+if (is_premain_linked(@ARGV)) {
+       print "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c\n";
+       system "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c";
+       die "First stage Compile failure" if $? != 0;
+} elsif (!defined($ENV{FIPS_SIG})) {
+       die "no fips_premain.obj linked";
+}
 
 print "$fips_link @ARGV\n";
 system "$fips_link @ARGV";
 die "First stage Link failure" if $? != 0;
 
+if (defined($ENV{FIPS_SIG})) {
+       print "$ENV{FIPS_SIG} $fips_target\n";
+       system "$ENV{FIPS_SIG} $fips_target";
+       die "$ENV{FIPS_SIG} $fips_target failed" if $? != 0;
+       exit;
+}
 
 print "$fips_premain_dso $fips_target\n";
 system("$fips_premain_dso $fips_target >$fips_target.sha1");
@@ -62,6 +72,22 @@ print "$fips_link @ARGV\n";
 system "$fips_link @ARGV";
 die "Second stage Link failure" if $? != 0;
 
+sub is_premain_linked
+       {
+       return 1 if (grep /fips_premain\.obj/,@_);
+       foreach (@_)
+               {
+               if (/^@(.*)/ && -f $1)
+                       {
+                       open FD,$1 or die "can't open $1";
+                       my $ret = (grep /fips_premain\.obj/,<FD>)?1:0;
+                       close FD;
+                       return $ret;
+                       }
+               }
+       return 0;
+       }
+
 sub check_hash
        {
        my ($sha1_exe, $filename) = @_;