diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2009-01-09 12:14:10 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2009-01-09 12:14:10 +0000 |
commit | d30d6ad00561d36a052e2a024020f6802756f04a (patch) | |
tree | d0056b85d59fbcdf6660f64d326c2aec91ab897d /lib/libcrypto/util | |
parent | e3e8dff41f7ab5012303998d65d07ce01ada07e2 (diff) |
import openssl-0.9.8j
Diffstat (limited to 'lib/libcrypto/util')
-rw-r--r-- | lib/libcrypto/util/arx.pl | 15 | ||||
-rw-r--r-- | lib/libcrypto/util/mksdef.pl | 87 |
2 files changed, 102 insertions, 0 deletions
diff --git a/lib/libcrypto/util/arx.pl b/lib/libcrypto/util/arx.pl new file mode 100644 index 00000000000..ce62625c334 --- /dev/null +++ b/lib/libcrypto/util/arx.pl @@ -0,0 +1,15 @@ +#!/bin/perl + +# Simple perl script to wrap round "ar" program and exclude any +# object files in the environment variable EXCL_OBJ + +map { s/^.*\/([^\/]*)$/$1/ ; $EXCL{$_} = 1} split(' ', $ENV{EXCL_OBJ}); + +#my @ks = keys %EXCL; +#print STDERR "Excluding: @ks \n"; + +my @ARGS = grep { !exists $EXCL{$_} } @ARGV; + +system @ARGS; + +exit $? >> 8; diff --git a/lib/libcrypto/util/mksdef.pl b/lib/libcrypto/util/mksdef.pl new file mode 100644 index 00000000000..065dc675f1e --- /dev/null +++ b/lib/libcrypto/util/mksdef.pl @@ -0,0 +1,87 @@ + +# Perl script to split libeay32.def into two distinct DEF files for use in +# fipdso mode. It works out symbols in each case by running "link" command and +# parsing the output to find the list of missing symbols then splitting +# libeay32.def based on the result. + + +# Get list of unknown symbols + +my @deferr = `link @ARGV`; + +my $preamble = ""; +my @fipsdll; +my @fipsrest; +my %nosym; + +# Add symbols to a hash for easy lookup + +foreach (@deferr) + { + if (/^.*symbol (\S+)$/) + { + $nosym{$1} = 1; + } + } + +open (IN, "ms/libeay32.def") || die "Can't Open DEF file for spliting"; + +my $started = 0; + +# Parse libeay32.def into two arrays depending on whether the symbol matches +# the missing list. + + +foreach (<IN>) + { + if (/^\s*(\S+)\s*(\@\S+)\s*$/) + { + $started = 1; + if (exists $nosym{$1}) + { + push @fipsrest, $_; + } + else + { + my $imptmp = sprintf " %-39s %s\n", + "$1=libosslfips.$1", $2; + push @fipsrest, $imptmp; + push @fipsdll, "\t$1\n"; + } + } + $preamble .= $_ unless $started; + } + +close IN; + +# Hack! Add some additional exports needed for libcryptofips.dll +# + +push @fipsdll, "\tOPENSSL_showfatal\n"; +push @fipsdll, "\tOPENSSL_cpuid_setup\n"; + +# Write out DEF files for each array + +write_def("ms/libosslfips.def", "LIBOSSLFIPS", $preamble, \@fipsdll); +write_def("ms/libeayfips.def", "", $preamble, \@fipsrest); + + +sub write_def + { + my ($fnam, $defname, $preamble, $rdefs) = @_; + open (OUT, ">$fnam") || die "Can't Open DEF file $fnam for Writing\n"; + + if ($defname ne "") + { + $preamble =~ s/LIBEAY32/$defname/g; + $preamble =~ s/LIBEAY/$defname/g; + } + print OUT $preamble; + foreach (@$rdefs) + { + print OUT $_; + } + close OUT; + } + + |