PKCS#8 support for alternative PRFs.
[openssl.git] / util / fipsas.pl
index 39ce79dd90daed44e6239c7b43f8aac16c16da6c..1694c59a411fc52582574f262c2e902c3606d241 100644 (file)
@@ -8,6 +8,9 @@ my @ARGS = @ARGV;
 
 my $top = shift @ARGS;
 my $target = shift @ARGS;
+my $tmptarg = $target;
+
+$tmptarg =~ s/\.[^\\\/\.]+$/.tmp/;
 
 my $runasm = 1;
 
@@ -19,7 +22,7 @@ if ($ARGS[0] eq "norunasm")
 
 my $enabled = 0;
 
-$enabled = 1 if $ENV{CFLAG} =~ /-DOPENSSL_FIPSSYMS/;
+$enabled = 1 if $ENV{FIPSCANISTERINTERNAL} eq "y";
 
 if ($enabled == 0 && $runasm)
        {
@@ -48,12 +51,16 @@ while (<IN>)
 
 my ($from, $to);
 
+#delete any temp file lying around
+
+unlink $tmptarg;
+
 #rename target temporarily
-rename($target, "tmptarg.s") || die "Can't rename $target\n";
+rename($target, $tmptarg) || die "Can't rename $target";
 
 #edit target
-open IN,"tmptarg.s";
-open OUT, ">$target";
+open(IN,$tmptarg) || die "Can't open temporary file";
+open(OUT, ">$target") || die "Can't open output file $target";
 
 while (<IN>)
 {
@@ -70,21 +77,17 @@ if ($runasm)
        {
        # run assembler
        system @ARGS;
-print STDERR "RUNNING: @ARGS\n";
+
        my $rv = $?;
-exit 0;
+
        # restore target
        unlink $target;
-       rename "tmptarg.s", $target;
+       rename $tmptarg, $target;
 
        die "Error executing assembler!" if $rv != 0;
        }
 else
        {
        # Don't care about target
-       unlink "tmptarg.s";
+       unlink $tmptarg;
        }
-
-
-
-