first commit, SM2-DSA only

This commit is contained in:
Zhi Guan
2014-12-01 10:40:26 +08:00
commit 57954c4567
2230 changed files with 569407 additions and 0 deletions

6
util/FreeBSD.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
perl util/perlpath.pl /usr/bin
perl util/ssldir.pl /usr/local
perl util/mk1mf.pl FreeBSD >Makefile.FreeBSD
perl Configure FreeBSD

123
util/add_cr.pl Executable file
View File

@@ -0,0 +1,123 @@
#!/usr/local/bin/perl
#
# This adds a copyright message to a souce code file.
# It also gets the file name correct.
#
# perl util/add_cr.pl *.[ch] */*.[ch] */*/*.[ch]
#
foreach (@ARGV)
{
&dofile($_);
}
sub dofile
{
local($file)=@_;
open(IN,"<$file") || die "unable to open $file:$!\n";
print STDERR "doing $file\n";
@in=<IN>;
return(1) if ($in[0] =~ / NOCW /);
@out=();
open(OUT,">$file.out") || die "unable to open $file.$$:$!\n";
push(@out,"/* $file */\n");
if (($in[1] !~ /^\/\* Copyright \(C\) [0-9-]+ Eric Young \(eay\@cryptsoft.com\)/))
{
push(@out,&Copyright);
$i=2;
@a=grep(/ Copyright \(C\) /,@in);
if ($#a >= 0)
{
while (($i <= $#in) && ($in[$i] ne " */\n"))
{ $i++; }
$i++ if ($in[$i] eq " */\n");
while (($i <= $#in) && ($in[$i] =~ /^\s*$/))
{ $i++; }
push(@out,"\n");
for ( ; $i <= $#in; $i++)
{ push(@out,$in[$i]); }
}
else
{ push(@out,@in); }
}
else
{
shift(@in);
push(@out,@in);
}
print OUT @out;
close(IN);
close(OUT);
rename("$file","$file.orig") || die "unable to rename $file:$!\n";
rename("$file.out",$file) || die "unable to rename $file.out:$!\n";
}
sub Copyright
{
return <<'EOF';
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
EOF
}

134
util/bat.sh Executable file
View File

@@ -0,0 +1,134 @@
#!/usr/local/bin/perl
$infile="/home/eay/ssl/SSLeay/MINFO";
open(IN,"<$infile") || die "unable to open $infile:$!\n";
$_=<IN>;
for (;;)
{
chop;
($key,$val)=/^([^=]+)=(.*)/;
if ($key eq "RELATIVE_DIRECTORY")
{
if ($lib ne "")
{
$uc=$lib;
$uc =~ s/^lib(.*)\.a/$1/;
$uc =~ tr/a-z/A-Z/;
$lib_nam{$uc}=$uc;
$lib_obj{$uc}.=$libobj." ";
}
last if ($val eq "FINISHED");
$lib="";
$libobj="";
$dir=$val;
}
if ($key eq "TEST")
{ $test.=&var_add($dir,$val); }
if (($key eq "PROGS") || ($key eq "E_OBJ"))
{ $e_exe.=&var_add($dir,$val); }
if ($key eq "LIB")
{
$lib=$val;
$lib =~ s/^.*\/([^\/]+)$/$1/;
}
if ($key eq "EXHEADER")
{ $exheader.=&var_add($dir,$val); }
if ($key eq "HEADER")
{ $header.=&var_add($dir,$val); }
if ($key eq "LIBSRC")
{ $libsrc.=&var_add($dir,$val); }
if (!($_=<IN>))
{ $_="RELATIVE_DIRECTORY=FINISHED\n"; }
}
close(IN);
@a=split(/\s+/,$libsrc);
foreach (@a)
{
print "${_}.c\n";
}
sub var_add
{
local($dir,$val)=@_;
local(@a,$_,$ret);
return("") if $no_engine && $dir =~ /\/engine/;
return("") if $no_idea && $dir =~ /\/idea/;
return("") if $no_rc2 && $dir =~ /\/rc2/;
return("") if $no_rc4 && $dir =~ /\/rc4/;
return("") if $no_rsa && $dir =~ /\/rsa/;
return("") if $no_rsa && $dir =~ /^rsaref/;
return("") if $no_dsa && $dir =~ /\/dsa/;
return("") if $no_dh && $dir =~ /\/dh/;
if ($no_des && $dir =~ /\/des/)
{
if ($val =~ /read_pwd/)
{ return("$dir/read_pwd "); }
else
{ return(""); }
}
return("") if $no_mdc2 && $dir =~ /\/mdc2/;
return("") if $no_sock && $dir =~ /\/proxy/;
return("") if $no_bf && $dir =~ /\/bf/;
return("") if $no_cast && $dir =~ /\/cast/;
$val =~ s/^\s*(.*)\s*$/$1/;
@a=split(/\s+/,$val);
grep(s/\.[och]$//,@a);
@a=grep(!/^e_.*_3d$/,@a) if $no_des;
@a=grep(!/^e_.*_d$/,@a) if $no_des;
@a=grep(!/^e_.*_i$/,@a) if $no_idea;
@a=grep(!/^e_.*_r2$/,@a) if $no_rc2;
@a=grep(!/^e_.*_bf$/,@a) if $no_bf;
@a=grep(!/^e_.*_c$/,@a) if $no_cast;
@a=grep(!/^e_rc4$/,@a) if $no_rc4;
@a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2;
@a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3;
@a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock;
@a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2;
@a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5;
@a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa;
@a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa;
@a=grep(!/(^pem_seal$)/,@a) if $no_rsa;
@a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa;
@a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa;
@a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4;
@a=grep(!/_dhp$/,@a) if $no_dh;
@a=grep(!/(^sha[^1])|(_sha$)|(m_dss$)/,@a) if $no_sha;
@a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
@a=grep(!/_mdc2$/,@a) if $no_mdc2;
@a=grep(!/^engine$/,@a) if $no_engine;
@a=grep(!/(^rsa$)|(^genrsa$)|(^req$)|(^ca$)/,@a) if $no_rsa;
@a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa;
@a=grep(!/^gendsa$/,@a) if $no_sha1;
@a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh;
@a=grep(!/(^dh)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
grep($_="$dir/$_",@a);
@a=grep(!/(^|\/)s_/,@a) if $no_sock;
@a=grep(!/(^|\/)bio_sock/,@a) if $no_sock;
$ret=join(' ',@a)." ";
return($ret);
}

64
util/ck_errf.pl Executable file
View File

@@ -0,0 +1,64 @@
#!/usr/local/bin/perl
#
# This is just a quick script to scan for cases where the 'error'
# function name in a XXXerr() macro is wrong.
#
# Run in the top level by going
# perl util/ck_errf.pl */*.c */*/*.c
#
my $err_strict = 0;
my $bad = 0;
foreach $file (@ARGV)
{
if ($file eq "-strict")
{
$err_strict = 1;
next;
}
open(IN,"<$file") || die "unable to open $file\n";
$func="";
while (<IN>)
{
if (!/;$/ && /^([a-zA-Z].*[\s*])?([A-Za-z_0-9]+)\(.*[),]/)
{
/^([^()]*(\([^()]*\)[^()]*)*)\(/;
$1 =~ /([A-Za-z_0-9]*)$/;
$func = $1;
$func =~ tr/A-Z/a-z/;
}
if (/([A-Z0-9]+)err\(([^,]+)/ && ! /ckerr_ignore/)
{
$errlib=$1;
$n=$2;
if ($func eq "")
{ print "$file:$.:???:$n\n"; $bad = 1; next; }
if ($n !~ /([^_]+)_F_(.+)$/)
{
# print "check -$file:$.:$func:$n\n";
next;
}
$lib=$1;
$n=$2;
if ($lib ne $errlib)
{ print "$file:$.:$func:$n [${errlib}err]\n"; $bad = 1; next; }
$n =~ tr/A-Z/a-z/;
if (($n ne $func) && ($errlib ne "SYS"))
{ print "$file:$.:$func:$n\n"; $bad = 1; next; }
# print "$func:$1\n";
}
}
close(IN);
}
if ($bad && $err_strict)
{
print STDERR "FATAL: error discrepancy\n";
exit 1;
}

58
util/clean-depend.pl Executable file
View File

@@ -0,0 +1,58 @@
#!/usr/local/bin/perl -w
# Clean the dependency list in a makefile of standard includes...
# Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999
use strict;
while(<STDIN>) {
print;
last if /^# DO NOT DELETE THIS LINE/;
}
my %files;
my $thisfile="";
while(<STDIN>) {
my ($dummy, $file,$deps)=/^((.*):)? (.*)$/;
my $origfile="";
$thisfile=$file if defined $file;
next if !defined $deps;
$origfile=$thisfile;
$origfile=~s/\.o$/.c/;
my @deps=split ' ',$deps;
@deps=grep(!/^\//,@deps);
@deps=grep(!/^\\$/,@deps);
@deps=grep(!/^$origfile$/,@deps);
# pull out the kludged kerberos header (if present).
@deps=grep(!/^[.\/]+\/krb5.h/,@deps);
push @{$files{$thisfile}},@deps;
}
my $file;
foreach $file (sort keys %files) {
my $len=0;
my $dep;
my $origfile=$file;
$origfile=~s/\.o$/.c/;
$file=~s/^\.\///;
push @{$files{$file}},$origfile;
my $prevdep="";
# Remove leading ./ before sorting
my @deps = map { $_ =~ s/^\.\///; $_ } @{$files{$file}};
foreach $dep (sort @deps) {
$dep=~s/^\.\///;
next if $prevdep eq $dep; # to exterminate duplicates...
$prevdep = $dep;
$len=0 if $len+length($dep)+1 >= 80;
if($len == 0) {
print "\n$file:";
$len=length($file)+1;
}
print " $dep";
$len+=length($dep)+1;
}
}
print "\n";

59
util/copy.pl Normal file
View File

@@ -0,0 +1,59 @@
#!/usr/local/bin/perl
use Fcntl;
# copy.pl
# Perl script 'copy' comment. On Windows the built in "copy" command also
# copies timestamps: this messes up Makefile dependencies.
my $arg;
foreach $arg (@ARGV) {
$arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob...
foreach (glob $arg)
{
push @filelist, $_;
}
}
$fnum = @filelist;
if ($fnum <= 1)
{
die "Need at least two filenames";
}
$dest = pop @filelist;
if ($fnum > 2 && ! -d $dest)
{
die "Destination must be a directory";
}
foreach (@filelist)
{
if (-d $dest)
{
$dfile = $_;
$dfile =~ s|^.*[/\\]([^/\\]*)$|$1|;
$dfile = "$dest/$dfile";
}
else
{
$dfile = $dest;
}
sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_";
sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY)
|| die "Can't Open $dfile";
while (sysread IN, $buf, 10240)
{
syswrite(OUT, $buf, length($buf));
}
close(IN);
close(OUT);
print "Copying: $_ to $dfile\n";
}

146
util/cygwin.sh Executable file
View File

@@ -0,0 +1,146 @@
#!/bin/bash
#
# This script configures, builds and packs the binary package for
# the Cygwin net distribution version of OpenSSL
#
# Uncomment when debugging
#set -x
CONFIG_OPTIONS="--prefix=/usr shared zlib no-idea no-rc5"
INSTALL_PREFIX=/tmp/install/INSTALL
VERSION=
SUBVERSION=$1
function cleanup()
{
rm -rf ${INSTALL_PREFIX}/etc
rm -rf ${INSTALL_PREFIX}/usr
}
function get_openssl_version()
{
eval `grep '^VERSION=' Makefile`
if [ -z "${VERSION}" ]
then
echo "Error: Couldn't retrieve OpenSSL version from Makefile."
echo " Check value of variable VERSION in Makefile."
exit 1
fi
}
function base_install()
{
mkdir -p ${INSTALL_PREFIX}
cleanup
make install INSTALL_PREFIX="${INSTALL_PREFIX}"
}
function doc_install()
{
DOC_DIR=${INSTALL_PREFIX}/usr/share/doc/openssl
mkdir -p ${DOC_DIR}
cp CHANGES CHANGES.SSLeay INSTALL LICENSE NEWS README ${DOC_DIR}
create_cygwin_readme
}
function certs_install()
{
CERTS_DIR=${INSTALL_PREFIX}/usr/ssl/certs
mkdir -p ${CERTS_DIR}
cp -rp certs/* ${CERTS_DIR}
}
function create_cygwin_readme()
{
README_DIR=${INSTALL_PREFIX}/usr/share/doc/Cygwin
README_FILE=${README_DIR}/openssl-${VERSION}.README
mkdir -p ${README_DIR}
cat > ${README_FILE} <<- EOF
The Cygwin version has been built using the following configure:
./config ${CONFIG_OPTIONS}
The IDEA and RC5 algorithms are disabled due to patent and/or
licensing issues.
EOF
}
function create_profile_files()
{
PROFILE_DIR=${INSTALL_PREFIX}/etc/profile.d
mkdir -p $PROFILE_DIR
cat > ${PROFILE_DIR}/openssl.sh <<- "EOF"
export MANPATH="${MANPATH}:/usr/ssl/man"
EOF
cat > ${PROFILE_DIR}/openssl.csh <<- "EOF"
if ( $?MANPATH ) then
setenv MANPATH "${MANPATH}:/usr/ssl/man"
else
setenv MANPATH ":/usr/ssl/man"
endif
EOF
}
if [ -z "${SUBVERSION}" ]
then
echo "Usage: $0 subversion"
exit 1
fi
if [ ! -f config ]
then
echo "You must start this script in the OpenSSL toplevel source dir."
exit 1
fi
./config ${CONFIG_OPTIONS}
get_openssl_version
make depend || exit 1
make || exit 1
base_install
doc_install
certs_install
create_cygwin_readme
create_profile_files
cd ${INSTALL_PREFIX}
chmod u+w usr/lib/engines/*.so
strip usr/bin/*.exe usr/bin/*.dll usr/lib/engines/*.so
chmod u-w usr/lib/engines/*.so
# Runtime package
tar cjf libopenssl${VERSION//[!0-9]/}-${VERSION}-${SUBVERSION}.tar.bz2 \
usr/bin/cyg*dll
# Base package
find etc usr/bin/openssl.exe usr/bin/c_rehash usr/lib/engines usr/share/doc \
usr/ssl/certs usr/ssl/man/man[157] usr/ssl/misc usr/ssl/openssl.cnf \
usr/ssl/private \
-empty -o \! -type d |
tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 -
# Development package
find usr/include usr/lib/*.a usr/lib/pkgconfig usr/ssl/man/man3 \
-empty -o \! -type d |
tar cjfT openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 -
ls -l openssl-${VERSION}-${SUBVERSION}.tar.bz2
ls -l openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2
ls -l libopenssl${VERSION//[!0-9]/}-${VERSION}-${SUBVERSION}.tar.bz2
cleanup
exit 0

7
util/deleof.pl Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/local/bin/perl
while (<>)
{
print
last if (/^# DO NOT DELETE THIS LINE/);
}

34
util/deltree.com Normal file
View File

@@ -0,0 +1,34 @@
$! DELTREE.COM
$
$ call deltree 'p1'
$ exit $status
$
$ deltree: subroutine ! P1 is a name of a directory
$ on control_y then goto dt_STOP
$ on warning then goto dt_exit
$ _dt_def = f$trnlnm("SYS$DISK")+f$directory()
$ if f$parse(p1) .eqs. "" then exit
$ set default 'f$parse(p1,,,"DEVICE")''f$parse(p1,,,"DIRECTORY")'
$ p1 = f$parse(p1,,,"NAME") + f$parse(p1,,,"TYPE")
$ _fp = f$parse(".DIR",p1)
$ dt_loop:
$ _f = f$search(_fp)
$ if _f .eqs. "" then goto dt_loopend
$ call deltree [.'f$parse(_f,,,"NAME")']*.*
$ goto dt_loop
$ dt_loopend:
$ _fp = f$parse(p1,".;*")
$ if f$search(_fp) .eqs. "" then goto dt_exit
$ set noon
$ set file/prot=(S:RWED,O:RWED,G:RWED,W:RWED) '_fp'
$ set on
$ delete/nolog '_fp'
$ dt_exit:
$ set default '_dt_def'
$ goto dt_end
$ dt_STOP:
$ set default '_dt_def'
$ stop/id=""
$ exit
$ dt_end:
$ endsubroutine

18
util/dirname.pl Normal file
View File

@@ -0,0 +1,18 @@
#!/usr/local/bin/perl
if ($#ARGV < 0) {
die "dirname.pl: too few arguments\n";
} elsif ($#ARGV > 0) {
die "dirname.pl: too many arguments\n";
}
my $d = $ARGV[0];
if ($d =~ m|.*/.*|) {
$d =~ s|/[^/]*$||;
} else {
$d = ".";
}
print $d,"\n";
exit(0);

19
util/do_ms.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
#
# generate the Microsoft makefiles and .def files
#
PATH=util:../util:$PATH
# perl util/mk1mf.pl no-sock VC-MSDOS >ms/msdos.mak
# perl util/mk1mf.pl VC-W31-32 >ms/w31.mak
perl util/mk1mf.pl dll VC-WIN16 >ms/w31dll.mak
# perl util/mk1mf.pl VC-WIN32 >ms/nt.mak
perl util/mk1mf.pl dll VC-WIN32 >ms/ntdll.mak
perl util/mk1mf.pl Mingw32 >ms/mingw32.mak
perl util/mk1mf.pl Mingw32-files >ms/mingw32f.mak
perl util/mkdef.pl 16 libeay > ms/libeay16.def
perl util/mkdef.pl 32 libeay > ms/libeay32.def
perl util/mkdef.pl 16 ssleay > ms/ssleay16.def
perl util/mkdef.pl 32 ssleay > ms/ssleay32.def

38
util/domd Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh
# Do a makedepend, only leave out the standard headers
# Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999
TOP=$1
shift
if [ "$1" = "-MD" ]; then
shift
MAKEDEPEND=$1
shift
fi
if [ "$MAKEDEPEND" = "" ]; then MAKEDEPEND=makedepend; fi
cp Makefile Makefile.save
# fake the presence of Kerberos
touch $TOP/krb5.h
if expr "$MAKEDEPEND" : '.*gcc$' > /dev/null; then
args=""
while [ $# -gt 0 ]; do
if [ "$1" != "--" ]; then args="$args $1"; fi
shift
done
sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp
echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp
${MAKEDEPEND} -Werror -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp || exit 1
${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new
RC=$?
rm -f Makefile.tmp
else
${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@ && \
${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new
RC=$?
fi
mv Makefile.new Makefile
# unfake the presence of Kerberos
rm $TOP/krb5.h
exit $RC

33
util/err-ins.pl Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/local/bin/perl
#
# tack error codes onto the end of a file
#
open(ERR,$ARGV[0]) || die "unable to open error file '$ARGV[0]':$!\n";
@err=<ERR>;
close(ERR);
open(IN,$ARGV[1]) || die "unable to open header file '$ARGV[1]':$!\n";
@out="";
while (<IN>)
{
push(@out,$_);
last if /BEGIN ERROR CODES/;
}
close(IN);
open(OUT,">$ARGV[1]") || die "unable to open header file '$ARGV[1]':$1\n";
print OUT @out;
print OUT @err;
print OUT <<"EOF";
#ifdef __cplusplus
}
#endif
#endif
EOF
close(OUT);

26
util/extract-names.pl Normal file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/perl
$/ = ""; # Eat a paragraph at once.
while(<STDIN>) {
chop;
s/\n/ /gm;
if (/^=head1 /) {
$name = 0;
} elsif ($name) {
if (/ - /) {
s/ - .*//;
s/,\s+/,/g;
s/\s+,/,/g;
s/^\s+//g;
s/\s+$//g;
s/\s/_/g;
push @words, split ',';
}
}
if (/^=head1 *NAME *$/) {
$name = 1;
}
}
print join("\n", @words),"\n";

12
util/extract-section.pl Normal file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/perl
while(<STDIN>) {
if (/=for\s+comment\s+openssl_manual_section:(\S+)/)
{
print "$1\n";
exit 0;
}
}
print "$ARGV[0]\n";

61
util/files.pl Executable file
View File

@@ -0,0 +1,61 @@
#!/usr/local/bin/perl
#
# used to generate the file MINFO for use by util/mk1mf.pl
# It is basically a list of all variables from the passed makefile
#
$s="";
while (<>)
{
chop;
s/#.*//;
if (/^(\S+)\s*=\s*(.*)$/)
{
$o="";
($s,$b)=($1,$2);
for (;;)
{
if ($b =~ /\\$/)
{
chop($b);
$o.=$b." ";
$b=<>;
chop($b);
}
else
{
$o.=$b." ";
last;
}
}
$o =~ s/^\s+//;
$o =~ s/\s+$//;
$o =~ s/\s+/ /g;
$o =~ s/\$[({]([^)}]+)[)}]/$sym{$1}/g;
$sym{$s}=$o;
}
}
$pwd=`pwd`; chop($pwd);
if ($sym{'TOP'} eq ".")
{
$n=0;
$dir=".";
}
else {
$n=split(/\//,$sym{'TOP'});
@_=split(/\//,$pwd);
$z=$#_-$n+1;
foreach $i ($z .. $#_) { $dir.=$_[$i]."/"; }
chop($dir);
}
print "RELATIVE_DIRECTORY=$dir\n";
foreach (sort keys %sym)
{
print "$_=$sym{$_}\n";
}
print "RELATIVE_DIRECTORY=\n";

14
util/fixNT.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
#
# clean up the mess that NT makes of my source tree
#
if [ -f makefile -a ! -f Makefile ]; then
/bin/mv makefile Makefile
fi
chmod +x Configure util/*
echo cleaning
/bin/rm -f `find . -name '*.$$$' -print` 2>/dev/null >/dev/null
echo 'removing those damn ^M'
perl -pi -e 's/\015//' `find . -type 'f' -print |grep -v '.obj$' |grep -v '.der$' |grep -v '.gz'`
make -f Makefile links

108
util/install.sh Executable file
View File

@@ -0,0 +1,108 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5; it is not part of GNU.
#
# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# set DOITPROG to echo to test this script
doit="${DOITPROG:-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG:-mv}"
cpprog="${CPPROG:-cp}"
chmodprog="${CHMODPROG:-chmod}"
chownprog="${CHOWNPROG:-chown}"
chgrpprog="${CHGRPPROG:-chgrp}"
stripprog="${STRIPPROG:-strip}"
rmprog="${RMPROG:-rm}"
instcmd="$mvprog"
chmodcmd=""
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
src=""
dst=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
fi
# if destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
fi
# get rid of the old one and mode the new one in
$doit $rmcmd $dst
$doit $instcmd $src $dst
# and set any options; do chmod last to preserve setuid bits
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; fi
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; fi
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; fi
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; fi
exit 0

4191
util/libeay.num Executable file

File diff suppressed because it is too large Load Diff

1164
util/mk1mf.pl Executable file

File diff suppressed because it is too large Load Diff

220
util/mkcerts.sh Executable file
View File

@@ -0,0 +1,220 @@
#!/bin/sh
# This script will re-make all the required certs.
# cd apps
# sh ../util/mkcerts.sh
# mv ca-cert.pem pca-cert.pem ../certs
# cd ..
# cat certs/*.pem >>apps/server.pem
# cat certs/*.pem >>apps/server2.pem
# SSLEAY=`pwd`/apps/ssleay; export SSLEAY
# sh tools/c_rehash certs
#
CAbits=1024
SSLEAY="../apps/openssl"
CONF="-config ../apps/openssl.cnf"
# create pca request.
echo creating $CAbits bit PCA cert request
$SSLEAY req $CONF \
-new -md5 -newkey $CAbits \
-keyout pca-key.pem \
-out pca-req.pem -nodes >/dev/null <<EOF
AU
Queensland
.
CryptSoft Pty Ltd
.
Test PCA (1024 bit)
EOF
if [ $? != 0 ]; then
echo problems generating PCA request
exit 1
fi
#sign it.
echo
echo self signing PCA
$SSLEAY x509 -md5 -days 1461 \
-req -signkey pca-key.pem \
-CAcreateserial -CAserial pca-cert.srl \
-in pca-req.pem -out pca-cert.pem
if [ $? != 0 ]; then
echo problems self signing PCA cert
exit 1
fi
echo
# create ca request.
echo creating $CAbits bit CA cert request
$SSLEAY req $CONF \
-new -md5 -newkey $CAbits \
-keyout ca-key.pem \
-out ca-req.pem -nodes >/dev/null <<EOF
AU
Queensland
.
CryptSoft Pty Ltd
.
Test CA (1024 bit)
EOF
if [ $? != 0 ]; then
echo problems generating CA request
exit 1
fi
#sign it.
echo
echo signing CA
$SSLEAY x509 -md5 -days 1461 \
-req \
-CAcreateserial -CAserial pca-cert.srl \
-CA pca-cert.pem -CAkey pca-key.pem \
-in ca-req.pem -out ca-cert.pem
if [ $? != 0 ]; then
echo problems signing CA cert
exit 1
fi
echo
# create server request.
echo creating 512 bit server cert request
$SSLEAY req $CONF \
-new -md5 -newkey 512 \
-keyout s512-key.pem \
-out s512-req.pem -nodes >/dev/null <<EOF
AU
Queensland
.
CryptSoft Pty Ltd
.
Server test cert (512 bit)
EOF
if [ $? != 0 ]; then
echo problems generating 512 bit server cert request
exit 1
fi
#sign it.
echo
echo signing 512 bit server cert
$SSLEAY x509 -md5 -days 365 \
-req \
-CAcreateserial -CAserial ca-cert.srl \
-CA ca-cert.pem -CAkey ca-key.pem \
-in s512-req.pem -out server.pem
if [ $? != 0 ]; then
echo problems signing 512 bit server cert
exit 1
fi
echo
# create 1024 bit server request.
echo creating 1024 bit server cert request
$SSLEAY req $CONF \
-new -md5 -newkey 1024 \
-keyout s1024key.pem \
-out s1024req.pem -nodes >/dev/null <<EOF
AU
Queensland
.
CryptSoft Pty Ltd
.
Server test cert (1024 bit)
EOF
if [ $? != 0 ]; then
echo problems generating 1024 bit server cert request
exit 1
fi
#sign it.
echo
echo signing 1024 bit server cert
$SSLEAY x509 -md5 -days 365 \
-req \
-CAcreateserial -CAserial ca-cert.srl \
-CA ca-cert.pem -CAkey ca-key.pem \
-in s1024req.pem -out server2.pem
if [ $? != 0 ]; then
echo problems signing 1024 bit server cert
exit 1
fi
echo
# create 512 bit client request.
echo creating 512 bit client cert request
$SSLEAY req $CONF \
-new -md5 -newkey 512 \
-keyout c512-key.pem \
-out c512-req.pem -nodes >/dev/null <<EOF
AU
Queensland
.
CryptSoft Pty Ltd
.
Client test cert (512 bit)
EOF
if [ $? != 0 ]; then
echo problems generating 512 bit client cert request
exit 1
fi
#sign it.
echo
echo signing 512 bit client cert
$SSLEAY x509 -md5 -days 365 \
-req \
-CAcreateserial -CAserial ca-cert.srl \
-CA ca-cert.pem -CAkey ca-key.pem \
-in c512-req.pem -out client.pem
if [ $? != 0 ]; then
echo problems signing 512 bit client cert
exit 1
fi
echo cleanup
cat pca-key.pem >> pca-cert.pem
cat ca-key.pem >> ca-cert.pem
cat s512-key.pem >> server.pem
cat s1024key.pem >> server2.pem
cat c512-key.pem >> client.pem
for i in pca-cert.pem ca-cert.pem server.pem server2.pem client.pem
do
$SSLEAY x509 -issuer -subject -in $i -noout >$$
cat $$
/bin/cat $i >>$$
/bin/mv $$ $i
done
#/bin/rm -f *key.pem *req.pem *.srl
echo Finished

1507
util/mkdef.pl Executable file

File diff suppressed because it is too large Load Diff

34
util/mkdir-p.pl Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/local/bin/perl
# mkdir-p.pl
# On some systems, the -p option to mkdir (= also create any missing parent
# directories) is not available.
my $arg;
foreach $arg (@ARGV) {
$arg =~ tr|\\|/|;
&do_mkdir_p($arg);
}
sub do_mkdir_p {
local($dir) = @_;
$dir =~ s|/*\Z(?!\n)||s;
if (-d $dir) {
return;
}
if ($dir =~ m|[^/]/|s) {
local($parent) = $dir;
$parent =~ s|[^/]*\Z(?!\n)||s;
do_mkdir_p($parent);
}
mkdir($dir, 0777) || die "Cannot create directory $dir: $!\n";
print "created directory `$dir'\n";
}

810
util/mkerr.pl Normal file
View File

@@ -0,0 +1,810 @@
#!/usr/local/bin/perl -w
my $config = "crypto/err/openssl.ec";
my $hprefix = "openssl/";
my $debug = 0;
my $rebuild = 0;
my $static = 1;
my $recurse = 0;
my $reindex = 0;
my $dowrite = 0;
my $staticloader = "";
my $pack_errcode;
my $load_errcode;
my $errcount;
while (@ARGV) {
my $arg = $ARGV[0];
if($arg eq "-conf") {
shift @ARGV;
$config = shift @ARGV;
} elsif($arg eq "-hprefix") {
shift @ARGV;
$hprefix = shift @ARGV;
} elsif($arg eq "-debug") {
$debug = 1;
shift @ARGV;
} elsif($arg eq "-rebuild") {
$rebuild = 1;
shift @ARGV;
} elsif($arg eq "-recurse") {
$recurse = 1;
shift @ARGV;
} elsif($arg eq "-reindex") {
$reindex = 1;
shift @ARGV;
} elsif($arg eq "-nostatic") {
$static = 0;
shift @ARGV;
} elsif($arg eq "-staticloader") {
$staticloader = "static ";
shift @ARGV;
} elsif($arg eq "-write") {
$dowrite = 1;
shift @ARGV;
} elsif($arg eq "-help" || $arg eq "-h" || $arg eq "-?" || $arg eq "--help") {
print STDERR <<"EOF";
mkerr.pl [options] ...
Options:
-conf F Use the config file F instead of the default one:
crypto/err/openssl.ec
-hprefix P Prepend the filenames in generated #include <header>
statements with prefix P. Default: 'openssl/' (without
the quotes, naturally)
-debug Turn on debugging verbose output on stderr.
-rebuild Rebuild all header and C source files, irrespective of the
fact if any error or function codes have been added/removed.
Default: only update files for libraries which saw change
(of course, this requires '-write' as well, or no
files will be touched!)
-recurse scan a preconfigured set of directories / files for error and
function codes:
(<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>, <apps/*.c>)
When this option is NOT specified, the filelist is taken from
the commandline instead. Here, wildcards may be embedded. (Be
sure to escape those to prevent the shell from expanding them
for you when you wish mkerr.pl to do so instead.)
Default: take file list to scan from the command line.
-reindex Discard the numeric values previously assigned to the error
and function codes as extracted from the scanned header files;
instead renumber all of them starting from 100. (Note that
the numbers assigned through 'R' records in the config file
remain intact.)
Default: keep previously assigned numbers. (You are warned
when collisions are detected.)
-nostatic Generates a different source code, where these additional
functions are generated for each library specified in the
config file:
void ERR_load_<LIB>_strings(void);
void ERR_unload_<LIB>_strings(void);
void ERR_<LIB>_error(int f, int r, char *fn, int ln);
#define <LIB>err(f,r) ERR_<LIB>_error(f,r,__FILE__,__LINE__)
while the code facilitates the use of these in an environment
where the error support routines are dynamically loaded at
runtime.
Default: 'static' code generation.
-staticloader Prefix generated functions with the 'static' scope modifier.
Default: don't write any scope modifier prefix.
-write Actually (over)write the generated code to the header and C
source files as assigned to each library through the config
file.
Default: don't write.
-help / -h / -? / --help Show this help text.
... Additional arguments are added to the file list to scan,
assuming '-recurse' was NOT specified on the command line.
EOF
exit 1;
} else {
last;
}
}
if($recurse) {
@source = (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>);
} else {
@source = @ARGV;
}
# Read in the config file
open(IN, "<$config") || die "Can't open config file $config";
# Parse config file
while(<IN>)
{
if(/^L\s+(\S+)\s+(\S+)\s+(\S+)/) {
$hinc{$1} = $2;
$libinc{$2} = $1;
$cskip{$3} = $1;
if($3 ne "NONE") {
$csrc{$1} = $3;
$fmax{$1} = 100;
$rmax{$1} = 100;
$fassigned{$1} = ":";
$rassigned{$1} = ":";
$fnew{$1} = 0;
$rnew{$1} = 0;
}
} elsif (/^F\s+(\S+)/) {
# Add extra function with $1
} elsif (/^R\s+(\S+)\s+(\S+)/) {
$rextra{$1} = $2;
$rcodes{$1} = $2;
}
}
close IN;
# Scan each header file in turn and make a list of error codes
# and function names
while (($hdr, $lib) = each %libinc)
{
next if($hdr eq "NONE");
print STDERR "Scanning header file $hdr\n" if $debug;
my $line = "", $def= "", $linenr = 0, $gotfile = 0;
if (open(IN, "<$hdr")) {
$gotfile = 1;
while(<IN>) {
$linenr++;
print STDERR "line: $linenr\r" if $debug;
last if(/BEGIN\s+ERROR\s+CODES/);
if ($line ne '') {
$_ = $line . $_;
$line = '';
}
if (/\\$/) {
$line = $_;
next;
}
if(/\/\*/) {
if (not /\*\//) { # multiline comment...
$line = $_; # ... just accumulate
next;
} else {
s/\/\*.*?\*\///gs; # wipe it
}
}
if ($cpp) {
$cpp++ if /^#\s*if/;
$cpp-- if /^#\s*endif/;
next;
}
$cpp = 1 if /^#.*ifdef.*cplusplus/; # skip "C" declaration
next if (/^\#/); # skip preprocessor directives
s/{[^{}]*}//gs; # ignore {} blocks
if (/\{|\/\*/) { # Add a } so editor works...
$line = $_;
} else {
$def .= $_;
}
}
}
print STDERR " \r" if $debug;
$defnr = 0;
# Delete any DECLARE_ macros
$def =~ s/DECLARE_\w+\([\w,\s]+\)//gs;
foreach (split /;/, $def) {
$defnr++;
print STDERR "def: $defnr\r" if $debug;
# The goal is to collect function names from function declarations.
s/^[\n\s]*//g;
s/[\n\s]*$//g;
# Skip over recognized non-function declarations
next if(/typedef\W/ or /DECLARE_STACK_OF/ or /TYPEDEF_.*_OF/);
# Remove STACK_OF(foo)
s/STACK_OF\(\w+\)/void/;
# Reduce argument lists to empty ()
# fold round brackets recursively: (t(*v)(t),t) -> (t{}{},t) -> {}
while(/\(.*\)/s) {
s/\([^\(\)]+\)/\{\}/gs;
s/\(\s*\*\s*(\w+)\s*\{\}\s*\)/$1/gs; #(*f{}) -> f
}
# pretend as we didn't use curly braces: {} -> ()
s/\{\}/\(\)/gs;
if (/(\w+)\s*\(\).*/s) { # first token prior [first] () is
my $name = $1; # a function name!
$name =~ tr/[a-z]/[A-Z]/;
$ftrans{$name} = $1;
} elsif (/[\(\)]/ and not (/=/)) {
print STDERR "Header $hdr: cannot parse: $_;\n";
}
}
print STDERR " \r" if $debug;
next if $reindex;
# Scan function and reason codes and store them: keep a note of the
# maximum code used.
if ($gotfile) {
while(<IN>) {
if(/^\#define\s+(\S+)\s+(\S+)/) {
$name = $1;
$code = $2;
next if $name =~ /^${lib}err/;
unless($name =~ /^${lib}_([RF])_(\w+)$/) {
print STDERR "Invalid error code $name\n";
next;
}
if($1 eq "R") {
$rcodes{$name} = $code;
if ($rassigned{$lib} =~ /:$code:/) {
print STDERR "!! ERROR: $lib reason code $code assigned twice (collision at $name)\n";
++$errcount;
}
$rassigned{$lib} .= "$code:";
if(!(exists $rextra{$name}) &&
($code > $rmax{$lib}) ) {
$rmax{$lib} = $code;
}
} else {
if ($fassigned{$lib} =~ /:$code:/) {
print STDERR "!! ERROR: $lib function code $code assigned twice (collision at $name)\n";
++$errcount;
}
$fassigned{$lib} .= "$code:";
if($code > $fmax{$lib}) {
$fmax{$lib} = $code;
}
$fcodes{$name} = $code;
}
}
}
}
if ($debug) {
if (defined($fmax{$lib})) {
print STDERR "Max function code fmax" . "{" . "$lib" . "} = $fmax{$lib}\n";
$fassigned{$lib} =~ m/^:(.*):$/;
@fassigned = sort {$a <=> $b} split(":", $1);
print STDERR " @fassigned\n";
}
if (defined($rmax{$lib})) {
print STDERR "Max reason code rmax" . "{" . "$lib" . "} = $rmax{$lib}\n";
$rassigned{$lib} =~ m/^:(.*):$/;
@rassigned = sort {$a <=> $b} split(":", $1);
print STDERR " @rassigned\n";
}
}
if ($lib eq "SSL") {
if ($rmax{$lib} >= 1000) {
print STDERR "!! ERROR: SSL error codes 1000+ are reserved for alerts.\n";
print STDERR "!! Any new alerts must be added to $config.\n";
++$errcount;
print STDERR "\n";
}
}
close IN;
}
# Scan each C source file and look for function and reason codes
# This is done by looking for strings that "look like" function or
# reason codes: basically anything consisting of all upper case and
# numerics which has _F_ or _R_ in it and which has the name of an
# error library at the start. This seems to work fine except for the
# oddly named structure BIO_F_CTX which needs to be ignored.
# If a code doesn't exist in list compiled from headers then mark it
# with the value "X" as a place holder to give it a value later.
# Store all function and reason codes found in %ufcodes and %urcodes
# so all those unreferenced can be printed out.
foreach $file (@source) {
# Don't parse the error source file.
next if exists $cskip{$file};
print STDERR "File loaded: ".$file."\r" if $debug;
open(IN, "<$file") || die "Can't open source file $file\n";
while(<IN>) {
# skip obsoleted source files entirely!
last if(/^#error\s+obsolete/);
if(/(([A-Z0-9]+)_F_([A-Z0-9_]+))/) {
next unless exists $csrc{$2};
next if($1 eq "BIO_F_BUFFER_CTX");
$ufcodes{$1} = 1;
if(!exists $fcodes{$1}) {
$fcodes{$1} = "X";
$fnew{$2}++;
}
$notrans{$1} = 1 unless exists $ftrans{$3};
print STDERR "Function: $1\t= $fcodes{$1} (lib: $2, name: $3)\n" if $debug;
}
if(/(([A-Z0-9]+)_R_[A-Z0-9_]+)/) {
next unless exists $csrc{$2};
$urcodes{$1} = 1;
if(!exists $rcodes{$1}) {
$rcodes{$1} = "X";
$rnew{$2}++;
}
print STDERR "Reason: $1\t= $rcodes{$1} (lib: $2)\n" if $debug;
}
}
close IN;
}
print STDERR " \n" if $debug;
# Now process each library in turn.
foreach $lib (keys %csrc)
{
my $hfile = $hinc{$lib};
my $cfile = $csrc{$lib};
if(!$fnew{$lib} && !$rnew{$lib}) {
print STDERR "$lib:\t\tNo new error codes\n";
next unless $rebuild;
} else {
print STDERR "$lib:\t\t$fnew{$lib} New Functions,";
print STDERR " $rnew{$lib} New Reasons.\n";
next unless $dowrite;
}
# If we get here then we have some new error codes so we
# need to rebuild the header file and C file.
# Make a sorted list of error and reason codes for later use.
my @function = sort grep(/^${lib}_/,keys %fcodes);
my @reasons = sort grep(/^${lib}_/,keys %rcodes);
# Rewrite the header file
if (open(IN, "<$hfile")) {
# Copy across the old file
while(<IN>) {
push @out, $_;
last if (/BEGIN ERROR CODES/);
}
close IN;
} else {
push @out,
"/* ====================================================================\n",
" * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved.\n",
" *\n",
" * Redistribution and use in source and binary forms, with or without\n",
" * modification, are permitted provided that the following conditions\n",
" * are met:\n",
" *\n",
" * 1. Redistributions of source code must retain the above copyright\n",
" * notice, this list of conditions and the following disclaimer. \n",
" *\n",
" * 2. Redistributions in binary form must reproduce the above copyright\n",
" * notice, this list of conditions and the following disclaimer in\n",
" * the documentation and/or other materials provided with the\n",
" * distribution.\n",
" *\n",
" * 3. All advertising materials mentioning features or use of this\n",
" * software must display the following acknowledgment:\n",
" * \"This product includes software developed by the OpenSSL Project\n",
" * for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n",
" *\n",
" * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n",
" * endorse or promote products derived from this software without\n",
" * prior written permission. For written permission, please contact\n",
" * openssl-core\@openssl.org.\n",
" *\n",
" * 5. Products derived from this software may not be called \"OpenSSL\"\n",
" * nor may \"OpenSSL\" appear in their names without prior written\n",
" * permission of the OpenSSL Project.\n",
" *\n",
" * 6. Redistributions of any form whatsoever must retain the following\n",
" * acknowledgment:\n",
" * \"This product includes software developed by the OpenSSL Project\n",
" * for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n",
" *\n",
" * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n",
" * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n",
" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n",
" * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n",
" * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n",
" * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n",
" * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n",
" * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n",
" * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n",
" * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n",
" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n",
" * OF THE POSSIBILITY OF SUCH DAMAGE.\n",
" * ====================================================================\n",
" *\n",
" * This product includes cryptographic software written by Eric Young\n",
" * (eay\@cryptsoft.com). This product includes software written by Tim\n",
" * Hudson (tjh\@cryptsoft.com).\n",
" *\n",
" */\n",
"\n",
"#ifndef HEADER_${lib}_ERR_H\n",
"#define HEADER_${lib}_ERR_H\n",
"\n",
"#ifdef __cplusplus\n",
"extern \"C\" {\n",
"#endif\n",
"\n",
"/* BEGIN ERROR CODES */\n";
}
open (OUT, ">$hfile") || die "Can't Open File $hfile for writing\n";
print OUT @out;
undef @out;
print OUT <<"EOF";
/* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
EOF
if($static) {
print OUT <<"EOF";
${staticloader}void ERR_load_${lib}_strings(void);
EOF
} else {
print OUT <<"EOF";
${staticloader}void ERR_load_${lib}_strings(void);
${staticloader}void ERR_unload_${lib}_strings(void);
${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line);
#define ${lib}err(f,r) ERR_${lib}_error((f),(r),__FILE__,__LINE__)
EOF
}
print OUT <<"EOF";
/* Error codes for the $lib functions. */
/* Function codes. */
EOF
foreach $i (@function) {
$z=6-int(length($i)/8);
if($fcodes{$i} eq "X") {
$fassigned{$lib} =~ m/^:([^:]*):/;
$findcode = $1;
if (!defined($findcode)) {
$findcode = $fmax{$lib};
}
while ($fassigned{$lib} =~ m/:$findcode:/) {
$findcode++;
}
$fcodes{$i} = $findcode;
$fassigned{$lib} .= "$findcode:";
print STDERR "New Function code $i\n" if $debug;
}
printf OUT "#define $i%s $fcodes{$i}\n","\t" x $z;
}
print OUT "\n/* Reason codes. */\n";
foreach $i (@reasons) {
$z=6-int(length($i)/8);
if($rcodes{$i} eq "X") {
$rassigned{$lib} =~ m/^:([^:]*):/;
$findcode = $1;
if (!defined($findcode)) {
$findcode = $rmax{$lib};
}
while ($rassigned{$lib} =~ m/:$findcode:/) {
$findcode++;
}
$rcodes{$i} = $findcode;
$rassigned{$lib} .= "$findcode:";
print STDERR "New Reason code $i\n" if $debug;
}
printf OUT "#define $i%s $rcodes{$i}\n","\t" x $z;
}
print OUT <<"EOF";
#ifdef __cplusplus
}
#endif
#endif
EOF
close OUT;
# Rewrite the C source file containing the error details.
# First, read any existing reason string definitions:
my %err_reason_strings;
if (open(IN,"<$cfile")) {
while (<IN>) {
if (/\b(${lib}_R_\w*)\b.*\"(.*)\"/) {
$err_reason_strings{$1} = $2;
}
if (/\b${lib}_F_(\w*)\b.*\"(.*)\"/) {
if (!exists $ftrans{$1} && ($1 ne $2)) {
print STDERR "WARNING: Mismatched function string $2\n";
$ftrans{$1} = $2;
}
}
}
close(IN);
}
my $hincf;
if($static) {
$hfile =~ /([^\/]+)$/;
$hincf = "<${hprefix}$1>";
} else {
$hincf = "\"$hfile\"";
}
# If static we know the error code at compile time so use it
# in error definitions.
if ($static)
{
$pack_errcode = "ERR_LIB_${lib}";
$load_errcode = "0";
}
else
{
$pack_errcode = "0";
$load_errcode = "ERR_LIB_${lib}";
}
open (OUT,">$cfile") || die "Can't open $cfile for writing";
print OUT <<"EOF";
/* $cfile */
/* ====================================================================
* Copyright (c) 1999-2010 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core\@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay\@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh\@cryptsoft.com).
*
*/
/* NOTE: this file was auto generated by the mkerr.pl script: any changes
* made to it will be overwritten when the script next updates this file,
* only reason strings will be preserved.
*/
#include <stdio.h>
#include <openssl/err.h>
#include $hincf
/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK($pack_errcode,func,0)
#define ERR_REASON(reason) ERR_PACK($pack_errcode,0,reason)
static ERR_STRING_DATA ${lib}_str_functs[]=
{
EOF
# Add each function code: if a function name is found then use it.
foreach $i (@function) {
my $fn;
$i =~ /^${lib}_F_(\S+)$/;
$fn = $1;
if(exists $ftrans{$fn}) {
$fn = $ftrans{$fn};
}
# print OUT "{ERR_PACK($pack_errcode,$i,0),\t\"$fn\"},\n";
print OUT "{ERR_FUNC($i),\t\"$fn\"},\n";
}
print OUT <<"EOF";
{0,NULL}
};
static ERR_STRING_DATA ${lib}_str_reasons[]=
{
EOF
# Add each reason code.
foreach $i (@reasons) {
my $rn;
my $rstr = "ERR_REASON($i)";
my $nspc = 0;
if (exists $err_reason_strings{$i}) {
$rn = $err_reason_strings{$i};
} else {
$i =~ /^${lib}_R_(\S+)$/;
$rn = $1;
$rn =~ tr/_[A-Z]/ [a-z]/;
}
$nspc = 40 - length($rstr) unless length($rstr) > 40;
$nspc = " " x $nspc;
print OUT "{${rstr}${nspc},\"$rn\"},\n";
}
if($static) {
print OUT <<"EOF";
{0,NULL}
};
#endif
${staticloader}void ERR_load_${lib}_strings(void)
{
#ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(${lib}_str_functs[0].error) == NULL)
{
ERR_load_strings($load_errcode,${lib}_str_functs);
ERR_load_strings($load_errcode,${lib}_str_reasons);
}
#endif
}
EOF
} else {
print OUT <<"EOF";
{0,NULL}
};
#endif
#ifdef ${lib}_LIB_NAME
static ERR_STRING_DATA ${lib}_lib_name[]=
{
{0 ,${lib}_LIB_NAME},
{0,NULL}
};
#endif
static int ${lib}_lib_error_code=0;
static int ${lib}_error_init=1;
${staticloader}void ERR_load_${lib}_strings(void)
{
if (${lib}_lib_error_code == 0)
${lib}_lib_error_code=ERR_get_next_error_library();
if (${lib}_error_init)
{
${lib}_error_init=0;
#ifndef OPENSSL_NO_ERR
ERR_load_strings(${lib}_lib_error_code,${lib}_str_functs);
ERR_load_strings(${lib}_lib_error_code,${lib}_str_reasons);
#endif
#ifdef ${lib}_LIB_NAME
${lib}_lib_name->error = ERR_PACK(${lib}_lib_error_code,0,0);
ERR_load_strings(0,${lib}_lib_name);
#endif
}
}
${staticloader}void ERR_unload_${lib}_strings(void)
{
if (${lib}_error_init == 0)
{
#ifndef OPENSSL_NO_ERR
ERR_unload_strings(${lib}_lib_error_code,${lib}_str_functs);
ERR_unload_strings(${lib}_lib_error_code,${lib}_str_reasons);
#endif
#ifdef ${lib}_LIB_NAME
ERR_unload_strings(0,${lib}_lib_name);
#endif
${lib}_error_init=1;
}
}
${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line)
{
if (${lib}_lib_error_code == 0)
${lib}_lib_error_code=ERR_get_next_error_library();
ERR_PUT_error(${lib}_lib_error_code,function,reason,file,line);
}
EOF
}
close OUT;
undef %err_reason_strings;
}
if($debug && defined(%notrans)) {
print STDERR "The following function codes were not translated:\n";
foreach(sort keys %notrans)
{
print STDERR "$_\n";
}
}
# Make a list of unreferenced function and reason codes
foreach (keys %fcodes) {
push (@funref, $_) unless exists $ufcodes{$_};
}
foreach (keys %rcodes) {
push (@runref, $_) unless exists $urcodes{$_};
}
if($debug && defined(@funref) ) {
print STDERR "The following function codes were not referenced:\n";
foreach(sort @funref)
{
print STDERR "$_\n";
}
}
if($debug && defined(@runref) ) {
print STDERR "The following reason codes were not referenced:\n";
foreach(sort @runref)
{
print STDERR "$_\n";
}
}
if($errcount) {
print STDERR "There were errors, failing...\n\n";
exit $errcount;
}

141
util/mkfiles.pl Executable file
View File

@@ -0,0 +1,141 @@
#!/usr/local/bin/perl
#
# This is a hacked version of files.pl for systems that can't do a 'make files'.
# Do a perl util/mkminfo.pl >MINFO to build MINFO
# Written by Steve Henson 1999.
# List of directories to process
my @dirs = (
".",
"crypto",
"crypto/md2",
"crypto/md4",
"crypto/md5",
"crypto/sha",
"crypto/mdc2",
"crypto/hmac",
"crypto/ripemd",
"crypto/des",
"crypto/rc2",
"crypto/rc4",
"crypto/rc5",
"crypto/idea",
"crypto/bf",
"crypto/cast",
"crypto/aes",
"crypto/camellia",
"crypto/seed",
"crypto/modes",
"crypto/bn",
"crypto/rsa",
"crypto/dsa",
"crypto/dso",
"crypto/dh",
"crypto/ec",
"crypto/ecdh",
"crypto/ecdsa",
"crypto/buffer",
"crypto/bio",
"crypto/stack",
"crypto/lhash",
"crypto/rand",
"crypto/err",
"crypto/objects",
"crypto/evp",
"crypto/asn1",
"crypto/pem",
"crypto/x509",
"crypto/x509v3",
"crypto/cms",
"crypto/conf",
"crypto/jpake",
"crypto/txt_db",
"crypto/pkcs7",
"crypto/pkcs12",
"crypto/comp",
"crypto/engine",
"crypto/ocsp",
"crypto/ui",
"crypto/krb5",
#"crypto/store",
"crypto/pqueue",
"crypto/whrlpool",
"crypto/ts",
"ssl",
"apps",
"engines",
"engines/ccgost",
"test",
"tools"
);
%top;
foreach (@dirs) {
&files_dir ($_, "Makefile");
}
exit(0);
sub files_dir
{
my ($dir, $makefile) = @_;
my %sym;
open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile";
my $s="";
while (<IN>)
{
chop;
s/#.*//;
if (/^(\S+)\s*=\s*(.*)$/)
{
$o="";
($s,$b)=($1,$2);
for (;;)
{
if ($b =~ /\\$/)
{
chop($b);
$o.=$b." ";
$b=<IN>;
chop($b);
}
else
{
$o.=$b." ";
last;
}
}
$o =~ s/^\s+//;
$o =~ s/\s+$//;
$o =~ s/\s+/ /g;
$o =~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge;
$sym{$s}=($top{$s} or $o);
}
}
print "RELATIVE_DIRECTORY=$dir\n";
foreach (sort keys %sym)
{
print "$_=$sym{$_}\n";
}
if ($dir eq "." && defined($sym{"BUILDENV"}))
{
foreach (split(' ',$sym{"BUILDENV"}))
{
/^(.+)=/;
$top{$1}=$sym{$1};
}
}
print "RELATIVE_DIRECTORY=\n";
close (IN);
}

73
util/mklink.pl Executable file
View File

@@ -0,0 +1,73 @@
#!/usr/local/bin/perl
# mklink.pl
# The first command line argument is a non-empty relative path
# specifying the "from" directory.
# Each other argument is a file name not containing / and
# names a file in the current directory.
#
# For each of these files, we create in the "from" directory a link
# of the same name pointing to the local file.
#
# We assume that the directory structure is a tree, i.e. that it does
# not contain symbolic links and that the parent of / is never referenced.
# Apart from this, this script should be able to handle even the most
# pathological cases.
use Cwd;
my $from = shift;
my @files = @ARGV;
my @from_path = split(/[\\\/]/, $from);
my $pwd = getcwd();
chomp($pwd);
my @pwd_path = split(/[\\\/]/, $pwd);
my @to_path = ();
my $dirname;
foreach $dirname (@from_path) {
# In this loop, @to_path always is a relative path from
# @pwd_path (interpreted is an absolute path) to the original pwd.
# At the end, @from_path (as a relative path from the original pwd)
# designates the same directory as the absolute path @pwd_path,
# which means that @to_path then is a path from there to the original pwd.
next if ($dirname eq "" || $dirname eq ".");
if ($dirname eq "..") {
@to_path = (pop(@pwd_path), @to_path);
} else {
@to_path = ("..", @to_path);
push(@pwd_path, $dirname);
}
}
my $to = join('/', @to_path);
my $file;
$symlink_exists=eval {symlink("",""); 1};
if ($^O eq "msys") { $symlink_exists=0 };
foreach $file (@files) {
my $err = "";
if ($symlink_exists) {
unlink "$from/$file";
symlink("$to/$file", "$from/$file") or $err = " [$!]";
} else {
unlink "$from/$file";
open (OLD, "<$file") or die "Can't open $file: $!";
open (NEW, ">$from/$file") or die "Can't open $from/$file: $!";
binmode(OLD);
binmode(NEW);
while (<OLD>) {
print NEW $_;
}
close (OLD) or die "Can't close $file: $!";
close (NEW) or die "Can't close $from/$file: $!";
}
print $file . " => $from/$file$err\n";
}

71
util/mkrc.pl Executable file
View File

@@ -0,0 +1,71 @@
#!/bin/env perl
#
open FD,"crypto/opensslv.h";
while(<FD>) {
if (/OPENSSL_VERSION_NUMBER\s+(0x[0-9a-f]+)/i) {
$ver = hex($1);
$v1 = ($ver>>28);
$v2 = ($ver>>20)&0xff;
$v3 = ($ver>>12)&0xff;
$v4 = ($ver>> 4)&0xff;
$beta = $ver&0xf;
$version = "$v1.$v2.$v3";
if ($beta==0xf) { $version .= chr(ord('a')+$v4-1) if ($v4); }
elsif ($beta==0){ $version .= "-dev"; }
else { $version .= "-beta$beta"; }
last;
}
}
close(FD);
$filename = $ARGV[0]; $filename =~ /(.*)\.([^.]+)$/;
$basename = $1;
$extname = $2;
if ($extname =~ /dll/i) { $description = "OpenSSL shared library"; }
else { $description = "OpenSSL application"; }
print <<___;
#include <winver.h>
LANGUAGE 0x09,0x01
1 VERSIONINFO
FILEVERSION $v1,$v2,$v3,$v4
PRODUCTVERSION $v1,$v2,$v3,$v4
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x01L
#else
FILEFLAGS 0x00L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
// Required:
VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
VALUE "FileDescription", "$description\\0"
VALUE "FileVersion", "$version\\0"
VALUE "InternalName", "$basename\\0"
VALUE "OriginalFilename", "$filename\\0"
VALUE "ProductName", "The OpenSSL Toolkit\\0"
VALUE "ProductVersion", "$version\\0"
// Optional:
//VALUE "Comments", "\\0"
VALUE "LegalCopyright", "Copyright © 1998-2006 The OpenSSL Project. Copyright © 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
//VALUE "LegalTrademarks", "\\0"
//VALUE "PrivateBuild", "\\0"
//VALUE "SpecialBuild", "\\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 0x4b0
END
END
___

192
util/mkstack.pl Executable file
View File

@@ -0,0 +1,192 @@
#!/usr/local/bin/perl -w
# This is a utility that searches out "DECLARE_STACK_OF()"
# declarations in .h and .c files, and updates/creates/replaces
# the corresponding macro declarations in crypto/stack/safestack.h.
# As it's not generally possible to have macros that generate macros,
# we need to control this from the "outside", here in this script.
#
# Geoff Thorpe, June, 2000 (with massive Perl-hacking
# help from Steve Robb)
my $safestack = "crypto/stack/safestack";
my $do_write;
while (@ARGV) {
my $arg = $ARGV[0];
if($arg eq "-write") {
$do_write = 1;
}
shift @ARGV;
}
@source = (<crypto/*.[ch]>, <crypto/*/*.[ch]>, <ssl/*.[ch]>, <apps/*.[ch]>);
foreach $file (@source) {
next if -l $file;
# Open the .c/.h file for reading
open(IN, "< $file") || die "Can't open $file for reading: $!";
while(<IN>) {
if (/^DECLARE_STACK_OF\(([^)]+)\)/) {
push @stacklst, $1;
}
if (/^DECLARE_SPECIAL_STACK_OF\(([^,\s]+)\s*,\s*([^>\s]+)\)/) {
push @sstacklst, [$1, $2];
}
if (/^DECLARE_ASN1_SET_OF\(([^)]+)\)/) {
push @asn1setlst, $1;
}
if (/^DECLARE_PKCS12_STACK_OF\(([^)]+)\)/) {
push @p12stklst, $1;
}
if (/^DECLARE_LHASH_OF\(([^)]+)\)/) {
push @lhashlst, $1;
}
}
close(IN);
}
my $old_stackfile = "";
my $new_stackfile = "";
my $inside_block = 0;
my $type_thing;
open(IN, "< $safestack.h") || die "Can't open input file: $!";
while(<IN>) {
$old_stackfile .= $_;
if (m|^/\* This block of defines is updated by util/mkstack.pl, please do not touch! \*/|) {
$inside_block = 1;
}
if (m|^/\* End of util/mkstack.pl block, you may now edit :-\) \*/|) {
$inside_block = 0;
} elsif ($inside_block == 0) {
$new_stackfile .= $_;
}
next if($inside_block != 1);
$new_stackfile .= "/* This block of defines is updated by util/mkstack.pl, please do not touch! */";
foreach $type_thing (sort @stacklst) {
$new_stackfile .= <<EOF;
#define sk_${type_thing}_new(cmp) SKM_sk_new($type_thing, (cmp))
#define sk_${type_thing}_new_null() SKM_sk_new_null($type_thing)
#define sk_${type_thing}_free(st) SKM_sk_free($type_thing, (st))
#define sk_${type_thing}_num(st) SKM_sk_num($type_thing, (st))
#define sk_${type_thing}_value(st, i) SKM_sk_value($type_thing, (st), (i))
#define sk_${type_thing}_set(st, i, val) SKM_sk_set($type_thing, (st), (i), (val))
#define sk_${type_thing}_zero(st) SKM_sk_zero($type_thing, (st))
#define sk_${type_thing}_push(st, val) SKM_sk_push($type_thing, (st), (val))
#define sk_${type_thing}_unshift(st, val) SKM_sk_unshift($type_thing, (st), (val))
#define sk_${type_thing}_find(st, val) SKM_sk_find($type_thing, (st), (val))
#define sk_${type_thing}_find_ex(st, val) SKM_sk_find_ex($type_thing, (st), (val))
#define sk_${type_thing}_delete(st, i) SKM_sk_delete($type_thing, (st), (i))
#define sk_${type_thing}_delete_ptr(st, ptr) SKM_sk_delete_ptr($type_thing, (st), (ptr))
#define sk_${type_thing}_insert(st, val, i) SKM_sk_insert($type_thing, (st), (val), (i))
#define sk_${type_thing}_set_cmp_func(st, cmp) SKM_sk_set_cmp_func($type_thing, (st), (cmp))
#define sk_${type_thing}_dup(st) SKM_sk_dup($type_thing, st)
#define sk_${type_thing}_pop_free(st, free_func) SKM_sk_pop_free($type_thing, (st), (free_func))
#define sk_${type_thing}_shift(st) SKM_sk_shift($type_thing, (st))
#define sk_${type_thing}_pop(st) SKM_sk_pop($type_thing, (st))
#define sk_${type_thing}_sort(st) SKM_sk_sort($type_thing, (st))
#define sk_${type_thing}_is_sorted(st) SKM_sk_is_sorted($type_thing, (st))
EOF
}
foreach $type_thing (sort @sstacklst) {
my $t1 = $type_thing->[0];
my $t2 = $type_thing->[1];
$new_stackfile .= <<EOF;
#define sk_${t1}_new(cmp) ((STACK_OF($t1) *)sk_new(CHECKED_SK_CMP_FUNC($t2, cmp)))
#define sk_${t1}_new_null() ((STACK_OF($t1) *)sk_new_null())
#define sk_${t1}_push(st, val) sk_push(CHECKED_STACK_OF($t1, st), CHECKED_PTR_OF($t2, val))
#define sk_${t1}_find(st, val) sk_find(CHECKED_STACK_OF($t1, st), CHECKED_PTR_OF($t2, val))
#define sk_${t1}_value(st, i) (($t1)sk_value(CHECKED_STACK_OF($t1, st), i))
#define sk_${t1}_num(st) SKM_sk_num($t1, st)
#define sk_${t1}_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF($t1, st), CHECKED_SK_FREE_FUNC2($t1, free_func))
#define sk_${t1}_insert(st, val, i) sk_insert(CHECKED_STACK_OF($t1, st), CHECKED_PTR_OF($t2, val), i)
#define sk_${t1}_free(st) SKM_sk_free(${t1}, st)
#define sk_${t1}_set(st, i, val) sk_set(CHECKED_STACK_OF($t1, st), i, CHECKED_PTR_OF($t2, val))
#define sk_${t1}_zero(st) SKM_sk_zero($t1, (st))
#define sk_${t1}_unshift(st, val) sk_unshift(CHECKED_STACK_OF($t1, st), CHECKED_PTR_OF($t2, val))
#define sk_${t1}_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF($t1), st), CHECKED_CONST_PTR_OF($t2, val))
#define sk_${t1}_delete(st, i) SKM_sk_delete($t1, (st), (i))
#define sk_${t1}_delete_ptr(st, ptr) ($t1 *)sk_delete_ptr(CHECKED_STACK_OF($t1, st), CHECKED_PTR_OF($t2, ptr))
#define sk_${t1}_set_cmp_func(st, cmp) \\
((int (*)(const $t2 * const *,const $t2 * const *)) \\
sk_set_cmp_func(CHECKED_STACK_OF($t1, st), CHECKED_SK_CMP_FUNC($t2, cmp)))
#define sk_${t1}_dup(st) SKM_sk_dup($t1, st)
#define sk_${t1}_shift(st) SKM_sk_shift($t1, (st))
#define sk_${t1}_pop(st) ($t2 *)sk_pop(CHECKED_STACK_OF($t1, st))
#define sk_${t1}_sort(st) SKM_sk_sort($t1, (st))
#define sk_${t1}_is_sorted(st) SKM_sk_is_sorted($t1, (st))
EOF
}
foreach $type_thing (sort @asn1setlst) {
$new_stackfile .= <<EOF;
#define d2i_ASN1_SET_OF_${type_thing}(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\
SKM_ASN1_SET_OF_d2i($type_thing, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
#define i2d_ASN1_SET_OF_${type_thing}(st, pp, i2d_func, ex_tag, ex_class, is_set) \\
SKM_ASN1_SET_OF_i2d($type_thing, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
#define ASN1_seq_pack_${type_thing}(st, i2d_func, buf, len) \\
SKM_ASN1_seq_pack($type_thing, (st), (i2d_func), (buf), (len))
#define ASN1_seq_unpack_${type_thing}(buf, len, d2i_func, free_func) \\
SKM_ASN1_seq_unpack($type_thing, (buf), (len), (d2i_func), (free_func))
EOF
}
foreach $type_thing (sort @p12stklst) {
$new_stackfile .= <<EOF;
#define PKCS12_decrypt_d2i_${type_thing}(algor, d2i_func, free_func, pass, passlen, oct, seq) \\
SKM_PKCS12_decrypt_d2i($type_thing, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq))
EOF
}
foreach $type_thing (sort @lhashlst) {
my $lc_tt = lc $type_thing;
$new_stackfile .= <<EOF;
#define lh_${type_thing}_new() LHM_lh_new(${type_thing},${lc_tt})
#define lh_${type_thing}_insert(lh,inst) LHM_lh_insert(${type_thing},lh,inst)
#define lh_${type_thing}_retrieve(lh,inst) LHM_lh_retrieve(${type_thing},lh,inst)
#define lh_${type_thing}_delete(lh,inst) LHM_lh_delete(${type_thing},lh,inst)
#define lh_${type_thing}_doall(lh,fn) LHM_lh_doall(${type_thing},lh,fn)
#define lh_${type_thing}_doall_arg(lh,fn,arg_type,arg) \\
LHM_lh_doall_arg(${type_thing},lh,fn,arg_type,arg)
#define lh_${type_thing}_error(lh) LHM_lh_error(${type_thing},lh)
#define lh_${type_thing}_num_items(lh) LHM_lh_num_items(${type_thing},lh)
#define lh_${type_thing}_down_load(lh) LHM_lh_down_load(${type_thing},lh)
#define lh_${type_thing}_node_stats_bio(lh,out) \\
LHM_lh_node_stats_bio(${type_thing},lh,out)
#define lh_${type_thing}_node_usage_stats_bio(lh,out) \\
LHM_lh_node_usage_stats_bio(${type_thing},lh,out)
#define lh_${type_thing}_stats_bio(lh,out) \\
LHM_lh_stats_bio(${type_thing},lh,out)
#define lh_${type_thing}_free(lh) LHM_lh_free(${type_thing},lh)
EOF
}
$new_stackfile .= "/* End of util/mkstack.pl block, you may now edit :-) */\n";
$inside_block = 2;
}
if ($new_stackfile eq $old_stackfile) {
print "No changes to $safestack.h.\n";
exit 0; # avoid unnecessary rebuild
}
if ($do_write) {
print "Writing new $safestack.h.\n";
open OUT, ">$safestack.h" || die "Can't open output file";
print OUT $new_stackfile;
close OUT;
}

26
util/opensslwrap.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
HERE="`echo $0 | sed -e 's|[^/]*$||'`"
OPENSSL="${HERE}../apps/openssl"
if [ -d "${HERE}../engines" -a "x$OPENSSL_ENGINES" = "x" ]; then
OPENSSL_ENGINES="${HERE}../engines"; export OPENSSL_ENGINES
fi
if [ -x "${OPENSSL}.exe" ]; then
# The original reason for this script existence is to work around
# certain caveats in run-time linker behaviour. On Windows platforms
# adjusting $PATH used to be sufficient, but with introduction of
# SafeDllSearchMode in XP/2003 the only way to get it right in
# *all* possible situations is to copy newly built .DLLs to apps/
# and test/, which is now done elsewhere... The $PATH is adjusted
# for backward compatibility (and nostagical reasons:-).
if [ "$OSTYPE" != msdosdjgpp ]; then
PATH="${HERE}..:$PATH"; export PATH
fi
exec "${OPENSSL}.exe" "$@"
elif [ -x "${OPENSSL}" -a -x "${HERE}shlib_wrap.sh" ]; then
exec "${HERE}shlib_wrap.sh" "${OPENSSL}" "$@"
else
exec "${OPENSSL}" "$@" # hope for the best...
fi

35
util/perlpath.pl Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/local/bin/perl
#
# modify the '#!/usr/local/bin/perl'
# line in all scripts that rely on perl.
#
require "find.pl";
$#ARGV == 0 || print STDERR "usage: perlpath newpath (eg /usr/bin)\n";
&find(".");
sub wanted
{
return unless /\.pl$/ || /^[Cc]onfigur/;
open(IN,"<$_") || die "unable to open $dir/$_:$!\n";
@a=<IN>;
close(IN);
if (-d $ARGV[0]) {
$a[0]="#!$ARGV[0]/perl\n";
}
else {
$a[0]="#!$ARGV[0]\n";
}
# Playing it safe...
$new="$_.new";
open(OUT,">$new") || die "unable to open $dir/$new:$!\n";
print OUT @a;
close(OUT);
rename($new,$_) || die "unable to rename $dir/$new:$!\n";
chmod(0755,$_) || die "unable to chmod $dir/$new:$!\n";
}

139
util/pl/BC-32.pl Normal file
View File

@@ -0,0 +1,139 @@
#!/usr/local/bin/perl
# Borland C++ builder 3 and 4 -- Janez Jere <jj@void.si>
#
$ssl= "ssleay32";
$crypto="libeay32";
$o='\\';
$cp='copy';
$rm='del';
# C compiler stuff
$cc='bcc32';
$lflags="-ap -Tpe -x -Gn ";
$mlflags='';
$out_def="out32";
$tmp_def="tmp32";
$inc_def="inc32";
#enable max error messages, disable most common warnings
$cflags="-DWIN32_LEAN_AND_MEAN -q -w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp -D_strnicmp=strnicmp ";
if ($debug)
{
$cflags.="-Od -y -v -vi- -D_DEBUG";
$mlflags.=' ';
}
else
{
$cflags.="-O2 -ff -fp";
}
$obj='.obj';
$ofile="-o";
# EXE linking stuff
$link="ilink32";
$efile="";
$exep='.exe';
if ($no_sock)
{ $ex_libs=""; }
else { $ex_libs="cw32mt.lib import32.lib"; }
# static library stuff
$mklib='tlib /P64';
$ranlib='';
$plib="";
$libp=".lib";
$shlibp=($shlib)?".dll":".lib";
$lfile='';
$shlib_ex_obj="";
$app_ex_obj="c0x32.obj";
$asm='nasmw -f obj -d__omf__';
$asm.=" /Zi" if $debug;
$afile='-o';
$bn_mulw_obj='';
$bn_mulw_src='';
$des_enc_obj='';
$des_enc_src='';
$bf_enc_obj='';
$bf_enc_src='';
if (!$no_asm)
{
$bn_mulw_obj='crypto\bn\asm\bn_win32.obj';
$bn_mulw_src='crypto\bn\asm\bn_win32.asm';
$des_enc_obj='crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj';
$des_enc_src='crypto\des\asm\d_win32.asm crypto\des\asm\y_win32.asm';
$bf_enc_obj='crypto\bf\asm\b_win32.obj';
$bf_enc_src='crypto\bf\asm\b_win32.asm';
$cast_enc_obj='crypto\cast\asm\c_win32.obj';
$cast_enc_src='crypto\cast\asm\c_win32.asm';
$rc4_enc_obj='crypto\rc4\asm\r4_win32.obj';
$rc4_enc_src='crypto\rc4\asm\r4_win32.asm';
$rc5_enc_obj='crypto\rc5\asm\r5_win32.obj';
$rc5_enc_src='crypto\rc5\asm\r5_win32.asm';
$md5_asm_obj='crypto\md5\asm\m5_win32.obj';
$md5_asm_src='crypto\md5\asm\m5_win32.asm';
$sha1_asm_obj='crypto\sha\asm\s1_win32.obj';
$sha1_asm_src='crypto\sha\asm\s1_win32.asm';
$rmd160_asm_obj='crypto\ripemd\asm\rm_win32.obj';
$rmd160_asm_src='crypto\ripemd\asm\rm_win32.asm';
$cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
}
if ($shlib)
{
$mlflags.=" $lflags /dll";
# $cflags =~ s| /MD| /MT|;
$lib_cflag=" /GD -D_WINDLL -D_DLL";
$out_def="out32dll";
$tmp_def="tmp32dll";
}
sub do_lib_rule
{
local($objs,$target,$name,$shlib)=@_;
local($ret,$Name);
$taget =~ s/\//$o/g if $o ne '/';
($Name=$name) =~ tr/a-z/A-Z/;
# $target="\$(LIB_D)$o$target";
$ret.="$target: $objs\n";
if (!$shlib)
{
$ret.=<<___;
-\$(RM) $lfile$target
\$(MKLIB) $lfile$target \@&&!
+\$(**: = &^
+)
!
___
}
else
{
local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
$ex.=' ws2_32.lib gdi32.lib';
$ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
}
$ret.="\n";
return($ret);
}
sub do_link_rule
{
local($target,$files,$dep_libs,$libs)=@_;
local($ret,$_);
$file =~ s/\//$o/g if $o ne '/';
$n=&bname($targer);
$ret.="$target: $files $dep_libs\n";
$ret.="\t\$(LINK) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n\n";
return($ret);
}
1;

104
util/pl/Mingw32.pl Normal file
View File

@@ -0,0 +1,104 @@
#!/usr/local/bin/perl
#
# Mingw32.pl -- Mingw
#
$o='/';
$cp='cp';
$rm='rm -f';
$mkdir='gmkdir';
$o='\\';
$cp='copy';
$rm='del';
$mkdir='mkdir';
# C compiler stuff
$cc='gcc';
if ($debug)
{ $cflags="-DL_ENDIAN -DDSO_WIN32 -g2 -ggdb"; }
else
{ $cflags="-DL_ENDIAN -DDSO_WIN32 -fomit-frame-pointer -O3 -mcpu=i486 -Wall"; }
if ($gaswin and !$no_asm)
{
$bn_asm_obj='$(OBJ_D)\bn-win32.o';
$bn_asm_src='crypto/bn/asm/bn-win32.s';
$bnco_asm_obj='$(OBJ_D)\co-win32.o';
$bnco_asm_src='crypto/bn/asm/co-win32.s';
$des_enc_obj='$(OBJ_D)\d-win32.o $(OBJ_D)\y-win32.o';
$des_enc_src='crypto/des/asm/d-win32.s crypto/des/asm/y-win32.s';
$bf_enc_obj='$(OBJ_D)\b-win32.o';
$bf_enc_src='crypto/bf/asm/b-win32.s';
# $cast_enc_obj='$(OBJ_D)\c-win32.o';
# $cast_enc_src='crypto/cast/asm/c-win32.s';
$rc4_enc_obj='$(OBJ_D)\r4-win32.o';
$rc4_enc_src='crypto/rc4/asm/r4-win32.s';
$rc5_enc_obj='$(OBJ_D)\r5-win32.o';
$rc5_enc_src='crypto/rc5/asm/r5-win32.s';
$md5_asm_obj='$(OBJ_D)\m5-win32.o';
$md5_asm_src='crypto/md5/asm/m5-win32.s';
$rmd160_asm_obj='$(OBJ_D)\rm-win32.o';
$rmd160_asm_src='crypto/ripemd/asm/rm-win32.s';
$sha1_asm_obj='$(OBJ_D)\s1-win32.o';
$sha1_asm_src='crypto/sha/asm/s1-win32.s';
$cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS";
}
$obj='.o';
$ofile='-o ';
# EXE linking stuff
$link='${CC}';
$lflags='${CFLAGS}';
$efile='-o ';
$exep='';
$ex_libs="-lws2_32 -lgdi32";
# static library stuff
$mklib='ar r';
$mlflags='';
$ranlib='ranlib';
$plib='lib';
$libp=".a";
$shlibp=".a";
$lfile='';
$asm='as';
$afile='-o ';
#$bn_asm_obj="";
#$bn_asm_src="";
#$des_enc_obj="";
#$des_enc_src="";
#$bf_enc_obj="";
#$bf_enc_src="";
sub do_lib_rule
{
local($obj,$target,$name,$shlib)=@_;
local($ret,$_,$Name);
$target =~ s/\//$o/g if $o ne '/';
$target="$target";
($Name=$name) =~ tr/a-z/A-Z/;
$ret.="$target: \$(${Name}OBJ)\n";
$ret.="\tif exist $target \$(RM) $target\n";
$ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
$ret.="\t\$(RANLIB) $target\n\n";
}
sub do_link_rule
{
local($target,$files,$dep_libs,$libs)=@_;
local($ret,$_);
$file =~ s/\//$o/g if $o ne '/';
$n=&bname($target);
$ret.="$target: $files $dep_libs\n";
$ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n";
return($ret);
}
1;

120
util/pl/OS2-EMX.pl Normal file
View File

@@ -0,0 +1,120 @@
#!/usr/local/bin/perl
#
# OS2-EMX.pl - for EMX GCC on OS/2
#
$o='/';
$cp='cp';
$rm='rm -f';
$preamble = "SHELL=sh\n";
# C compiler stuff
$cc='gcc';
$cflags="-DL_ENDIAN -O3 -fomit-frame-pointer -m486 -Zmtd -Wall ";
$cflags.="-Zomf " if $shlib;
$shl_cflag="-Zdll";
if ($debug) {
$cflags.="-g ";
}
$obj=$shlib ? '.obj' : '.o';
$ofile='-o ';
# EXE linking stuff
$link='${CC}';
$lflags='${CFLAGS} -Zbsd-signals -s';
$efile='-o ';
$exep='.exe';
$ex_libs="-lsocket";
# static library stuff
$mklib='ar r';
$mlflags='';
$ranlib="ar s";
$plib='';
$libp=$shlib ? ".lib" : ".a";
$shlibp=$shlib ? ".dll" : ".a";
$lfile='';
$asm=$shlib ? 'as -Zomf' : 'as';
$afile='-o ';
$bn_asm_obj="";
$bn_asm_src="";
$des_enc_obj="";
$des_enc_src="";
$bf_enc_obj="";
$bf_enc_src="";
if (!$no_asm)
{
$bn_asm_obj="crypto/bn/asm/bn-os2$obj crypto/bn/asm/co-os2$obj";
$bn_asm_src="crypto/bn/asm/bn-os2.asm crypto/bn/asm/co-os2.asm";
$des_enc_obj="crypto/des/asm/d-os2$obj crypto/des/asm/y-os2$obj";
$des_enc_src="crypto/des/asm/d-os2.asm crypto/des/asm/y-os2.asm";
$bf_enc_obj="crypto/bf/asm/b-os2$obj";
$bf_enc_src="crypto/bf/asm/b-os2.asm";
$cast_enc_obj="crypto/cast/asm/c-os2$obj";
$cast_enc_src="crypto/cast/asm/c-os2.asm";
$rc4_enc_obj="crypto/rc4/asm/r4-os2$obj";
$rc4_enc_src="crypto/rc4/asm/r4-os2.asm";
$rc5_enc_obj="crypto/rc5/asm/r5-os2$obj";
$rc5_enc_src="crypto/rc5/asm/r5-os2.asm";
$md5_asm_obj="crypto/md5/asm/m5-os2$obj";
$md5_asm_src="crypto/md5/asm/m5-os2.asm";
$sha1_asm_obj="crypto/sha/asm/s1-os2$obj";
$sha1_asm_src="crypto/sha/asm/s1-os2.asm";
$rmd160_asm_obj="crypto/ripemd/asm/rm-os2$obj";
$rmd160_asm_src="crypto/ripemd/asm/rm-os2.asm";
$cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS";
}
if ($shlib)
{
$mlflags.=" $lflags -Zdll";
$lib_cflag=" -D_DLL";
$out_def="out_dll";
$tmp_def="tmp_dll";
}
sub do_lib_rule
{
local($obj,$target,$name,$shlib)=@_;
local($ret,$_,$Name);
$target =~ s/\//$o/g if $o ne '/';
$target="$target";
($Name=$name) =~ tr/a-z/A-Z/;
$ret.="$target: \$(${Name}OBJ)\n";
if (!$shlib)
{
$ret.="\t\$(RM) $target\n";
$ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
$ret.="\t\$(RANLIB) $target\n\n";
}
else
{
local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
$ex.=' -lsocket';
$ret.="\t\$(LINK) \$(SHLIB_CFLAGS) \$(MLFLAGS) $efile$target \$(SHLIB_EX_OBJ) \$(${Name}OBJ) $ex os2/${Name}.def\n";
$ret.="\temximp -o $out_def/$name.a os2/${Name}.def\n";
$ret.="\temximp -o $out_def/$name.lib os2/${Name}.def\n\n";
}
}
sub do_link_rule
{
local($target,$files,$dep_libs,$libs)=@_;
local($ret,$_);
$file =~ s/\//$o/g if $o ne '/';
$n=&bname($target);
$ret.="$target: $files $dep_libs\n";
$ret.="\t\$(LINK) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n\n";
return($ret);
}
1;

338
util/pl/VC-32.pl Normal file
View File

@@ -0,0 +1,338 @@
#!/usr/local/bin/perl
# VC-32.pl - unified script for Microsoft Visual C++, covering Win32,
# Win64 and WinCE [follow $FLAVOR variable to trace the differences].
#
$ssl= "ssleay32";
$crypto="libeay32";
$o='\\';
$cp='$(PERL) util/copy.pl';
$mkdir='$(PERL) util/mkdir-p.pl';
$rm='del /Q';
$zlib_lib="zlib1.lib";
# Santize -L options for ms link
$l_flags =~ s/-L("\[^"]+")/\/libpath:$1/g;
$l_flags =~ s/-L(\S+)/\/libpath:$1/g;
# C compiler stuff
$cc='cl';
if ($FLAVOR =~ /WIN64/)
{
# Note that we currently don't have /WX on Win64! There is a lot of
# warnings, but only of two types:
#
# C4344: conversion from '__int64' to 'int/long', possible loss of data
# C4267: conversion from 'size_t' to 'int/long', possible loss of data
#
# Amount of latter type is minimized by aliasing strlen to function of
# own desing and limiting its return value to 2GB-1 (see e_os.h). As
# per 0.9.8 release remaining warnings were explicitly examined and
# considered safe to ignore.
#
$base_cflags= " $mf_cflag";
my $f = $shlib?' /MD':' /MT';
$lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
$opt_cflags=$f.' /Ox';
$dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
$lflags="/nologo /subsystem:console /opt:ref";
*::perlasm_compile_target = sub {
my ($target,$source,$bname)=@_;
my $ret;
$bname =~ s/(.*)\.[^\.]$/$1/;
$ret=<<___;
\$(TMP_D)$o$bname.asm: $source
set ASM=\$(ASM)
\$(PERL) $source \$\@
$target: \$(TMP_D)$o$bname.asm
\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm
___
}
}
elsif ($FLAVOR =~ /CE/)
{
# sanity check
die '%OSVERSION% is not defined' if (!defined($ENV{'OSVERSION'}));
die '%PLATFORM% is not defined' if (!defined($ENV{'PLATFORM'}));
die '%TARGETCPU% is not defined' if (!defined($ENV{'TARGETCPU'}));
#
# Idea behind this is to mimic flags set by eVC++ IDE...
#
$wcevers = $ENV{'OSVERSION'}; # WCENNN
die '%OSVERSION% value is insane' if ($wcevers !~ /^WCE([1-9])([0-9]{2})$/);
$wcecdefs = "-D_WIN32_WCE=$1$2 -DUNDER_CE=$1$2"; # -D_WIN32_WCE=NNN
$wcelflag = "/subsystem:windowsce,$1.$2"; # ...,N.NN
$wceplatf = $ENV{'PLATFORM'};
$wceplatf =~ tr/a-z0-9 /A-Z0-9_/d;
$wcecdefs .= " -DWCE_PLATFORM_$wceplatf";
$wcetgt = $ENV{'TARGETCPU'}; # just shorter name...
SWITCH: for($wcetgt) {
/^X86/ && do { $wcecdefs.=" -Dx86 -D_X86_ -D_i386_ -Di_386_";
$wcelflag.=" /machine:IX86"; last; };
/^ARMV4[IT]/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt";
$wcecdefs.=" -DTHUMB -D_THUMB_" if($wcetgt=~/T$/);
$wcecdefs.=" -QRarch4T -QRinterwork-return";
$wcelflag.=" /machine:THUMB"; last; };
/^ARM/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt";
$wcelflag.=" /machine:ARM"; last; };
/^MIPSIV/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
$wcecdefs.=" -D_MIPS64 -QMmips4 -QMn32";
$wcelflag.=" /machine:MIPSFPU"; last; };
/^MIPS16/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
$wcecdefs.=" -DMIPSII -QMmips16";
$wcelflag.=" /machine:MIPS16"; last; };
/^MIPSII/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
$wcecdefs.=" -QMmips2";
$wcelflag.=" /machine:MIPS"; last; };
/^R4[0-9]{3}/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000";
$wcelflag.=" /machine:MIPS"; last; };
/^SH[0-9]/ && do { $wcecdefs.=" -D$wcetgt -D_$wcetgt_ -DSHx";
$wcecdefs.=" -Qsh4" if ($wcetgt =~ /^SH4/);
$wcelflag.=" /machine:$wcetgt"; last; };
{ $wcecdefs.=" -D$wcetgt -D_$wcetgt_";
$wcelflag.=" /machine:$wcetgt"; last; };
}
$cc='$(CC)';
$base_cflags=' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT';
$base_cflags.=" $wcecdefs";
$base_cflags.=' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT'}));
$base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'}));
$opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics...
$dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG';
$lflags="/nologo /opt:ref $wcelflag";
}
else # Win32
{
$base_cflags= " $mf_cflag";
my $f = $shlib?' /MD':' /MT';
$lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
$opt_cflags=$f.' /Ox /O2 /Ob2';
$dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
$lflags="/nologo /subsystem:console /opt:ref";
}
$mlflags='';
$out_def ="out32"; $out_def.="dll" if ($shlib);
$out_def.='_$(TARGETCPU)' if ($FLAVOR =~ /CE/);
$tmp_def ="tmp32"; $tmp_def.="dll" if ($shlib);
$tmp_def.='_$(TARGETCPU)' if ($FLAVOR =~ /CE/);
$inc_def="inc32";
if ($debug)
{
$cflags=$dbg_cflags.$base_cflags;
}
else
{
$cflags=$opt_cflags.$base_cflags;
}
# generate symbols.pdb unconditionally
$app_cflag.=" /Zi /Fd\$(TMP_D)/app";
$lib_cflag.=" /Zi /Fd\$(TMP_D)/lib";
$lflags.=" /debug";
$obj='.obj';
$asm_suffix='.asm';
$ofile="/Fo";
# EXE linking stuff
$link="link";
$rsc="rc";
$efile="/out:";
$exep='.exe';
if ($no_sock) { $ex_libs=''; }
elsif ($FLAVOR =~ /CE/) { $ex_libs='winsock.lib'; }
else { $ex_libs='ws2_32.lib'; }
if ($FLAVOR =~ /CE/)
{
$ex_libs.=' $(WCECOMPAT)/lib/wcecompatex.lib' if (defined($ENV{'WCECOMPAT'}));
$ex_libs.=' $(PORTSDK_LIBPATH)/portlib.lib' if (defined($ENV{'PORTSDK_LIBPATH'}));
$ex_libs.=' /nodefaultlib:oldnames.lib coredll.lib corelibc.lib' if ($ENV{'TARGETCPU'} eq "X86");
}
else
{
$ex_libs.=' gdi32.lib advapi32.lib crypt32.lib user32.lib';
$ex_libs.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/ and `cl 2>&1` =~ /14\.00\.4[0-9]{4}\./);
# WIN32 UNICODE build gets linked with unicows.lib for
# backward compatibility with Win9x.
$ex_libs="unicows.lib $ex_libs" if ($FLAVOR =~ /WIN32/ and $cflags =~ /\-DUNICODE/);
}
# static library stuff
$mklib='lib /nologo';
$ranlib='';
$plib="";
$libp=".lib";
$shlibp=($shlib)?".dll":".lib";
$lfile='/out:';
$shlib_ex_obj="";
$app_ex_obj="setargv.obj" if ($FLAVOR !~ /CE/);
if ($FLAVOR =~ /WIN64A/) {
if (`nasm -v 2>NUL` =~ /NASM version ([0-9]+\.[0-9]+)/ && $1 >= 2.0) {
$asm='nasm -f win64 -DNEAR -Ox -g';
$afile='-o ';
} else {
$asm='ml64 /c /Cp /Cx /Zi';
$afile='/Fo';
}
} elsif ($FLAVOR =~ /WIN64I/) {
$asm='ias -d debug';
$afile="-o ";
} elsif ($nasm) {
my $ver=`nasm -v 2>NUL`;
my $vew=`nasmw -v 2>NUL`;
# pick newest version
$asm=($ver ge $vew?"nasm":"nasmw")." -f win32";
$asmtype="win32n";
$afile='-o ';
} else {
$asm='ml /nologo /Cp /coff /c /Cx /Zi';
$afile='/Fo';
$asmtype="win32";
}
$bn_asm_obj='';
$bn_asm_src='';
$des_enc_obj='';
$des_enc_src='';
$bf_enc_obj='';
$bf_enc_src='';
if (!$no_asm)
{
win32_import_asm($mf_bn_asm, "bn", \$bn_asm_obj, \$bn_asm_src);
win32_import_asm($mf_aes_asm, "aes", \$aes_asm_obj, \$aes_asm_src);
win32_import_asm($mf_des_asm, "des", \$des_enc_obj, \$des_enc_src);
win32_import_asm($mf_bf_asm, "bf", \$bf_enc_obj, \$bf_enc_src);
win32_import_asm($mf_cast_asm, "cast", \$cast_enc_obj, \$cast_enc_src);
win32_import_asm($mf_rc4_asm, "rc4", \$rc4_enc_obj, \$rc4_enc_src);
win32_import_asm($mf_rc5_asm, "rc5", \$rc5_enc_obj, \$rc5_enc_src);
win32_import_asm($mf_md5_asm, "md5", \$md5_asm_obj, \$md5_asm_src);
win32_import_asm($mf_sha_asm, "sha", \$sha1_asm_obj, \$sha1_asm_src);
win32_import_asm($mf_rmd_asm, "ripemd", \$rmd160_asm_obj, \$rmd160_asm_src);
win32_import_asm($mf_wp_asm, "whrlpool", \$whirlpool_asm_obj, \$whirlpool_asm_src);
win32_import_asm($mf_cpuid_asm, "", \$cpuid_asm_obj, \$cpuid_asm_src);
$perl_asm = 1;
}
if ($shlib && $FLAVOR !~ /CE/)
{
$mlflags.=" $lflags /dll";
$lib_cflag.=" -D_WINDLL";
#
# Engage Applink...
#
$app_ex_obj.=" \$(OBJ_D)\\applink.obj /implib:\$(TMP_D)\\junk.lib";
$cflags.=" -DOPENSSL_USE_APPLINK -I.";
# I'm open for better suggestions than overriding $banner...
$banner=<<'___';
@echo Building OpenSSL
$(OBJ_D)\applink.obj: ms\applink.c
$(CC) /Fo$(OBJ_D)\applink.obj $(APP_CFLAGS) -c ms\applink.c
$(OBJ_D)\uplink.obj: ms\uplink.c ms\applink.c
$(CC) /Fo$(OBJ_D)\uplink.obj $(SHLIB_CFLAGS) -c ms\uplink.c
$(INCO_D)\applink.c: ms\applink.c
$(CP) ms\applink.c $(INCO_D)\applink.c
EXHEADER= $(EXHEADER) $(INCO_D)\applink.c
LIBS_DEP=$(LIBS_DEP) $(OBJ_D)\applink.obj
CRYPTOOBJ=$(OBJ_D)\uplink.obj $(CRYPTOOBJ)
___
$banner.=<<'___' if ($FLAVOR =~ /WIN64/);
CRYPTOOBJ=ms\uptable.obj $(CRYPTOOBJ)
___
}
elsif ($shlib && $FLAVOR =~ /CE/)
{
$mlflags.=" $lflags /dll";
$lflags.=' /entry:mainCRTstartup' if(defined($ENV{'PORTSDK_LIBPATH'}));
$lib_cflag.=" -D_WINDLL -D_DLL";
}
sub do_lib_rule
{
local($objs,$target,$name,$shlib)=@_;
local($ret);
$taget =~ s/\//$o/g if $o ne '/';
if ($name ne "")
{
$name =~ tr/a-z/A-Z/;
$name = "/def:ms/${name}.def";
}
# $target="\$(LIB_D)$o$target";
$ret.="$target: $objs\n";
if (!$shlib)
{
# $ret.="\t\$(RM) \$(O_$Name)\n";
$ret.="\t\$(MKLIB) $lfile$target @<<\n $objs\n<<\n";
}
else
{
local($ex)=($target =~ /O_CRYPTO/)?'':' $(L_CRYPTO)';
$ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/;
$ret.="\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex \$(EX_LIBS)\n<<\n";
$ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n";
}
$ret.="\n";
return($ret);
}
sub do_link_rule
{
local($target,$files,$dep_libs,$libs)=@_;
local($ret,$_);
$file =~ s/\//$o/g if $o ne '/';
$n=&bname($targer);
$ret.="$target: $files $dep_libs\n";
$ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n";
$ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n";
$ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n";
return($ret);
}
sub win32_import_asm
{
my ($mf_var, $asm_name, $oref, $sref) = @_;
my $asm_dir;
if ($asm_name eq "")
{
$asm_dir = "crypto\\";
}
else
{
$asm_dir = "crypto\\$asm_name\\asm\\";
}
$$oref = "";
$mf_var =~ s/\.o$/.obj/g;
foreach (split(/ /, $mf_var))
{
$$oref .= $asm_dir . $_ . " ";
}
$$oref =~ s/ $//;
$$sref = $$oref;
$$sref =~ s/\.obj/.asm/g;
}
1;

104
util/pl/linux.pl Normal file
View File

@@ -0,0 +1,104 @@
#!/usr/local/bin/perl
#
# linux.pl - the standard unix makefile stuff.
#
$o='/';
$cp='/bin/cp';
$rm='/bin/rm -f';
# C compiler stuff
$cc='gcc';
if ($debug)
{ $cflags="-g2 -ggdb -DREF_CHECK -DCRYPTO_MDEBUG"; }
elsif ($profile)
{ $cflags="-pg -O3"; }
else
{ $cflags="-O3 -fomit-frame-pointer"; }
if (!$no_asm)
{
$bn_asm_obj='$(OBJ_D)/bn86-elf.o';
$bn_asm_src='crypto/bn/asm/bn86unix.cpp';
$bnco_asm_obj='$(OBJ_D)/co86-elf.o';
$bnco_asm_src='crypto/bn/asm/co86unix.cpp';
$des_enc_obj='$(OBJ_D)/dx86-elf.o $(OBJ_D)/yx86-elf.o';
$des_enc_src='crypto/des/asm/dx86unix.cpp crypto/des/asm/yx86unix.cpp';
$bf_enc_obj='$(OBJ_D)/bx86-elf.o';
$bf_enc_src='crypto/bf/asm/bx86unix.cpp';
$cast_enc_obj='$(OBJ_D)/cx86-elf.o';
$cast_enc_src='crypto/cast/asm/cx86unix.cpp';
$rc4_enc_obj='$(OBJ_D)/rx86-elf.o';
$rc4_enc_src='crypto/rc4/asm/rx86unix.cpp';
$rc5_enc_obj='$(OBJ_D)/r586-elf.o';
$rc5_enc_src='crypto/rc5/asm/r586unix.cpp';
$md5_asm_obj='$(OBJ_D)/mx86-elf.o';
$md5_asm_src='crypto/md5/asm/mx86unix.cpp';
$rmd160_asm_obj='$(OBJ_D)/rm86-elf.o';
$rmd160_asm_src='crypto/ripemd/asm/rm86unix.cpp';
$sha1_asm_obj='$(OBJ_D)/sx86-elf.o';
$sha1_asm_src='crypto/sha/asm/sx86unix.cpp';
$cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS";
}
$cflags.=" -DTERMIO -DL_ENDIAN -m486 -Wall";
if ($shlib)
{
$shl_cflag=" -DPIC -fpic";
$shlibp=".so.$ssl_version";
$so_shlibp=".so";
}
sub do_shlib_rule
{
local($obj,$target,$name,$shlib,$so_name)=@_;
local($ret,$_,$Name);
$target =~ s/\//$o/g if $o ne '/';
($Name=$name) =~ tr/a-z/A-Z/;
$ret.="$target: \$(${Name}OBJ)\n";
$ret.="\t\$(RM) target\n";
$ret.="\tgcc \${CFLAGS} -shared -Wl,-soname,$target -o $target \$(${Name}OBJ)\n";
($t=$target) =~ s/(^.*)\/[^\/]*$/$1/;
if ($so_name ne "")
{
$ret.="\t\$(RM) \$(LIB_D)$o$so_name\n";
$ret.="\tln -s $target \$(LIB_D)$o$so_name\n\n";
}
}
sub do_link_rule
{
local($target,$files,$dep_libs,$libs)=@_;
local($ret,$_);
$file =~ s/\//$o/g if $o ne '/';
$n=&bname($target);
$ret.="$target: $files $dep_libs\n";
$ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n";
return($ret);
}
sub do_asm_rule
{
local($target,$src)=@_;
local($ret,@s,@t,$i);
$target =~ s/\//$o/g if $o ne "/";
$src =~ s/\//$o/g if $o ne "/";
@s=split(/\s+/,$src);
@t=split(/\s+/,$target);
for ($i=0; $i<=$#s; $i++)
{
$ret.="$t[$i]: $s[$i]\n";
$ret.="\tgcc -E -DELF \$(SRC_D)$o$s[$i]|\$(AS) $afile$t[$i]\n\n";
}
return($ret);
}
1;

532
util/pl/netware.pl Normal file
View File

@@ -0,0 +1,532 @@
# Metrowerks Codewarrior or gcc / nlmconv for NetWare
#
$version_header = "crypto/opensslv.h";
open(IN, "$version_header") or die "Couldn't open $version_header: $!";
while (<IN>) {
if (/^#define[\s\t]+OPENSSL_VERSION_NUMBER[\s\t]+0x(\d)(\d{2})(\d{2})(\d{2})/)
{
# die "OpenSSL version detected: $1.$2.$3.$4\n";
#$nlmvernum = "$1,$2,$3";
$nlmvernum = "$1,".($2*10+$3).",".($4*1);
#$nlmverstr = "$1.".($2*1).".".($3*1).($4?(chr(96+$4)):"");
break;
}
}
close(IN) or die "Couldn't close $version_header: $!";
$readme_file = "README";
open(IN, $readme_file) or die "Couldn't open $readme_file: $!";
while (<IN>) {
if (/^[\s\t]+OpenSSL[\s\t]+(\d)\.(\d{1,2})\.(\d{1,2})([a-z])(.*)/)
{
#$nlmvernum = "$1,$2,$3";
#$nlmvernum = "$1,".($2*10+$3).",".($4*1);
$nlmverstr = "$1.$2.$3$4$5";
}
elsif (/^[\s\t]+(Copyright \(c\) \d{4}\-\d{4} The OpenSSL Project)$/)
{
$nlmcpystr = $1;
}
break if ($nlmvernum && $nlmcpystr);
}
close(IN) or die "Couldn't close $readme_file: $!";
# Define stacksize here
$nlmstack = "32768";
# some default settings here in case we failed to find them in README
$nlmvernum = "1,0,0" if (!$nlmvernum);
$nlmverstr = "OpenSSL" if (!$nlmverstr);
$nlmcpystr = "Copyright (c) 1998-now The OpenSSL Project" if (!$nlmcpystr);
# die "OpenSSL copyright: $nlmcpystr\nOpenSSL verstring: $nlmverstr\nOpenSSL vernumber: $nlmvernum\n";
# The import files and other misc imports needed to link
@misc_imports = ("GetProcessSwitchCount", "RunningProcess",
"GetSuperHighResolutionTimer");
if ($LIBC)
{
@import_files = ("libc.imp");
@module_files = ("libc");
$libarch = "LIBC";
}
else
{
# clib build
@import_files = ("clib.imp");
push(@import_files, "socklib.imp") if ($BSDSOCK);
@module_files = ("clib");
# push(@misc_imports, "_rt_modu64%16", "_rt_divu64%16");
$libarch = "CLIB";
}
if ($BSDSOCK)
{
$libarch .= "-BSD";
}
else
{
$libarch .= "-WS2";
push(@import_files, "ws2nlm.imp");
}
# The "IMPORTS" environment variable must be set and point to the location
# where import files (*.imp) can be found.
# Example: set IMPORTS=c:\ndk\nwsdk\imports
$import_path = $ENV{"IMPORTS"} || die ("IMPORTS environment variable not set\n");
# The "PRELUDE" environment variable must be set and point to the location
# and name of the prelude source to link with ( nwpre.obj is recommended ).
# Example: set PRELUDE=c:\codewar\novell support\metrowerks support\libraries\runtime\nwpre.obj
$prelude = $ENV{"PRELUDE"} || die ("PRELUDE environment variable not set\n");
# The "INCLUDES" environment variable must be set and point to the location
# where import files (*.imp) can be found.
$include_path = $ENV{"INCLUDE"} || die ("INCLUDES environment variable not set\n");
$include_path =~ s/\\/\//g;
$include_path = join(" -I", split(/;/, $include_path));
# check for gcc compiler
$gnuc = $ENV{"GNUC"};
#$ssl= "ssleay32";
#$crypto="libeay32";
if ($gnuc)
{
# C compiler
$cc='gcc';
# Linker
$link='nlmconv';
# librarian
$mklib='ar';
$o='/';
# cp command
$cp='cp -af';
# rm command
$rm='rm -f';
# mv command
$mv='mv -f';
# mkdir command
$mkdir='gmkdir';
#$ranlib='ranlib';
}
else
{
# C compiler
$cc='mwccnlm';
# Linker
$link='mwldnlm';
# librarian
$mklib='mwldnlm';
# Path separator
$o='\\';
# cp command
$cp='copy >nul:';
# rm command
$rm='del /f /q';
}
# assembler
if ($nw_nasm)
{
$asm=(`nasm -v 2>NUL` gt `nasmw -v 2>NUL`?"nasm":"nasmw");
if ($gnuc)
{
$asm.=" -s -f elf";
}
else
{
$asm.=" -s -f coff -d __coff__";
}
$afile="-o ";
$asm.=" -g" if $debug;
}
elsif ($nw_mwasm)
{
$asm="mwasmnlm -maxerrors 20";
$afile="-o ";
$asm.=" -g" if $debug;
}
elsif ($nw_masm)
{
# masm assembly settings - it should be possible to use masm but haven't
# got it working.
# $asm='ml /Cp /coff /c /Cx';
# $asm.=" /Zi" if $debug;
# $afile='/Fo';
die("Support for masm assembler not yet functional\n");
}
else
{
$asm="";
$afile="";
}
if ($gnuc)
{
# compile flags for GNUC
# additional flags based upon debug | non-debug
if ($debug)
{
$cflags="-g -DDEBUG";
}
else
{
$cflags="-O2";
}
$cflags.=" -nostdinc -I$include_path \\
-fno-builtin -fpcc-struct-return -fno-strict-aliasing \\
-funsigned-char -Wall -Wno-unused -Wno-uninitialized";
# link flags
$lflags="-T";
}
else
{
# compile flags for CodeWarrior
# additional flags based upon debug | non-debug
if ($debug)
{
$cflags="-opt off -g -sym internal -DDEBUG";
}
else
{
# CodeWarrior compiler has a problem with optimizations for floating
# points - no optimizations until further investigation
# $cflags="-opt all";
}
# NOTES: Several c files in the crypto subdirectory include headers from
# their local directories. Metrowerks wouldn't find these h files
# without adding individual include directives as compile flags
# or modifying the c files. Instead of adding individual include
# paths for each subdirectory a recursive include directive
# is used ( -ir crypto ).
#
# A similar issue exists for the engines and apps subdirectories.
#
# Turned off the "possible" warnings ( -w nopossible ). Metrowerks
# complained a lot about various stuff. May want to turn back
# on for further development.
$cflags.=" -nostdinc -ir crypto -ir engines -ir apps -I$include_path \\
-msgstyle gcc -align 4 -processor pentium -char unsigned \\
-w on -w nolargeargs -w nopossible -w nounusedarg -w nounusedexpr \\
-w noimplicitconv -relax_pointers -nosyspath -maxerrors 20";
# link flags
$lflags="-msgstyle gcc -zerobss -nostdlib -sym internal -commandfile";
}
# common defines
$cflags.=" -DL_ENDIAN -DOPENSSL_SYSNAME_NETWARE -U_WIN32";
# If LibC build add in NKS_LIBC define and set the entry/exit
# routines - The default entry/exit routines are for CLib and don't exist
# in LibC
if ($LIBC)
{
$cflags.=" -DNETWARE_LIBC";
$nlmstart = "_LibCPrelude";
$nlmexit = "_LibCPostlude";
@nlm_flags = ("pseudopreemption", "flag_on 64");
}
else
{
$cflags.=" -DNETWARE_CLIB";
$nlmstart = "_Prelude";
$nlmexit = "_Stop";
}
# If BSD Socket support is requested, set a define for the compiler
if ($BSDSOCK)
{
$cflags.=" -DNETWARE_BSDSOCK";
if (!$LIBC)
{
$cflags.=" -DNETDB_USE_INTERNET";
}
}
# linking stuff
# for the output directories use the mk1mf.pl values with "_nw" appended
if ($shlib)
{
if ($LIBC)
{
$out_def.="_nw_libc_nlm";
$tmp_def.="_nw_libc_nlm";
$inc_def.="_nw_libc_nlm";
}
else # NETWARE_CLIB
{
$out_def.="_nw_clib_nlm";
$tmp_def.="_nw_clib_nlm";
$inc_def.="_nw_clib_nlm";
}
}
else
{
if ($gnuc) # GNUC Tools
{
$libp=".a";
$shlibp=".a";
$lib_flags="-cr";
}
else # CodeWarrior
{
$libp=".lib";
$shlibp=".lib";
$lib_flags="-nodefaults -type library -o";
}
if ($LIBC)
{
$out_def.="_nw_libc";
$tmp_def.="_nw_libc";
$inc_def.="_nw_libc";
}
else # NETWARE_CLIB
{
$out_def.="_nw_clib";
$tmp_def.="_nw_clib";
$inc_def.="_nw_clib";
}
}
# used by mk1mf.pl
$obj='.o';
$ofile='-o ';
$efile='';
$exep='.nlm';
$ex_libs='';
if (!$no_asm)
{
$bn_asm_obj="\$(OBJ_D)${o}bn-nw${obj}";
$bn_asm_src="crypto${o}bn${o}asm${o}bn-nw.asm";
$bnco_asm_obj="\$(OBJ_D)${o}co-nw${obj}";
$bnco_asm_src="crypto${o}bn${o}asm${o}co-nw.asm";
$aes_asm_obj="\$(OBJ_D)${o}a-nw${obj}";
$aes_asm_src="crypto${o}aes${o}asm${o}a-nw.asm";
$des_enc_obj="\$(OBJ_D)${o}d-nw${obj} \$(OBJ_D)${o}y-nw${obj}";
$des_enc_src="crypto${o}des${o}asm${o}d-nw.asm crypto${o}des${o}asm${o}y-nw.asm";
$bf_enc_obj="\$(OBJ_D)${o}b-nw${obj}";
$bf_enc_src="crypto${o}bf${o}asm${o}b-nw.asm";
$cast_enc_obj="\$(OBJ_D)${o}c-nw${obj}";
$cast_enc_src="crypto${o}cast${o}asm${o}c-nw.asm";
$rc4_enc_obj="\$(OBJ_D)${o}r4-nw${obj}";
$rc4_enc_src="crypto${o}rc4${o}asm${o}r4-nw.asm";
$rc5_enc_obj="\$(OBJ_D)${o}r5-nw${obj}";
$rc5_enc_src="crypto${o}rc5${o}asm${o}r5-nw.asm";
$md5_asm_obj="\$(OBJ_D)${o}m5-nw${obj}";
$md5_asm_src="crypto${o}md5${o}asm${o}m5-nw.asm";
$sha1_asm_obj="\$(OBJ_D)${o}s1-nw${obj} \$(OBJ_D)${o}sha256-nw${obj} \$(OBJ_D)${o}sha512-nw${obj}";
$sha1_asm_src="crypto${o}sha${o}asm${o}s1-nw.asm crypto${o}sha${o}asm${o}sha256-nw.asm crypto${o}sha${o}asm${o}sha512-nw.asm";
$rmd160_asm_obj="\$(OBJ_D)${o}rm-nw${obj}";
$rmd160_asm_src="crypto${o}ripemd${o}asm${o}rm-nw.asm";
$whirlpool_asm_obj="\$(OBJ_D)${o}wp-nw${obj}";
$whirlpool_asm_src="crypto${o}whrlpool${o}asm${o}wp-nw.asm";
$cpuid_asm_obj="\$(OBJ_D)${o}x86cpuid-nw${obj}";
$cpuid_asm_src="crypto${o}x86cpuid-nw.asm";
$cflags.=" -DOPENSSL_CPUID_OBJ -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DMD5_ASM -DWHIRLPOOL_ASM";
$cflags.=" -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM";
$cflags.=" -DAES_ASM -DRMD160_ASM";
}
else
{
$bn_asm_obj='';
$bn_asm_src='';
$bnco_asm_obj='';
$bnco_asm_src='';
$aes_asm_obj='';
$aes_asm_src='';
$des_enc_obj='';
$des_enc_src='';
$bf_enc_obj='';
$bf_enc_src='';
$cast_enc_obj='';
$cast_enc_src='';
$rc4_enc_obj='';
$rc4_enc_src='';
$rc5_enc_obj='';
$rc5_enc_src='';
$md5_asm_obj='';
$md5_asm_src='';
$sha1_asm_obj='';
$sha1_asm_src='';
$rmd160_asm_obj='';
$rmd160_asm_src='';
$whirlpool_asm_obj='';
$whirlpool_asm_src='';
$cpuid_asm_obj='';
$cpuid_asm_src='';
}
# create the *.def linker command files in \openssl\netware\ directory
sub do_def_file
{
# strip off the leading path
my($target) = bname(shift);
my($i);
if ($target =~ /(.*).nlm/)
{
$target = $1;
}
# special case for openssl - the mk1mf.pl defines E_EXE = openssl
if ($target =~ /E_EXE/)
{
$target =~ s/\$\(E_EXE\)/openssl/;
}
# Note: originally tried to use full path ( \openssl\netware\$target.def )
# Metrowerks linker choked on this with an assertion failure. bug???
#
my($def_file) = "netware${o}$target.def";
open(DEF_OUT, ">$def_file") || die("unable to open file $def_file\n");
print( DEF_OUT "# command file generated by netware.pl for NLM target.\n" );
print( DEF_OUT "# do not edit this file - all your changes will be lost!!\n" );
print( DEF_OUT "#\n");
print( DEF_OUT "DESCRIPTION \"$target ($libarch) - OpenSSL $nlmverstr\"\n");
print( DEF_OUT "COPYRIGHT \"$nlmcpystr\"\n");
print( DEF_OUT "VERSION $nlmvernum\n");
print( DEF_OUT "STACK $nlmstack\n");
print( DEF_OUT "START $nlmstart\n");
print( DEF_OUT "EXIT $nlmexit\n");
# special case for openssl
if ($target eq "openssl")
{
print( DEF_OUT "SCREENNAME \"OpenSSL $nlmverstr\"\n");
}
else
{
print( DEF_OUT "SCREENNAME \"DEFAULT\"\n");
}
foreach $i (@misc_imports)
{
print( DEF_OUT "IMPORT $i\n");
}
foreach $i (@import_files)
{
print( DEF_OUT "IMPORT \@$import_path${o}$i\n");
}
foreach $i (@module_files)
{
print( DEF_OUT "MODULE $i\n");
}
foreach $i (@nlm_flags)
{
print( DEF_OUT "$i\n");
}
if ($gnuc)
{
if ($target =~ /openssl/)
{
print( DEF_OUT "INPUT ${tmp_def}${o}openssl${obj}\n");
print( DEF_OUT "INPUT ${tmp_def}${o}openssl${libp}\n");
}
else
{
print( DEF_OUT "INPUT ${tmp_def}${o}${target}${obj}\n");
}
print( DEF_OUT "INPUT $prelude\n");
print( DEF_OUT "INPUT ${out_def}${o}${ssl}${libp} ${out_def}${o}${crypto}${libp}\n");
print( DEF_OUT "OUTPUT $target.nlm\n");
}
close(DEF_OUT);
return($def_file);
}
sub do_lib_rule
{
my($objs,$target,$name,$shlib)=@_;
my($ret);
$ret.="$target: $objs\n";
if (!$shlib)
{
$ret.="\t\@echo Building Lib: $name\n";
$ret.="\t\$(MKLIB) $lib_flags $target $objs\n";
$ret.="\t\@echo .\n"
}
else
{
die( "Building as NLM not currently supported!" );
}
$ret.="\n";
return($ret);
}
sub do_link_rule
{
my($target,$files,$dep_libs,$libs)=@_;
my($ret);
my($def_file) = do_def_file($target);
$ret.="$target: $files $dep_libs\n";
# NOTE: When building the test nlms no screen name is given
# which causes the console screen to be used. By using the console
# screen there is no "<press any key to continue>" message which
# requires user interaction. The test script ( do_tests.pl ) needs
# to be able to run the tests without requiring user interaction.
#
# However, the sample program "openssl.nlm" is used by the tests and is
# a interactive sample so a screen is desired when not be run by the
# tests. To solve the problem, two versions of the program are built:
# openssl2 - no screen used by tests
# openssl - default screen - use for normal interactive modes
#
# special case for openssl - the mk1mf.pl defines E_EXE = openssl
if ($target =~ /E_EXE/)
{
my($target2) = $target;
$target2 =~ s/\(E_EXE\)/\(E_EXE\)2/;
# openssl2
my($def_file2) = do_def_file($target2);
if ($gnuc)
{
$ret.="\t\$(MKLIB) $lib_flags \$(TMP_D)${o}\$(E_EXE).a \$(filter-out \$(TMP_D)${o}\$(E_EXE)${obj},$files)\n";
$ret.="\t\$(LINK) \$(LFLAGS) $def_file2\n";
$ret.="\t\@$mv \$(E_EXE)2.nlm \$(TEST_D)\n";
}
else
{
$ret.="\t\$(LINK) \$(LFLAGS) $def_file2 $files \"$prelude\" $libs -o $target2\n";
}
}
if ($gnuc)
{
$ret.="\t\$(LINK) \$(LFLAGS) $def_file\n";
$ret.="\t\@$mv \$(\@F) \$(TEST_D)\n";
}
else
{
$ret.="\t\$(LINK) \$(LFLAGS) $def_file $files \"$prelude\" $libs -o $target\n";
}
$ret.="\n";
return($ret);
}
1;

38
util/pl/ultrix.pl Normal file
View File

@@ -0,0 +1,38 @@
#!/usr/local/bin/perl
#
# linux.pl - the standard unix makefile stuff.
#
$o='/';
$cp='/bin/cp';
$rm='/bin/rm -f';
# C compiler stuff
$cc='cc';
if ($debug)
{ $cflags="-g -DREF_CHECK -DCRYPTO_MDEBUG"; }
else
{ $cflags="-O2"; }
$cflags.=" -std1 -DL_ENDIAN";
if (!$no_asm)
{
$bn_asm_obj='$(OBJ_D)/mips1.o';
$bn_asm_src='crypto/bn/asm/mips1.s';
}
sub do_link_rule
{
local($target,$files,$dep_libs,$libs)=@_;
local($ret,$_);
$file =~ s/\//$o/g if $o ne '/';
$n=&bname($target);
$ret.="$target: $files $dep_libs\n";
$ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n";
return($ret);
}
1;

96
util/pl/unix.pl Normal file
View File

@@ -0,0 +1,96 @@
#!/usr/local/bin/perl
#
# unix.pl - the standard unix makefile stuff.
#
$o='/';
$cp='/bin/cp';
$rm='/bin/rm -f';
# C compiler stuff
if ($gcc)
{
$cc='gcc';
if ($debug)
{ $cflags="-g2 -ggdb"; }
else
{ $cflags="-O3 -fomit-frame-pointer"; }
}
else
{
$cc='cc';
if ($debug)
{ $cflags="-g"; }
else
{ $cflags="-O"; }
}
$obj='.o';
$ofile='-o ';
# EXE linking stuff
$link='${CC}';
$lflags='${CFLAGS}';
$efile='-o ';
$exep='';
$ex_libs="";
# static library stuff
$mklib='ar r';
$mlflags='';
$ranlib=&which("ranlib") or $ranlib="true";
$plib='lib';
$libp=".a";
$shlibp=".a";
$lfile='';
$asm='as';
$afile='-o ';
$bn_asm_obj="";
$bn_asm_src="";
$des_enc_obj="";
$des_enc_src="";
$bf_enc_obj="";
$bf_enc_src="";
sub do_lib_rule
{
local($obj,$target,$name,$shlib)=@_;
local($ret,$_,$Name);
$target =~ s/\//$o/g if $o ne '/';
$target="$target";
($Name=$name) =~ tr/a-z/A-Z/;
$ret.="$target: \$(${Name}OBJ)\n";
$ret.="\t\$(RM) $target\n";
$ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
$ret.="\t\$(RANLIB) $target\n\n";
}
sub do_link_rule
{
local($target,$files,$dep_libs,$libs)=@_;
local($ret,$_);
$file =~ s/\//$o/g if $o ne '/';
$n=&bname($target);
$ret.="$target: $files $dep_libs\n";
$ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n";
return($ret);
}
sub which
{
my ($name)=@_;
my $path;
foreach $path (split /:/, $ENV{PATH})
{
if (-x "$path/$name")
{
return "$path/$name";
}
}
}
1;

1184
util/pod2man.pl Executable file

File diff suppressed because it is too large Load Diff

58
util/pod2mantest Executable file
View File

@@ -0,0 +1,58 @@
#!/bin/sh
# This script is used by test/Makefile to check whether a sane 'pod2man'
# is installed.
# ('make install' should not try to run 'pod2man' if it does not exist or if
# it is a broken 'pod2man' version that is known to cause trouble. if we find
# the system 'pod2man' to be broken, we use our own copy instead)
#
# In any case, output an appropriate command line for running (or not
# running) pod2man.
IFS=:
if test "$OSTYPE" = "msdosdjgpp"; then IFS=";"; fi
try_without_dir=true
# First we try "pod2man", then "$dir/pod2man" for each item in $PATH.
for dir in dummy${IFS}$PATH; do
if [ "$try_without_dir" = true ]; then
# first iteration
pod2man=pod2man
try_without_dir=false
else
# second and later iterations
pod2man="$dir/pod2man"
if [ ! -f "$pod2man" ]; then # '-x' is not available on Ultrix
pod2man=''
fi
fi
if [ ! "$pod2man" = '' ]; then
failure=none
if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | fgrep OpenSSL >/dev/null; then
:
else
failure=BasicTest
fi
if [ "$failure" = none ]; then
if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | grep '^MARKER - ' >/dev/null; then
failure=MultilineTest
fi
fi
if [ "$failure" = none ]; then
echo "$pod2man"
exit 0
fi
echo "$pod2man does not work properly ('$failure' failed). Looking for another pod2man ..." >&2
fi
done
echo "No working pod2man found. Consider installing a new version." >&2
echo "As a workaround, we'll use a bundled old copy of pod2man.pl." >&2
echo "$1 ../../util/pod2man.pl"

15
util/pod2mantest.pod Normal file
View File

@@ -0,0 +1,15 @@
=pod
=head1 NAME
foo, bar,
MARKER - test of multiline name section
=head1 DESCRIPTION
This is a test .pod file to see if we have a buggy pod2man or not.
If we have a buggy implementation, we will get a line matching the
regular expression "^ +MARKER - test of multiline name section *$"
at the end of the resulting document.
=cut

10
util/point.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
rm -f "$2"
if test "$OSTYPE" = msdosdjgpp || test "x$PLATFORM" = xmingw ; then
cp "$1" "$2"
else
ln -s "$1" "$2"
fi
echo "$2 => $1"

201
util/selftest.pl Normal file
View File

@@ -0,0 +1,201 @@
#!/usr/local/bin/perl -w
#
# Run the test suite and generate a report
#
if (! -f "Configure") {
print "Please run perl util/selftest.pl in the OpenSSL directory.\n";
exit 1;
}
my $report="testlog";
my $os="??";
my $version="??";
my $platform0="??";
my $platform="??";
my $options="??";
my $last="??";
my $ok=0;
my $cc="cc";
my $cversion="??";
my $sep="-----------------------------------------------------------------------------\n";
my $not_our_fault="\nPlease ask your system administrator/vendor for more information.\n[Problems with your operating system setup should not be reported\nto the OpenSSL project.]\n";
open(OUT,">$report") or die;
print OUT "OpenSSL self-test report:\n\n";
$uname=`uname -a`;
$uname="??\n" if $uname eq "";
$c=`sh config -t`;
foreach $_ (split("\n",$c)) {
$os=$1 if (/Operating system: (.*)$/);
$platform0=$1 if (/Configuring for (.*)$/);
}
system "sh config" if (! -f "Makefile");
if (open(IN,"<Makefile")) {
while (<IN>) {
$version=$1 if (/^VERSION=(.*)$/);
$platform=$1 if (/^PLATFORM=(.*)$/);
$options=$1 if (/^OPTIONS=(.*)$/);
$cc=$1 if (/^CC= *(.*)$/);
}
close(IN);
} else {
print OUT "Error running config!\n";
}
$cversion=`$cc -v 2>&1`;
$cversion=`$cc -V 2>&1` if $cversion =~ "[Uu]sage";
$cversion=`$cc -V |head -1` if $cversion =~ "Error";
$cversion=`$cc --version` if $cversion eq "";
$cversion =~ s/Reading specs.*\n//;
$cversion =~ s/usage.*\n//;
chomp $cversion;
if (open(IN,"<CHANGES")) {
while(<IN>) {
if (/\*\) (.{0,55})/ && !/applies to/) {
$last=$1;
last;
}
}
close(IN);
}
print OUT "OpenSSL version: $version\n";
print OUT "Last change: $last...\n";
print OUT "Options: $options\n" if $options ne "";
print OUT "OS (uname): $uname";
print OUT "OS (config): $os\n";
print OUT "Target (default): $platform0\n";
print OUT "Target: $platform\n";
print OUT "Compiler: $cversion\n";
print OUT "\n";
print "Checking compiler...\n";
if (open(TEST,">cctest.c")) {
print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <errno.h>\nmain(){printf(\"Hello world\\n\");}\n";
close(TEST);
system("$cc -o cctest cctest.c");
if (`./cctest` !~ /Hello world/) {
print OUT "Compiler doesn't work.\n";
print OUT $not_our_fault;
goto err;
}
system("ar r cctest.a /dev/null");
if (not -f "cctest.a") {
print OUT "Check your archive tool (ar).\n";
print OUT $not_our_fault;
goto err;
}
} else {
print OUT "Can't create cctest.c\n";
}
if (open(TEST,">cctest.c")) {
print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <openssl/opensslv.h>\nmain(){printf(OPENSSL_VERSION_TEXT);}\n";
close(TEST);
system("$cc -o cctest -Iinclude cctest.c");
$cctest = `./cctest`;
if ($cctest !~ /OpenSSL $version/) {
if ($cctest =~ /OpenSSL/) {
print OUT "#include uses headers from different OpenSSL version!\n";
} else {
print OUT "Can't compile test program!\n";
}
print OUT $not_our_fault;
goto err;
}
} else {
print OUT "Can't create cctest.c\n";
}
print "Running make...\n";
if (system("make 2>&1 | tee make.log") > 255) {
print OUT "make failed!\n";
if (open(IN,"<make.log")) {
print OUT $sep;
while (<IN>) {
print OUT;
}
close(IN);
print OUT $sep;
} else {
print OUT "make.log not found!\n";
}
goto err;
}
# Not sure why this is here. The tests themselves can detect if their
# particular feature isn't included, and should therefore skip themselves.
# To skip *all* tests just because one algorithm isn't included is like
# shooting mosquito with an elephant gun...
# -- Richard Levitte, inspired by problem report 1089
#
#$_=$options;
#s/no-asm//;
#s/no-shared//;
#s/no-krb5//;
#if (/no-/)
#{
# print OUT "Test skipped.\n";
# goto err;
#}
print "Running make test...\n";
if (system("make test 2>&1 | tee maketest.log") > 255)
{
print OUT "make test failed!\n";
} else {
$ok=1;
}
if ($ok and open(IN,"<maketest.log")) {
while (<IN>) {
$ok=2 if /^platform: $platform/;
}
close(IN);
}
if ($ok != 2) {
print OUT "Failure!\n";
if (open(IN,"<make.log")) {
print OUT $sep;
while (<IN>) {
print OUT;
}
close(IN);
print OUT $sep;
} else {
print OUT "make.log not found!\n";
}
if (open(IN,"<maketest.log")) {
while (<IN>) {
print OUT;
}
close(IN);
print OUT $sep;
} else {
print OUT "maketest.log not found!\n";
}
} else {
print OUT "Test passed.\n";
}
err:
close(OUT);
print "\n";
open(IN,"<$report") or die;
while (<IN>) {
if (/$sep/) {
print "[...]\n";
last;
}
print;
}
print "\nTest report in file $report\n";

93
util/shlib_wrap.sh Executable file
View File

@@ -0,0 +1,93 @@
#!/bin/sh
[ $# -ne 0 ] || set -x # debug mode without arguments:-)
THERE="`echo $0 | sed -e 's|[^/]*$||' 2>/dev/null`.."
[ -d "${THERE}" ] || exec "$@" # should never happen...
# Alternative to this is to parse ${THERE}/Makefile...
LIBCRYPTOSO="${THERE}/libcrypto.so"
if [ -f "$LIBCRYPTOSO" ]; then
while [ -h "$LIBCRYPTOSO" ]; do
LIBCRYPTOSO="${THERE}/`ls -l "$LIBCRYPTOSO" | sed -e 's|.*\-> ||'`"
done
SOSUFFIX=`echo ${LIBCRYPTOSO} | sed -e 's|.*\.so||' 2>/dev/null`
LIBSSLSO="${THERE}/libssl.so${SOSUFFIX}"
fi
SYSNAME=`(uname -s) 2>/dev/null`;
case "$SYSNAME" in
SunOS|IRIX*)
# SunOS and IRIX run-time linkers evaluate alternative
# variables depending on target ABI...
rld_var=LD_LIBRARY_PATH
case "`(/usr/bin/file "$LIBCRYPTOSO") 2>/dev/null`" in
*ELF\ 64*SPARC*|*ELF\ 64*AMD64*)
[ -n "$LD_LIBRARY_PATH_64" ] && rld_var=LD_LIBRARY_PATH_64
LD_PRELOAD_64="$LIBCRYPTOSO $LIBSSLSO"; export LD_PRELOAD_64
preload_var=LD_PRELOAD_64
;;
# Why are newly built .so's preloaded anyway? Because run-time
# .so lookup path embedded into application takes precedence
# over LD_LIBRARY_PATH and as result application ends up linking
# to previously installed .so's. On IRIX instead of preloading
# newly built .so's we trick run-time linker to fail to find
# the installed .so by setting _RLD_ROOT variable.
*ELF\ 32*MIPS*)
#_RLD_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLD_LIST
_RLD_ROOT=/no/such/dir; export _RLD_ROOT
eval $rld_var=\"/usr/lib'${'$rld_var':+:$'$rld_var'}'\"
preload_var=_RLD_LIST
;;
*ELF\ N32*MIPS*)
[ -n "$LD_LIBRARYN32_PATH" ] && rld_var=LD_LIBRARYN32_PATH
#_RLDN32_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLDN32_LIST
_RLDN32_ROOT=/no/such/dir; export _RLDN32_ROOT
eval $rld_var=\"/usr/lib32'${'$rld_var':+:$'$rld_var'}'\"
preload_var=_RLDN32_LIST
;;
*ELF\ 64*MIPS*)
[ -n "$LD_LIBRARY64_PATH" ] && rld_var=LD_LIBRARY64_PATH
#_RLD64_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLD64_LIST
_RLD64_ROOT=/no/such/dir; export _RLD64_ROOT
eval $rld_var=\"/usr/lib64'${'$rld_var':+:$'$rld_var'}'\"
preload_var=_RLD64_LIST
;;
esac
eval $rld_var=\"${THERE}'${'$rld_var':+:$'$rld_var'}'\"; export $rld_var
unset rld_var
;;
*) LD_LIBRARY_PATH="${THERE}:$LD_LIBRARY_PATH" # Linux, ELF HP-UX
DYLD_LIBRARY_PATH="${THERE}:$DYLD_LIBRARY_PATH" # MacOS X
SHLIB_PATH="${THERE}:$SHLIB_PATH" # legacy HP-UX
LIBPATH="${THERE}:$LIBPATH" # AIX, OS/2
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH
# Even though $PATH is adjusted [for Windows sake], it doesn't
# necessarily does the trick. Trouble is that with introduction
# of SafeDllSearchMode in XP/2003 it's more appropriate to copy
# .DLLs in vicinity of executable, which is done elsewhere...
if [ "$OSTYPE" != msdosdjgpp ]; then
PATH="${THERE}:$PATH"; export PATH
fi
;;
esac
if [ -f "$LIBCRYPTOSO" -a -z "$preload_var" ]; then
# Following three lines are major excuse for isolating them into
# this wrapper script. Original reason for setting LD_PRELOAD
# was to make it possible to pass 'make test' when user linked
# with -rpath pointing to previous version installation. Wrapping
# it into a script makes it possible to do so on multi-ABI
# platforms.
case "$SYSNAME" in
*BSD|QNX) LD_PRELOAD="$LIBCRYPTOSO:$LIBSSLSO" ;; # *BSD, QNX
*) LD_PRELOAD="$LIBCRYPTOSO $LIBSSLSO" ;; # SunOS, Linux, ELF HP-UX
esac
_RLD_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT" # Tru64, o32 IRIX
DYLD_INSERT_LIBRARIES="$LIBCRYPTOSO:$LIBSSLSO" # MacOS X
export LD_PRELOAD _RLD_LIST DYLD_INSERT_LIBRARIES
fi
cmd="$1${EXE_EXT}"
shift
exec "$cmd" "$@"

