util/fipslink.pl: further adjustments.
authorAndy Polyakov <appro@openssl.org>
Sat, 27 Oct 2012 23:36:43 +0000 (23:36 +0000)
committerAndy Polyakov <appro@openssl.org>
Sat, 27 Oct 2012 23:36:43 +0000 (23:36 +0000)
fips/sha/Makefile
test/Makefile
util/fipslink.pl

index 9bc598301f5f54321eed4f294459f716699b4c11..0878e7bf641440543e0f94df8f4349b98560d667 100644 (file)
@@ -30,7 +30,8 @@ LIB=$(TOP)/libcrypto.a
 LIBSRC=fips_sha1_selftest.c
 LIBOBJ=fips_sha1_selftest.o
 
-SRC= $(LIBSRC) fips_standalone_sha1.c
+SRC= $(LIBSRC)
+PROGS= fips_standalone_sha1.c
 
 EXHEADER=
 HEADER=        
index 9f3722b85605db0e810ec8cc8a6cd36c0a1514e2..77caa2502ccaba0e7770e170e514fc5686ca9721 100644 (file)
@@ -12,6 +12,7 @@ PERL=         perl
 # KRB5 stuff
 KRB5_INCLUDES=
 LIBKRB5=
+TEST=          fips_algvs.c
 
 PEX_LIBS=
 EX_LIBS= #-lnsl -lsocket
index 4b07036419e8d3c1e4703ca33e3e1036b5423ec9..4a88fc6d77e07d36b25d95fdb7c8f782e7666d79 100644 (file)
@@ -33,12 +33,12 @@ check_hash($sha1_exe, "fipscanister.lib");
 
 print "Integrity check OK\n";
 
-if (grep /fips_premain\.obj/,@ARGV) {
+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";
+       die "no fips_premain.obj linked";
 }
 
 print "$fips_link @ARGV\n";
@@ -46,7 +46,8 @@ system "$fips_link @ARGV";
 die "First stage Link failure" if $? != 0;
 
 if (defined($ENV{FIPS_SIG})) {
-       system "$ENV{FIPS_SIG} $fips_target"
+       print "$ENV{FIPS_SIG} $fips_target\n";
+       system "$ENV{FIPS_SIG} $fips_target";
        die "$ENV{FIPS_SIG} $fips_target failed" if $? != 0;
        exit;
 }
@@ -71,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) = @_;