提交 38bae7ba 编写于 作者: D Dr. Stephen Henson

Experimental perl script to edit assembly language source files,

call the assembler, then restore original file.

This makes OPENSSL_FIPSSYMS work for assembly language builds.
上级 d47691ec
# FIPS assembly language preprocessor
# Renames all symbols in the file to
# their modified fips versions.
my @ARGS = @ARGV;
my $top = shift @ARGS;
my $target = shift @ARGS;
# Open symbol rename file.
open(IN, "$top/fips/fipssyms.h") || die "Can't open fipssyms.h";
# Skip to assembler symbols
while (<IN>)
{
last if (/assembler/)
}
# Store all renames.
while (<IN>)
{
if (/^#define\s+(\w+)\s+(\w+)\b/)
{
$edits{$1} = $2;
}
}
my ($from, $to);
#rename target temporarily
rename($target, "tmptarg.s") || die "Can't rename $target\n";
#edit target
open IN,"tmptarg.s";
open OUT, ">$target";
while (<IN>)
{
while (($from, $to) = each %edits)
{
s/(\b)$from(\b)/$1$to$2/g;
}
print OUT $_;
}
# run assembler
system @ARGS;
my $rv = $?;
# restore target
unlink $target;
rename "tmptarg.s", $target;
die "Error executing assembler!" if $rv != 0;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册