80
util/sp-diff.pl Executable file
View File

@@ -0,0 +1,80 @@
#!/usr/local/bin/perl
#
# This file takes as input, the files that have been output from
# ssleay speed.
# It prints a table of the relative differences with %100 being 'no difference'
#
($#ARGV == 1) || die "$0 speedout1 speedout2\n";
%one=&loadfile($ARGV[0]);
%two=&loadfile($ARGV[1]);
$line=0;
foreach $a ("md2","md4","md5","sha","sha1","rc4","des cfb","des cbc","des ede3",
"idea cfb","idea cbc","rc2 cfb","rc2 cbc","blowfish cbc","cast cbc")
{
if (defined($one{$a,8}) && defined($two{$a,8}))
{
print "type 8 byte% 64 byte% 256 byte% 1024 byte% 8192 byte%\n"
unless $line;
$line++;
printf "%-12s ",$a;
foreach $b (8,64,256,1024,8192)
{
$r=$two{$a,$b}/$one{$a,$b}*100;
printf "%12.2f",$r;
}
print "\n";
}
}
foreach $a (
"rsa 512","rsa 1024","rsa 2048","rsa 4096",
"dsa 512","dsa 1024","dsa 2048",
)
{
if (defined($one{$a,1}) && defined($two{$a,1}))
{
$r1=($one{$a,1}/$two{$a,1})*100;
$r2=($one{$a,2}/$two{$a,2})*100;
printf "$a bits %% %6.2f %% %6.2f\n",$r1,$r2;
}
}
sub loadfile
{
local($file)=@_;
local($_,%ret);
open(IN,"<$file") || die "unable to open '$file' for input\n";
$header=1;
while (<IN>)
{
$header=0 if /^[dr]sa/;
if (/^type/) { $header=0; next; }
next if $header;
chop;
@a=split;
if ($a[0] =~ /^[dr]sa$/)
{
($n,$t1,$t2)=($_ =~ /^([dr]sa\s+\d+)\s+bits\s+([.\d]+)s\s+([.\d]+)/);
$ret{$n,1}=$t1;
$ret{$n,2}=$t2;
}
else
{
$n=join(' ',grep(/[^k]$/,@a));
@k=grep(s/k$//,@a);
$ret{$n, 8}=$k[0];
$ret{$n, 64}=$k[1];
$ret{$n, 256}=$k[2];
$ret{$n,1024}=$k[3];
$ret{$n,8192}=$k[4];
}
}
close(IN);
return(%ret);
}

39
util/speed.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/sh
#
# This is a ugly script use, in conjuction with editing the 'b'
# configuration in the $(TOP)/Configure script which will
# output when finished a file called speed.log which is the
# timings of SSLeay with various options turned on or off.
#
# from the $(TOP) directory
# Edit Configure, modifying things to do with the b/bl-4c-2c etc
# configurations.
#
make clean
perl Configure b
make
apps/ssleay version -v -b -f >speed.1
apps/ssleay speed >speed.1l
perl Configure bl-4c-2c
/bin/rm -f crypto/rc4/*.o crypto/bn/bn*.o crypto/md2/md2_dgst.o
make
apps/ssleay speed rc4 rsa md2 >speed.2l
perl Configure bl-4c-ri
/bin/rm -f crypto/rc4/rc4*.o
make
apps/ssleay speed rc4 >speed.3l
perl Configure b2-is-ri-dp
/bin/rm -f crypto/idea/i_*.o crypto/rc4/*.o crypto/des/ecb_enc.o crypto/bn/bn*.o
apps/ssleay speed rsa rc4 idea des >speed.4l
cat speed.1 >speed.log
cat speed.1l >>speed.log
perl util/sp-diff.pl speed.1l speed.2l >>speed.log
perl util/sp-diff.pl speed.1l speed.3l >>speed.log
perl util/sp-diff.pl speed.1l speed.4l >>speed.log

147
util/src-dep.pl Executable file
View File

@@ -0,0 +1,147 @@
#!/usr/local/bin/perl
# we make up an array of
# $file{function_name}=filename;
# $unres{filename}="func1 func2 ...."
$debug=1;
#$nm_func="parse_linux";
$nm_func="parse_solaris";
foreach (@ARGV)
{
&$nm_func($_);
}
foreach $file (sort keys %unres)
{
@a=split(/\s+/,$unres{$file});
%ff=();
foreach $func (@a)
{
$f=$file{$func};
$ff{$f}=1 if $f ne "";
}
foreach $a (keys %ff)
{ $we_need{$file}.="$a "; }
}
foreach $file (sort keys %we_need)
{
# print " $file $we_need{$file}\n";
foreach $bit (split(/\s+/,$we_need{$file}))
{ push(@final,&walk($bit)); }
foreach (@final) { $fin{$_}=1; }
@final="";
foreach (sort keys %fin)
{ push(@final,$_); }
print "$file: @final\n";
}
sub walk
{
local($f)=@_;
local(@a,%seen,@ret,$r);
@ret="";
$f =~ s/^\s+//;
$f =~ s/\s+$//;
return "" if ($f =~ "^\s*$");
return(split(/\s/,$done{$f})) if defined ($done{$f});
return if $in{$f} > 0;
$in{$f}++;
push(@ret,$f);
foreach $r (split(/\s+/,$we_need{$f}))
{
push(@ret,&walk($r));
}
$in{$f}--;
$done{$f}=join(" ",@ret);
return(@ret);
}
sub parse_linux
{
local($name)=@_;
open(IN,"nm $name|") || die "unable to run 'nn $name':$!\n";
while (<IN>)
{
chop;
next if /^\s*$/;
if (/^[^[](.*):$/)
{
$file=$1;
$file="$1.c" if /\[(.*).o\]/;
print STDERR "$file\n";
$we_need{$file}=" ";
next;
}
@a=split(/\s*\|\s*/);
next unless $#a == 7;
next unless $a[4] eq "GLOB";
if ($a[6] eq "UNDEF")
{
$unres{$file}.=$a[7]." ";
}
else
{
if ($file{$a[7]} ne "")
{
print STDERR "duplicate definition of $a[7],\n$file{$a[7]} and $file \n";
}
else
{
$file{$a[7]}=$file;
}
}
}
close(IN);
}
sub parse_solaris
{
local($name)=@_;
open(IN,"nm $name|") || die "unable to run 'nn $name':$!\n";
while (<IN>)
{
chop;
next if /^\s*$/;
if (/^(\S+):$/)
{
$file=$1;
#$file="$1.c" if $file =~ /^(.*).o$/;
print STDERR "$file\n";
$we_need{$file}=" ";
next;
}
@a=split(/\s*\|\s*/);
next unless $#a == 7;
next unless $a[4] eq "GLOB";
if ($a[6] eq "UNDEF")
{
$unres{$file}.=$a[7]." ";
print STDERR "$file needs $a[7]\n" if $debug;
}
else
{
if ($file{$a[7]} ne "")
{
print STDERR "duplicate definition of $a[7],\n$file{$a[7]} and $file \n";
}
else
{
$file{$a[7]}=$file;
print STDERR "$file has $a[7]\n" if $debug;
}
}
}
close(IN);
}

