X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=util%2Ffipsas.pl;h=cad7c08ca202af7ad9a9473f7ae1c11d40801e82;hp=c6964e19cfadd68ea9306b678565771427fc6241;hb=524289baa514dbaa457c15af59f70d0669b9528f;hpb=5d439d69552e753debc48461293517b66b0b94b4 diff --git a/util/fipsas.pl b/util/fipsas.pl index c6964e19cf..cad7c08ca2 100644 --- a/util/fipsas.pl +++ b/util/fipsas.pl @@ -9,19 +9,25 @@ my @ARGS = @ARGV; my $top = shift @ARGS; my $target = shift @ARGS; -# HACK to disable operation if no OPENSSL_FIPSSYMS option. -# will go away when tested more fully. +my $runasm = 1; + +if ($ARGS[0] eq "norunasm") + { + $runasm = 0; + shift @ARGS; + } my $enabled = 0; -foreach (@ARGS) { $enabled = 1 if /-DOPENSSL_FIPSSYMS/ ; } +$enabled = 1 if $ENV{CFLAG} =~ /-DOPENSSL_FIPSSYMS/; -if ($enabled == 0) +if ($enabled == 0 && $runasm) { system @ARGS; exit $? } + # Open symbol rename file. open(IN, "$top/fips/fipssyms.h") || die "Can't open fipssyms.h"; @@ -53,18 +59,32 @@ while () { while (($from, $to) = each %edits) { - s/(\b)$from(\b)/$1$to$2/g; + s/(\b_*)$from(\b)/$1$to$2/g; } print OUT $_; } -# run assembler -system @ARGS; -my $rv = $?; +close OUT; + +if ($runasm) + { + # run assembler + system @ARGS; + + my $rv = $?; + + # restore target + unlink $target; + rename "tmptarg.s", $target; + + die "Error executing assembler!" if $rv != 0; + } +else + { + # Don't care about target + unlink "tmptarg.s"; + } + -# restore target -unlink $target; -rename "tmptarg.s", $target; -die "Error executing assembler!" if $rv != 0;