summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src/util
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2009-01-09 12:13:50 +0000
committerdjm <djm@openbsd.org>2009-01-09 12:13:50 +0000
commit82a8dcafbb30bde31cbded094521103bf43ceb41 (patch)
tree8859b263d86cce51b675cde925c3270362dc661e /lib/libssl/src/util
parentExplain that any check pattern will work. (diff)
downloadwireguard-openbsd-82a8dcafbb30bde31cbded094521103bf43ceb41.tar.xz
wireguard-openbsd-82a8dcafbb30bde31cbded094521103bf43ceb41.zip
import openssl-0.9.8j
Diffstat (limited to 'lib/libssl/src/util')
-rw-r--r--lib/libssl/src/util/arx.pl15
-rw-r--r--lib/libssl/src/util/copy.pl11
-rw-r--r--lib/libssl/src/util/fipslink.pl2
-rw-r--r--lib/libssl/src/util/mksdef.pl87
4 files changed, 114 insertions, 1 deletions
diff --git a/lib/libssl/src/util/arx.pl b/lib/libssl/src/util/arx.pl
new file mode 100644
index 00000000000..ce62625c334
--- /dev/null
+++ b/lib/libssl/src/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/libssl/src/util/copy.pl b/lib/libssl/src/util/copy.pl
index e20b45530a8..eba6d5815e9 100644
--- a/lib/libssl/src/util/copy.pl
+++ b/lib/libssl/src/util/copy.pl
@@ -8,9 +8,16 @@ use Fcntl;
# Perl script 'copy' comment. On Windows the built in "copy" command also
# copies timestamps: this messes up Makefile dependencies.
+my $stripcr = 0;
+
my $arg;
foreach $arg (@ARGV) {
+ if ($arg eq "-stripcr")
+ {
+ $stripcr = 1;
+ next;
+ }
$arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob...
foreach (glob $arg)
{
@@ -49,6 +56,10 @@ foreach (@filelist)
|| die "Can't Open $dfile";
while (sysread IN, $buf, 10240)
{
+ if ($stripcr)
+ {
+ $buf =~ tr/\015//d;
+ }
syswrite(OUT, $buf, length($buf));
}
close(IN);
diff --git a/lib/libssl/src/util/fipslink.pl b/lib/libssl/src/util/fipslink.pl
index a893833c5c7..3597bc1740a 100644
--- a/lib/libssl/src/util/fipslink.pl
+++ b/lib/libssl/src/util/fipslink.pl
@@ -28,7 +28,7 @@ if (exists $ENV{"PREMAIN_DSO_EXE"})
}
check_hash($sha1_exe, "fips_premain.c");
-check_hash($sha1_exe, "fipscanister.o");
+check_hash($sha1_exe, "fipscanister.lib");
print "Integrity check OK\n";
diff --git a/lib/libssl/src/util/mksdef.pl b/lib/libssl/src/util/mksdef.pl
new file mode 100644
index 00000000000..065dc675f1e
--- /dev/null
+++ b/lib/libssl/src/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;
+ }
+
+