261
util/ssleay.num Executable file
View File

@@ -0,0 +1,261 @@
ERR_load_SSL_strings 1 EXIST::FUNCTION:
SSL_CIPHER_description 2 EXIST::FUNCTION:
SSL_CTX_add_client_CA 3 EXIST::FUNCTION:
SSL_CTX_add_session 4 EXIST::FUNCTION:
SSL_CTX_check_private_key 5 EXIST::FUNCTION:
SSL_CTX_ctrl 6 EXIST::FUNCTION:
SSL_CTX_flush_sessions 7 EXIST::FUNCTION:
SSL_CTX_free 8 EXIST::FUNCTION:
SSL_CTX_get_client_CA_list 9 EXIST::FUNCTION:
SSL_CTX_get_verify_callback 10 EXIST::FUNCTION:
SSL_CTX_get_verify_mode 11 EXIST::FUNCTION:
SSL_CTX_new 12 EXIST::FUNCTION:
SSL_CTX_remove_session 13 EXIST::FUNCTION:
SSL_CTX_set_cipher_list 15 EXIST::FUNCTION:
SSL_CTX_set_client_CA_list 16 EXIST::FUNCTION:
SSL_CTX_set_default_passwd_cb 17 EXIST::FUNCTION:
SSL_CTX_set_ssl_version 19 EXIST::FUNCTION:
SSL_CTX_set_verify 21 EXIST::FUNCTION:
SSL_CTX_use_PrivateKey 22 EXIST::FUNCTION:
SSL_CTX_use_PrivateKey_ASN1 23 EXIST::FUNCTION:
SSL_CTX_use_PrivateKey_file 24 EXIST::FUNCTION:STDIO
SSL_CTX_use_RSAPrivateKey 25 EXIST::FUNCTION:RSA
SSL_CTX_use_RSAPrivateKey_ASN1 26 EXIST::FUNCTION:RSA
SSL_CTX_use_RSAPrivateKey_file 27 EXIST::FUNCTION:RSA,STDIO
SSL_CTX_use_certificate 28 EXIST::FUNCTION:
SSL_CTX_use_certificate_ASN1 29 EXIST::FUNCTION:
SSL_CTX_use_certificate_file 30 EXIST::FUNCTION:STDIO
SSL_SESSION_free 31 EXIST::FUNCTION:
SSL_SESSION_new 32 EXIST::FUNCTION:
SSL_SESSION_print 33 EXIST::FUNCTION:BIO
SSL_SESSION_print_fp 34 EXIST::FUNCTION:FP_API
SSL_accept 35 EXIST::FUNCTION:
SSL_add_client_CA 36 EXIST::FUNCTION:
SSL_alert_desc_string 37 EXIST::FUNCTION:
SSL_alert_desc_string_long 38 EXIST::FUNCTION:
SSL_alert_type_string 39 EXIST::FUNCTION:
SSL_alert_type_string_long 40 EXIST::FUNCTION:
SSL_check_private_key 41 EXIST::FUNCTION:
SSL_clear 42 EXIST::FUNCTION:
SSL_connect 43 EXIST::FUNCTION:
SSL_copy_session_id 44 EXIST::FUNCTION:
SSL_ctrl 45 EXIST::FUNCTION:
SSL_dup 46 EXIST::FUNCTION:
SSL_dup_CA_list 47 EXIST::FUNCTION:
SSL_free 48 EXIST::FUNCTION:
SSL_get_certificate 49 EXIST::FUNCTION:
SSL_get_cipher_list 52 EXIST::FUNCTION:
SSL_get_ciphers 55 EXIST::FUNCTION:
SSL_get_client_CA_list 56 EXIST::FUNCTION:
SSL_get_default_timeout 57 EXIST::FUNCTION:
SSL_get_error 58 EXIST::FUNCTION:
SSL_get_fd 59 EXIST::FUNCTION:
SSL_get_peer_cert_chain 60 EXIST::FUNCTION:
SSL_get_peer_certificate 61 EXIST::FUNCTION:
SSL_get_rbio 63 EXIST::FUNCTION:BIO
SSL_get_read_ahead 64 EXIST::FUNCTION:
SSL_get_shared_ciphers 65 EXIST::FUNCTION:
SSL_get_ssl_method 66 EXIST::FUNCTION:
SSL_get_verify_callback 69 EXIST::FUNCTION:
SSL_get_verify_mode 70 EXIST::FUNCTION:
SSL_get_version 71 EXIST::FUNCTION:
SSL_get_wbio 72 EXIST::FUNCTION:BIO
SSL_load_client_CA_file 73 EXIST::FUNCTION:STDIO
SSL_load_error_strings 74 EXIST::FUNCTION:
SSL_new 75 EXIST::FUNCTION:
SSL_peek 76 EXIST::FUNCTION:
SSL_pending 77 EXIST::FUNCTION:
SSL_read 78 EXIST::FUNCTION:
SSL_renegotiate 79 EXIST::FUNCTION:
SSL_rstate_string 80 EXIST::FUNCTION:
SSL_rstate_string_long 81 EXIST::FUNCTION:
SSL_set_accept_state 82 EXIST::FUNCTION:
SSL_set_bio 83 EXIST::FUNCTION:BIO
SSL_set_cipher_list 84 EXIST::FUNCTION:
SSL_set_client_CA_list 85 EXIST::FUNCTION:
SSL_set_connect_state 86 EXIST::FUNCTION:
SSL_set_fd 87 EXIST::FUNCTION:SOCK
SSL_set_read_ahead 88 EXIST::FUNCTION:
SSL_set_rfd 89 EXIST::FUNCTION:SOCK
SSL_set_session 90 EXIST::FUNCTION:
SSL_set_ssl_method 91 EXIST::FUNCTION:
SSL_set_verify 94 EXIST::FUNCTION:
SSL_set_wfd 95 EXIST::FUNCTION:SOCK
SSL_shutdown 96 EXIST::FUNCTION:
SSL_state_string 97 EXIST::FUNCTION:
SSL_state_string_long 98 EXIST::FUNCTION:
SSL_use_PrivateKey 99 EXIST::FUNCTION:
SSL_use_PrivateKey_ASN1 100 EXIST::FUNCTION:
SSL_use_PrivateKey_file 101 EXIST::FUNCTION:STDIO
SSL_use_RSAPrivateKey 102 EXIST::FUNCTION:RSA
SSL_use_RSAPrivateKey_ASN1 103 EXIST::FUNCTION:RSA
SSL_use_RSAPrivateKey_file 104 EXIST::FUNCTION:RSA,STDIO
SSL_use_certificate 105 EXIST::FUNCTION:
SSL_use_certificate_ASN1 106 EXIST::FUNCTION:
SSL_use_certificate_file 107 EXIST::FUNCTION:STDIO
SSL_write 108 EXIST::FUNCTION:
SSLeay_add_ssl_algorithms 109 NOEXIST::FUNCTION:
SSLv23_client_method 110 EXIST::FUNCTION:RSA
SSLv23_method 111 EXIST::FUNCTION:RSA
SSLv23_server_method 112 EXIST::FUNCTION:RSA
SSLv2_client_method 113 EXIST::FUNCTION:RSA,SSL2
SSLv2_method 114 EXIST::FUNCTION:RSA,SSL2
SSLv2_server_method 115 EXIST::FUNCTION:RSA,SSL2
SSLv3_client_method 116 EXIST::FUNCTION:
SSLv3_method 117 EXIST::FUNCTION:
SSLv3_server_method 118 EXIST::FUNCTION:
d2i_SSL_SESSION 119 EXIST::FUNCTION:
i2d_SSL_SESSION 120 EXIST::FUNCTION:
BIO_f_ssl 121 EXIST::FUNCTION:BIO
BIO_new_ssl 122 EXIST::FUNCTION:BIO
BIO_proxy_ssl_copy_session_id 123 NOEXIST::FUNCTION:
BIO_ssl_copy_session_id 124 EXIST::FUNCTION:BIO
SSL_do_handshake 125 EXIST::FUNCTION:
SSL_get_privatekey 126 EXIST::FUNCTION:
SSL_get_current_cipher 127 EXIST::FUNCTION:
SSL_CIPHER_get_bits 128 EXIST::FUNCTION:
SSL_CIPHER_get_version 129 EXIST::FUNCTION:
SSL_CIPHER_get_name 130 EXIST::FUNCTION:
BIO_ssl_shutdown 131 EXIST::FUNCTION:BIO
SSL_SESSION_cmp 132 NOEXIST::FUNCTION:
SSL_SESSION_hash 133 NOEXIST::FUNCTION:
SSL_SESSION_get_time 134 EXIST::FUNCTION:
SSL_SESSION_set_time 135 EXIST::FUNCTION:
SSL_SESSION_get_timeout 136 EXIST::FUNCTION:
SSL_SESSION_set_timeout 137 EXIST::FUNCTION:
SSL_CTX_get_ex_data 138 EXIST::FUNCTION:
SSL_CTX_get_quiet_shutdown 140 EXIST::FUNCTION:
SSL_CTX_load_verify_locations 141 EXIST::FUNCTION:
SSL_CTX_set_default_verify_paths 142 EXIST:!VMS:FUNCTION:
SSL_CTX_set_def_verify_paths 142 EXIST:VMS:FUNCTION:
SSL_CTX_set_ex_data 143 EXIST::FUNCTION:
SSL_CTX_set_quiet_shutdown 145 EXIST::FUNCTION:
SSL_SESSION_get_ex_data 146 EXIST::FUNCTION:
SSL_SESSION_set_ex_data 148 EXIST::FUNCTION:
SSL_get_SSL_CTX 150 EXIST::FUNCTION:
SSL_get_ex_data 151 EXIST::FUNCTION:
SSL_get_quiet_shutdown 153 EXIST::FUNCTION:
SSL_get_session 154 EXIST::FUNCTION:
SSL_get_shutdown 155 EXIST::FUNCTION:
SSL_get_verify_result 157 EXIST::FUNCTION:
SSL_set_ex_data 158 EXIST::FUNCTION:
SSL_set_info_callback 160 EXIST::FUNCTION:
SSL_set_quiet_shutdown 161 EXIST::FUNCTION:
SSL_set_shutdown 162 EXIST::FUNCTION:
SSL_set_verify_result 163 EXIST::FUNCTION:
SSL_version 164 EXIST::FUNCTION:
SSL_get_info_callback 165 EXIST::FUNCTION:
SSL_state 166 EXIST::FUNCTION:
SSL_CTX_get_ex_new_index 167 EXIST::FUNCTION:
SSL_SESSION_get_ex_new_index 168 EXIST::FUNCTION:
SSL_get_ex_new_index 169 EXIST::FUNCTION:
TLSv1_method 170 EXIST::FUNCTION:
TLSv1_server_method 171 EXIST::FUNCTION:
TLSv1_client_method 172 EXIST::FUNCTION:
BIO_new_buffer_ssl_connect 173 EXIST::FUNCTION:BIO
BIO_new_ssl_connect 174 EXIST::FUNCTION:BIO
SSL_get_ex_data_X509_STORE_CTX_idx 175 EXIST:!VMS:FUNCTION:
SSL_get_ex_d_X509_STORE_CTX_idx 175 EXIST:VMS:FUNCTION:
SSL_CTX_set_tmp_dh_callback 176 EXIST::FUNCTION:DH
SSL_CTX_set_tmp_rsa_callback 177 EXIST::FUNCTION:RSA
SSL_CTX_set_timeout 178 EXIST::FUNCTION:
SSL_CTX_get_timeout 179 EXIST::FUNCTION:
SSL_CTX_get_cert_store 180 EXIST::FUNCTION:
SSL_CTX_set_cert_store 181 EXIST::FUNCTION:
SSL_want 182 EXIST::FUNCTION:
SSL_library_init 183 EXIST::FUNCTION:
SSL_COMP_add_compression_method 184 EXIST::FUNCTION:COMP
SSL_add_file_cert_subjects_to_stack 185 EXIST:!VMS:FUNCTION:STDIO
SSL_add_file_cert_subjs_to_stk 185 EXIST:VMS:FUNCTION:STDIO
SSL_set_tmp_rsa_callback 186 EXIST::FUNCTION:RSA
SSL_set_tmp_dh_callback 187 EXIST::FUNCTION:DH
SSL_add_dir_cert_subjects_to_stack 188 EXIST:!VMS:FUNCTION:STDIO
SSL_add_dir_cert_subjs_to_stk 188 EXIST:VMS:FUNCTION:STDIO
SSL_set_session_id_context 189 EXIST::FUNCTION:
SSL_CTX_use_certificate_chain_file 222 EXIST:!VMS:FUNCTION:STDIO
SSL_CTX_use_cert_chain_file 222 EXIST:VMS:FUNCTION:STDIO
SSL_CTX_set_verify_depth 225 EXIST::FUNCTION:
SSL_set_verify_depth 226 EXIST::FUNCTION:
SSL_CTX_get_verify_depth 228 EXIST::FUNCTION:
SSL_get_verify_depth 229 EXIST::FUNCTION:
SSL_CTX_set_session_id_context 231 EXIST::FUNCTION:
SSL_CTX_set_cert_verify_callback 232 EXIST:!VMS:FUNCTION:
SSL_CTX_set_cert_verify_cb 232 EXIST:VMS:FUNCTION:
SSL_CTX_set_default_passwd_cb_userdata 235 EXIST:!VMS:FUNCTION:
SSL_CTX_set_def_passwd_cb_ud 235 EXIST:VMS:FUNCTION:
SSL_set_purpose 236 EXIST::FUNCTION:
SSL_CTX_set_trust 237 EXIST::FUNCTION:
SSL_CTX_set_purpose 238 EXIST::FUNCTION:
SSL_set_trust 239 EXIST::FUNCTION:
SSL_get_finished 240 EXIST::FUNCTION:
SSL_get_peer_finished 241 EXIST::FUNCTION:
SSL_get1_session 242 EXIST::FUNCTION:
SSL_CTX_callback_ctrl 243 EXIST::FUNCTION:
SSL_callback_ctrl 244 EXIST::FUNCTION:
SSL_CTX_sessions 245 EXIST::FUNCTION:
SSL_get_rfd 246 EXIST::FUNCTION:
SSL_get_wfd 247 EXIST::FUNCTION:
kssl_cget_tkt 248 EXIST::FUNCTION:KRB5
SSL_has_matching_session_id 249 EXIST::FUNCTION:
kssl_err_set 250 EXIST::FUNCTION:KRB5
kssl_ctx_show 251 EXIST::FUNCTION:KRB5
kssl_validate_times 252 EXIST::FUNCTION:KRB5
kssl_check_authent 253 EXIST::FUNCTION:KRB5
kssl_ctx_new 254 EXIST::FUNCTION:KRB5
kssl_build_principal_2 255 EXIST::FUNCTION:KRB5
kssl_skip_confound 256 EXIST::FUNCTION:KRB5
kssl_sget_tkt 257 EXIST::FUNCTION:KRB5
SSL_set_generate_session_id 258 EXIST::FUNCTION:
kssl_ctx_setkey 259 EXIST::FUNCTION:KRB5
kssl_ctx_setprinc 260 EXIST::FUNCTION:KRB5
kssl_ctx_free 261 EXIST::FUNCTION:KRB5
kssl_krb5_free_data_contents 262 EXIST::FUNCTION:KRB5
kssl_ctx_setstring 263 EXIST::FUNCTION:KRB5
SSL_CTX_set_generate_session_id 264 EXIST::FUNCTION:
SSL_renegotiate_pending 265 EXIST::FUNCTION:
SSL_CTX_set_msg_callback 266 EXIST::FUNCTION:
SSL_set_msg_callback 267 EXIST::FUNCTION:
DTLSv1_client_method 268 EXIST::FUNCTION:
SSL_CTX_set_tmp_ecdh_callback 269 EXIST::FUNCTION:ECDH
SSL_set_tmp_ecdh_callback 270 EXIST::FUNCTION:ECDH
SSL_COMP_get_name 271 EXIST::FUNCTION:COMP
SSL_get_current_compression 272 EXIST::FUNCTION:COMP
DTLSv1_method 273 EXIST::FUNCTION:
SSL_get_current_expansion 274 EXIST::FUNCTION:COMP
DTLSv1_server_method 275 EXIST::FUNCTION:
SSL_COMP_get_compression_methods 276 EXIST:!VMS:FUNCTION:COMP
SSL_COMP_get_compress_methods 276 EXIST:VMS:FUNCTION:COMP
SSL_SESSION_get_id 277 EXIST::FUNCTION:
SSL_CTX_sess_set_new_cb 278 EXIST::FUNCTION:
SSL_CTX_sess_get_get_cb 279 EXIST::FUNCTION:
SSL_CTX_sess_set_get_cb 280 EXIST::FUNCTION:
SSL_CTX_set_cookie_verify_cb 281 EXIST::FUNCTION:
SSL_CTX_get_info_callback 282 EXIST::FUNCTION:
SSL_CTX_set_cookie_generate_cb 283 EXIST::FUNCTION:
SSL_CTX_set_client_cert_cb 284 EXIST::FUNCTION:
SSL_CTX_sess_set_remove_cb 285 EXIST::FUNCTION:
SSL_CTX_set_info_callback 286 EXIST::FUNCTION:
SSL_CTX_sess_get_new_cb 287 EXIST::FUNCTION:
SSL_CTX_get_client_cert_cb 288 EXIST::FUNCTION:
SSL_CTX_sess_get_remove_cb 289 EXIST::FUNCTION:
SSL_set_SSL_CTX 290 EXIST::FUNCTION:
SSL_get_servername 291 EXIST::FUNCTION:TLSEXT
SSL_get_servername_type 292 EXIST::FUNCTION:TLSEXT
SSL_CTX_set_client_cert_engine 293 EXIST::FUNCTION:ENGINE
SSL_CTX_use_psk_identity_hint 294 EXIST::FUNCTION:PSK
SSL_CTX_set_psk_client_callback 295 EXIST::FUNCTION:PSK
PEM_write_bio_SSL_SESSION 296 EXIST::FUNCTION:
SSL_get_psk_identity_hint 297 EXIST::FUNCTION:PSK
SSL_set_psk_server_callback 298 EXIST::FUNCTION:PSK
SSL_use_psk_identity_hint 299 EXIST::FUNCTION:PSK
SSL_set_psk_client_callback 300 EXIST::FUNCTION:PSK
PEM_read_SSL_SESSION 301 EXIST:!WIN16:FUNCTION:
PEM_read_bio_SSL_SESSION 302 EXIST::FUNCTION:
SSL_CTX_set_psk_server_callback 303 EXIST::FUNCTION:PSK
SSL_get_psk_identity 304 EXIST::FUNCTION:PSK
PEM_write_SSL_SESSION 305 EXIST:!WIN16:FUNCTION:
SSL_set_session_ticket_ext 306 EXIST::FUNCTION:
SSL_set_session_secret_cb 307 EXIST::FUNCTION:
SSL_set_session_ticket_ext_cb 308 EXIST::FUNCTION:
SSL_set1_param 309 EXIST::FUNCTION:
SSL_CTX_set1_param 310 EXIST::FUNCTION:

