2 # Perl script to split libeay32.def into two distinct DEF files for use in
3 # fipdso mode. It works out symbols in each case by running "link" command and
4 # parsing the output to find the list of missing symbols then splitting
5 # libeay32.def based on the result.
8 # Get list of unknown symbols
10 my @deferr = `link @ARGV`;
17 # Add symbols to a hash for easy lookup
21 if (/^.*symbol (\S+)$/)
27 open (IN, "ms/libeay32.def") || die "Can't Open DEF file for splittling";
31 # Parse libeay32.def into two arrays depending on whether the symbol matches
40 if (exists $nosym{$1})
46 push @fipsdll, "\t$1\n";
49 $preamble .= $_ unless $started;
54 # Hack! Add some additional exports needed for libcryptofips.dll
57 push @fipsdll, "\tOPENSSL_showfatal\n";
58 push @fipsdll, "\tOPENSSL_cpuid_setup\n";
60 # Write out DEF files for each array
62 write_def("ms/libfips.def", "LIBFIPS", $preamble, \@fipsdll);
63 write_def("ms/libcryptofips.def", "LIBCRYPTOFIPS", $preamble, \@fipsrest);
68 my ($fnam, $defname, $preamble, $rdefs) = @_;
69 open (OUT, ">$fnam") || die "Can't Open DEF file $fnam for Writing\n";
71 $preamble =~ s/LIBEAY32/$defname/g;
72 $preamble =~ s/LIBEAY/$defname/g;