17
util/tab_num.pl Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/local/bin/perl
$num=1;
$width=40;
while (<>)
{
chop;
$i=length($_);
$n=$width-$i;
$i=int(($n+7)/8);
print $_.("\t" x $i).$num."\n";
$num++;
}

42
util/x86asm.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/sh
echo Generating x86 assember
echo Bignum
(cd crypto/bn/asm; perl x86.pl cpp > bn86unix.cpp)
(cd crypto/bn/asm; perl x86.pl win32 > bn-win32.asm)
echo DES
(cd crypto/des/asm; perl des-586.pl cpp > dx86unix.cpp)
(cd crypto/des/asm; perl des-586.pl win32 > d-win32.asm)
echo "crypt(3)"
(cd crypto/des/asm; perl crypt586.pl cpp > yx86unix.cpp)
(cd crypto/des/asm; perl crypt586.pl win32 > y-win32.asm)
echo Blowfish
(cd crypto/bf/asm; perl bf-586.pl cpp > bx86unix.cpp)
(cd crypto/bf/asm; perl bf-586.pl win32 > b-win32.asm)
echo CAST5
(cd crypto/cast/asm; perl cast-586.pl cpp > cx86unix.cpp)
(cd crypto/cast/asm; perl cast-586.pl win32 > c-win32.asm)
echo RC4
(cd crypto/rc4/asm; perl rc4-586.pl cpp > rx86unix.cpp)
(cd crypto/rc4/asm; perl rc4-586.pl win32 > r4-win32.asm)
echo MD5
(cd crypto/md5/asm; perl md5-586.pl cpp > mx86unix.cpp)
(cd crypto/md5/asm; perl md5-586.pl win32 > m5-win32.asm)
echo SHA1
(cd crypto/sha/asm; perl sha1-586.pl cpp > sx86unix.cpp)
(cd crypto/sha/asm; perl sha1-586.pl win32 > s1-win32.asm)
echo RIPEMD160
(cd crypto/ripemd/asm; perl rmd-586.pl cpp > rm86unix.cpp)
(cd crypto/ripemd/asm; perl rmd-586.pl win32 > rm-win32.asm)
echo RC5/32
(cd crypto/rc5/asm; perl rc5-586.pl cpp > r586unix.cpp)
(cd crypto/rc5/asm; perl rc5-586.pl win32 > r5-win32.asm)