From: afresh1 Date: Thu, 17 Apr 2014 19:20:52 +0000 (+0000) Subject: Remove unused ssl utils X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d1858455faeb6a7b9bc36c5e46135fc9e8945cb6;p=openbsd Remove unused ssl utils This code is the reason perl has a name as a write only language. ok deraadt miod --- diff --git a/lib/libcrypto/util/FreeBSD.sh b/lib/libcrypto/util/FreeBSD.sh deleted file mode 100644 index db8edfc6aa2..00000000000 --- a/lib/libcrypto/util/FreeBSD.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -perl util/perlpath.pl /usr/bin -perl util/ssldir.pl /usr/local -perl util/mk1mf.pl FreeBSD >Makefile.FreeBSD -perl Configure FreeBSD diff --git a/lib/libcrypto/util/add_cr.pl b/lib/libcrypto/util/add_cr.pl deleted file mode 100644 index c7b62c11ec9..00000000000 --- a/lib/libcrypto/util/add_cr.pl +++ /dev/null @@ -1,123 +0,0 @@ -#!/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=; - - 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 - } diff --git a/lib/libcrypto/util/ck_errf.pl b/lib/libcrypto/util/ck_errf.pl deleted file mode 100644 index f13af5c50b4..00000000000 --- a/lib/libcrypto/util/ck_errf.pl +++ /dev/null @@ -1,64 +0,0 @@ -#!/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 () - { - 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; - } - diff --git a/lib/libcrypto/util/clean-depend.pl b/lib/libcrypto/util/clean-depend.pl deleted file mode 100644 index d3525b0ed06..00000000000 --- a/lib/libcrypto/util/clean-depend.pl +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/local/bin/perl -w -# Clean the dependency list in a makefile of standard includes... -# Written by Ben Laurie 19 Jan 1999 - -use strict; - -while() { - print; - last if /^# DO NOT DELETE THIS LINE/; -} - -my %files; - -my $thisfile=""; -while() { - 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"; diff --git a/lib/libcrypto/util/copy.pl b/lib/libcrypto/util/copy.pl deleted file mode 100644 index eba6d5815e9..00000000000 --- a/lib/libcrypto/util/copy.pl +++ /dev/null @@ -1,70 +0,0 @@ -#!/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 $stripcr = 0; - -my $arg; - -foreach $arg (@ARGV) { - if ($arg eq "-stripcr") - { - $stripcr = 1; - next; - } - $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... - foreach (glob $arg) - { - 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) - { - if ($stripcr) - { - $buf =~ tr/\015//d; - } - syswrite(OUT, $buf, length($buf)); - } - close(IN); - close(OUT); - print "Copying: $_ to $dfile\n"; - } - - diff --git a/lib/libcrypto/util/deleof.pl b/lib/libcrypto/util/deleof.pl deleted file mode 100644 index 155acd88ff1..00000000000 --- a/lib/libcrypto/util/deleof.pl +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/local/bin/perl - -while (<>) - { - print - last if (/^# DO NOT DELETE THIS LINE/); - } diff --git a/lib/libcrypto/util/dirname.pl b/lib/libcrypto/util/dirname.pl deleted file mode 100644 index d7a66d96acc..00000000000 --- a/lib/libcrypto/util/dirname.pl +++ /dev/null @@ -1,18 +0,0 @@ -#!/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); diff --git a/lib/libcrypto/util/domd b/lib/libcrypto/util/domd deleted file mode 100644 index bab48cb7a27..00000000000 --- a/lib/libcrypto/util/domd +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# Do a makedepend, only leave out the standard headers -# Written by Ben Laurie 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 diff --git a/lib/libcrypto/util/err-ins.pl b/lib/libcrypto/util/err-ins.pl deleted file mode 100644 index 31b70df8d0e..00000000000 --- a/lib/libcrypto/util/err-ins.pl +++ /dev/null @@ -1,33 +0,0 @@ -#!/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=; -close(ERR); - -open(IN,$ARGV[1]) || die "unable to open header file '$ARGV[1]':$!\n"; - -@out=""; -while () - { - 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); - - diff --git a/lib/libcrypto/util/extract-names.pl b/lib/libcrypto/util/extract-names.pl deleted file mode 100644 index 35bd6ed8432..00000000000 --- a/lib/libcrypto/util/extract-names.pl +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/perl - -$/ = ""; # Eat a paragraph at once. -while() { - 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"; - diff --git a/lib/libcrypto/util/extract-section.pl b/lib/libcrypto/util/extract-section.pl deleted file mode 100644 index 7a0ba4f69a7..00000000000 --- a/lib/libcrypto/util/extract-section.pl +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/perl - -while() { - if (/=for\s+comment\s+openssl_manual_section:(\S+)/) - { - print "$1\n"; - exit 0; - } -} - -print "$ARGV[0]\n"; - diff --git a/lib/libcrypto/util/files.pl b/lib/libcrypto/util/files.pl deleted file mode 100644 index 41f033e3b9a..00000000000 --- a/lib/libcrypto/util/files.pl +++ /dev/null @@ -1,61 +0,0 @@ -#!/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"; diff --git a/lib/libcrypto/util/install.sh b/lib/libcrypto/util/install.sh deleted file mode 100644 index e1d0c982df5..00000000000 --- a/lib/libcrypto/util/install.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/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 diff --git a/lib/libcrypto/util/mk1mf.pl b/lib/libcrypto/util/mk1mf.pl deleted file mode 100644 index 48de99f66c5..00000000000 --- a/lib/libcrypto/util/mk1mf.pl +++ /dev/null @@ -1,1230 +0,0 @@ -#!/usr/local/bin/perl -# A bit of an evil hack but it post processes the file ../MINFO which -# is generated by `make files` in the top directory. -# This script outputs one mega makefile that has no shell stuff or any -# funny stuff -# - -$INSTALLTOP="/usr/local/ssl"; -$OPENSSLDIR="/usr/local/ssl"; -$OPTIONS=""; -$ssl_version=""; -$banner="\t\@echo Building OpenSSL"; - -my $no_static_engine = 1; -my $engines = ""; -my $otherlibs = ""; -local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic -local $zlib_lib = ""; -local $perl_asm = 0; # 1 to autobuild asm files from perl scripts - -my $ex_l_libs = ""; - -# Options to import from top level Makefile - -my %mf_import = ( - VERSION => \$ssl_version, - OPTIONS => \$OPTIONS, - INSTALLTOP => \$INSTALLTOP, - OPENSSLDIR => \$OPENSSLDIR, - PLATFORM => \$mf_platform, - CFLAG => \$mf_cflag, - DEPFLAG => \$mf_depflag, - CPUID_OBJ => \$mf_cpuid_asm, - BN_ASM => \$mf_bn_asm, - DES_ENC => \$mf_des_asm, - AES_ENC => \$mf_aes_asm, - BF_ENC => \$mf_bf_asm, - CAST_ENC => \$mf_cast_asm, - RC4_ENC => \$mf_rc4_asm, - RC5_ENC => \$mf_rc5_asm, - MD5_ASM_OBJ => \$mf_md5_asm, - SHA1_ASM_OBJ => \$mf_sha_asm, - RMD160_ASM_OBJ => \$mf_rmd_asm, - WP_ASM_OBJ => \$mf_wp_asm, - CMLL_ENC => \$mf_cm_asm, - BASEADDR => \$baseaddr, - FIPSDIR => \$fipsdir, -); - - -open(IN,") { - my ($mf_opt, $mf_ref); - while (($mf_opt, $mf_ref) = each %mf_import) { - if (/^$mf_opt\s*=\s*(.*)$/) { - $$mf_ref = $1; - } - } -} -close(IN); - -$debug = 1 if $mf_platform =~ /^debug-/; - -die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq ""; - -$infile="MINFO"; - -%ops=( - "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", - "VC-WIN64I", "Microsoft C/C++ - Win64/IA-64", - "VC-WIN64A", "Microsoft C/C++ - Win64/x64", - "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", - "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", - "Mingw32", "GNU C++ - Windows NT or 9x", - "Mingw32-files", "Create files with DOS copy ...", - "BC-NT", "Borland C++ 4.5 - Windows NT", - "linux-elf","Linux elf", - "ultrix-mips","DEC mips ultrix", - "FreeBSD","FreeBSD distribution", - "OS2-EMX", "EMX GCC OS/2", - "netware-clib", "CodeWarrior for NetWare - CLib - with WinSock Sockets", - "netware-clib-bsdsock", "CodeWarrior for NetWare - CLib - with BSD Sockets", - "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets", - "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets", - "default","cc under unix", - "auto", "auto detect from top level Makefile" - ); - -$platform=""; -my $xcflags=""; -foreach (@ARGV) - { - if (!&read_options && !defined($ops{$_})) - { - print STDERR "unknown option - $_\n"; - print STDERR "usage: perl mk1mf.pl [options] [system]\n"; - print STDERR "\nwhere [system] can be one of the following\n"; - foreach $i (sort keys %ops) - { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; } - print STDERR <<"EOF"; -and [options] can be one of - no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest - no-ripemd - no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher - no-bf no-cast no-aes no-camellia no-seed - no-rsa no-dsa no-dh - Skip this public key cipher - no-ssl2 no-ssl3 - Skip this version of SSL - just-ssl - remove all non-ssl keys/digest - no-asm - No x86 asm - no-krb5 - No KRB5 - no-srp - No SRP - no-ec - No EC - no-ecdsa - No ECDSA - no-ecdh - No ECDH - no-engine - No engine - no-hw - No hw - nasm - Use NASM for x86 asm - nw-nasm - Use NASM x86 asm for NetWare - nw-mwasm - Use Metrowerks x86 asm for NetWare - gaswin - Use GNU as with Mingw32 - no-socks - No socket code - no-err - No error strings - dll/shlib - Build shared libraries (MS) - debug - Debug build - profile - Profiling build - gcc - Use Gcc (unix) - -Values that can be set -TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler - --L -l - extra library flags (unix) -- - extra 'cc' flags, - added (MS), or replace (unix) -EOF - exit(1); - } - $platform=$_; - } -foreach (grep(!/^$/, split(/ /, $OPTIONS))) - { - print STDERR "unknown option - $_\n" if !&read_options; - } - -$no_static_engine = 0 if (!$shlib); - -$no_mdc2=1 if ($no_des); - -$no_ssl3=1 if ($no_md5 || $no_sha); -$no_ssl3=1 if ($no_rsa && $no_dh); - -$no_ssl2=1 if ($no_md5); -$no_ssl2=1 if ($no_rsa); - -$out_def="out"; -$inc_def="outinc"; -$tmp_def="tmp"; - -$perl="perl" unless defined $perl; -$mkdir="-mkdir" unless defined $mkdir; - -($ssl,$crypto)=("ssl","crypto"); -$ranlib="echo ranlib"; - -$cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; -$src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.'; -$bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:''; - -# $bin_dir.=$o causes a core dump on my sparc :-( - - -$NT=0; - -push(@INC,"util/pl","pl"); - -if ($platform eq "auto") { - $platform = $mf_platform; - print STDERR "Imported platform $mf_platform\n"; -} - -if (($platform =~ /VC-(.+)/)) - { - $FLAVOR=$1; - $NT = 1 if $1 eq "NT"; - require 'VC-32.pl'; - } -elsif ($platform eq "Mingw32") - { - require 'Mingw32.pl'; - } -elsif ($platform eq "Mingw32-files") - { - require 'Mingw32f.pl'; - } -elsif ($platform eq "BC-NT") - { - $bc=1; - require 'BC-32.pl'; - } -elsif ($platform eq "FreeBSD") - { - require 'unix.pl'; - $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer'; - } -elsif ($platform eq "linux-elf") - { - require "unix.pl"; - require "linux.pl"; - $unix=1; - } -elsif ($platform eq "ultrix-mips") - { - require "unix.pl"; - require "ultrix.pl"; - $unix=1; - } -elsif ($platform eq "OS2-EMX") - { - $wc=1; - require 'OS2-EMX.pl'; - } -elsif (($platform eq "netware-clib") || ($platform eq "netware-libc") || - ($platform eq "netware-clib-bsdsock") || ($platform eq "netware-libc-bsdsock")) - { - $LIBC=1 if $platform eq "netware-libc" || $platform eq "netware-libc-bsdsock"; - $BSDSOCK=1 if ($platform eq "netware-libc-bsdsock") || ($platform eq "netware-clib-bsdsock"); - require 'netware.pl'; - } -else - { - require "unix.pl"; - - $unix=1; - $cflags.=' -DTERMIO'; - } - -$fipsdir =~ s/\//${o}/g; - -$out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":""); -$tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":""); -$inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def; - -$bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); - -$cflags= "$xcflags$cflags" if $xcflags ne ""; - -$cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; -$cflags.=" -DOPENSSL_NO_AES" if $no_aes; -$cflags.=" -DOPENSSL_NO_CAMELLIA" if $no_camellia; -$cflags.=" -DOPENSSL_NO_SEED" if $no_seed; -$cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; -$cflags.=" -DOPENSSL_NO_RC4" if $no_rc4; -$cflags.=" -DOPENSSL_NO_RC5" if $no_rc5; -$cflags.=" -DOPENSSL_NO_MD2" if $no_md2; -$cflags.=" -DOPENSSL_NO_MD4" if $no_md4; -$cflags.=" -DOPENSSL_NO_MD5" if $no_md5; -$cflags.=" -DOPENSSL_NO_SHA" if $no_sha; -$cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; -$cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd; -$cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; -$cflags.=" -DOPENSSL_NO_BF" if $no_bf; -$cflags.=" -DOPENSSL_NO_CAST" if $no_cast; -$cflags.=" -DOPENSSL_NO_DES" if $no_des; -$cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; -$cflags.=" -DOPENSSL_NO_DSA" if $no_dsa; -$cflags.=" -DOPENSSL_NO_DH" if $no_dh; -$cflags.=" -DOPENSSL_NO_WHIRLPOOL" if $no_whirlpool; -$cflags.=" -DOPENSSL_NO_SOCK" if $no_sock; -$cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2; -$cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; -$cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext; -$cflags.=" -DOPENSSL_NO_SRP" if $no_srp; -$cflags.=" -DOPENSSL_NO_CMS" if $no_cms; -$cflags.=" -DOPENSSL_NO_ERR" if $no_err; -$cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; -$cflags.=" -DOPENSSL_NO_EC" if $no_ec; -$cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa; -$cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; -$cflags.=" -DOPENSSL_NO_GOST" if $no_gost; -$cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; -$cflags.=" -DOPENSSL_NO_HW" if $no_hw; -$cflags.=" -DOPENSSL_FIPS" if $fips; -$cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; -$cflags.=" -DOPENSSL_NO_EC2M" if $no_ec2m; -$cflags.= " -DZLIB" if $zlib_opt; -$cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; - -if ($no_static_engine) - { - $cflags .= " -DOPENSSL_NO_STATIC_ENGINE"; - } -else - { - $cflags .= " -DOPENSSL_NO_DYNAMIC_ENGINE"; - } - -#$cflags.=" -DRSAref" if $rsaref ne ""; - -## if ($unix) -## { $cflags="$c_flags" if ($c_flags ne ""); } -##else - { $cflags="$c_flags$cflags" if ($c_flags ne ""); } - -$ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); - - -%shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", - "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); - -if ($msdos) - { - $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n"; - $banner.="\t\@echo top level directory, if you don't have perl, you will\n"; - $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n"; - $banner.="\t\@echo documentation for details.\n"; - } - -# have to do this to allow $(CC) under unix -$link="$bin_dir$link" if ($link !~ /^\$/); - -$INSTALLTOP =~ s|/|$o|g; -$OPENSSLDIR =~ s|/|$o|g; - -############################################# -# We parse in input file and 'store' info for later printing. -open(IN,"<$infile") || die "unable to open $infile:$!\n"; -$_=; -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 "KRB5_INCLUDES") - { $cflags .= " $val";} - - if ($key eq "ZLIB_INCLUDE") - { $cflags .= " $val" if $val ne "";} - - if ($key eq "LIBZLIB") - { $zlib_lib = "$val" if $val ne "";} - - if ($key eq "LIBKRB5") - { $ex_libs .= " $val" if $val ne "";} - - if ($key eq "TEST") - { $test.=&var_add($dir,$val, 0); } - - if (($key eq "PROGS") || ($key eq "E_OBJ")) - { $e_exe.=&var_add($dir,$val, 0); } - - if ($key eq "LIB") - { - $lib=$val; - $lib =~ s/^.*\/([^\/]+)$/$1/; - } - if ($key eq "LIBNAME" && $no_static_engine) - { - $lib=$val; - $lib =~ s/^.*\/([^\/]+)$/$1/; - $otherlibs .= " $lib"; - } - - if ($key eq "EXHEADER") - { $exheader.=&var_add($dir,$val, 1); } - - if ($key eq "HEADER") - { $header.=&var_add($dir,$val, 1); } - - if ($key eq "LIBOBJ" && ($dir ne "engines" || !$no_static_engine)) - { $libobj=&var_add($dir,$val, 0); } - if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine) - { $engines.=$val } - - if (!($_=)) - { $_="RELATIVE_DIRECTORY=FINISHED\n"; } - } -close(IN); - -if ($shlib) - { - $extra_install= <<"EOF"; - \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}bin\" - \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}bin\" - \$(CP) \"\$(L_SSL)\" \"\$(INSTALLTOP)${o}lib\" - \$(CP) \"\$(L_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" -EOF - if ($no_static_engine) - { - $extra_install .= <<"EOF" - \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\" - \$(CP) \"\$(E_SHLIB)\" \"\$(INSTALLTOP)${o}lib${o}engines\" -EOF - } - } -else - { - $extra_install= <<"EOF"; - \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}lib\" - \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" -EOF - $ex_libs .= " $zlib_lib" if $zlib_opt == 1; - if ($fips) - { - $build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)"; - $ex_l_libs .= " \$(O_FIPSCANISTER)"; - } - } - -$defs= <<"EOF"; -# This makefile has been automatically generated from the OpenSSL distribution. -# This single makefile will build the complete OpenSSL distribution and -# by default leave the 'intertesting' output files in .${o}out and the stuff -# that needs deleting in .${o}tmp. -# The file was generated by running 'make makefile.one', which -# does a 'make files', which writes all the environment variables from all -# the makefiles to the file call MINFO. This file is used by -# util${o}mk1mf.pl to generate makefile.one. -# The 'makefile per directory' system suites me when developing this -# library and also so I can 'distribute' indervidual library sections. -# The one monster makefile better suits building in non-unix -# environments. - -EOF - -$defs .= $preamble if defined $preamble; - -$defs.= <<"EOF"; -INSTALLTOP=$INSTALLTOP -OPENSSLDIR=$OPENSSLDIR - -# Set your compiler options -PLATFORM=$platform -CC=$bin_dir${cc} -CFLAG=$cflags -APP_CFLAG=$app_cflag -LIB_CFLAG=$lib_cflag -SHLIB_CFLAG=$shl_cflag -APP_EX_OBJ=$app_ex_obj -SHLIB_EX_OBJ=$shlib_ex_obj -# add extra libraries to this define, for solaris -lsocket -lnsl would -# be added -EX_LIBS=$ex_libs - -# The OpenSSL directory -SRC_D=$src_dir - -LINK=$link -LFLAGS=$lflags -RSC=$rsc - -# The output directory for everything intersting -OUT_D=$out_dir -# The output directory for all the temporary muck -TMP_D=$tmp_dir -# The output directory for the header files -INC_D=$inc_dir -INCO_D=$inc_dir${o}openssl - -PERL=$perl -CP=$cp -RM=$rm -RANLIB=$ranlib -MKDIR=$mkdir -MKLIB=$bin_dir$mklib -MLFLAGS=$mlflags -ASM=$bin_dir$asm - -# FIPS validated module and support file locations - -FIPSDIR=$fipsdir -BASEADDR=$baseaddr -FIPSLIB_D=\$(FIPSDIR)${o}lib -FIPS_PREMAIN_SRC=\$(FIPSLIB_D)${o}fips_premain.c -O_FIPSCANISTER=\$(FIPSLIB_D)${o}fipscanister.lib -FIPS_SHA1_EXE=\$(FIPSDIR)${o}bin${o}fips_standalone_sha1${exep} -E_PREMAIN_DSO=fips_premain_dso -PREMAIN_DSO_EXE=\$(BIN_D)${o}fips_premain_dso$exep -FIPSLINK=\$(PERL) \$(FIPSDIR)${o}bin${o}fipslink.pl - -###################################################### -# You should not need to touch anything below this point -###################################################### - -E_EXE=openssl -SSL=$ssl -CRYPTO=$crypto - -# BIN_D - Binary output directory -# TEST_D - Binary test file output directory -# LIB_D - library output directory -# ENG_D - dynamic engine output directory -# Note: if you change these point to different directories then uncomment out -# the lines around the 'NB' comment below. -# -BIN_D=\$(OUT_D) -TEST_D=\$(OUT_D) -LIB_D=\$(OUT_D) -ENG_D=\$(OUT_D) - -# INCL_D - local library directory -# OBJ_D - temp object file directory -OBJ_D=\$(TMP_D) -INCL_D=\$(TMP_D) - -O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp -O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp -SO_SSL= $plib\$(SSL)$so_shlibp -SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp -L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp -L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp - -L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs - -###################################################### -# Don't touch anything below this point -###################################################### - -INC=-I\$(INC_D) -I\$(INCL_D) -APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) -LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) -SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) -LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) - -############################################# -EOF - -$rules=<<"EOF"; -all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe $build_targets - -banner: -$banner - -\$(TMP_D): - \$(MKDIR) \"\$(TMP_D)\" -# NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different -#\$(BIN_D): -# \$(MKDIR) \$(BIN_D) -# -#\$(TEST_D): -# \$(MKDIR) \$(TEST_D) - -\$(LIB_D): - \$(MKDIR) \"\$(LIB_D)\" - -\$(INCO_D): \$(INC_D) - \$(MKDIR) \"\$(INCO_D)\" - -\$(INC_D): - \$(MKDIR) \"\$(INC_D)\" - -headers: \$(HEADER) \$(EXHEADER) - @ - -lib: \$(LIBS_DEP) \$(E_SHLIB) - -exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep - -install: all - \$(MKDIR) \"\$(INSTALLTOP)\" - \$(MKDIR) \"\$(INSTALLTOP)${o}bin\" - \$(MKDIR) \"\$(INSTALLTOP)${o}include\" - \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\" - \$(MKDIR) \"\$(INSTALLTOP)${o}lib\" - \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\" - \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\" - \$(MKDIR) \"\$(OPENSSLDIR)\" - \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\" -$extra_install - - -test: \$(T_EXE) - cd \$(BIN_D) - ..${o}ms${o}test - -clean: - \$(RM) \$(TMP_D)$o*.* - -vclean: - \$(RM) \$(TMP_D)$o*.* - \$(RM) \$(OUT_D)$o*.* - -EOF - -my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform"; -$platform_cpp_symbol =~ s/-/_/g; -if (open(IN,"crypto/buildinf.h")) - { - # Remove entry for this platform in existing file buildinf.h. - - my $old_buildinf_h = ""; - while () - { - if (/^\#ifdef $platform_cpp_symbol$/) - { - while () { last if (/^\#endif/); } - } - else - { - $old_buildinf_h .= $_; - } - } - close(IN); - - open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h"; - print OUT $old_buildinf_h; - close(OUT); - } - -open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h"; -printf OUT < \$no_rc2, - "no-rc4" => \$no_rc4, - "no-rc5" => \$no_rc5, - "no-idea" => \$no_idea, - "no-aes" => \$no_aes, - "no-camellia" => \$no_camellia, - "no-seed" => \$no_seed, - "no-des" => \$no_des, - "no-bf" => \$no_bf, - "no-cast" => \$no_cast, - "no-md2" => \$no_md2, - "no-md4" => \$no_md4, - "no-md5" => \$no_md5, - "no-sha" => \$no_sha, - "no-sha1" => \$no_sha1, - "no-ripemd" => \$no_ripemd, - "no-mdc2" => \$no_mdc2, - "no-whirlpool" => \$no_whirlpool, - "no-patents" => - [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa], - "no-rsa" => \$no_rsa, - "no-dsa" => \$no_dsa, - "no-dh" => \$no_dh, - "no-hmac" => \$no_hmac, - "no-asm" => \$no_asm, - "nasm" => \$nasm, - "nw-nasm" => \$nw_nasm, - "nw-mwasm" => \$nw_mwasm, - "gaswin" => \$gaswin, - "no-ssl2" => \$no_ssl2, - "no-ssl3" => \$no_ssl3, - "no-tlsext" => \$no_tlsext, - "no-srp" => \$no_srp, - "no-cms" => \$no_cms, - "no-ec2m" => \$no_ec2m, - "no-jpake" => \$no_jpake, - "no-ec_nistp_64_gcc_128" => 0, - "no-err" => \$no_err, - "no-sock" => \$no_sock, - "no-krb5" => \$no_krb5, - "no-ec" => \$no_ec, - "no-ecdsa" => \$no_ecdsa, - "no-ecdh" => \$no_ecdh, - "no-gost" => \$no_gost, - "no-engine" => \$no_engine, - "no-hw" => \$no_hw, - "no-rsax" => 0, - "just-ssl" => - [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast, - \$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh, - \$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5, - \$no_aes, \$no_camellia, \$no_seed, \$no_srp], - "rsaref" => 0, - "gcc" => \$gcc, - "debug" => \$debug, - "profile" => \$profile, - "shlib" => \$shlib, - "dll" => \$shlib, - "shared" => 0, - "no-sctp" => 0, - "no-gmp" => 0, - "no-rfc3779" => 0, - "no-montasm" => 0, - "no-shared" => 0, - "no-store" => 0, - "no-zlib" => 0, - "no-zlib-dynamic" => 0, - "fips" => \$fips - ); - - if (exists $valid_options{$_}) - { - my $r = $valid_options{$_}; - if ( ref $r eq "SCALAR") - { $$r = 1;} - elsif ( ref $r eq "ARRAY") - { - my $r2; - foreach $r2 (@$r) - { - $$r2 = 1; - } - } - } - elsif (/^no-comp$/) { $xcflags = "-DOPENSSL_NO_COMP $xcflags"; } - elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 } - elsif (/^enable-zlib-dynamic$/) - { - $zlib_opt = 2; - } - elsif (/^no-static-engine/) - { - $no_static_engine = 1; - } - elsif (/^enable-static-engine/) - { - $no_static_engine = 0; - } - # There are also enable-xxx options which correspond to - # the no-xxx. Since the scalars are enabled by default - # these can be ignored. - elsif (/^enable-/) - { - my $t = $_; - $t =~ s/^enable/no/; - if (exists $valid_options{$t}) - {return 1;} - return 0; - } - # experimental-xxx is mostly like enable-xxx, but opensslconf.v - # will still set OPENSSL_NO_xxx unless we set OPENSSL_EXPERIMENTAL_xxx. - # (No need to fail if we don't know the algorithm -- this is for adventurous users only.) - elsif (/^experimental-/) - { - my $algo, $ALGO; - ($algo = $_) =~ s/^experimental-//; - ($ALGO = $algo) =~ tr/[a-z]/[A-Z]/; - - $xcflags="-DOPENSSL_EXPERIMENTAL_$ALGO $xcflags"; - - } - elsif (/^--with-krb5-flavor=(.*)$/) - { - my $krb5_flavor = $1; - if ($krb5_flavor =~ /^force-[Hh]eimdal$/) - { - $xcflags="-DKRB5_HEIMDAL $xcflags"; - } - elsif ($krb5_flavor =~ /^MIT/i) - { - $xcflags="-DKRB5_MIT $xcflags"; - if ($krb5_flavor =~ /^MIT[._-]*1[._-]*[01]/i) - { - $xcflags="-DKRB5_MIT_OLD11 $xcflags" - } - } - } - elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } - elsif (/^-[lL].*$/) { $l_flags.="$_ "; } - elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) - { $c_flags.="$_ "; } - else { return(0); } - return(1); - } diff --git a/lib/libcrypto/util/mkcerts.sh b/lib/libcrypto/util/mkcerts.sh deleted file mode 100644 index 0184fcb70ec..00000000000 --- a/lib/libcrypto/util/mkcerts.sh +++ /dev/null @@ -1,220 +0,0 @@ -#!/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 </dev/null </dev/null </dev/null </dev/null <> 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 - diff --git a/lib/libcrypto/util/mkdef.pl b/lib/libcrypto/util/mkdef.pl deleted file mode 100644 index 9a8c7b87d1a..00000000000 --- a/lib/libcrypto/util/mkdef.pl +++ /dev/null @@ -1,1539 +0,0 @@ -#!/usr/local/bin/perl -w -# -# generate a .def file -# -# It does this by parsing the header files and looking for the -# prototyped functions: it then prunes the output. -# -# Intermediary files are created, call libeay.num and ssleay.num,... -# Previously, they had the following format: -# -# routine-name nnnn -# -# But that isn't enough for a number of reasons, the first on being that -# this format is (needlessly) very Win32-centric, and even then... -# One of the biggest problems is that there's no information about what -# routines should actually be used, which varies with what crypto algorithms -# are disabled. Also, some operating systems (for example VMS with VAX C) -# need to keep track of the global variables as well as the functions. -# -# So, a remake of this script is done so as to include information on the -# kind of symbol it is (function or variable) and what algorithms they're -# part of. This will allow easy translating to .def files or the corresponding -# file in other operating systems (a .opt file for VMS, possibly with a .mar -# file). -# -# The format now becomes: -# -# routine-name nnnn info -# -# and the "info" part is actually a colon-separated string of fields with -# the following meaning: -# -# existence:platform:kind:algorithms -# -# - "existence" can be "EXIST" or "NOEXIST" depending on if the symbol is -# found somewhere in the source, -# - "platforms" is empty if it exists on all platforms, otherwise it contains -# comma-separated list of the platform, just as they are if the symbol exists -# for those platforms, or prepended with a "!" if not. This helps resolve -# symbol name variants for platforms where the names are too long for the -# compiler or linker, or if the systems is case insensitive and there is a -# clash, or the symbol is implemented differently (see -# EXPORT_VAR_AS_FUNCTION). This script assumes renaming of symbols is found -# in the file crypto/symhacks.h. -# The semantics for the platforms is that every item is checked against the -# environment. For the negative items ("!FOO"), if any of them is false -# (i.e. "FOO" is true) in the environment, the corresponding symbol can't be -# used. For the positive itms, if all of them are false in the environment, -# the corresponding symbol can't be used. Any combination of positive and -# negative items are possible, and of course leave room for some redundancy. -# - "kind" is "FUNCTION" or "VARIABLE". The meaning of that is obvious. -# - "algorithms" is a comma-separated list of algorithm names. This helps -# exclude symbols that are part of an algorithm that some user wants to -# exclude. -# - -my $debug=0; - -my $crypto_num= "util/libeay.num"; -my $ssl_num= "util/ssleay.num"; -my $libname; - -my $do_update = 0; -my $do_rewrite = 1; -my $do_crypto = 0; -my $do_ssl = 0; -my $do_ctest = 0; -my $do_ctestall = 0; -my $do_checkexist = 0; - -my $VMSVAX=0; -my $VMSNonVAX=0; -my $VMS=0; -my $W32=0; -my $W16=0; -my $NT=0; -my $OS2=0; -# Set this to make typesafe STACK definitions appear in DEF -my $safe_stack_def = 0; - -my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", - "EXPORT_VAR_AS_FUNCTION", "ZLIB", "OPENSSL_FIPS" ); -my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); -my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", - "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", - "SHA256", "SHA512", "RIPEMD", - "MDC2", "WHIRLPOOL", "RSA", "DSA", "DH", "EC", "ECDH", "ECDSA", "EC2M", - "HMAC", "AES", "CAMELLIA", "SEED", "GOST", - # EC_NISTP_64_GCC_128 - "EC_NISTP_64_GCC_128", - # Envelope "algorithms" - "EVP", "X509", "ASN1_TYPEDEFS", - # Helper "algorithms" - "BIO", "COMP", "BUFFER", "LHASH", "STACK", "ERR", - "LOCKING", - # External "algorithms" - "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM", - # Engines - "STATIC_ENGINE", "ENGINE", "HW", "GMP", - # RFC3779 - "RFC3779", - # TLS - "TLSEXT", "PSK", "SRP", "HEARTBEATS", - # CMS - "CMS", - # CryptoAPI Engine - "CAPIENG", - # SSL v2 - "SSL2", - # JPAKE - "JPAKE", - # NEXTPROTONEG - "NEXTPROTONEG", - # Deprecated functions - "DEPRECATED", - # Hide SSL internals - "SSL_INTERN", - # SCTP - "SCTP"); - -my $options=""; -open(IN,") { - $options=$1 if (/^OPTIONS=(.*)$/); -} -close(IN); - -# The following ciphers may be excluded (by Configure). This means functions -# defined with ifndef(NO_XXX) are not included in the .def file, and everything -# in directory xxx is ignored. -my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf; -my $no_cast; my $no_whirlpool; my $no_camellia; my $no_seed; -my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2; -my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; -my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw; -my $no_fp_api; my $no_static_engine=1; my $no_gmp; my $no_deprecated; -my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng; -my $no_jpake; my $no_srp; my $no_ssl2; my $no_ec2m; my $no_nistp_gcc; -my $no_nextprotoneg; my $no_sctp; - -my $fips; - -my $zlib; - - -foreach (@ARGV, split(/ /, $options)) - { - $debug=1 if $_ eq "debug"; - $W32=1 if $_ eq "32"; - $W16=1 if $_ eq "16"; - if($_ eq "NT") { - $W32 = 1; - $NT = 1; - } - if ($_ eq "VMS-VAX") { - $VMS=1; - $VMSVAX=1; - } - if ($_ eq "VMS-NonVAX") { - $VMS=1; - $VMSNonVAX=1; - } - $VMS=1 if $_ eq "VMS"; - $OS2=1 if $_ eq "OS2"; - $fips=1 if /^fips/; - if ($_ eq "zlib" || $_ eq "enable-zlib" || $_ eq "zlib-dynamic" - || $_ eq "enable-zlib-dynamic") { - $zlib = 1; - } - - $do_ssl=1 if $_ eq "ssleay"; - if ($_ eq "ssl") { - $do_ssl=1; - $libname=$_ - } - $do_crypto=1 if $_ eq "libeay"; - if ($_ eq "crypto") { - $do_crypto=1; - $libname=$_; - } - $no_static_engine=1 if $_ eq "no-static-engine"; - $no_static_engine=0 if $_ eq "enable-static-engine"; - $do_update=1 if $_ eq "update"; - $do_rewrite=1 if $_ eq "rewrite"; - $do_ctest=1 if $_ eq "ctest"; - $do_ctestall=1 if $_ eq "ctestall"; - $do_checkexist=1 if $_ eq "exist"; - #$safe_stack_def=1 if $_ eq "-DDEBUG_SAFESTACK"; - - if (/^no-rc2$/) { $no_rc2=1; } - elsif (/^no-rc4$/) { $no_rc4=1; } - elsif (/^no-rc5$/) { $no_rc5=1; } - elsif (/^no-idea$/) { $no_idea=1; } - elsif (/^no-des$/) { $no_des=1; $no_mdc2=1; } - elsif (/^no-bf$/) { $no_bf=1; } - elsif (/^no-cast$/) { $no_cast=1; } - elsif (/^no-whirlpool$/) { $no_whirlpool=1; } - elsif (/^no-md2$/) { $no_md2=1; } - elsif (/^no-md4$/) { $no_md4=1; } - elsif (/^no-md5$/) { $no_md5=1; } - elsif (/^no-sha$/) { $no_sha=1; } - elsif (/^no-ripemd$/) { $no_ripemd=1; } - elsif (/^no-mdc2$/) { $no_mdc2=1; } - elsif (/^no-rsa$/) { $no_rsa=1; } - elsif (/^no-dsa$/) { $no_dsa=1; } - elsif (/^no-dh$/) { $no_dh=1; } - elsif (/^no-ec$/) { $no_ec=1; } - elsif (/^no-ecdsa$/) { $no_ecdsa=1; } - elsif (/^no-ecdh$/) { $no_ecdh=1; } - elsif (/^no-hmac$/) { $no_hmac=1; } - elsif (/^no-aes$/) { $no_aes=1; } - elsif (/^no-camellia$/) { $no_camellia=1; } - elsif (/^no-seed$/) { $no_seed=1; } - elsif (/^no-evp$/) { $no_evp=1; } - elsif (/^no-lhash$/) { $no_lhash=1; } - elsif (/^no-stack$/) { $no_stack=1; } - elsif (/^no-err$/) { $no_err=1; } - elsif (/^no-buffer$/) { $no_buffer=1; } - elsif (/^no-bio$/) { $no_bio=1; } - #elsif (/^no-locking$/) { $no_locking=1; } - elsif (/^no-comp$/) { $no_comp=1; } - elsif (/^no-dso$/) { $no_dso=1; } - elsif (/^no-krb5$/) { $no_krb5=1; } - elsif (/^no-engine$/) { $no_engine=1; } - elsif (/^no-hw$/) { $no_hw=1; } - elsif (/^no-gmp$/) { $no_gmp=1; } - elsif (/^no-rfc3779$/) { $no_rfc3779=1; } - elsif (/^no-tlsext$/) { $no_tlsext=1; } - elsif (/^no-cms$/) { $no_cms=1; } - elsif (/^no-ec2m$/) { $no_ec2m=1; } - elsif (/^no-ec_nistp_64_gcc_128$/) { $no_nistp_gcc=1; } - elsif (/^no-nextprotoneg$/) { $no_nextprotoneg=1; } - elsif (/^no-ssl2$/) { $no_ssl2=1; } - elsif (/^no-capieng$/) { $no_capieng=1; } - elsif (/^no-jpake$/) { $no_jpake=1; } - elsif (/^no-srp$/) { $no_srp=1; } - elsif (/^no-sctp$/) { $no_sctp=1; } - } - - -if (!$libname) { - if ($do_ssl) { - $libname="SSLEAY"; - } - if ($do_crypto) { - $libname="LIBEAY"; - } -} - -# If no platform is given, assume WIN32 -if ($W32 + $W16 + $VMS + $OS2 == 0) { - $W32 = 1; -} - -# Add extra knowledge -if ($W16) { - $no_fp_api=1; -} - -if (!$do_ssl && !$do_crypto) - { - print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT | OS2 ]\n"; - exit(1); - } - -%ssl_list=&load_numbers($ssl_num); -$max_ssl = $max_num; -%crypto_list=&load_numbers($crypto_num); -$max_crypto = $max_num; - -my $ssl="ssl/ssl.h"; -$ssl.=" ssl/kssl.h"; -$ssl.=" ssl/tls1.h"; -$ssl.=" ssl/srtp.h"; - -my $crypto ="crypto/crypto.h"; -$crypto.=" crypto/cryptlib.h"; -$crypto.=" crypto/o_dir.h"; -$crypto.=" crypto/o_str.h"; -$crypto.=" crypto/o_time.h"; -$crypto.=" crypto/des/des.h crypto/des/des_old.h" ; # unless $no_des; -$crypto.=" crypto/idea/idea.h" ; # unless $no_idea; -$crypto.=" crypto/rc4/rc4.h" ; # unless $no_rc4; -$crypto.=" crypto/rc5/rc5.h" ; # unless $no_rc5; -$crypto.=" crypto/rc2/rc2.h" ; # unless $no_rc2; -$crypto.=" crypto/bf/blowfish.h" ; # unless $no_bf; -$crypto.=" crypto/cast/cast.h" ; # unless $no_cast; -$crypto.=" crypto/whrlpool/whrlpool.h" ; -$crypto.=" crypto/md2/md2.h" ; # unless $no_md2; -$crypto.=" crypto/md4/md4.h" ; # unless $no_md4; -$crypto.=" crypto/md5/md5.h" ; # unless $no_md5; -$crypto.=" crypto/mdc2/mdc2.h" ; # unless $no_mdc2; -$crypto.=" crypto/sha/sha.h" ; # unless $no_sha; -$crypto.=" crypto/ripemd/ripemd.h" ; # unless $no_ripemd; -$crypto.=" crypto/aes/aes.h" ; # unless $no_aes; -$crypto.=" crypto/camellia/camellia.h" ; # unless $no_camellia; -$crypto.=" crypto/seed/seed.h"; # unless $no_seed; - -$crypto.=" crypto/bn/bn.h"; -$crypto.=" crypto/rsa/rsa.h" ; # unless $no_rsa; -$crypto.=" crypto/dsa/dsa.h" ; # unless $no_dsa; -$crypto.=" crypto/dh/dh.h" ; # unless $no_dh; -$crypto.=" crypto/ec/ec.h" ; # unless $no_ec; -$crypto.=" crypto/ecdsa/ecdsa.h" ; # unless $no_ecdsa; -$crypto.=" crypto/ecdh/ecdh.h" ; # unless $no_ecdh; -$crypto.=" crypto/hmac/hmac.h" ; # unless $no_hmac; -$crypto.=" crypto/cmac/cmac.h" ; # unless $no_hmac; - -$crypto.=" crypto/engine/engine.h"; # unless $no_engine; -$crypto.=" crypto/stack/stack.h" ; # unless $no_stack; -$crypto.=" crypto/buffer/buffer.h" ; # unless $no_buffer; -$crypto.=" crypto/bio/bio.h" ; # unless $no_bio; -$crypto.=" crypto/dso/dso.h" ; # unless $no_dso; -$crypto.=" crypto/lhash/lhash.h" ; # unless $no_lhash; -$crypto.=" crypto/conf/conf.h"; -$crypto.=" crypto/txt_db/txt_db.h"; - -$crypto.=" crypto/evp/evp.h" ; # unless $no_evp; -$crypto.=" crypto/objects/objects.h"; -$crypto.=" crypto/pem/pem.h"; -#$crypto.=" crypto/meth/meth.h"; -$crypto.=" crypto/asn1/asn1.h"; -$crypto.=" crypto/asn1/asn1t.h"; -$crypto.=" crypto/asn1/asn1_mac.h"; -$crypto.=" crypto/err/err.h" ; # unless $no_err; -$crypto.=" crypto/pkcs7/pkcs7.h"; -$crypto.=" crypto/pkcs12/pkcs12.h"; -$crypto.=" crypto/x509/x509.h"; -$crypto.=" crypto/x509/x509_vfy.h"; -$crypto.=" crypto/x509v3/x509v3.h"; -$crypto.=" crypto/ts/ts.h"; -$crypto.=" crypto/rand/rand.h"; -$crypto.=" crypto/comp/comp.h" ; # unless $no_comp; -$crypto.=" crypto/ocsp/ocsp.h"; -$crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; -$crypto.=" crypto/krb5/krb5_asn.h"; -#$crypto.=" crypto/store/store.h"; -$crypto.=" crypto/pqueue/pqueue.h"; -$crypto.=" crypto/cms/cms.h"; -$crypto.=" crypto/jpake/jpake.h"; -$crypto.=" crypto/modes/modes.h"; -$crypto.=" crypto/srp/srp.h"; - -my $symhacks="crypto/symhacks.h"; - -my @ssl_symbols = &do_defs("SSLEAY", $ssl, $symhacks); -my @crypto_symbols = &do_defs("LIBEAY", $crypto, $symhacks); - -if ($do_update) { - -if ($do_ssl == 1) { - - &maybe_add_info("SSLEAY",*ssl_list,@ssl_symbols); - if ($do_rewrite == 1) { - open(OUT, ">$ssl_num"); - &rewrite_numbers(*OUT,"SSLEAY",*ssl_list,@ssl_symbols); - } else { - open(OUT, ">>$ssl_num"); - } - &update_numbers(*OUT,"SSLEAY",*ssl_list,$max_ssl,@ssl_symbols); - close OUT; -} - -if($do_crypto == 1) { - - &maybe_add_info("LIBEAY",*crypto_list,@crypto_symbols); - if ($do_rewrite == 1) { - open(OUT, ">$crypto_num"); - &rewrite_numbers(*OUT,"LIBEAY",*crypto_list,@crypto_symbols); - } else { - open(OUT, ">>$crypto_num"); - } - &update_numbers(*OUT,"LIBEAY",*crypto_list,$max_crypto,@crypto_symbols); - close OUT; -} - -} elsif ($do_checkexist) { - &check_existing(*ssl_list, @ssl_symbols) - if $do_ssl == 1; - &check_existing(*crypto_list, @crypto_symbols) - if $do_crypto == 1; -} elsif ($do_ctest || $do_ctestall) { - - print <<"EOF"; - -/* Test file to check all DEF file symbols are present by trying - * to link to all of them. This is *not* intended to be run! - */ - -int main() -{ -EOF - &print_test_file(*STDOUT,"SSLEAY",*ssl_list,$do_ctestall,@ssl_symbols) - if $do_ssl == 1; - - &print_test_file(*STDOUT,"LIBEAY",*crypto_list,$do_ctestall,@crypto_symbols) - if $do_crypto == 1; - - print "}\n"; - -} else { - - &print_def_file(*STDOUT,$libname,*ssl_list,@ssl_symbols) - if $do_ssl == 1; - - &print_def_file(*STDOUT,$libname,*crypto_list,@crypto_symbols) - if $do_crypto == 1; - -} - - -sub do_defs -{ - my($name,$files,$symhacksfile)=@_; - my $file; - my @ret; - my %syms; - my %platform; # For anything undefined, we assume "" - my %kind; # For anything undefined, we assume "FUNCTION" - my %algorithm; # For anything undefined, we assume "" - my %variant; - my %variant_cnt; # To be able to allocate "name{n}" if "name" - # is the same name as the original. - my $cpp; - my %unknown_algorithms = (); - - foreach $file (split(/\s+/,$symhacksfile." ".$files)) - { - print STDERR "DEBUG: starting on $file:\n" if $debug; - open(IN,"<$file") || die "unable to open $file:$!\n"; - my $line = "", my $def= ""; - my %tag = ( - (map { $_ => 0 } @known_platforms), - (map { "OPENSSL_SYS_".$_ => 0 } @known_ossl_platforms), - (map { "OPENSSL_NO_".$_ => 0 } @known_algorithms), - NOPROTO => 0, - PERL5 => 0, - _WINDLL => 0, - CONST_STRICT => 0, - TRUE => 1, - ); - my $symhacking = $file eq $symhacksfile; - my @current_platforms = (); - my @current_algorithms = (); - - # params: symbol, alias, platforms, kind - # The reason to put this subroutine in a variable is that - # it will otherwise create it's own, unshared, version of - # %tag and %variant... - my $make_variant = sub - { - my ($s, $a, $p, $k) = @_; - my ($a1, $a2); - - print STDERR "DEBUG: make_variant: Entered with ",$s,", ",$a,", ",(defined($p)?$p:""),", ",(defined($k)?$k:""),"\n" if $debug; - if (defined($p)) - { - $a1 = join(",",$p, - grep(!/^$/, - map { $tag{$_} == 1 ? $_ : "" } - @known_platforms)); - } - else - { - $a1 = join(",", - grep(!/^$/, - map { $tag{$_} == 1 ? $_ : "" } - @known_platforms)); - } - $a2 = join(",", - grep(!/^$/, - map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : "" } - @known_ossl_platforms)); - print STDERR "DEBUG: make_variant: a1 = $a1; a2 = $a2\n" if $debug; - if ($a1 eq "") { $a1 = $a2; } - elsif ($a1 ne "" && $a2 ne "") { $a1 .= ",".$a2; } - if ($a eq $s) - { - if (!defined($variant_cnt{$s})) - { - $variant_cnt{$s} = 0; - } - $variant_cnt{$s}++; - $a .= "{$variant_cnt{$s}}"; - } - my $toadd = $a.":".$a1.(defined($k)?":".$k:""); - my $togrep = $s.'(\{[0-9]+\})?:'.$a1.(defined($k)?":".$k:""); - if (!grep(/^$togrep$/, - split(/;/, defined($variant{$s})?$variant{$s}:""))) { - if (defined($variant{$s})) { $variant{$s} .= ";"; } - $variant{$s} .= $toadd; - } - print STDERR "DEBUG: make_variant: Exit with variant of ",$s," = ",$variant{$s},"\n" if $debug; - }; - - print STDERR "DEBUG: parsing ----------\n" if $debug; - while() { - if (/\/\* Error codes for the \w+ functions\. \*\//) - { - undef @tag; - last; - } - if ($line ne '') { - $_ = $line . $_; - $line = ''; - } - - if (/\\$/) { - chomp; # remove eol - chop; # remove ending backslash - $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/; - - s/{[^{}]*}//gs; # ignore {} blocks - print STDERR "DEBUG: \$def=\"$def\"\n" if $debug && $def ne ""; - print STDERR "DEBUG: \$_=\"$_\"\n" if $debug; - if (/^\#\s*ifndef\s+(.*)/) { - push(@tag,"-"); - push(@tag,$1); - $tag{$1}=-1; - print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; - } elsif (/^\#\s*if\s+!defined\(([^\)]+)\)/) { - push(@tag,"-"); - if (/^\#\s*if\s+(!defined\(([^\)]+)\)(\s+\&\&\s+!defined\(([^\)]+)\))*)$/) { - my $tmp_1 = $1; - my $tmp_; - foreach $tmp_ (split '\&\&',$tmp_1) { - $tmp_ =~ /!defined\(([^\)]+)\)/; - print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; - push(@tag,$1); - $tag{$1}=-1; - } - } else { - print STDERR "Warning: $file: complicated expression: $_" if $debug; # because it is O... - print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; - push(@tag,$1); - $tag{$1}=-1; - } - } elsif (/^\#\s*ifdef\s+(\S*)/) { - push(@tag,"-"); - push(@tag,$1); - $tag{$1}=1; - print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; - } elsif (/^\#\s*if\s+defined\(([^\)]+)\)/) { - push(@tag,"-"); - if (/^\#\s*if\s+(defined\(([^\)]+)\)(\s+\|\|\s+defined\(([^\)]+)\))*)$/) { - my $tmp_1 = $1; - my $tmp_; - foreach $tmp_ (split '\|\|',$tmp_1) { - $tmp_ =~ /defined\(([^\)]+)\)/; - print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; - push(@tag,$1); - $tag{$1}=1; - } - } else { - print STDERR "Warning: $file: complicated expression: $_\n" if $debug; # because it is O... - print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; - push(@tag,$1); - $tag{$1}=1; - } - } elsif (/^\#\s*error\s+(\w+) is disabled\./) { - my $tag_i = $#tag; - while($tag[$tag_i] ne "-") { - if ($tag[$tag_i] eq "OPENSSL_NO_".$1) { - $tag{$tag[$tag_i]}=2; - print STDERR "DEBUG: $file: chaged tag $1 = 2\n" if $debug; - } - $tag_i--; - } - } elsif (/^\#\s*endif/) { - my $tag_i = $#tag; - while($tag_i > 0 && $tag[$tag_i] ne "-") { - my $t=$tag[$tag_i]; - print STDERR "DEBUG: \$t=\"$t\"\n" if $debug; - if ($tag{$t}==2) { - $tag{$t}=-1; - } else { - $tag{$t}=0; - } - print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug; - pop(@tag); - if ($t =~ /^OPENSSL_NO_([A-Z0-9_]+)$/) { - $t=$1; - } else { - $t=""; - } - if ($t ne "" - && !grep(/^$t$/, @known_algorithms)) { - $unknown_algorithms{$t} = 1; - #print STDERR "DEBUG: Added as unknown algorithm: $t\n" if $debug; - } - $tag_i--; - } - pop(@tag); - } elsif (/^\#\s*else/) { - my $tag_i = $#tag; - while($tag[$tag_i] ne "-") { - my $t=$tag[$tag_i]; - $tag{$t}= -$tag{$t}; - print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug; - $tag_i--; - } - } elsif (/^\#\s*if\s+1/) { - push(@tag,"-"); - # Dummy tag - push(@tag,"TRUE"); - $tag{"TRUE"}=1; - print STDERR "DEBUG: $file: found 1\n" if $debug; - } elsif (/^\#\s*if\s+0/) { - push(@tag,"-"); - # Dummy tag - push(@tag,"TRUE"); - $tag{"TRUE"}=-1; - print STDERR "DEBUG: $file: found 0\n" if $debug; - } elsif (/^\#\s*define\s+(\w+)\s+(\w+)/ - && $symhacking && $tag{'TRUE'} != -1) { - # This is for aliasing. When we find an alias, - # we have to invert - &$make_variant($1,$2); - print STDERR "DEBUG: $file: defined $1 = $2\n" if $debug; - } - if (/^\#/) { - @current_platforms = - grep(!/^$/, - map { $tag{$_} == 1 ? $_ : - $tag{$_} == -1 ? "!".$_ : "" } - @known_platforms); - push @current_platforms - , grep(!/^$/, - map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : - $tag{"OPENSSL_SYS_".$_} == -1 ? "!".$_ : "" } - @known_ossl_platforms); - @current_algorithms = - grep(!/^$/, - map { $tag{"OPENSSL_NO_".$_} == -1 ? $_ : "" } - @known_algorithms); - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - next; - } - if ($tag{'TRUE'} != -1) { - if (/^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) { - next; - } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) { - $def .= "int d2i_$3(void);"; - $def .= "int i2d_$3(void);"; - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int $2_it;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("$2_it","$2_it", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - next; - } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_fname\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) { - $def .= "int d2i_$3(void);"; - $def .= "int i2d_$3(void);"; - $def .= "int $3_free(void);"; - $def .= "int $3_new(void);"; - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int $2_it;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("$2_it","$2_it", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - next; - } elsif (/^\s*DECLARE_ASN1_FUNCTIONS\s*\(\s*(\w*)\s*\)/ || - /^\s*DECLARE_ASN1_FUNCTIONS_const\s*\(\s*(\w*)\s*\)/) { - $def .= "int d2i_$1(void);"; - $def .= "int i2d_$1(void);"; - $def .= "int $1_free(void);"; - $def .= "int $1_new(void);"; - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int $1_it;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("$1_it","$1_it", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - next; - } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS_const\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { - $def .= "int d2i_$2(void);"; - $def .= "int i2d_$2(void);"; - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int $2_it;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("$2_it","$2_it", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - next; - } elsif (/^\s*DECLARE_ASN1_ALLOC_FUNCTIONS\s*\(\s*(\w*)\s*\)/) { - $def .= "int $1_free(void);"; - $def .= "int $1_new(void);"; - next; - } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { - $def .= "int d2i_$2(void);"; - $def .= "int i2d_$2(void);"; - $def .= "int $2_free(void);"; - $def .= "int $2_new(void);"; - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int $2_it;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("$2_it","$2_it", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - next; - } elsif (/^\s*DECLARE_ASN1_ITEM\s*\(\s*(\w*)\s*\)/) { - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int $1_it;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("$1_it","$1_it", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - next; - } elsif (/^\s*DECLARE_ASN1_NDEF_FUNCTION\s*\(\s*(\w*)\s*\)/) { - $def .= "int i2d_$1_NDEF(void);"; - } elsif (/^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) { - next; - } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION\s*\(\s*(\w*)\s*\)/) { - $def .= "int $1_print_ctx(void);"; - next; - } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { - $def .= "int $2_print_ctx(void);"; - next; - } elsif (/^\s*DECLARE_PKCS12_STACK_OF\s*\(\s*(\w*)\s*\)/) { - next; - } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ || - /^DECLARE_PEM_rw_cb\s*\(\s*(\w*)\s*,/ || - /^DECLARE_PEM_rw_const\s*\(\s*(\w*)\s*,/ ) { - # Things not in Win16 - $def .= - "#INFO:" - .join(',',"!WIN16",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "int PEM_read_$1(void);"; - $def .= "int PEM_write_$1(void);"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Things that are everywhere - $def .= "int PEM_read_bio_$1(void);"; - $def .= "int PEM_write_bio_$1(void);"; - next; - } elsif (/^DECLARE_PEM_write\s*\(\s*(\w*)\s*,/ || - /^DECLARE_PEM_write_cb\s*\(\s*(\w*)\s*,/ ) { - # Things not in Win16 - $def .= - "#INFO:" - .join(',',"!WIN16",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "int PEM_write_$1(void);"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Things that are everywhere - $def .= "int PEM_write_bio_$1(void);"; - next; - } elsif (/^DECLARE_PEM_read\s*\(\s*(\w*)\s*,/ || - /^DECLARE_PEM_read_cb\s*\(\s*(\w*)\s*,/ ) { - # Things not in Win16 - $def .= - "#INFO:" - .join(',',"!WIN16",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "int PEM_read_$1(void);"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Things that are everywhere - $def .= "int PEM_read_bio_$1(void);"; - next; - } elsif (/^OPENSSL_DECLARE_GLOBAL\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int _shadow_$2;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("_shadow_$2","_shadow_$2", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - } elsif ($tag{'CONST_STRICT'} != 1) { - if (/\{|\/\*|\([^\)]*$/) { - $line = $_; - } else { - $def .= $_; - } - } - } - } - close(IN); - - my $algs; - my $plays; - - print STDERR "DEBUG: postprocessing ----------\n" if $debug; - foreach (split /;/, $def) { - my $s; my $k = "FUNCTION"; my $p; my $a; - s/^[\n\s]*//g; - s/[\n\s]*$//g; - next if(/\#undef/); - next if(/typedef\W/); - next if(/\#define/); - - # 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; - - s/STACK_OF\(\)/void/gs; - s/LHASH_OF\(\)/void/gs; - - print STDERR "DEBUG: \$_ = \"$_\"\n" if $debug; - if (/^\#INFO:([^:]*):(.*)$/) { - $plats = $1; - $algs = $2; - print STDERR "DEBUG: found info on platforms ($plats) and algorithms ($algs)\n" if $debug; - next; - } elsif (/^\s*OPENSSL_EXTERN\s.*?(\w+(\{[0-9]+\})?)(\[[0-9]*\])*\s*$/) { - $s = $1; - $k = "VARIABLE"; - print STDERR "DEBUG: found external variable $s\n" if $debug; - } elsif (/TYPEDEF_\w+_OF/s) { - next; - } elsif (/(\w+)\s*\(\).*/s) { # first token prior [first] () is - $s = $1; # a function name! - print STDERR "DEBUG: found function $s\n" if $debug; - } elsif (/\(/ and not (/=/)) { - print STDERR "File $file: cannot parse: $_;\n"; - next; - } else { - next; - } - - $syms{$s} = 1; - $kind{$s} = $k; - - $p = $plats; - $a = $algs; - $a .= ",BF" if($s =~ /EVP_bf/); - $a .= ",CAST" if($s =~ /EVP_cast/); - $a .= ",DES" if($s =~ /EVP_des/); - $a .= ",DSA" if($s =~ /EVP_dss/); - $a .= ",IDEA" if($s =~ /EVP_idea/); - $a .= ",MD2" if($s =~ /EVP_md2/); - $a .= ",MD4" if($s =~ /EVP_md4/); - $a .= ",MD5" if($s =~ /EVP_md5/); - $a .= ",RC2" if($s =~ /EVP_rc2/); - $a .= ",RC4" if($s =~ /EVP_rc4/); - $a .= ",RC5" if($s =~ /EVP_rc5/); - $a .= ",RIPEMD" if($s =~ /EVP_ripemd/); - $a .= ",SHA" if($s =~ /EVP_sha/); - $a .= ",RSA" if($s =~ /EVP_(Open|Seal)(Final|Init)/); - $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/); - $a .= ",RSA" if($s =~ /RSAPrivateKey/); - $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/); - - $platform{$s} = - &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); - $algorithm{$s} .= ','.$a; - - if (defined($variant{$s})) { - foreach $v (split /;/,$variant{$s}) { - (my $r, my $p, my $k) = split(/:/,$v); - my $ip = join ',',map({ /^!(.*)$/ ? $1 : "!".$_ } split /,/, $p); - $syms{$r} = 1; - if (!defined($k)) { $k = $kind{$s}; } - $kind{$r} = $k."(".$s.")"; - $algorithm{$r} = $algorithm{$s}; - $platform{$r} = &reduce_platforms($platform{$s}.",".$p.",".$p); - $platform{$s} = &reduce_platforms($platform{$s}.','.$ip.','.$ip); - print STDERR "DEBUG: \$variant{\"$s\"} = ",$v,"; \$r = $r; \$p = ",$platform{$r},"; \$a = ",$algorithm{$r},"; \$kind = ",$kind{$r},"\n" if $debug; - } - } - print STDERR "DEBUG: \$s = $s; \$p = ",$platform{$s},"; \$a = ",$algorithm{$s},"; \$kind = ",$kind{$s},"\n" if $debug; - } - } - - # Prune the returned symbols - - delete $syms{"bn_dump1"}; - $platform{"BIO_s_log"} .= ",!WIN32,!WIN16,!macintosh"; - - $platform{"PEM_read_NS_CERT_SEQ"} = "VMS"; - $platform{"PEM_write_NS_CERT_SEQ"} = "VMS"; - $platform{"PEM_read_P8_PRIV_KEY_INFO"} = "VMS"; - $platform{"PEM_write_P8_PRIV_KEY_INFO"} = "VMS"; - $platform{"EVP_sha384"} = "!VMSVAX"; - $platform{"EVP_sha512"} = "!VMSVAX"; - $platform{"SHA384_Init"} = "!VMSVAX"; - $platform{"SHA384_Transform"} = "!VMSVAX"; - $platform{"SHA384_Update"} = "!VMSVAX"; - $platform{"SHA384_Final"} = "!VMSVAX"; - $platform{"SHA384"} = "!VMSVAX"; - $platform{"SHA512_Init"} = "!VMSVAX"; - $platform{"SHA512_Transform"} = "!VMSVAX"; - $platform{"SHA512_Update"} = "!VMSVAX"; - $platform{"SHA512_Final"} = "!VMSVAX"; - $platform{"SHA512"} = "!VMSVAX"; - $platform{"WHIRLPOOL_Init"} = "!VMSVAX"; - $platform{"WHIRLPOOL"} = "!VMSVAX"; - $platform{"WHIRLPOOL_BitUpdate"} = "!VMSVAX"; - $platform{"EVP_whirlpool"} = "!VMSVAX"; - $platform{"WHIRLPOOL_Final"} = "!VMSVAX"; - $platform{"WHIRLPOOL_Update"} = "!VMSVAX"; - - - # Info we know about - - push @ret, map { $_."\\".&info_string($_,"EXIST", - $platform{$_}, - $kind{$_}, - $algorithm{$_}) } keys %syms; - - if (keys %unknown_algorithms) { - print STDERR "WARNING: mkdef.pl doesn't know the following algorithms:\n"; - print STDERR "\t",join("\n\t",keys %unknown_algorithms),"\n"; - } - return(@ret); -} - -# Param: string of comma-separated platform-specs. -sub reduce_platforms -{ - my ($platforms) = @_; - my $pl = defined($platforms) ? $platforms : ""; - my %p = map { $_ => 0 } split /,/, $pl; - my $ret; - - print STDERR "DEBUG: Entered reduce_platforms with \"$platforms\"\n" - if $debug; - # We do this, because if there's code like the following, it really - # means the function exists in all cases and should therefore be - # everywhere. By increasing and decreasing, we may attain 0: - # - # ifndef WIN16 - # int foo(); - # else - # int _fat foo(); - # endif - foreach $platform (split /,/, $pl) { - if ($platform =~ /^!(.*)$/) { - $p{$1}--; - } else { - $p{$platform}++; - } - } - foreach $platform (keys %p) { - if ($p{$platform} == 0) { delete $p{$platform}; } - } - - delete $p{""}; - - $ret = join(',',sort(map { $p{$_} < 0 ? "!".$_ : $_ } keys %p)); - print STDERR "DEBUG: Exiting reduce_platforms with \"$ret\"\n" - if $debug; - return $ret; -} - -sub info_string { - (my $symbol, my $exist, my $platforms, my $kind, my $algorithms) = @_; - - my %a = defined($algorithms) ? - map { $_ => 1 } split /,/, $algorithms : (); - my $k = defined($kind) ? $kind : "FUNCTION"; - my $ret; - my $p = &reduce_platforms($platforms); - - delete $a{""}; - - $ret = $exist; - $ret .= ":".$p; - $ret .= ":".$k; - $ret .= ":".join(',',sort keys %a); - return $ret; -} - -sub maybe_add_info { - (my $name, *nums, my @symbols) = @_; - my $sym; - my $new_info = 0; - my %syms=(); - - print STDERR "Updating $name info\n"; - foreach $sym (@symbols) { - (my $s, my $i) = split /\\/, $sym; - if (defined($nums{$s})) { - $i =~ s/^(.*?:.*?:\w+)(\(\w+\))?/$1/; - (my $n, my $dummy) = split /\\/, $nums{$s}; - if (!defined($dummy) || $i ne $dummy) { - $nums{$s} = $n."\\".$i; - $new_info++; - print STDERR "DEBUG: maybe_add_info for $s: \"$dummy\" => \"$i\"\n" if $debug; - } - } - $syms{$s} = 1; - } - - my @s=sort { &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") } keys %nums; - foreach $sym (@s) { - (my $n, my $i) = split /\\/, $nums{$sym}; - if (!defined($syms{$sym}) && $i !~ /^NOEXIST:/) { - $new_info++; - print STDERR "DEBUG: maybe_add_info for $sym: -> undefined\n" if $debug; - } - } - if ($new_info) { - print STDERR "$new_info old symbols got an info update\n"; - if (!$do_rewrite) { - print STDERR "You should do a rewrite to fix this.\n"; - } - } else { - print STDERR "No old symbols needed info update\n"; - } -} - -# Param: string of comma-separated keywords, each possibly prefixed with a "!" -sub is_valid -{ - my ($keywords_txt,$platforms) = @_; - my (@keywords) = split /,/,$keywords_txt; - my ($falsesum, $truesum) = (0, 1); - - # Param: one keyword - sub recognise - { - my ($keyword,$platforms) = @_; - - if ($platforms) { - # platforms - if ($keyword eq "VMSVAX" && $VMSVAX) { return 1; } - if ($keyword eq "VMSNonVAX" && $VMSNonVAX) { return 1; } - if ($keyword eq "VMS" && $VMS) { return 1; } - if ($keyword eq "WIN32" && $W32) { return 1; } - if ($keyword eq "WIN16" && $W16) { return 1; } - if ($keyword eq "WINNT" && $NT) { return 1; } - if ($keyword eq "OS2" && $OS2) { return 1; } - # Special platforms: - # EXPORT_VAR_AS_FUNCTION means that global variables - # will be represented as functions. This currently - # only happens on VMS-VAX. - if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) { - return 1; - } - if ($keyword eq "OPENSSL_FIPS" && $fips) { - return 1; - } - if ($keyword eq "ZLIB" && $zlib) { return 1; } - return 0; - } else { - # algorithms - if ($keyword eq "RC2" && $no_rc2) { return 0; } - if ($keyword eq "RC4" && $no_rc4) { return 0; } - if ($keyword eq "RC5" && $no_rc5) { return 0; } - if ($keyword eq "IDEA" && $no_idea) { return 0; } - if ($keyword eq "DES" && $no_des) { return 0; } - if ($keyword eq "BF" && $no_bf) { return 0; } - if ($keyword eq "CAST" && $no_cast) { return 0; } - if ($keyword eq "MD2" && $no_md2) { return 0; } - if ($keyword eq "MD4" && $no_md4) { return 0; } - if ($keyword eq "MD5" && $no_md5) { return 0; } - if ($keyword eq "SHA" && $no_sha) { return 0; } - if ($keyword eq "RIPEMD" && $no_ripemd) { return 0; } - if ($keyword eq "MDC2" && $no_mdc2) { return 0; } - if ($keyword eq "WHIRLPOOL" && $no_whirlpool) { return 0; } - if ($keyword eq "RSA" && $no_rsa) { return 0; } - if ($keyword eq "DSA" && $no_dsa) { return 0; } - if ($keyword eq "DH" && $no_dh) { return 0; } - if ($keyword eq "EC" && $no_ec) { return 0; } - if ($keyword eq "ECDSA" && $no_ecdsa) { return 0; } - if ($keyword eq "ECDH" && $no_ecdh) { return 0; } - if ($keyword eq "HMAC" && $no_hmac) { return 0; } - if ($keyword eq "AES" && $no_aes) { return 0; } - if ($keyword eq "CAMELLIA" && $no_camellia) { return 0; } - if ($keyword eq "SEED" && $no_seed) { return 0; } - if ($keyword eq "EVP" && $no_evp) { return 0; } - if ($keyword eq "LHASH" && $no_lhash) { return 0; } - if ($keyword eq "STACK" && $no_stack) { return 0; } - if ($keyword eq "ERR" && $no_err) { return 0; } - if ($keyword eq "BUFFER" && $no_buffer) { return 0; } - if ($keyword eq "BIO" && $no_bio) { return 0; } - if ($keyword eq "COMP" && $no_comp) { return 0; } - if ($keyword eq "DSO" && $no_dso) { return 0; } - if ($keyword eq "KRB5" && $no_krb5) { return 0; } - if ($keyword eq "ENGINE" && $no_engine) { return 0; } - if ($keyword eq "HW" && $no_hw) { return 0; } - if ($keyword eq "FP_API" && $no_fp_api) { return 0; } - if ($keyword eq "STATIC_ENGINE" && $no_static_engine) { return 0; } - if ($keyword eq "GMP" && $no_gmp) { return 0; } - if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; } - if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; } - if ($keyword eq "PSK" && $no_psk) { return 0; } - if ($keyword eq "CMS" && $no_cms) { return 0; } - if ($keyword eq "EC2M" && $no_ec2m) { return 0; } - if ($keyword eq "NEXTPROTONEG" && $no_nextprotoneg) { return 0; } - if ($keyword eq "EC_NISTP_64_GCC_128" && $no_nistp_gcc) - { return 0; } - if ($keyword eq "SSL2" && $no_ssl2) { return 0; } - if ($keyword eq "CAPIENG" && $no_capieng) { return 0; } - if ($keyword eq "JPAKE" && $no_jpake) { return 0; } - if ($keyword eq "SRP" && $no_srp) { return 0; } - if ($keyword eq "SCTP" && $no_sctp) { return 0; } - if ($keyword eq "DEPRECATED" && $no_deprecated) { return 0; } - - # Nothing recognise as true - return 1; - } - } - - foreach $k (@keywords) { - if ($k =~ /^!(.*)$/) { - $falsesum += &recognise($1,$platforms); - } else { - $truesum *= &recognise($k,$platforms); - } - } - print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug; - return (!$falsesum) && $truesum; -} - -sub print_test_file -{ - (*OUT,my $name,*nums,my $testall,my @symbols)=@_; - my $n = 1; my @e; my @r; - my $sym; my $prev = ""; my $prefSSLeay; - - (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols); - (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:.*/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols); - @symbols=((sort @e),(sort @r)); - - foreach $sym (@symbols) { - (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; - my $v = 0; - $v = 1 if $i=~ /^.*?:.*?:VARIABLE/; - my $p = ($i =~ /^[^:]*:([^:]*):/,$1); - my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1); - if (!defined($nums{$s})) { - print STDERR "Warning: $s does not have a number assigned\n" - if(!$do_update); - } elsif (is_valid($p,1) && is_valid($a,0)) { - my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1); - if ($prev eq $s2) { - print OUT "\t/* The following has already appeared previously */\n"; - print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n"; - } - $prev = $s2; # To warn about duplicates... - - ($nn,$ni)=($nums{$s2} =~ /^(.*?)\\(.*)$/); - if ($v) { - print OUT "\textern int $s2; /* type unknown */ /* $nn $ni */\n"; - } else { - print OUT "\textern int $s2(); /* type unknown */ /* $nn $ni */\n"; - } - } - } -} - -sub get_version { - local *MF; - my $v = '?'; - open MF, 'Makefile' or return $v; - while () { - $v = $1, last if /^VERSION=(.*?)\s*$/; - } - close MF; - return $v; -} - -sub print_def_file -{ - (*OUT,my $name,*nums,my @symbols)=@_; - my $n = 1; my @e; my @r; my @v; my $prev=""; - my $liboptions=""; - my $libname = $name; - my $http_vendor = 'www.openssl.org/'; - my $version = get_version(); - my $what = "OpenSSL: implementation of Secure Socket Layer"; - my $description = "$what $version, $name - http://$http_vendor"; - - if ($W32) - { $libname.="32"; } - elsif ($W16) - { $libname.="16"; } - elsif ($OS2) - { # DLL names should not clash on the whole system. - # However, they should not have any particular relationship - # to the name of the static library. Chose descriptive names - # (must be at most 8 chars). - my %translate = (ssl => 'open_ssl', crypto => 'cryptssl'); - $libname = $translate{$name} || $name; - $liboptions = <) { - chop; - s/#.*$//; - next if /^\s*$/; - @a=split; - if (defined $ret{$a[0]}) { - # This is actually perfectly OK - #print STDERR "Warning: Symbol '",$a[0],"' redefined. old=",$ret{$a[0]},", new=",$a[1],"\n"; - } - if ($max_num > $a[1]) { - print STDERR "Warning: Number decreased from ",$max_num," to ",$a[1],"\n"; - } - elsif ($max_num == $a[1]) { - # This is actually perfectly OK - #print STDERR "Warning: Symbol ",$a[0]," has same number as previous ",$prev,": ",$a[1],"\n"; - if ($a[0] eq $prev) { - $prev_cnt++; - $a[0] .= "{$prev_cnt}"; - } - } - else { - $prev_cnt = 0; - } - if ($#a < 2) { - # Existence will be proven later, in do_defs - $ret{$a[0]}=$a[1]; - $num_noinfo++; - } else { - $ret{$a[0]}=$a[1]."\\".$a[2]; # \\ is a special marker - } - $max_num = $a[1] if $a[1] > $max_num; - $prev=$a[0]; - } - if ($num_noinfo) { - print STDERR "Warning: $num_noinfo symbols were without info."; - if ($do_rewrite) { - printf STDERR " The rewrite will fix this.\n"; - } else { - printf STDERR " You should do a rewrite to fix this.\n"; - } - } - close(IN); - return(%ret); -} - -sub parse_number -{ - (my $str, my $what) = @_; - (my $n, my $i) = split(/\\/,$str); - if ($what eq "n") { - return $n; - } else { - return $i; - } -} - -sub rewrite_numbers -{ - (*OUT,$name,*nums,@symbols)=@_; - my $thing; - - print STDERR "Rewriting $name\n"; - - my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols); - my $r; my %r; my %rsyms; - foreach $r (@r) { - (my $s, my $i) = split /\\/, $r; - my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/; - $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/; - $r{$a} = $s."\\".$i; - $rsyms{$s} = 1; - } - - my %syms = (); - foreach $_ (@symbols) { - (my $n, my $i) = split /\\/; - $syms{$n} = 1; - } - - my @s=sort { - &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") - || $a cmp $b - } keys %nums; - foreach $sym (@s) { - (my $n, my $i) = split /\\/, $nums{$sym}; - next if defined($i) && $i =~ /^.*?:.*?:\w+\(\w+\)/; - next if defined($rsyms{$sym}); - print STDERR "DEBUG: rewrite_numbers for sym = ",$sym,": i = ",$i,", n = ",$n,", rsym{sym} = ",$rsyms{$sym},"syms{sym} = ",$syms{$sym},"\n" if $debug; - $i="NOEXIST::FUNCTION:" - if !defined($i) || $i eq "" || !defined($syms{$sym}); - my $s2 = $sym; - $s2 =~ s/\{[0-9]+\}$//; - printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i; - if (exists $r{$sym}) { - (my $s, $i) = split /\\/,$r{$sym}; - my $s2 = $s; - $s2 =~ s/\{[0-9]+\}$//; - printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i; - } - } -} - -sub update_numbers -{ - (*OUT,$name,*nums,my $start_num, my @symbols)=@_; - my $new_syms = 0; - - print STDERR "Updating $name numbers\n"; - - my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols); - my $r; my %r; my %rsyms; - foreach $r (@r) { - (my $s, my $i) = split /\\/, $r; - my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/; - $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/; - $r{$a} = $s."\\".$i; - $rsyms{$s} = 1; - } - - foreach $sym (@symbols) { - (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; - next if $i =~ /^.*?:.*?:\w+\(\w+\)/; - next if defined($rsyms{$sym}); - die "ERROR: Symbol $sym had no info attached to it." - if $i eq ""; - if (!exists $nums{$s}) { - $new_syms++; - my $s2 = $s; - $s2 =~ s/\{[0-9]+\}$//; - printf OUT "%s%-39s %d\t%s\n","",$s2, ++$start_num,$i; - if (exists $r{$s}) { - ($s, $i) = split /\\/,$r{$s}; - $s =~ s/\{[0-9]+\}$//; - printf OUT "%s%-39s %d\t%s\n","",$s, $start_num,$i; - } - } - } - if($new_syms) { - print STDERR "$new_syms New symbols added\n"; - } else { - print STDERR "No New symbols Added\n"; - } -} - -sub check_existing -{ - (*nums, my @symbols)=@_; - my %existing; my @remaining; - @remaining=(); - foreach $sym (@symbols) { - (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; - $existing{$s}=1; - } - foreach $sym (keys %nums) { - if (!exists $existing{$sym}) { - push @remaining, $sym; - } - } - if(@remaining) { - print STDERR "The following symbols do not seem to exist:\n"; - foreach $sym (@remaining) { - print STDERR "\t",$sym,"\n"; - } - } -} - diff --git a/lib/libcrypto/util/mkdir-p.pl b/lib/libcrypto/util/mkdir-p.pl deleted file mode 100644 index e73d02b073b..00000000000 --- a/lib/libcrypto/util/mkdir-p.pl +++ /dev/null @@ -1,34 +0,0 @@ -#!/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"; -} diff --git a/lib/libcrypto/util/mkfiles.pl b/lib/libcrypto/util/mkfiles.pl deleted file mode 100644 index 3214f69ea5e..00000000000 --- a/lib/libcrypto/util/mkfiles.pl +++ /dev/null @@ -1,142 +0,0 @@ -#!/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/cmac", -"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", -"crypto/srp", -"ssl", -"apps", -"engines", -"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 () - { - 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/\$[({]([^)}]+)[)}]/$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); -} diff --git a/lib/libcrypto/util/mklink.pl b/lib/libcrypto/util/mklink.pl deleted file mode 100644 index 61db12c68f3..00000000000 --- a/lib/libcrypto/util/mklink.pl +++ /dev/null @@ -1,73 +0,0 @@ -#!/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 () { - 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"; -} diff --git a/lib/libcrypto/util/mkrc.pl b/lib/libcrypto/util/mkrc.pl deleted file mode 100755 index 0ceadcf8d14..00000000000 --- a/lib/libcrypto/util/mkrc.pl +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/env perl -# -open FD,"crypto/opensslv.h"; -while() { - 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 - -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 -___ diff --git a/lib/libcrypto/util/perlpath.pl b/lib/libcrypto/util/perlpath.pl deleted file mode 100644 index a1f236bd984..00000000000 --- a/lib/libcrypto/util/perlpath.pl +++ /dev/null @@ -1,35 +0,0 @@ -#!/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=; - 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"; - } diff --git a/lib/libcrypto/util/pod2man.pl b/lib/libcrypto/util/pod2man.pl deleted file mode 100644 index 025d914f2e8..00000000000 --- a/lib/libcrypto/util/pod2man.pl +++ /dev/null @@ -1,1184 +0,0 @@ -: #!/usr/bin/perl-5.005 - eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' - if $running_under_some_shell; - -$DEF_PM_SECTION = '3pm' || '3'; - -=head1 NAME - -pod2man - translate embedded Perl pod directives into man pages - -=head1 SYNOPSIS - -B -[ B<--section=>I ] -[ B<--release=>I ] -[ B<--center=>I ] -[ B<--date=>I ] -[ B<--fixed=>I ] -[ B<--official> ] -[ B<--lax> ] -I - -=head1 DESCRIPTION - -B converts its input file containing embedded pod directives (see -L) into nroff source suitable for viewing with nroff(1) or -troff(1) using the man(7) macro set. - -Besides the obvious pod conversions, B also takes care of -func(), func(n), and simple variable references like $foo or @bar so -you don't have to use code escapes for them; complex expressions like -C<$fred{'stuff'}> will still need to be escaped, though. Other nagging -little roffish things that it catches include translating the minus in -something like foo-bar, making a long dash--like this--into a real em -dash, fixing up "paired quotes", putting a little space after the -parens in something like func(), making C++ and PI look right, making -double underbars have a little tiny space between them, making ALLCAPS -a teeny bit smaller in troff(1), and escaping backslashes so you don't -have to. - -=head1 OPTIONS - -=over 8 - -=item center - -Set the centered header to a specific string. The default is -"User Contributed Perl Documentation", unless the C<--official> flag is -given, in which case the default is "Perl Programmers Reference Guide". - -=item date - -Set the left-hand footer string to this value. By default, -the modification date of the input file will be used. - -=item fixed - -The fixed font to use for code refs. Defaults to CW. - -=item official - -Set the default header to indicate that this page is of -the standard release in case C<--center> is not given. - -=item release - -Set the centered footer. By default, this is the current -perl release. - -=item section - -Set the section for the C<.TH> macro. The standard conventions on -sections are to use 1 for user commands, 2 for system calls, 3 for -functions, 4 for devices, 5 for file formats, 6 for games, 7 for -miscellaneous information, and 8 for administrator commands. This works -best if you put your Perl man pages in a separate tree, like -F. By default, section 1 will be used -unless the file ends in F<.pm> in which case section 3 will be selected. - -=item lax - -Don't complain when required sections aren't present. - -=back - -=head1 Anatomy of a Proper Man Page - -For those not sure of the proper layout of a man page, here's -an example of the skeleton of a proper man page. Head of the -major headers should be setout as a C<=head1> directive, and -are historically written in the rather startling ALL UPPER CASE -format, although this is not mandatory. -Minor headers may be included using C<=head2>, and are -typically in mixed case. - -=over 10 - -=item NAME - -Mandatory section; should be a comma-separated list of programs or -functions documented by this podpage, such as: - - foo, bar - programs to do something - -=item SYNOPSIS - -A short usage summary for programs and functions, which -may someday be deemed mandatory. - -=item DESCRIPTION - -Long drawn out discussion of the program. It's a good idea to break this -up into subsections using the C<=head2> directives, like - - =head2 A Sample Subection - - =head2 Yet Another Sample Subection - -=item OPTIONS - -Some people make this separate from the description. - -=item RETURN VALUE - -What the program or function returns if successful. - -=item ERRORS - -Exceptions, return codes, exit stati, and errno settings. - -=item EXAMPLES - -Give some example uses of the program. - -=item ENVIRONMENT - -Envariables this program might care about. - -=item FILES - -All files used by the program. You should probably use the FEE -for these. - -=item SEE ALSO - -Other man pages to check out, like man(1), man(7), makewhatis(8), or catman(8). - -=item NOTES - -Miscellaneous commentary. - -=item CAVEATS - -Things to take special care with; sometimes called WARNINGS. - -=item DIAGNOSTICS - -All possible messages the program can print out--and -what they mean. - -=item BUGS - -Things that are broken or just don't work quite right. - -=item RESTRICTIONS - -Bugs you don't plan to fix :-) - -=item AUTHOR - -Who wrote it (or AUTHORS if multiple). - -=item HISTORY - -Programs derived from other sources sometimes have this, or -you might keep a modification log here. - -=back - -=head1 EXAMPLES - - pod2man program > program.1 - pod2man some_module.pm > /usr/perl/man/man3/some_module.3 - pod2man --section=7 note.pod > note.7 - -=head1 DIAGNOSTICS - -The following diagnostics are generated by B. Items -marked "(W)" are non-fatal, whereas the "(F)" errors will cause -B to immediately exit with a non-zero status. - -=over 4 - -=item bad option in paragraph %d of %s: ``%s'' should be [%s]<%s> - -(W) If you start include an option, you should set it off -as bold, italic, or code. - -=item can't open %s: %s - -(F) The input file wasn't available for the given reason. - -=item Improper man page - no dash in NAME header in paragraph %d of %s - -(W) The NAME header did not have an isolated dash in it. This is -considered important. - -=item Invalid man page - no NAME line in %s - -(F) You did not include a NAME header, which is essential. - -=item roff font should be 1 or 2 chars, not `%s' (F) - -(F) The font specified with the C<--fixed> option was not -a one- or two-digit roff font. - -=item %s is missing required section: %s - -(W) Required sections include NAME, DESCRIPTION, and if you're -using a section starting with a 3, also a SYNOPSIS. Actually, -not having a NAME is a fatal. - -=item Unknown escape: %s in %s - -(W) An unknown HTML entity (probably for an 8-bit character) was given via -a CE> directive. Besides amp, lt, gt, and quot, recognized -entities are Aacute, aacute, Acirc, acirc, AElig, aelig, Agrave, agrave, -Aring, aring, Atilde, atilde, Auml, auml, Ccedil, ccedil, Eacute, eacute, -Ecirc, ecirc, Egrave, egrave, ETH, eth, Euml, euml, Iacute, iacute, Icirc, -icirc, Igrave, igrave, Iuml, iuml, Ntilde, ntilde, Oacute, oacute, Ocirc, -ocirc, Ograve, ograve, Oslash, oslash, Otilde, otilde, Ouml, ouml, szlig, -THORN, thorn, Uacute, uacute, Ucirc, ucirc, Ugrave, ugrave, Uuml, uuml, -Yacute, yacute, and yuml. - -=item Unmatched =back - -(W) You have a C<=back> without a corresponding C<=over>. - -=item Unrecognized pod directive: %s - -(W) You specified a pod directive that isn't in the known list of -C<=head1>, C<=head2>, C<=item>, C<=over>, C<=back>, or C<=cut>. - - -=back - -=head1 NOTES - -If you would like to print out a lot of man page continuously, you -probably want to set the C and D registers to set contiguous page -numbering and even/odd paging, at least on some versions of man(7). -Settting the F register will get you some additional experimental -indexing: - - troff -man -rC1 -rD1 -rF1 perl.1 perldata.1 perlsyn.1 ... - -The indexing merely outputs messages via C<.tm> for each -major page, section, subsection, item, and any CE> -directives. - - -=head1 RESTRICTIONS - -None at this time. - -=head1 BUGS - -The =over and =back directives don't really work right. They -take absolute positions instead of offsets, don't nest well, and -making people count is suboptimal in any event. - -=head1 AUTHORS - -Original prototype by Larry Wall, but so massively hacked over by -Tom Christiansen such that Larry probably doesn't recognize it anymore. - -=cut - -$/ = ""; -$cutting = 1; -@Indices = (); - -# We try first to get the version number from a local binary, in case we're -# running an installed version of Perl to produce documentation from an -# uninstalled newer version's pod files. -if ($^O ne 'plan9' and $^O ne 'dos' and $^O ne 'os2' and $^O ne 'MSWin32') { - my $perl = (-x './perl' && -f './perl' ) ? - './perl' : - ((-x '../perl' && -f '../perl') ? - '../perl' : - ''); - ($version,$patch) = `$perl -e 'print $]'` =~ /^(\d\.\d{3})(\d{2})?/ if $perl; -} -# No luck; we'll just go with the running Perl's version -($version,$patch) = $] =~ /^(.{5})(\d{2})?/ unless $version; -$DEF_RELEASE = "perl $version"; -$DEF_RELEASE .= ", patch $patch" if $patch; - - -sub makedate { - my $secs = shift; - my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secs); - my $mname = (qw{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec})[$mon]; - $year += 1900; - return "$mday/$mname/$year"; -} - -use Getopt::Long; - -$DEF_SECTION = 1; -$DEF_CENTER = "User Contributed Perl Documentation"; -$STD_CENTER = "Perl Programmers Reference Guide"; -$DEF_FIXED = 'CW'; -$DEF_LAX = 0; - -sub usage { - warn "$0: @_\n" if @_; - die <"; -$Filename = $name; -if ($section =~ /^1/) { - require File::Basename; - $name = uc File::Basename::basename($name); -} -$name =~ s/\.(pod|p[lm])$//i; - -# Lose everything up to the first of -# */lib/*perl* standard or site_perl module -# */*perl*/lib from -D prefix=/opt/perl -# */*perl*/ random module hierarchy -# which works. -$name =~ s-//+-/-g; -if ($name =~ s-^.*?/lib/[^/]*perl[^/]*/--i - or $name =~ s-^.*?/[^/]*perl[^/]*/lib/--i - or $name =~ s-^.*?/[^/]*perl[^/]*/--i) { - # Lose ^site(_perl)?/. - $name =~ s-^site(_perl)?/--; - # Lose ^arch/. (XXX should we use Config? Just for archname?) - $name =~ s~^(.*-$^O|$^O-.*)/~~o; - # Lose ^version/. - $name =~ s-^\d+\.\d+/--; -} - -# Translate Getopt/Long to Getopt::Long, etc. -$name =~ s(/)(::)g; - -if ($name ne 'something') { - FCHECK: { - open(F, "< $ARGV[0]") || die "can't open $ARGV[0]: $!"; - while () { - next unless /^=\b/; - if (/^=head1\s+NAME\s*$/) { # an /m would forgive mistakes - $_ = ; - unless (/\s*-+\s+/) { - $oops++; - warn "$0: Improper man page - no dash in NAME header in paragraph $. of $ARGV[0]\n" - } else { - my @n = split /\s+-+\s+/; - if (@n != 2) { - $oops++; - warn "$0: Improper man page - malformed NAME header in paragraph $. of $ARGV[0]\n" - } - else { - $n[0] =~ s/\n/ /g; - $n[1] =~ s/\n/ /g; - %namedesc = @n; - } - } - last FCHECK; - } - next if /^=cut\b/; # DB_File and Net::Ping have =cut before NAME - next if /^=pod\b/; # It is OK to have =pod before NAME - next if /^=(for|begin|end)\s+comment\b/; # It is OK to have =for =begin or =end comment before NAME - die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax; - } - die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax; - } - close F; -} - -print <<"END"; -.rn '' }` -''' \$RCSfile\$\$Revision\$\$Date\$ -''' -''' \$Log\$ -''' -.de Sh -.br -.if t .Sp -.ne 5 -.PP -\\fB\\\\\$1\\fR -.PP -.. -.de Sp -.if t .sp .5v -.if n .sp -.. -.de Ip -.br -.ie \\\\n(.\$>=3 .ne \\\\\$3 -.el .ne 3 -.IP "\\\\\$1" \\\\\$2 -.. -.de Vb -.ft $CFont -.nf -.ne \\\\\$1 -.. -.de Ve -.ft R - -.fi -.. -''' -''' -''' Set up \\*(-- to give an unbreakable dash; -''' string Tr holds user defined translation string. -''' Bell System Logo is used as a dummy character. -''' -.tr \\(*W-|\\(bv\\*(Tr -.ie n \\{\\ -.ds -- \\(*W- -.ds PI pi -.if (\\n(.H=4u)&(1m=24u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-12u'-\\" diablo 10 pitch -.if (\\n(.H=4u)&(1m=20u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-8u'-\\" diablo 12 pitch -.ds L" "" -.ds R" "" -''' \\*(M", \\*(S", \\*(N" and \\*(T" are the equivalent of -''' \\*(L" and \\*(R", except that they are used on ".xx" lines, -''' such as .IP and .SH, which do another additional levels of -''' double-quote interpretation -.ds M" """ -.ds S" """ -.ds N" """"" -.ds T" """"" -.ds L' ' -.ds R' ' -.ds M' ' -.ds S' ' -.ds N' ' -.ds T' ' -'br\\} -.el\\{\\ -.ds -- \\(em\\| -.tr \\*(Tr -.ds L" `` -.ds R" '' -.ds M" `` -.ds S" '' -.ds N" `` -.ds T" '' -.ds L' ` -.ds R' ' -.ds M' ` -.ds S' ' -.ds N' ` -.ds T' ' -.ds PI \\(*p -'br\\} -END - -print <<'END'; -.\" If the F register is turned on, we'll generate -.\" index entries out stderr for the following things: -.\" TH Title -.\" SH Header -.\" Sh Subsection -.\" Ip Item -.\" X<> Xref (embedded -.\" Of course, you have to process the output yourself -.\" in some meaninful fashion. -.if \nF \{ -.de IX -.tm Index:\\$1\t\\n%\t"\\$2" -.. -.nr % 0 -.rr F -.\} -END - -print <<"END"; -.TH $name $section "$RP" "$date" "$center" -.UC -END - -push(@Indices, qq{.IX Title "$name $section"}); - -while (($name, $desc) = each %namedesc) { - for ($name, $desc) { s/^\s+//; s/\s+$//; } - push(@Indices, qq(.IX Name "$name - $desc"\n)); -} - -print <<'END'; -.if n .hy 0 -.if n .na -.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' -.de CQ \" put $1 in typewriter font -END -print ".ft $CFont\n"; -print <<'END'; -'if n "\c -'if t \\&\\$1\c -'if n \\&\\$1\c -'if n \&" -\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 -'.ft R -.. -.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 -. \" AM - accent mark definitions -.bd B 3 -. \" fudge factors for nroff and troff -.if n \{\ -. ds #H 0 -. ds #V .8m -. ds #F .3m -. ds #[ \f1 -. ds #] \fP -.\} -.if t \{\ -. ds #H ((1u-(\\\\n(.fu%2u))*.13m) -. ds #V .6m -. ds #F 0 -. ds #[ \& -. ds #] \& -.\} -. \" simple accents for nroff and troff -.if n \{\ -. ds ' \& -. ds ` \& -. ds ^ \& -. ds , \& -. ds ~ ~ -. ds ? ? -. ds ! ! -. ds / -. ds q -.\} -.if t \{\ -. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" -. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' -. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' -. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' -. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' -. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' -. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' -. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' -. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' -.\} -. \" troff and (daisy-wheel) nroff accents -.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' -.ds 8 \h'\*(#H'\(*b\h'-\*(#H' -.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] -.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' -.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' -.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] -.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] -.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' -.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' -.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] -.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] -.ds ae a\h'-(\w'a'u*4/10)'e -.ds Ae A\h'-(\w'A'u*4/10)'E -.ds oe o\h'-(\w'o'u*4/10)'e -.ds Oe O\h'-(\w'O'u*4/10)'E -. \" corrections for vroff -.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' -.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' -. \" for low resolution devices (crt and lpr) -.if \n(.H>23 .if \n(.V>19 \ -\{\ -. ds : e -. ds 8 ss -. ds v \h'-1'\o'\(aa\(ga' -. ds _ \h'-1'^ -. ds . \h'-1'. -. ds 3 3 -. ds o a -. ds d- d\h'-1'\(ga -. ds D- D\h'-1'\(hy -. ds th \o'bp' -. ds Th \o'LP' -. ds ae ae -. ds Ae AE -. ds oe oe -. ds Oe OE -.\} -.rm #[ #] #H #V #F C -END - -$indent = 0; - -$begun = ""; - -# Unrolling [^A-Z>]|[A-Z](?!<) gives: // MRE pp 165. -my $nonest = '(?:[^A-Z>]*(?:[A-Z](?!<)[^A-Z>]*)*)'; - -while (<>) { - if ($cutting) { - next unless /^=/; - $cutting = 0; - } - if ($begun) { - if (/^=end\s+$begun/) { - $begun = ""; - } - elsif ($begun =~ /^(roff|man)$/) { - print STDOUT $_; - } - next; - } - chomp; - - # Translate verbatim paragraph - - if (/^\s/) { - @lines = split(/\n/); - for (@lines) { - 1 while s - {^( [^\t]* ) \t ( \t* ) } - { $1 . ' ' x (8 - (length($1)%8) + 8 * (length($2))) }ex; - s/\\/\\e/g; - s/\A/\\&/s; - } - $lines = @lines; - makespace() unless $verbatim++; - print ".Vb $lines\n"; - print join("\n", @lines), "\n"; - print ".Ve\n"; - $needspace = 0; - next; - } - - $verbatim = 0; - - if (/^=for\s+(\S+)\s*/s) { - if ($1 eq "man" or $1 eq "roff") { - print STDOUT $',"\n\n"; - } else { - # ignore unknown for - } - next; - } - elsif (/^=begin\s+(\S+)\s*/s) { - $begun = $1; - if ($1 eq "man" or $1 eq "roff") { - print STDOUT $'."\n\n"; - } - next; - } - - # check for things that'll hosed our noremap scheme; affects $_ - init_noremap(); - - if (!/^=item/) { - - # trofficate backslashes; must do it before what happens below - s/\\/noremap('\\e')/ge; - - # protect leading periods and quotes against *roff - # mistaking them for directives - s/^(?:[A-Z]<)?[.']/\\&$&/gm; - - # first hide the escapes in case we need to - # intuit something and get it wrong due to fmting - - 1 while s/([A-Z]<$nonest>)/noremap($1)/ge; - - # func() is a reference to a perl function - s{ - \b - ( - [:\w]+ \(\) - ) - } {I<$1>}gx; - - # func(n) is a reference to a perl function or a man page - s{ - ([:\w]+) - ( - \( [^\051]+ \) - ) - } {I<$1>\\|$2}gx; - - # convert simple variable references - s/(\s+)([\$\@%][\w:]+)(?!\()/${1}C<$2>/g; - - if (m{ ( - [\-\w]+ - \( - [^\051]*? - [\@\$,] - [^\051]*? - \) - ) - }x && $` !~ /([LCI]<[^<>]*|-)$/ && !/^=\w/) - { - warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [LCI]<$1>\n"; - $oops++; - } - - while (/(-[a-zA-Z])\b/g && $` !~ /[\w\-]$/) { - warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [CB]<$1>\n"; - $oops++; - } - - # put it back so we get the <> processed again; - clear_noremap(0); # 0 means leave the E's - - } else { - # trofficate backslashes - s/\\/noremap('\\e')/ge; - - } - - # need to hide E<> first; they're processed in clear_noremap - s/(E<[^<>]+>)/noremap($1)/ge; - - - $maxnest = 10; - while ($maxnest-- && /[A-Z]/font($1) . $2 . font('R')/eg; - - # files and filelike refs in italics - s/F<($nonest)>/I<$1>/g; - - # no break -- usually we want C<> for this - s/S<($nonest)>/nobreak($1)/eg; - - # LREF: a la HREF L - s:L<([^|>]+)\|[^>]+>:$1:g; - - # LREF: a manpage(3f) - s:L<([a-zA-Z][^\s\/]+)(\([^\)]+\))?>:the I<$1>$2 manpage:g; - - # LREF: an =item on another manpage - s{ - L< - ([^/]+) - / - ( - [:\w]+ - (\(\))? - ) - > - } {the C<$2> entry in the I<$1> manpage}gx; - - # LREF: an =item on this manpage - s{ - ((?: - L< - / - ( - [:\w]+ - (\(\))? - ) - > - (,?\s+(and\s+)?)? - )+) - } { internal_lrefs($1) }gex; - - # LREF: a =head2 (head1?), maybe on a manpage, maybe right here - # the "func" can disambiguate - s{ - L< - (?: - ([a-zA-Z]\S+?) / - )? - "?(.*?)"? - > - }{ - do { - $1 # if no $1, assume it means on this page. - ? "the section on I<$2> in the I<$1> manpage" - : "the section on I<$2>" - } - }gesx; # s in case it goes over multiple lines, so . matches \n - - s/Z<>/\\&/g; - - # comes last because not subject to reprocessing - s/C<($nonest)>/noremap("${CFont_embed}${1}\\fR")/eg; - } - - if (s/^=//) { - $needspace = 0; # Assume this. - - s/\n/ /g; - - ($Cmd, $_) = split(' ', $_, 2); - - $dotlevel = 1; - if ($Cmd eq 'head1') { - $dotlevel = 1; - } - elsif ($Cmd eq 'head2') { - $dotlevel = 1; - } - elsif ($Cmd eq 'item') { - $dotlevel = 2; - } - - if (defined $_) { - &escapes($dotlevel); - s/"/""/g; - } - - clear_noremap(1); - - if ($Cmd eq 'cut') { - $cutting = 1; - } - elsif ($Cmd eq 'head1') { - s/\s+$//; - delete $wanna_see{$_} if exists $wanna_see{$_}; - print qq{.SH "$_"\n}; - push(@Indices, qq{.IX Header "$_"\n}); - } - elsif ($Cmd eq 'head2') { - print qq{.Sh "$_"\n}; - push(@Indices, qq{.IX Subsection "$_"\n}); - } - elsif ($Cmd eq 'over') { - push(@indent,$indent); - $indent += ($_ + 0) || 5; - } - elsif ($Cmd eq 'back') { - $indent = pop(@indent); - warn "$0: Unmatched =back in paragraph $. of $ARGV\n" unless defined $indent; - $needspace = 1; - } - elsif ($Cmd eq 'item') { - s/^\*( |$)/\\(bu$1/g; - # if you know how to get ":s please do - s/\\\*\(L"([^"]+?)\\\*\(R"/'$1'/g; - s/\\\*\(L"([^"]+?)""/'$1'/g; - s/[^"]""([^"]+?)""[^"]/'$1'/g; - # here do something about the $" in perlvar? - print STDOUT qq{.Ip "$_" $indent\n}; - push(@Indices, qq{.IX Item "$_"\n}); - } - elsif ($Cmd eq 'pod') { - # this is just a comment - } - else { - warn "$0: Unrecognized pod directive in paragraph $. of $ARGV: $Cmd\n"; - } - } - else { - if ($needspace) { - &makespace; - } - &escapes(0); - clear_noremap(1); - print $_, "\n"; - $needspace = 1; - } -} - -print <<"END"; - -.rn }` '' -END - -if (%wanna_see && !$lax) { - @missing = keys %wanna_see; - warn "$0: $Filename is missing required section" - . (@missing > 1 && "s") - . ": @missing\n"; - $oops++; -} - -foreach (@Indices) { print "$_\n"; } - -exit; -#exit ($oops != 0); - -######################################################################### - -sub nobreak { - my $string = shift; - $string =~ s/ /\\ /g; - $string; -} - -sub escapes { - my $indot = shift; - - s/X<(.*?)>/mkindex($1)/ge; - - # translate the minus in foo-bar into foo\-bar for roff - s/([^0-9a-z-])-([^-])/$1\\-$2/g; - - # make -- into the string version \*(-- (defined above) - s/\b--\b/\\*(--/g; - s/"--([^"])/"\\*(--$1/g; # should be a better way - s/([^"])--"/$1\\*(--"/g; - - # fix up quotes; this is somewhat tricky - my $dotmacroL = 'L'; - my $dotmacroR = 'R'; - if ( $indot == 1 ) { - $dotmacroL = 'M'; - $dotmacroR = 'S'; - } - elsif ( $indot >= 2 ) { - $dotmacroL = 'N'; - $dotmacroR = 'T'; - } - if (!/""/) { - s/(^|\s)(['"])/noremap("$1\\*($dotmacroL$2")/ge; - s/(['"])($|[\-\s,;\\!?.])/noremap("\\*($dotmacroR$1$2")/ge; - } - - #s/(?!")(?:.)--(?!")(?:.)/\\*(--/g; - #s/(?:(?!")(?:.)--(?:"))|(?:(?:")--(?!")(?:.))/\\*(--/g; - - - # make sure that func() keeps a bit a space tween the parens - ### s/\b\(\)/\\|()/g; - ### s/\b\(\)/(\\|)/g; - - # make C++ into \*C+, which is a squinched version (defined above) - s/\bC\+\+/\\*(C+/g; - - # make double underbars have a little tiny space between them - s/__/_\\|_/g; - - # PI goes to \*(PI (defined above) - s/\bPI\b/noremap('\\*(PI')/ge; - - # make all caps a teeny bit smaller, but don't muck with embedded code literals - my $hidCFont = font('C'); - if ($Cmd !~ /^head1/) { # SH already makes smaller - # /g isn't enough; 1 while or we'll be off - -# 1 while s{ -# (?!$hidCFont)(..|^.|^) -# \b -# ( -# [A-Z][\/A-Z+:\-\d_$.]+ -# ) -# (s?) -# \b -# } {$1\\s-1$2\\s0}gmox; - - 1 while s{ - (?!$hidCFont)(..|^.|^) - ( - \b[A-Z]{2,}[\/A-Z+:\-\d_\$]*\b - ) - } { - $1 . noremap( '\\s-1' . $2 . '\\s0' ) - }egmox; - - } -} - -# make troff just be normal, but make small nroff get quoted -# decided to just put the quotes in the text; sigh; -sub ccvt { - local($_,$prev) = @_; - noremap(qq{.CQ "$_" \n\\&}); -} - -sub makespace { - if ($indent) { - print ".Sp\n"; - } - else { - print ".PP\n"; - } -} - -sub mkindex { - my ($entry) = @_; - my @entries = split m:\s*/\s*:, $entry; - push @Indices, ".IX Xref " . join ' ', map {qq("$_")} @entries; - return ''; -} - -sub font { - local($font) = shift; - return '\\f' . noremap($font); -} - -sub noremap { - local($thing_to_hide) = shift; - $thing_to_hide =~ tr/\000-\177/\200-\377/; - return $thing_to_hide; -} - -sub init_noremap { - # escape high bit characters in input stream - s/([\200-\377])/"E<".ord($1).">"/ge; -} - -sub clear_noremap { - my $ready_to_print = $_[0]; - - tr/\200-\377/\000-\177/; - - # trofficate backslashes - # s/(?!\\e)(?:..|^.|^)\\/\\e/g; - - # now for the E<>s, which have been hidden until now - # otherwise the interative \w<> processing would have - # been hosed by the E - s { - E< - ( - ( \d + ) - | ( [A-Za-z]+ ) - ) - > - } { - do { - defined $2 - ? chr($2) - : - exists $HTML_Escapes{$3} - ? do { $HTML_Escapes{$3} } - : do { - warn "$0: Unknown escape in paragraph $. of $ARGV: ``$&''\n"; - "E<$1>"; - } - } - }egx if $ready_to_print; -} - -sub internal_lrefs { - local($_) = shift; - local $trailing_and = s/and\s+$// ? "and " : ""; - - s{L]+)>}{$1}g; - my(@items) = split( /(?:,?\s+(?:and\s+)?)/ ); - my $retstr = "the "; - my $i; - for ($i = 0; $i <= $#items; $i++) { - $retstr .= "C<$items[$i]>"; - $retstr .= ", " if @items > 2 && $i != $#items; - $retstr .= " and " if $i+2 == @items; - } - - $retstr .= " entr" . ( @items > 1 ? "ies" : "y" ) - . " elsewhere in this document"; - # terminal space to avoid words running together (pattern used - # strips terminal spaces) - $retstr .= " " if length $trailing_and; - $retstr .= $trailing_and; - - return $retstr; - -} - -BEGIN { -%HTML_Escapes = ( - 'amp' => '&', # ampersand - 'lt' => '<', # left chevron, less-than - 'gt' => '>', # right chevron, greater-than - 'quot' => '"', # double quote - - "Aacute" => "A\\*'", # capital A, acute accent - "aacute" => "a\\*'", # small a, acute accent - "Acirc" => "A\\*^", # capital A, circumflex accent - "acirc" => "a\\*^", # small a, circumflex accent - "AElig" => '\*(AE', # capital AE diphthong (ligature) - "aelig" => '\*(ae', # small ae diphthong (ligature) - "Agrave" => "A\\*`", # capital A, grave accent - "agrave" => "A\\*`", # small a, grave accent - "Aring" => 'A\\*o', # capital A, ring - "aring" => 'a\\*o', # small a, ring - "Atilde" => 'A\\*~', # capital A, tilde - "atilde" => 'a\\*~', # small a, tilde - "Auml" => 'A\\*:', # capital A, dieresis or umlaut mark - "auml" => 'a\\*:', # small a, dieresis or umlaut mark - "Ccedil" => 'C\\*,', # capital C, cedilla - "ccedil" => 'c\\*,', # small c, cedilla - "Eacute" => "E\\*'", # capital E, acute accent - "eacute" => "e\\*'", # small e, acute accent - "Ecirc" => "E\\*^", # capital E, circumflex accent - "ecirc" => "e\\*^", # small e, circumflex accent - "Egrave" => "E\\*`", # capital E, grave accent - "egrave" => "e\\*`", # small e, grave accent - "ETH" => '\\*(D-', # capital Eth, Icelandic - "eth" => '\\*(d-', # small eth, Icelandic - "Euml" => "E\\*:", # capital E, dieresis or umlaut mark - "euml" => "e\\*:", # small e, dieresis or umlaut mark - "Iacute" => "I\\*'", # capital I, acute accent - "iacute" => "i\\*'", # small i, acute accent - "Icirc" => "I\\*^", # capital I, circumflex accent - "icirc" => "i\\*^", # small i, circumflex accent - "Igrave" => "I\\*`", # capital I, grave accent - "igrave" => "i\\*`", # small i, grave accent - "Iuml" => "I\\*:", # capital I, dieresis or umlaut mark - "iuml" => "i\\*:", # small i, dieresis or umlaut mark - "Ntilde" => 'N\*~', # capital N, tilde - "ntilde" => 'n\*~', # small n, tilde - "Oacute" => "O\\*'", # capital O, acute accent - "oacute" => "o\\*'", # small o, acute accent - "Ocirc" => "O\\*^", # capital O, circumflex accent - "ocirc" => "o\\*^", # small o, circumflex accent - "Ograve" => "O\\*`", # capital O, grave accent - "ograve" => "o\\*`", # small o, grave accent - "Oslash" => "O\\*/", # capital O, slash - "oslash" => "o\\*/", # small o, slash - "Otilde" => "O\\*~", # capital O, tilde - "otilde" => "o\\*~", # small o, tilde - "Ouml" => "O\\*:", # capital O, dieresis or umlaut mark - "ouml" => "o\\*:", # small o, dieresis or umlaut mark - "szlig" => '\*8', # small sharp s, German (sz ligature) - "THORN" => '\\*(Th', # capital THORN, Icelandic - "thorn" => '\\*(th',, # small thorn, Icelandic - "Uacute" => "U\\*'", # capital U, acute accent - "uacute" => "u\\*'", # small u, acute accent - "Ucirc" => "U\\*^", # capital U, circumflex accent - "ucirc" => "u\\*^", # small u, circumflex accent - "Ugrave" => "U\\*`", # capital U, grave accent - "ugrave" => "u\\*`", # small u, grave accent - "Uuml" => "U\\*:", # capital U, dieresis or umlaut mark - "uuml" => "u\\*:", # small u, dieresis or umlaut mark - "Yacute" => "Y\\*'", # capital Y, acute accent - "yacute" => "y\\*'", # small y, acute accent - "yuml" => "y\\*:", # small y, dieresis or umlaut mark -); -} - diff --git a/lib/libcrypto/util/pod2mantest b/lib/libcrypto/util/pod2mantest deleted file mode 100644 index 384e683df4c..00000000000 --- a/lib/libcrypto/util/pod2mantest +++ /dev/null @@ -1,58 +0,0 @@ -#!/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" diff --git a/lib/libcrypto/util/pod2mantest.pod b/lib/libcrypto/util/pod2mantest.pod deleted file mode 100644 index 5d2539a17fb..00000000000 --- a/lib/libcrypto/util/pod2mantest.pod +++ /dev/null @@ -1,15 +0,0 @@ -=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 diff --git a/lib/libcrypto/util/point.sh b/lib/libcrypto/util/point.sh deleted file mode 100644 index da39899cb19..00000000000 --- a/lib/libcrypto/util/point.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/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" - diff --git a/lib/libcrypto/util/selftest.pl b/lib/libcrypto/util/selftest.pl deleted file mode 100644 index 7b32e9f4ff2..00000000000 --- a/lib/libcrypto/util/selftest.pl +++ /dev/null @@ -1,201 +0,0 @@ -#!/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,") { - $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,") { - 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 \n#include \n#include \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 \n#include \n#include \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,") { - 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,") { - $ok=2 if /^platform: $platform/; - } - close(IN); -} - -if ($ok != 2) { - print OUT "Failure!\n"; - if (open(IN,") { - print OUT; - } - close(IN); - print OUT $sep; - } else { - print OUT "make.log not found!\n"; - } - if (open(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 () { - if (/$sep/) { - print "[...]\n"; - last; - } - print; -} -print "\nTest report in file $report\n"; - diff --git a/lib/libcrypto/util/sp-diff.pl b/lib/libcrypto/util/sp-diff.pl deleted file mode 100644 index 9d6c60387fa..00000000000 --- a/lib/libcrypto/util/sp-diff.pl +++ /dev/null @@ -1,80 +0,0 @@ -#!/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 () - { - $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); - } - diff --git a/lib/libcrypto/util/speed.sh b/lib/libcrypto/util/speed.sh deleted file mode 100644 index f489706197b..00000000000 --- a/lib/libcrypto/util/speed.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/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 - diff --git a/lib/libcrypto/util/src-dep.pl b/lib/libcrypto/util/src-dep.pl deleted file mode 100644 index ad997e47468..00000000000 --- a/lib/libcrypto/util/src-dep.pl +++ /dev/null @@ -1,147 +0,0 @@ -#!/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 () - { - 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 () - { - 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); - } - diff --git a/lib/libcrypto/util/tab_num.pl b/lib/libcrypto/util/tab_num.pl deleted file mode 100644 index a81ed0edc24..00000000000 --- a/lib/libcrypto/util/tab_num.pl +++ /dev/null @@ -1,17 +0,0 @@ -#!/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++; - } - diff --git a/lib/libssl/src/util/FreeBSD.sh b/lib/libssl/src/util/FreeBSD.sh deleted file mode 100644 index db8edfc6aa2..00000000000 --- a/lib/libssl/src/util/FreeBSD.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -perl util/perlpath.pl /usr/bin -perl util/ssldir.pl /usr/local -perl util/mk1mf.pl FreeBSD >Makefile.FreeBSD -perl Configure FreeBSD diff --git a/lib/libssl/src/util/add_cr.pl b/lib/libssl/src/util/add_cr.pl deleted file mode 100644 index c7b62c11ec9..00000000000 --- a/lib/libssl/src/util/add_cr.pl +++ /dev/null @@ -1,123 +0,0 @@ -#!/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=; - - 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 - } diff --git a/lib/libssl/src/util/ck_errf.pl b/lib/libssl/src/util/ck_errf.pl deleted file mode 100644 index f13af5c50b4..00000000000 --- a/lib/libssl/src/util/ck_errf.pl +++ /dev/null @@ -1,64 +0,0 @@ -#!/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 () - { - 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; - } - diff --git a/lib/libssl/src/util/clean-depend.pl b/lib/libssl/src/util/clean-depend.pl deleted file mode 100644 index d3525b0ed06..00000000000 --- a/lib/libssl/src/util/clean-depend.pl +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/local/bin/perl -w -# Clean the dependency list in a makefile of standard includes... -# Written by Ben Laurie 19 Jan 1999 - -use strict; - -while() { - print; - last if /^# DO NOT DELETE THIS LINE/; -} - -my %files; - -my $thisfile=""; -while() { - 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"; diff --git a/lib/libssl/src/util/copy.pl b/lib/libssl/src/util/copy.pl deleted file mode 100644 index eba6d5815e9..00000000000 --- a/lib/libssl/src/util/copy.pl +++ /dev/null @@ -1,70 +0,0 @@ -#!/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 $stripcr = 0; - -my $arg; - -foreach $arg (@ARGV) { - if ($arg eq "-stripcr") - { - $stripcr = 1; - next; - } - $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... - foreach (glob $arg) - { - 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) - { - if ($stripcr) - { - $buf =~ tr/\015//d; - } - syswrite(OUT, $buf, length($buf)); - } - close(IN); - close(OUT); - print "Copying: $_ to $dfile\n"; - } - - diff --git a/lib/libssl/src/util/deleof.pl b/lib/libssl/src/util/deleof.pl deleted file mode 100644 index 155acd88ff1..00000000000 --- a/lib/libssl/src/util/deleof.pl +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/local/bin/perl - -while (<>) - { - print - last if (/^# DO NOT DELETE THIS LINE/); - } diff --git a/lib/libssl/src/util/dirname.pl b/lib/libssl/src/util/dirname.pl deleted file mode 100644 index d7a66d96acc..00000000000 --- a/lib/libssl/src/util/dirname.pl +++ /dev/null @@ -1,18 +0,0 @@ -#!/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); diff --git a/lib/libssl/src/util/domd b/lib/libssl/src/util/domd deleted file mode 100644 index bab48cb7a27..00000000000 --- a/lib/libssl/src/util/domd +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# Do a makedepend, only leave out the standard headers -# Written by Ben Laurie 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 diff --git a/lib/libssl/src/util/err-ins.pl b/lib/libssl/src/util/err-ins.pl deleted file mode 100644 index 31b70df8d0e..00000000000 --- a/lib/libssl/src/util/err-ins.pl +++ /dev/null @@ -1,33 +0,0 @@ -#!/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=; -close(ERR); - -open(IN,$ARGV[1]) || die "unable to open header file '$ARGV[1]':$!\n"; - -@out=""; -while () - { - 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); - - diff --git a/lib/libssl/src/util/extract-names.pl b/lib/libssl/src/util/extract-names.pl deleted file mode 100644 index 35bd6ed8432..00000000000 --- a/lib/libssl/src/util/extract-names.pl +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/perl - -$/ = ""; # Eat a paragraph at once. -while() { - 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"; - diff --git a/lib/libssl/src/util/extract-section.pl b/lib/libssl/src/util/extract-section.pl deleted file mode 100644 index 7a0ba4f69a7..00000000000 --- a/lib/libssl/src/util/extract-section.pl +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/perl - -while() { - if (/=for\s+comment\s+openssl_manual_section:(\S+)/) - { - print "$1\n"; - exit 0; - } -} - -print "$ARGV[0]\n"; - diff --git a/lib/libssl/src/util/files.pl b/lib/libssl/src/util/files.pl deleted file mode 100644 index 41f033e3b9a..00000000000 --- a/lib/libssl/src/util/files.pl +++ /dev/null @@ -1,61 +0,0 @@ -#!/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"; diff --git a/lib/libssl/src/util/install.sh b/lib/libssl/src/util/install.sh deleted file mode 100644 index e1d0c982df5..00000000000 --- a/lib/libssl/src/util/install.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/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 diff --git a/lib/libssl/src/util/mk1mf.pl b/lib/libssl/src/util/mk1mf.pl deleted file mode 100644 index 48de99f66c5..00000000000 --- a/lib/libssl/src/util/mk1mf.pl +++ /dev/null @@ -1,1230 +0,0 @@ -#!/usr/local/bin/perl -# A bit of an evil hack but it post processes the file ../MINFO which -# is generated by `make files` in the top directory. -# This script outputs one mega makefile that has no shell stuff or any -# funny stuff -# - -$INSTALLTOP="/usr/local/ssl"; -$OPENSSLDIR="/usr/local/ssl"; -$OPTIONS=""; -$ssl_version=""; -$banner="\t\@echo Building OpenSSL"; - -my $no_static_engine = 1; -my $engines = ""; -my $otherlibs = ""; -local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic -local $zlib_lib = ""; -local $perl_asm = 0; # 1 to autobuild asm files from perl scripts - -my $ex_l_libs = ""; - -# Options to import from top level Makefile - -my %mf_import = ( - VERSION => \$ssl_version, - OPTIONS => \$OPTIONS, - INSTALLTOP => \$INSTALLTOP, - OPENSSLDIR => \$OPENSSLDIR, - PLATFORM => \$mf_platform, - CFLAG => \$mf_cflag, - DEPFLAG => \$mf_depflag, - CPUID_OBJ => \$mf_cpuid_asm, - BN_ASM => \$mf_bn_asm, - DES_ENC => \$mf_des_asm, - AES_ENC => \$mf_aes_asm, - BF_ENC => \$mf_bf_asm, - CAST_ENC => \$mf_cast_asm, - RC4_ENC => \$mf_rc4_asm, - RC5_ENC => \$mf_rc5_asm, - MD5_ASM_OBJ => \$mf_md5_asm, - SHA1_ASM_OBJ => \$mf_sha_asm, - RMD160_ASM_OBJ => \$mf_rmd_asm, - WP_ASM_OBJ => \$mf_wp_asm, - CMLL_ENC => \$mf_cm_asm, - BASEADDR => \$baseaddr, - FIPSDIR => \$fipsdir, -); - - -open(IN,") { - my ($mf_opt, $mf_ref); - while (($mf_opt, $mf_ref) = each %mf_import) { - if (/^$mf_opt\s*=\s*(.*)$/) { - $$mf_ref = $1; - } - } -} -close(IN); - -$debug = 1 if $mf_platform =~ /^debug-/; - -die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq ""; - -$infile="MINFO"; - -%ops=( - "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", - "VC-WIN64I", "Microsoft C/C++ - Win64/IA-64", - "VC-WIN64A", "Microsoft C/C++ - Win64/x64", - "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", - "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", - "Mingw32", "GNU C++ - Windows NT or 9x", - "Mingw32-files", "Create files with DOS copy ...", - "BC-NT", "Borland C++ 4.5 - Windows NT", - "linux-elf","Linux elf", - "ultrix-mips","DEC mips ultrix", - "FreeBSD","FreeBSD distribution", - "OS2-EMX", "EMX GCC OS/2", - "netware-clib", "CodeWarrior for NetWare - CLib - with WinSock Sockets", - "netware-clib-bsdsock", "CodeWarrior for NetWare - CLib - with BSD Sockets", - "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets", - "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets", - "default","cc under unix", - "auto", "auto detect from top level Makefile" - ); - -$platform=""; -my $xcflags=""; -foreach (@ARGV) - { - if (!&read_options && !defined($ops{$_})) - { - print STDERR "unknown option - $_\n"; - print STDERR "usage: perl mk1mf.pl [options] [system]\n"; - print STDERR "\nwhere [system] can be one of the following\n"; - foreach $i (sort keys %ops) - { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; } - print STDERR <<"EOF"; -and [options] can be one of - no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest - no-ripemd - no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher - no-bf no-cast no-aes no-camellia no-seed - no-rsa no-dsa no-dh - Skip this public key cipher - no-ssl2 no-ssl3 - Skip this version of SSL - just-ssl - remove all non-ssl keys/digest - no-asm - No x86 asm - no-krb5 - No KRB5 - no-srp - No SRP - no-ec - No EC - no-ecdsa - No ECDSA - no-ecdh - No ECDH - no-engine - No engine - no-hw - No hw - nasm - Use NASM for x86 asm - nw-nasm - Use NASM x86 asm for NetWare - nw-mwasm - Use Metrowerks x86 asm for NetWare - gaswin - Use GNU as with Mingw32 - no-socks - No socket code - no-err - No error strings - dll/shlib - Build shared libraries (MS) - debug - Debug build - profile - Profiling build - gcc - Use Gcc (unix) - -Values that can be set -TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler - --L -l - extra library flags (unix) -- - extra 'cc' flags, - added (MS), or replace (unix) -EOF - exit(1); - } - $platform=$_; - } -foreach (grep(!/^$/, split(/ /, $OPTIONS))) - { - print STDERR "unknown option - $_\n" if !&read_options; - } - -$no_static_engine = 0 if (!$shlib); - -$no_mdc2=1 if ($no_des); - -$no_ssl3=1 if ($no_md5 || $no_sha); -$no_ssl3=1 if ($no_rsa && $no_dh); - -$no_ssl2=1 if ($no_md5); -$no_ssl2=1 if ($no_rsa); - -$out_def="out"; -$inc_def="outinc"; -$tmp_def="tmp"; - -$perl="perl" unless defined $perl; -$mkdir="-mkdir" unless defined $mkdir; - -($ssl,$crypto)=("ssl","crypto"); -$ranlib="echo ranlib"; - -$cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; -$src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.'; -$bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:''; - -# $bin_dir.=$o causes a core dump on my sparc :-( - - -$NT=0; - -push(@INC,"util/pl","pl"); - -if ($platform eq "auto") { - $platform = $mf_platform; - print STDERR "Imported platform $mf_platform\n"; -} - -if (($platform =~ /VC-(.+)/)) - { - $FLAVOR=$1; - $NT = 1 if $1 eq "NT"; - require 'VC-32.pl'; - } -elsif ($platform eq "Mingw32") - { - require 'Mingw32.pl'; - } -elsif ($platform eq "Mingw32-files") - { - require 'Mingw32f.pl'; - } -elsif ($platform eq "BC-NT") - { - $bc=1; - require 'BC-32.pl'; - } -elsif ($platform eq "FreeBSD") - { - require 'unix.pl'; - $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer'; - } -elsif ($platform eq "linux-elf") - { - require "unix.pl"; - require "linux.pl"; - $unix=1; - } -elsif ($platform eq "ultrix-mips") - { - require "unix.pl"; - require "ultrix.pl"; - $unix=1; - } -elsif ($platform eq "OS2-EMX") - { - $wc=1; - require 'OS2-EMX.pl'; - } -elsif (($platform eq "netware-clib") || ($platform eq "netware-libc") || - ($platform eq "netware-clib-bsdsock") || ($platform eq "netware-libc-bsdsock")) - { - $LIBC=1 if $platform eq "netware-libc" || $platform eq "netware-libc-bsdsock"; - $BSDSOCK=1 if ($platform eq "netware-libc-bsdsock") || ($platform eq "netware-clib-bsdsock"); - require 'netware.pl'; - } -else - { - require "unix.pl"; - - $unix=1; - $cflags.=' -DTERMIO'; - } - -$fipsdir =~ s/\//${o}/g; - -$out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":""); -$tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":""); -$inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def; - -$bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); - -$cflags= "$xcflags$cflags" if $xcflags ne ""; - -$cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; -$cflags.=" -DOPENSSL_NO_AES" if $no_aes; -$cflags.=" -DOPENSSL_NO_CAMELLIA" if $no_camellia; -$cflags.=" -DOPENSSL_NO_SEED" if $no_seed; -$cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; -$cflags.=" -DOPENSSL_NO_RC4" if $no_rc4; -$cflags.=" -DOPENSSL_NO_RC5" if $no_rc5; -$cflags.=" -DOPENSSL_NO_MD2" if $no_md2; -$cflags.=" -DOPENSSL_NO_MD4" if $no_md4; -$cflags.=" -DOPENSSL_NO_MD5" if $no_md5; -$cflags.=" -DOPENSSL_NO_SHA" if $no_sha; -$cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; -$cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd; -$cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; -$cflags.=" -DOPENSSL_NO_BF" if $no_bf; -$cflags.=" -DOPENSSL_NO_CAST" if $no_cast; -$cflags.=" -DOPENSSL_NO_DES" if $no_des; -$cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; -$cflags.=" -DOPENSSL_NO_DSA" if $no_dsa; -$cflags.=" -DOPENSSL_NO_DH" if $no_dh; -$cflags.=" -DOPENSSL_NO_WHIRLPOOL" if $no_whirlpool; -$cflags.=" -DOPENSSL_NO_SOCK" if $no_sock; -$cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2; -$cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; -$cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext; -$cflags.=" -DOPENSSL_NO_SRP" if $no_srp; -$cflags.=" -DOPENSSL_NO_CMS" if $no_cms; -$cflags.=" -DOPENSSL_NO_ERR" if $no_err; -$cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; -$cflags.=" -DOPENSSL_NO_EC" if $no_ec; -$cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa; -$cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; -$cflags.=" -DOPENSSL_NO_GOST" if $no_gost; -$cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; -$cflags.=" -DOPENSSL_NO_HW" if $no_hw; -$cflags.=" -DOPENSSL_FIPS" if $fips; -$cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; -$cflags.=" -DOPENSSL_NO_EC2M" if $no_ec2m; -$cflags.= " -DZLIB" if $zlib_opt; -$cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; - -if ($no_static_engine) - { - $cflags .= " -DOPENSSL_NO_STATIC_ENGINE"; - } -else - { - $cflags .= " -DOPENSSL_NO_DYNAMIC_ENGINE"; - } - -#$cflags.=" -DRSAref" if $rsaref ne ""; - -## if ($unix) -## { $cflags="$c_flags" if ($c_flags ne ""); } -##else - { $cflags="$c_flags$cflags" if ($c_flags ne ""); } - -$ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); - - -%shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", - "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); - -if ($msdos) - { - $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n"; - $banner.="\t\@echo top level directory, if you don't have perl, you will\n"; - $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n"; - $banner.="\t\@echo documentation for details.\n"; - } - -# have to do this to allow $(CC) under unix -$link="$bin_dir$link" if ($link !~ /^\$/); - -$INSTALLTOP =~ s|/|$o|g; -$OPENSSLDIR =~ s|/|$o|g; - -############################################# -# We parse in input file and 'store' info for later printing. -open(IN,"<$infile") || die "unable to open $infile:$!\n"; -$_=; -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 "KRB5_INCLUDES") - { $cflags .= " $val";} - - if ($key eq "ZLIB_INCLUDE") - { $cflags .= " $val" if $val ne "";} - - if ($key eq "LIBZLIB") - { $zlib_lib = "$val" if $val ne "";} - - if ($key eq "LIBKRB5") - { $ex_libs .= " $val" if $val ne "";} - - if ($key eq "TEST") - { $test.=&var_add($dir,$val, 0); } - - if (($key eq "PROGS") || ($key eq "E_OBJ")) - { $e_exe.=&var_add($dir,$val, 0); } - - if ($key eq "LIB") - { - $lib=$val; - $lib =~ s/^.*\/([^\/]+)$/$1/; - } - if ($key eq "LIBNAME" && $no_static_engine) - { - $lib=$val; - $lib =~ s/^.*\/([^\/]+)$/$1/; - $otherlibs .= " $lib"; - } - - if ($key eq "EXHEADER") - { $exheader.=&var_add($dir,$val, 1); } - - if ($key eq "HEADER") - { $header.=&var_add($dir,$val, 1); } - - if ($key eq "LIBOBJ" && ($dir ne "engines" || !$no_static_engine)) - { $libobj=&var_add($dir,$val, 0); } - if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine) - { $engines.=$val } - - if (!($_=)) - { $_="RELATIVE_DIRECTORY=FINISHED\n"; } - } -close(IN); - -if ($shlib) - { - $extra_install= <<"EOF"; - \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}bin\" - \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}bin\" - \$(CP) \"\$(L_SSL)\" \"\$(INSTALLTOP)${o}lib\" - \$(CP) \"\$(L_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" -EOF - if ($no_static_engine) - { - $extra_install .= <<"EOF" - \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\" - \$(CP) \"\$(E_SHLIB)\" \"\$(INSTALLTOP)${o}lib${o}engines\" -EOF - } - } -else - { - $extra_install= <<"EOF"; - \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}lib\" - \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" -EOF - $ex_libs .= " $zlib_lib" if $zlib_opt == 1; - if ($fips) - { - $build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)"; - $ex_l_libs .= " \$(O_FIPSCANISTER)"; - } - } - -$defs= <<"EOF"; -# This makefile has been automatically generated from the OpenSSL distribution. -# This single makefile will build the complete OpenSSL distribution and -# by default leave the 'intertesting' output files in .${o}out and the stuff -# that needs deleting in .${o}tmp. -# The file was generated by running 'make makefile.one', which -# does a 'make files', which writes all the environment variables from all -# the makefiles to the file call MINFO. This file is used by -# util${o}mk1mf.pl to generate makefile.one. -# The 'makefile per directory' system suites me when developing this -# library and also so I can 'distribute' indervidual library sections. -# The one monster makefile better suits building in non-unix -# environments. - -EOF - -$defs .= $preamble if defined $preamble; - -$defs.= <<"EOF"; -INSTALLTOP=$INSTALLTOP -OPENSSLDIR=$OPENSSLDIR - -# Set your compiler options -PLATFORM=$platform -CC=$bin_dir${cc} -CFLAG=$cflags -APP_CFLAG=$app_cflag -LIB_CFLAG=$lib_cflag -SHLIB_CFLAG=$shl_cflag -APP_EX_OBJ=$app_ex_obj -SHLIB_EX_OBJ=$shlib_ex_obj -# add extra libraries to this define, for solaris -lsocket -lnsl would -# be added -EX_LIBS=$ex_libs - -# The OpenSSL directory -SRC_D=$src_dir - -LINK=$link -LFLAGS=$lflags -RSC=$rsc - -# The output directory for everything intersting -OUT_D=$out_dir -# The output directory for all the temporary muck -TMP_D=$tmp_dir -# The output directory for the header files -INC_D=$inc_dir -INCO_D=$inc_dir${o}openssl - -PERL=$perl -CP=$cp -RM=$rm -RANLIB=$ranlib -MKDIR=$mkdir -MKLIB=$bin_dir$mklib -MLFLAGS=$mlflags -ASM=$bin_dir$asm - -# FIPS validated module and support file locations - -FIPSDIR=$fipsdir -BASEADDR=$baseaddr -FIPSLIB_D=\$(FIPSDIR)${o}lib -FIPS_PREMAIN_SRC=\$(FIPSLIB_D)${o}fips_premain.c -O_FIPSCANISTER=\$(FIPSLIB_D)${o}fipscanister.lib -FIPS_SHA1_EXE=\$(FIPSDIR)${o}bin${o}fips_standalone_sha1${exep} -E_PREMAIN_DSO=fips_premain_dso -PREMAIN_DSO_EXE=\$(BIN_D)${o}fips_premain_dso$exep -FIPSLINK=\$(PERL) \$(FIPSDIR)${o}bin${o}fipslink.pl - -###################################################### -# You should not need to touch anything below this point -###################################################### - -E_EXE=openssl -SSL=$ssl -CRYPTO=$crypto - -# BIN_D - Binary output directory -# TEST_D - Binary test file output directory -# LIB_D - library output directory -# ENG_D - dynamic engine output directory -# Note: if you change these point to different directories then uncomment out -# the lines around the 'NB' comment below. -# -BIN_D=\$(OUT_D) -TEST_D=\$(OUT_D) -LIB_D=\$(OUT_D) -ENG_D=\$(OUT_D) - -# INCL_D - local library directory -# OBJ_D - temp object file directory -OBJ_D=\$(TMP_D) -INCL_D=\$(TMP_D) - -O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp -O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp -SO_SSL= $plib\$(SSL)$so_shlibp -SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp -L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp -L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp - -L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs - -###################################################### -# Don't touch anything below this point -###################################################### - -INC=-I\$(INC_D) -I\$(INCL_D) -APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) -LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) -SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) -LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) - -############################################# -EOF - -$rules=<<"EOF"; -all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe $build_targets - -banner: -$banner - -\$(TMP_D): - \$(MKDIR) \"\$(TMP_D)\" -# NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different -#\$(BIN_D): -# \$(MKDIR) \$(BIN_D) -# -#\$(TEST_D): -# \$(MKDIR) \$(TEST_D) - -\$(LIB_D): - \$(MKDIR) \"\$(LIB_D)\" - -\$(INCO_D): \$(INC_D) - \$(MKDIR) \"\$(INCO_D)\" - -\$(INC_D): - \$(MKDIR) \"\$(INC_D)\" - -headers: \$(HEADER) \$(EXHEADER) - @ - -lib: \$(LIBS_DEP) \$(E_SHLIB) - -exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep - -install: all - \$(MKDIR) \"\$(INSTALLTOP)\" - \$(MKDIR) \"\$(INSTALLTOP)${o}bin\" - \$(MKDIR) \"\$(INSTALLTOP)${o}include\" - \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\" - \$(MKDIR) \"\$(INSTALLTOP)${o}lib\" - \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\" - \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\" - \$(MKDIR) \"\$(OPENSSLDIR)\" - \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\" -$extra_install - - -test: \$(T_EXE) - cd \$(BIN_D) - ..${o}ms${o}test - -clean: - \$(RM) \$(TMP_D)$o*.* - -vclean: - \$(RM) \$(TMP_D)$o*.* - \$(RM) \$(OUT_D)$o*.* - -EOF - -my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform"; -$platform_cpp_symbol =~ s/-/_/g; -if (open(IN,"crypto/buildinf.h")) - { - # Remove entry for this platform in existing file buildinf.h. - - my $old_buildinf_h = ""; - while () - { - if (/^\#ifdef $platform_cpp_symbol$/) - { - while () { last if (/^\#endif/); } - } - else - { - $old_buildinf_h .= $_; - } - } - close(IN); - - open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h"; - print OUT $old_buildinf_h; - close(OUT); - } - -open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h"; -printf OUT < \$no_rc2, - "no-rc4" => \$no_rc4, - "no-rc5" => \$no_rc5, - "no-idea" => \$no_idea, - "no-aes" => \$no_aes, - "no-camellia" => \$no_camellia, - "no-seed" => \$no_seed, - "no-des" => \$no_des, - "no-bf" => \$no_bf, - "no-cast" => \$no_cast, - "no-md2" => \$no_md2, - "no-md4" => \$no_md4, - "no-md5" => \$no_md5, - "no-sha" => \$no_sha, - "no-sha1" => \$no_sha1, - "no-ripemd" => \$no_ripemd, - "no-mdc2" => \$no_mdc2, - "no-whirlpool" => \$no_whirlpool, - "no-patents" => - [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa], - "no-rsa" => \$no_rsa, - "no-dsa" => \$no_dsa, - "no-dh" => \$no_dh, - "no-hmac" => \$no_hmac, - "no-asm" => \$no_asm, - "nasm" => \$nasm, - "nw-nasm" => \$nw_nasm, - "nw-mwasm" => \$nw_mwasm, - "gaswin" => \$gaswin, - "no-ssl2" => \$no_ssl2, - "no-ssl3" => \$no_ssl3, - "no-tlsext" => \$no_tlsext, - "no-srp" => \$no_srp, - "no-cms" => \$no_cms, - "no-ec2m" => \$no_ec2m, - "no-jpake" => \$no_jpake, - "no-ec_nistp_64_gcc_128" => 0, - "no-err" => \$no_err, - "no-sock" => \$no_sock, - "no-krb5" => \$no_krb5, - "no-ec" => \$no_ec, - "no-ecdsa" => \$no_ecdsa, - "no-ecdh" => \$no_ecdh, - "no-gost" => \$no_gost, - "no-engine" => \$no_engine, - "no-hw" => \$no_hw, - "no-rsax" => 0, - "just-ssl" => - [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast, - \$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh, - \$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5, - \$no_aes, \$no_camellia, \$no_seed, \$no_srp], - "rsaref" => 0, - "gcc" => \$gcc, - "debug" => \$debug, - "profile" => \$profile, - "shlib" => \$shlib, - "dll" => \$shlib, - "shared" => 0, - "no-sctp" => 0, - "no-gmp" => 0, - "no-rfc3779" => 0, - "no-montasm" => 0, - "no-shared" => 0, - "no-store" => 0, - "no-zlib" => 0, - "no-zlib-dynamic" => 0, - "fips" => \$fips - ); - - if (exists $valid_options{$_}) - { - my $r = $valid_options{$_}; - if ( ref $r eq "SCALAR") - { $$r = 1;} - elsif ( ref $r eq "ARRAY") - { - my $r2; - foreach $r2 (@$r) - { - $$r2 = 1; - } - } - } - elsif (/^no-comp$/) { $xcflags = "-DOPENSSL_NO_COMP $xcflags"; } - elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 } - elsif (/^enable-zlib-dynamic$/) - { - $zlib_opt = 2; - } - elsif (/^no-static-engine/) - { - $no_static_engine = 1; - } - elsif (/^enable-static-engine/) - { - $no_static_engine = 0; - } - # There are also enable-xxx options which correspond to - # the no-xxx. Since the scalars are enabled by default - # these can be ignored. - elsif (/^enable-/) - { - my $t = $_; - $t =~ s/^enable/no/; - if (exists $valid_options{$t}) - {return 1;} - return 0; - } - # experimental-xxx is mostly like enable-xxx, but opensslconf.v - # will still set OPENSSL_NO_xxx unless we set OPENSSL_EXPERIMENTAL_xxx. - # (No need to fail if we don't know the algorithm -- this is for adventurous users only.) - elsif (/^experimental-/) - { - my $algo, $ALGO; - ($algo = $_) =~ s/^experimental-//; - ($ALGO = $algo) =~ tr/[a-z]/[A-Z]/; - - $xcflags="-DOPENSSL_EXPERIMENTAL_$ALGO $xcflags"; - - } - elsif (/^--with-krb5-flavor=(.*)$/) - { - my $krb5_flavor = $1; - if ($krb5_flavor =~ /^force-[Hh]eimdal$/) - { - $xcflags="-DKRB5_HEIMDAL $xcflags"; - } - elsif ($krb5_flavor =~ /^MIT/i) - { - $xcflags="-DKRB5_MIT $xcflags"; - if ($krb5_flavor =~ /^MIT[._-]*1[._-]*[01]/i) - { - $xcflags="-DKRB5_MIT_OLD11 $xcflags" - } - } - } - elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } - elsif (/^-[lL].*$/) { $l_flags.="$_ "; } - elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) - { $c_flags.="$_ "; } - else { return(0); } - return(1); - } diff --git a/lib/libssl/src/util/mkcerts.sh b/lib/libssl/src/util/mkcerts.sh deleted file mode 100644 index 0184fcb70ec..00000000000 --- a/lib/libssl/src/util/mkcerts.sh +++ /dev/null @@ -1,220 +0,0 @@ -#!/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 </dev/null </dev/null </dev/null </dev/null <> 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 - diff --git a/lib/libssl/src/util/mkdef.pl b/lib/libssl/src/util/mkdef.pl deleted file mode 100644 index 9a8c7b87d1a..00000000000 --- a/lib/libssl/src/util/mkdef.pl +++ /dev/null @@ -1,1539 +0,0 @@ -#!/usr/local/bin/perl -w -# -# generate a .def file -# -# It does this by parsing the header files and looking for the -# prototyped functions: it then prunes the output. -# -# Intermediary files are created, call libeay.num and ssleay.num,... -# Previously, they had the following format: -# -# routine-name nnnn -# -# But that isn't enough for a number of reasons, the first on being that -# this format is (needlessly) very Win32-centric, and even then... -# One of the biggest problems is that there's no information about what -# routines should actually be used, which varies with what crypto algorithms -# are disabled. Also, some operating systems (for example VMS with VAX C) -# need to keep track of the global variables as well as the functions. -# -# So, a remake of this script is done so as to include information on the -# kind of symbol it is (function or variable) and what algorithms they're -# part of. This will allow easy translating to .def files or the corresponding -# file in other operating systems (a .opt file for VMS, possibly with a .mar -# file). -# -# The format now becomes: -# -# routine-name nnnn info -# -# and the "info" part is actually a colon-separated string of fields with -# the following meaning: -# -# existence:platform:kind:algorithms -# -# - "existence" can be "EXIST" or "NOEXIST" depending on if the symbol is -# found somewhere in the source, -# - "platforms" is empty if it exists on all platforms, otherwise it contains -# comma-separated list of the platform, just as they are if the symbol exists -# for those platforms, or prepended with a "!" if not. This helps resolve -# symbol name variants for platforms where the names are too long for the -# compiler or linker, or if the systems is case insensitive and there is a -# clash, or the symbol is implemented differently (see -# EXPORT_VAR_AS_FUNCTION). This script assumes renaming of symbols is found -# in the file crypto/symhacks.h. -# The semantics for the platforms is that every item is checked against the -# environment. For the negative items ("!FOO"), if any of them is false -# (i.e. "FOO" is true) in the environment, the corresponding symbol can't be -# used. For the positive itms, if all of them are false in the environment, -# the corresponding symbol can't be used. Any combination of positive and -# negative items are possible, and of course leave room for some redundancy. -# - "kind" is "FUNCTION" or "VARIABLE". The meaning of that is obvious. -# - "algorithms" is a comma-separated list of algorithm names. This helps -# exclude symbols that are part of an algorithm that some user wants to -# exclude. -# - -my $debug=0; - -my $crypto_num= "util/libeay.num"; -my $ssl_num= "util/ssleay.num"; -my $libname; - -my $do_update = 0; -my $do_rewrite = 1; -my $do_crypto = 0; -my $do_ssl = 0; -my $do_ctest = 0; -my $do_ctestall = 0; -my $do_checkexist = 0; - -my $VMSVAX=0; -my $VMSNonVAX=0; -my $VMS=0; -my $W32=0; -my $W16=0; -my $NT=0; -my $OS2=0; -# Set this to make typesafe STACK definitions appear in DEF -my $safe_stack_def = 0; - -my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", - "EXPORT_VAR_AS_FUNCTION", "ZLIB", "OPENSSL_FIPS" ); -my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); -my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", - "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", - "SHA256", "SHA512", "RIPEMD", - "MDC2", "WHIRLPOOL", "RSA", "DSA", "DH", "EC", "ECDH", "ECDSA", "EC2M", - "HMAC", "AES", "CAMELLIA", "SEED", "GOST", - # EC_NISTP_64_GCC_128 - "EC_NISTP_64_GCC_128", - # Envelope "algorithms" - "EVP", "X509", "ASN1_TYPEDEFS", - # Helper "algorithms" - "BIO", "COMP", "BUFFER", "LHASH", "STACK", "ERR", - "LOCKING", - # External "algorithms" - "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM", - # Engines - "STATIC_ENGINE", "ENGINE", "HW", "GMP", - # RFC3779 - "RFC3779", - # TLS - "TLSEXT", "PSK", "SRP", "HEARTBEATS", - # CMS - "CMS", - # CryptoAPI Engine - "CAPIENG", - # SSL v2 - "SSL2", - # JPAKE - "JPAKE", - # NEXTPROTONEG - "NEXTPROTONEG", - # Deprecated functions - "DEPRECATED", - # Hide SSL internals - "SSL_INTERN", - # SCTP - "SCTP"); - -my $options=""; -open(IN,") { - $options=$1 if (/^OPTIONS=(.*)$/); -} -close(IN); - -# The following ciphers may be excluded (by Configure). This means functions -# defined with ifndef(NO_XXX) are not included in the .def file, and everything -# in directory xxx is ignored. -my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf; -my $no_cast; my $no_whirlpool; my $no_camellia; my $no_seed; -my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2; -my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; -my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw; -my $no_fp_api; my $no_static_engine=1; my $no_gmp; my $no_deprecated; -my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng; -my $no_jpake; my $no_srp; my $no_ssl2; my $no_ec2m; my $no_nistp_gcc; -my $no_nextprotoneg; my $no_sctp; - -my $fips; - -my $zlib; - - -foreach (@ARGV, split(/ /, $options)) - { - $debug=1 if $_ eq "debug"; - $W32=1 if $_ eq "32"; - $W16=1 if $_ eq "16"; - if($_ eq "NT") { - $W32 = 1; - $NT = 1; - } - if ($_ eq "VMS-VAX") { - $VMS=1; - $VMSVAX=1; - } - if ($_ eq "VMS-NonVAX") { - $VMS=1; - $VMSNonVAX=1; - } - $VMS=1 if $_ eq "VMS"; - $OS2=1 if $_ eq "OS2"; - $fips=1 if /^fips/; - if ($_ eq "zlib" || $_ eq "enable-zlib" || $_ eq "zlib-dynamic" - || $_ eq "enable-zlib-dynamic") { - $zlib = 1; - } - - $do_ssl=1 if $_ eq "ssleay"; - if ($_ eq "ssl") { - $do_ssl=1; - $libname=$_ - } - $do_crypto=1 if $_ eq "libeay"; - if ($_ eq "crypto") { - $do_crypto=1; - $libname=$_; - } - $no_static_engine=1 if $_ eq "no-static-engine"; - $no_static_engine=0 if $_ eq "enable-static-engine"; - $do_update=1 if $_ eq "update"; - $do_rewrite=1 if $_ eq "rewrite"; - $do_ctest=1 if $_ eq "ctest"; - $do_ctestall=1 if $_ eq "ctestall"; - $do_checkexist=1 if $_ eq "exist"; - #$safe_stack_def=1 if $_ eq "-DDEBUG_SAFESTACK"; - - if (/^no-rc2$/) { $no_rc2=1; } - elsif (/^no-rc4$/) { $no_rc4=1; } - elsif (/^no-rc5$/) { $no_rc5=1; } - elsif (/^no-idea$/) { $no_idea=1; } - elsif (/^no-des$/) { $no_des=1; $no_mdc2=1; } - elsif (/^no-bf$/) { $no_bf=1; } - elsif (/^no-cast$/) { $no_cast=1; } - elsif (/^no-whirlpool$/) { $no_whirlpool=1; } - elsif (/^no-md2$/) { $no_md2=1; } - elsif (/^no-md4$/) { $no_md4=1; } - elsif (/^no-md5$/) { $no_md5=1; } - elsif (/^no-sha$/) { $no_sha=1; } - elsif (/^no-ripemd$/) { $no_ripemd=1; } - elsif (/^no-mdc2$/) { $no_mdc2=1; } - elsif (/^no-rsa$/) { $no_rsa=1; } - elsif (/^no-dsa$/) { $no_dsa=1; } - elsif (/^no-dh$/) { $no_dh=1; } - elsif (/^no-ec$/) { $no_ec=1; } - elsif (/^no-ecdsa$/) { $no_ecdsa=1; } - elsif (/^no-ecdh$/) { $no_ecdh=1; } - elsif (/^no-hmac$/) { $no_hmac=1; } - elsif (/^no-aes$/) { $no_aes=1; } - elsif (/^no-camellia$/) { $no_camellia=1; } - elsif (/^no-seed$/) { $no_seed=1; } - elsif (/^no-evp$/) { $no_evp=1; } - elsif (/^no-lhash$/) { $no_lhash=1; } - elsif (/^no-stack$/) { $no_stack=1; } - elsif (/^no-err$/) { $no_err=1; } - elsif (/^no-buffer$/) { $no_buffer=1; } - elsif (/^no-bio$/) { $no_bio=1; } - #elsif (/^no-locking$/) { $no_locking=1; } - elsif (/^no-comp$/) { $no_comp=1; } - elsif (/^no-dso$/) { $no_dso=1; } - elsif (/^no-krb5$/) { $no_krb5=1; } - elsif (/^no-engine$/) { $no_engine=1; } - elsif (/^no-hw$/) { $no_hw=1; } - elsif (/^no-gmp$/) { $no_gmp=1; } - elsif (/^no-rfc3779$/) { $no_rfc3779=1; } - elsif (/^no-tlsext$/) { $no_tlsext=1; } - elsif (/^no-cms$/) { $no_cms=1; } - elsif (/^no-ec2m$/) { $no_ec2m=1; } - elsif (/^no-ec_nistp_64_gcc_128$/) { $no_nistp_gcc=1; } - elsif (/^no-nextprotoneg$/) { $no_nextprotoneg=1; } - elsif (/^no-ssl2$/) { $no_ssl2=1; } - elsif (/^no-capieng$/) { $no_capieng=1; } - elsif (/^no-jpake$/) { $no_jpake=1; } - elsif (/^no-srp$/) { $no_srp=1; } - elsif (/^no-sctp$/) { $no_sctp=1; } - } - - -if (!$libname) { - if ($do_ssl) { - $libname="SSLEAY"; - } - if ($do_crypto) { - $libname="LIBEAY"; - } -} - -# If no platform is given, assume WIN32 -if ($W32 + $W16 + $VMS + $OS2 == 0) { - $W32 = 1; -} - -# Add extra knowledge -if ($W16) { - $no_fp_api=1; -} - -if (!$do_ssl && !$do_crypto) - { - print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT | OS2 ]\n"; - exit(1); - } - -%ssl_list=&load_numbers($ssl_num); -$max_ssl = $max_num; -%crypto_list=&load_numbers($crypto_num); -$max_crypto = $max_num; - -my $ssl="ssl/ssl.h"; -$ssl.=" ssl/kssl.h"; -$ssl.=" ssl/tls1.h"; -$ssl.=" ssl/srtp.h"; - -my $crypto ="crypto/crypto.h"; -$crypto.=" crypto/cryptlib.h"; -$crypto.=" crypto/o_dir.h"; -$crypto.=" crypto/o_str.h"; -$crypto.=" crypto/o_time.h"; -$crypto.=" crypto/des/des.h crypto/des/des_old.h" ; # unless $no_des; -$crypto.=" crypto/idea/idea.h" ; # unless $no_idea; -$crypto.=" crypto/rc4/rc4.h" ; # unless $no_rc4; -$crypto.=" crypto/rc5/rc5.h" ; # unless $no_rc5; -$crypto.=" crypto/rc2/rc2.h" ; # unless $no_rc2; -$crypto.=" crypto/bf/blowfish.h" ; # unless $no_bf; -$crypto.=" crypto/cast/cast.h" ; # unless $no_cast; -$crypto.=" crypto/whrlpool/whrlpool.h" ; -$crypto.=" crypto/md2/md2.h" ; # unless $no_md2; -$crypto.=" crypto/md4/md4.h" ; # unless $no_md4; -$crypto.=" crypto/md5/md5.h" ; # unless $no_md5; -$crypto.=" crypto/mdc2/mdc2.h" ; # unless $no_mdc2; -$crypto.=" crypto/sha/sha.h" ; # unless $no_sha; -$crypto.=" crypto/ripemd/ripemd.h" ; # unless $no_ripemd; -$crypto.=" crypto/aes/aes.h" ; # unless $no_aes; -$crypto.=" crypto/camellia/camellia.h" ; # unless $no_camellia; -$crypto.=" crypto/seed/seed.h"; # unless $no_seed; - -$crypto.=" crypto/bn/bn.h"; -$crypto.=" crypto/rsa/rsa.h" ; # unless $no_rsa; -$crypto.=" crypto/dsa/dsa.h" ; # unless $no_dsa; -$crypto.=" crypto/dh/dh.h" ; # unless $no_dh; -$crypto.=" crypto/ec/ec.h" ; # unless $no_ec; -$crypto.=" crypto/ecdsa/ecdsa.h" ; # unless $no_ecdsa; -$crypto.=" crypto/ecdh/ecdh.h" ; # unless $no_ecdh; -$crypto.=" crypto/hmac/hmac.h" ; # unless $no_hmac; -$crypto.=" crypto/cmac/cmac.h" ; # unless $no_hmac; - -$crypto.=" crypto/engine/engine.h"; # unless $no_engine; -$crypto.=" crypto/stack/stack.h" ; # unless $no_stack; -$crypto.=" crypto/buffer/buffer.h" ; # unless $no_buffer; -$crypto.=" crypto/bio/bio.h" ; # unless $no_bio; -$crypto.=" crypto/dso/dso.h" ; # unless $no_dso; -$crypto.=" crypto/lhash/lhash.h" ; # unless $no_lhash; -$crypto.=" crypto/conf/conf.h"; -$crypto.=" crypto/txt_db/txt_db.h"; - -$crypto.=" crypto/evp/evp.h" ; # unless $no_evp; -$crypto.=" crypto/objects/objects.h"; -$crypto.=" crypto/pem/pem.h"; -#$crypto.=" crypto/meth/meth.h"; -$crypto.=" crypto/asn1/asn1.h"; -$crypto.=" crypto/asn1/asn1t.h"; -$crypto.=" crypto/asn1/asn1_mac.h"; -$crypto.=" crypto/err/err.h" ; # unless $no_err; -$crypto.=" crypto/pkcs7/pkcs7.h"; -$crypto.=" crypto/pkcs12/pkcs12.h"; -$crypto.=" crypto/x509/x509.h"; -$crypto.=" crypto/x509/x509_vfy.h"; -$crypto.=" crypto/x509v3/x509v3.h"; -$crypto.=" crypto/ts/ts.h"; -$crypto.=" crypto/rand/rand.h"; -$crypto.=" crypto/comp/comp.h" ; # unless $no_comp; -$crypto.=" crypto/ocsp/ocsp.h"; -$crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; -$crypto.=" crypto/krb5/krb5_asn.h"; -#$crypto.=" crypto/store/store.h"; -$crypto.=" crypto/pqueue/pqueue.h"; -$crypto.=" crypto/cms/cms.h"; -$crypto.=" crypto/jpake/jpake.h"; -$crypto.=" crypto/modes/modes.h"; -$crypto.=" crypto/srp/srp.h"; - -my $symhacks="crypto/symhacks.h"; - -my @ssl_symbols = &do_defs("SSLEAY", $ssl, $symhacks); -my @crypto_symbols = &do_defs("LIBEAY", $crypto, $symhacks); - -if ($do_update) { - -if ($do_ssl == 1) { - - &maybe_add_info("SSLEAY",*ssl_list,@ssl_symbols); - if ($do_rewrite == 1) { - open(OUT, ">$ssl_num"); - &rewrite_numbers(*OUT,"SSLEAY",*ssl_list,@ssl_symbols); - } else { - open(OUT, ">>$ssl_num"); - } - &update_numbers(*OUT,"SSLEAY",*ssl_list,$max_ssl,@ssl_symbols); - close OUT; -} - -if($do_crypto == 1) { - - &maybe_add_info("LIBEAY",*crypto_list,@crypto_symbols); - if ($do_rewrite == 1) { - open(OUT, ">$crypto_num"); - &rewrite_numbers(*OUT,"LIBEAY",*crypto_list,@crypto_symbols); - } else { - open(OUT, ">>$crypto_num"); - } - &update_numbers(*OUT,"LIBEAY",*crypto_list,$max_crypto,@crypto_symbols); - close OUT; -} - -} elsif ($do_checkexist) { - &check_existing(*ssl_list, @ssl_symbols) - if $do_ssl == 1; - &check_existing(*crypto_list, @crypto_symbols) - if $do_crypto == 1; -} elsif ($do_ctest || $do_ctestall) { - - print <<"EOF"; - -/* Test file to check all DEF file symbols are present by trying - * to link to all of them. This is *not* intended to be run! - */ - -int main() -{ -EOF - &print_test_file(*STDOUT,"SSLEAY",*ssl_list,$do_ctestall,@ssl_symbols) - if $do_ssl == 1; - - &print_test_file(*STDOUT,"LIBEAY",*crypto_list,$do_ctestall,@crypto_symbols) - if $do_crypto == 1; - - print "}\n"; - -} else { - - &print_def_file(*STDOUT,$libname,*ssl_list,@ssl_symbols) - if $do_ssl == 1; - - &print_def_file(*STDOUT,$libname,*crypto_list,@crypto_symbols) - if $do_crypto == 1; - -} - - -sub do_defs -{ - my($name,$files,$symhacksfile)=@_; - my $file; - my @ret; - my %syms; - my %platform; # For anything undefined, we assume "" - my %kind; # For anything undefined, we assume "FUNCTION" - my %algorithm; # For anything undefined, we assume "" - my %variant; - my %variant_cnt; # To be able to allocate "name{n}" if "name" - # is the same name as the original. - my $cpp; - my %unknown_algorithms = (); - - foreach $file (split(/\s+/,$symhacksfile." ".$files)) - { - print STDERR "DEBUG: starting on $file:\n" if $debug; - open(IN,"<$file") || die "unable to open $file:$!\n"; - my $line = "", my $def= ""; - my %tag = ( - (map { $_ => 0 } @known_platforms), - (map { "OPENSSL_SYS_".$_ => 0 } @known_ossl_platforms), - (map { "OPENSSL_NO_".$_ => 0 } @known_algorithms), - NOPROTO => 0, - PERL5 => 0, - _WINDLL => 0, - CONST_STRICT => 0, - TRUE => 1, - ); - my $symhacking = $file eq $symhacksfile; - my @current_platforms = (); - my @current_algorithms = (); - - # params: symbol, alias, platforms, kind - # The reason to put this subroutine in a variable is that - # it will otherwise create it's own, unshared, version of - # %tag and %variant... - my $make_variant = sub - { - my ($s, $a, $p, $k) = @_; - my ($a1, $a2); - - print STDERR "DEBUG: make_variant: Entered with ",$s,", ",$a,", ",(defined($p)?$p:""),", ",(defined($k)?$k:""),"\n" if $debug; - if (defined($p)) - { - $a1 = join(",",$p, - grep(!/^$/, - map { $tag{$_} == 1 ? $_ : "" } - @known_platforms)); - } - else - { - $a1 = join(",", - grep(!/^$/, - map { $tag{$_} == 1 ? $_ : "" } - @known_platforms)); - } - $a2 = join(",", - grep(!/^$/, - map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : "" } - @known_ossl_platforms)); - print STDERR "DEBUG: make_variant: a1 = $a1; a2 = $a2\n" if $debug; - if ($a1 eq "") { $a1 = $a2; } - elsif ($a1 ne "" && $a2 ne "") { $a1 .= ",".$a2; } - if ($a eq $s) - { - if (!defined($variant_cnt{$s})) - { - $variant_cnt{$s} = 0; - } - $variant_cnt{$s}++; - $a .= "{$variant_cnt{$s}}"; - } - my $toadd = $a.":".$a1.(defined($k)?":".$k:""); - my $togrep = $s.'(\{[0-9]+\})?:'.$a1.(defined($k)?":".$k:""); - if (!grep(/^$togrep$/, - split(/;/, defined($variant{$s})?$variant{$s}:""))) { - if (defined($variant{$s})) { $variant{$s} .= ";"; } - $variant{$s} .= $toadd; - } - print STDERR "DEBUG: make_variant: Exit with variant of ",$s," = ",$variant{$s},"\n" if $debug; - }; - - print STDERR "DEBUG: parsing ----------\n" if $debug; - while() { - if (/\/\* Error codes for the \w+ functions\. \*\//) - { - undef @tag; - last; - } - if ($line ne '') { - $_ = $line . $_; - $line = ''; - } - - if (/\\$/) { - chomp; # remove eol - chop; # remove ending backslash - $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/; - - s/{[^{}]*}//gs; # ignore {} blocks - print STDERR "DEBUG: \$def=\"$def\"\n" if $debug && $def ne ""; - print STDERR "DEBUG: \$_=\"$_\"\n" if $debug; - if (/^\#\s*ifndef\s+(.*)/) { - push(@tag,"-"); - push(@tag,$1); - $tag{$1}=-1; - print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; - } elsif (/^\#\s*if\s+!defined\(([^\)]+)\)/) { - push(@tag,"-"); - if (/^\#\s*if\s+(!defined\(([^\)]+)\)(\s+\&\&\s+!defined\(([^\)]+)\))*)$/) { - my $tmp_1 = $1; - my $tmp_; - foreach $tmp_ (split '\&\&',$tmp_1) { - $tmp_ =~ /!defined\(([^\)]+)\)/; - print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; - push(@tag,$1); - $tag{$1}=-1; - } - } else { - print STDERR "Warning: $file: complicated expression: $_" if $debug; # because it is O... - print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; - push(@tag,$1); - $tag{$1}=-1; - } - } elsif (/^\#\s*ifdef\s+(\S*)/) { - push(@tag,"-"); - push(@tag,$1); - $tag{$1}=1; - print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; - } elsif (/^\#\s*if\s+defined\(([^\)]+)\)/) { - push(@tag,"-"); - if (/^\#\s*if\s+(defined\(([^\)]+)\)(\s+\|\|\s+defined\(([^\)]+)\))*)$/) { - my $tmp_1 = $1; - my $tmp_; - foreach $tmp_ (split '\|\|',$tmp_1) { - $tmp_ =~ /defined\(([^\)]+)\)/; - print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; - push(@tag,$1); - $tag{$1}=1; - } - } else { - print STDERR "Warning: $file: complicated expression: $_\n" if $debug; # because it is O... - print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; - push(@tag,$1); - $tag{$1}=1; - } - } elsif (/^\#\s*error\s+(\w+) is disabled\./) { - my $tag_i = $#tag; - while($tag[$tag_i] ne "-") { - if ($tag[$tag_i] eq "OPENSSL_NO_".$1) { - $tag{$tag[$tag_i]}=2; - print STDERR "DEBUG: $file: chaged tag $1 = 2\n" if $debug; - } - $tag_i--; - } - } elsif (/^\#\s*endif/) { - my $tag_i = $#tag; - while($tag_i > 0 && $tag[$tag_i] ne "-") { - my $t=$tag[$tag_i]; - print STDERR "DEBUG: \$t=\"$t\"\n" if $debug; - if ($tag{$t}==2) { - $tag{$t}=-1; - } else { - $tag{$t}=0; - } - print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug; - pop(@tag); - if ($t =~ /^OPENSSL_NO_([A-Z0-9_]+)$/) { - $t=$1; - } else { - $t=""; - } - if ($t ne "" - && !grep(/^$t$/, @known_algorithms)) { - $unknown_algorithms{$t} = 1; - #print STDERR "DEBUG: Added as unknown algorithm: $t\n" if $debug; - } - $tag_i--; - } - pop(@tag); - } elsif (/^\#\s*else/) { - my $tag_i = $#tag; - while($tag[$tag_i] ne "-") { - my $t=$tag[$tag_i]; - $tag{$t}= -$tag{$t}; - print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug; - $tag_i--; - } - } elsif (/^\#\s*if\s+1/) { - push(@tag,"-"); - # Dummy tag - push(@tag,"TRUE"); - $tag{"TRUE"}=1; - print STDERR "DEBUG: $file: found 1\n" if $debug; - } elsif (/^\#\s*if\s+0/) { - push(@tag,"-"); - # Dummy tag - push(@tag,"TRUE"); - $tag{"TRUE"}=-1; - print STDERR "DEBUG: $file: found 0\n" if $debug; - } elsif (/^\#\s*define\s+(\w+)\s+(\w+)/ - && $symhacking && $tag{'TRUE'} != -1) { - # This is for aliasing. When we find an alias, - # we have to invert - &$make_variant($1,$2); - print STDERR "DEBUG: $file: defined $1 = $2\n" if $debug; - } - if (/^\#/) { - @current_platforms = - grep(!/^$/, - map { $tag{$_} == 1 ? $_ : - $tag{$_} == -1 ? "!".$_ : "" } - @known_platforms); - push @current_platforms - , grep(!/^$/, - map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : - $tag{"OPENSSL_SYS_".$_} == -1 ? "!".$_ : "" } - @known_ossl_platforms); - @current_algorithms = - grep(!/^$/, - map { $tag{"OPENSSL_NO_".$_} == -1 ? $_ : "" } - @known_algorithms); - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - next; - } - if ($tag{'TRUE'} != -1) { - if (/^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) { - next; - } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) { - $def .= "int d2i_$3(void);"; - $def .= "int i2d_$3(void);"; - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int $2_it;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("$2_it","$2_it", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - next; - } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_fname\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) { - $def .= "int d2i_$3(void);"; - $def .= "int i2d_$3(void);"; - $def .= "int $3_free(void);"; - $def .= "int $3_new(void);"; - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int $2_it;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("$2_it","$2_it", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - next; - } elsif (/^\s*DECLARE_ASN1_FUNCTIONS\s*\(\s*(\w*)\s*\)/ || - /^\s*DECLARE_ASN1_FUNCTIONS_const\s*\(\s*(\w*)\s*\)/) { - $def .= "int d2i_$1(void);"; - $def .= "int i2d_$1(void);"; - $def .= "int $1_free(void);"; - $def .= "int $1_new(void);"; - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int $1_it;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("$1_it","$1_it", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - next; - } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS_const\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { - $def .= "int d2i_$2(void);"; - $def .= "int i2d_$2(void);"; - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int $2_it;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("$2_it","$2_it", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - next; - } elsif (/^\s*DECLARE_ASN1_ALLOC_FUNCTIONS\s*\(\s*(\w*)\s*\)/) { - $def .= "int $1_free(void);"; - $def .= "int $1_new(void);"; - next; - } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { - $def .= "int d2i_$2(void);"; - $def .= "int i2d_$2(void);"; - $def .= "int $2_free(void);"; - $def .= "int $2_new(void);"; - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int $2_it;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("$2_it","$2_it", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - next; - } elsif (/^\s*DECLARE_ASN1_ITEM\s*\(\s*(\w*)\s*\)/) { - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int $1_it;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("$1_it","$1_it", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - next; - } elsif (/^\s*DECLARE_ASN1_NDEF_FUNCTION\s*\(\s*(\w*)\s*\)/) { - $def .= "int i2d_$1_NDEF(void);"; - } elsif (/^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) { - next; - } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION\s*\(\s*(\w*)\s*\)/) { - $def .= "int $1_print_ctx(void);"; - next; - } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { - $def .= "int $2_print_ctx(void);"; - next; - } elsif (/^\s*DECLARE_PKCS12_STACK_OF\s*\(\s*(\w*)\s*\)/) { - next; - } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ || - /^DECLARE_PEM_rw_cb\s*\(\s*(\w*)\s*,/ || - /^DECLARE_PEM_rw_const\s*\(\s*(\w*)\s*,/ ) { - # Things not in Win16 - $def .= - "#INFO:" - .join(',',"!WIN16",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "int PEM_read_$1(void);"; - $def .= "int PEM_write_$1(void);"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Things that are everywhere - $def .= "int PEM_read_bio_$1(void);"; - $def .= "int PEM_write_bio_$1(void);"; - next; - } elsif (/^DECLARE_PEM_write\s*\(\s*(\w*)\s*,/ || - /^DECLARE_PEM_write_cb\s*\(\s*(\w*)\s*,/ ) { - # Things not in Win16 - $def .= - "#INFO:" - .join(',',"!WIN16",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "int PEM_write_$1(void);"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Things that are everywhere - $def .= "int PEM_write_bio_$1(void);"; - next; - } elsif (/^DECLARE_PEM_read\s*\(\s*(\w*)\s*,/ || - /^DECLARE_PEM_read_cb\s*\(\s*(\w*)\s*,/ ) { - # Things not in Win16 - $def .= - "#INFO:" - .join(',',"!WIN16",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "int PEM_read_$1(void);"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Things that are everywhere - $def .= "int PEM_read_bio_$1(void);"; - next; - } elsif (/^OPENSSL_DECLARE_GLOBAL\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { - # Variant for platforms that do not - # have to access globale variables - # in shared libraries through functions - $def .= - "#INFO:" - .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" - .join(',',@current_algorithms).";"; - $def .= "OPENSSL_EXTERN int _shadow_$2;"; - $def .= - "#INFO:" - .join(',',@current_platforms).":" - .join(',',@current_algorithms).";"; - # Variant for platforms that have to - # access globale variables in shared - # libraries through functions - &$make_variant("_shadow_$2","_shadow_$2", - "EXPORT_VAR_AS_FUNCTION", - "FUNCTION"); - } elsif ($tag{'CONST_STRICT'} != 1) { - if (/\{|\/\*|\([^\)]*$/) { - $line = $_; - } else { - $def .= $_; - } - } - } - } - close(IN); - - my $algs; - my $plays; - - print STDERR "DEBUG: postprocessing ----------\n" if $debug; - foreach (split /;/, $def) { - my $s; my $k = "FUNCTION"; my $p; my $a; - s/^[\n\s]*//g; - s/[\n\s]*$//g; - next if(/\#undef/); - next if(/typedef\W/); - next if(/\#define/); - - # 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; - - s/STACK_OF\(\)/void/gs; - s/LHASH_OF\(\)/void/gs; - - print STDERR "DEBUG: \$_ = \"$_\"\n" if $debug; - if (/^\#INFO:([^:]*):(.*)$/) { - $plats = $1; - $algs = $2; - print STDERR "DEBUG: found info on platforms ($plats) and algorithms ($algs)\n" if $debug; - next; - } elsif (/^\s*OPENSSL_EXTERN\s.*?(\w+(\{[0-9]+\})?)(\[[0-9]*\])*\s*$/) { - $s = $1; - $k = "VARIABLE"; - print STDERR "DEBUG: found external variable $s\n" if $debug; - } elsif (/TYPEDEF_\w+_OF/s) { - next; - } elsif (/(\w+)\s*\(\).*/s) { # first token prior [first] () is - $s = $1; # a function name! - print STDERR "DEBUG: found function $s\n" if $debug; - } elsif (/\(/ and not (/=/)) { - print STDERR "File $file: cannot parse: $_;\n"; - next; - } else { - next; - } - - $syms{$s} = 1; - $kind{$s} = $k; - - $p = $plats; - $a = $algs; - $a .= ",BF" if($s =~ /EVP_bf/); - $a .= ",CAST" if($s =~ /EVP_cast/); - $a .= ",DES" if($s =~ /EVP_des/); - $a .= ",DSA" if($s =~ /EVP_dss/); - $a .= ",IDEA" if($s =~ /EVP_idea/); - $a .= ",MD2" if($s =~ /EVP_md2/); - $a .= ",MD4" if($s =~ /EVP_md4/); - $a .= ",MD5" if($s =~ /EVP_md5/); - $a .= ",RC2" if($s =~ /EVP_rc2/); - $a .= ",RC4" if($s =~ /EVP_rc4/); - $a .= ",RC5" if($s =~ /EVP_rc5/); - $a .= ",RIPEMD" if($s =~ /EVP_ripemd/); - $a .= ",SHA" if($s =~ /EVP_sha/); - $a .= ",RSA" if($s =~ /EVP_(Open|Seal)(Final|Init)/); - $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/); - $a .= ",RSA" if($s =~ /RSAPrivateKey/); - $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/); - - $platform{$s} = - &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); - $algorithm{$s} .= ','.$a; - - if (defined($variant{$s})) { - foreach $v (split /;/,$variant{$s}) { - (my $r, my $p, my $k) = split(/:/,$v); - my $ip = join ',',map({ /^!(.*)$/ ? $1 : "!".$_ } split /,/, $p); - $syms{$r} = 1; - if (!defined($k)) { $k = $kind{$s}; } - $kind{$r} = $k."(".$s.")"; - $algorithm{$r} = $algorithm{$s}; - $platform{$r} = &reduce_platforms($platform{$s}.",".$p.",".$p); - $platform{$s} = &reduce_platforms($platform{$s}.','.$ip.','.$ip); - print STDERR "DEBUG: \$variant{\"$s\"} = ",$v,"; \$r = $r; \$p = ",$platform{$r},"; \$a = ",$algorithm{$r},"; \$kind = ",$kind{$r},"\n" if $debug; - } - } - print STDERR "DEBUG: \$s = $s; \$p = ",$platform{$s},"; \$a = ",$algorithm{$s},"; \$kind = ",$kind{$s},"\n" if $debug; - } - } - - # Prune the returned symbols - - delete $syms{"bn_dump1"}; - $platform{"BIO_s_log"} .= ",!WIN32,!WIN16,!macintosh"; - - $platform{"PEM_read_NS_CERT_SEQ"} = "VMS"; - $platform{"PEM_write_NS_CERT_SEQ"} = "VMS"; - $platform{"PEM_read_P8_PRIV_KEY_INFO"} = "VMS"; - $platform{"PEM_write_P8_PRIV_KEY_INFO"} = "VMS"; - $platform{"EVP_sha384"} = "!VMSVAX"; - $platform{"EVP_sha512"} = "!VMSVAX"; - $platform{"SHA384_Init"} = "!VMSVAX"; - $platform{"SHA384_Transform"} = "!VMSVAX"; - $platform{"SHA384_Update"} = "!VMSVAX"; - $platform{"SHA384_Final"} = "!VMSVAX"; - $platform{"SHA384"} = "!VMSVAX"; - $platform{"SHA512_Init"} = "!VMSVAX"; - $platform{"SHA512_Transform"} = "!VMSVAX"; - $platform{"SHA512_Update"} = "!VMSVAX"; - $platform{"SHA512_Final"} = "!VMSVAX"; - $platform{"SHA512"} = "!VMSVAX"; - $platform{"WHIRLPOOL_Init"} = "!VMSVAX"; - $platform{"WHIRLPOOL"} = "!VMSVAX"; - $platform{"WHIRLPOOL_BitUpdate"} = "!VMSVAX"; - $platform{"EVP_whirlpool"} = "!VMSVAX"; - $platform{"WHIRLPOOL_Final"} = "!VMSVAX"; - $platform{"WHIRLPOOL_Update"} = "!VMSVAX"; - - - # Info we know about - - push @ret, map { $_."\\".&info_string($_,"EXIST", - $platform{$_}, - $kind{$_}, - $algorithm{$_}) } keys %syms; - - if (keys %unknown_algorithms) { - print STDERR "WARNING: mkdef.pl doesn't know the following algorithms:\n"; - print STDERR "\t",join("\n\t",keys %unknown_algorithms),"\n"; - } - return(@ret); -} - -# Param: string of comma-separated platform-specs. -sub reduce_platforms -{ - my ($platforms) = @_; - my $pl = defined($platforms) ? $platforms : ""; - my %p = map { $_ => 0 } split /,/, $pl; - my $ret; - - print STDERR "DEBUG: Entered reduce_platforms with \"$platforms\"\n" - if $debug; - # We do this, because if there's code like the following, it really - # means the function exists in all cases and should therefore be - # everywhere. By increasing and decreasing, we may attain 0: - # - # ifndef WIN16 - # int foo(); - # else - # int _fat foo(); - # endif - foreach $platform (split /,/, $pl) { - if ($platform =~ /^!(.*)$/) { - $p{$1}--; - } else { - $p{$platform}++; - } - } - foreach $platform (keys %p) { - if ($p{$platform} == 0) { delete $p{$platform}; } - } - - delete $p{""}; - - $ret = join(',',sort(map { $p{$_} < 0 ? "!".$_ : $_ } keys %p)); - print STDERR "DEBUG: Exiting reduce_platforms with \"$ret\"\n" - if $debug; - return $ret; -} - -sub info_string { - (my $symbol, my $exist, my $platforms, my $kind, my $algorithms) = @_; - - my %a = defined($algorithms) ? - map { $_ => 1 } split /,/, $algorithms : (); - my $k = defined($kind) ? $kind : "FUNCTION"; - my $ret; - my $p = &reduce_platforms($platforms); - - delete $a{""}; - - $ret = $exist; - $ret .= ":".$p; - $ret .= ":".$k; - $ret .= ":".join(',',sort keys %a); - return $ret; -} - -sub maybe_add_info { - (my $name, *nums, my @symbols) = @_; - my $sym; - my $new_info = 0; - my %syms=(); - - print STDERR "Updating $name info\n"; - foreach $sym (@symbols) { - (my $s, my $i) = split /\\/, $sym; - if (defined($nums{$s})) { - $i =~ s/^(.*?:.*?:\w+)(\(\w+\))?/$1/; - (my $n, my $dummy) = split /\\/, $nums{$s}; - if (!defined($dummy) || $i ne $dummy) { - $nums{$s} = $n."\\".$i; - $new_info++; - print STDERR "DEBUG: maybe_add_info for $s: \"$dummy\" => \"$i\"\n" if $debug; - } - } - $syms{$s} = 1; - } - - my @s=sort { &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") } keys %nums; - foreach $sym (@s) { - (my $n, my $i) = split /\\/, $nums{$sym}; - if (!defined($syms{$sym}) && $i !~ /^NOEXIST:/) { - $new_info++; - print STDERR "DEBUG: maybe_add_info for $sym: -> undefined\n" if $debug; - } - } - if ($new_info) { - print STDERR "$new_info old symbols got an info update\n"; - if (!$do_rewrite) { - print STDERR "You should do a rewrite to fix this.\n"; - } - } else { - print STDERR "No old symbols needed info update\n"; - } -} - -# Param: string of comma-separated keywords, each possibly prefixed with a "!" -sub is_valid -{ - my ($keywords_txt,$platforms) = @_; - my (@keywords) = split /,/,$keywords_txt; - my ($falsesum, $truesum) = (0, 1); - - # Param: one keyword - sub recognise - { - my ($keyword,$platforms) = @_; - - if ($platforms) { - # platforms - if ($keyword eq "VMSVAX" && $VMSVAX) { return 1; } - if ($keyword eq "VMSNonVAX" && $VMSNonVAX) { return 1; } - if ($keyword eq "VMS" && $VMS) { return 1; } - if ($keyword eq "WIN32" && $W32) { return 1; } - if ($keyword eq "WIN16" && $W16) { return 1; } - if ($keyword eq "WINNT" && $NT) { return 1; } - if ($keyword eq "OS2" && $OS2) { return 1; } - # Special platforms: - # EXPORT_VAR_AS_FUNCTION means that global variables - # will be represented as functions. This currently - # only happens on VMS-VAX. - if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) { - return 1; - } - if ($keyword eq "OPENSSL_FIPS" && $fips) { - return 1; - } - if ($keyword eq "ZLIB" && $zlib) { return 1; } - return 0; - } else { - # algorithms - if ($keyword eq "RC2" && $no_rc2) { return 0; } - if ($keyword eq "RC4" && $no_rc4) { return 0; } - if ($keyword eq "RC5" && $no_rc5) { return 0; } - if ($keyword eq "IDEA" && $no_idea) { return 0; } - if ($keyword eq "DES" && $no_des) { return 0; } - if ($keyword eq "BF" && $no_bf) { return 0; } - if ($keyword eq "CAST" && $no_cast) { return 0; } - if ($keyword eq "MD2" && $no_md2) { return 0; } - if ($keyword eq "MD4" && $no_md4) { return 0; } - if ($keyword eq "MD5" && $no_md5) { return 0; } - if ($keyword eq "SHA" && $no_sha) { return 0; } - if ($keyword eq "RIPEMD" && $no_ripemd) { return 0; } - if ($keyword eq "MDC2" && $no_mdc2) { return 0; } - if ($keyword eq "WHIRLPOOL" && $no_whirlpool) { return 0; } - if ($keyword eq "RSA" && $no_rsa) { return 0; } - if ($keyword eq "DSA" && $no_dsa) { return 0; } - if ($keyword eq "DH" && $no_dh) { return 0; } - if ($keyword eq "EC" && $no_ec) { return 0; } - if ($keyword eq "ECDSA" && $no_ecdsa) { return 0; } - if ($keyword eq "ECDH" && $no_ecdh) { return 0; } - if ($keyword eq "HMAC" && $no_hmac) { return 0; } - if ($keyword eq "AES" && $no_aes) { return 0; } - if ($keyword eq "CAMELLIA" && $no_camellia) { return 0; } - if ($keyword eq "SEED" && $no_seed) { return 0; } - if ($keyword eq "EVP" && $no_evp) { return 0; } - if ($keyword eq "LHASH" && $no_lhash) { return 0; } - if ($keyword eq "STACK" && $no_stack) { return 0; } - if ($keyword eq "ERR" && $no_err) { return 0; } - if ($keyword eq "BUFFER" && $no_buffer) { return 0; } - if ($keyword eq "BIO" && $no_bio) { return 0; } - if ($keyword eq "COMP" && $no_comp) { return 0; } - if ($keyword eq "DSO" && $no_dso) { return 0; } - if ($keyword eq "KRB5" && $no_krb5) { return 0; } - if ($keyword eq "ENGINE" && $no_engine) { return 0; } - if ($keyword eq "HW" && $no_hw) { return 0; } - if ($keyword eq "FP_API" && $no_fp_api) { return 0; } - if ($keyword eq "STATIC_ENGINE" && $no_static_engine) { return 0; } - if ($keyword eq "GMP" && $no_gmp) { return 0; } - if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; } - if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; } - if ($keyword eq "PSK" && $no_psk) { return 0; } - if ($keyword eq "CMS" && $no_cms) { return 0; } - if ($keyword eq "EC2M" && $no_ec2m) { return 0; } - if ($keyword eq "NEXTPROTONEG" && $no_nextprotoneg) { return 0; } - if ($keyword eq "EC_NISTP_64_GCC_128" && $no_nistp_gcc) - { return 0; } - if ($keyword eq "SSL2" && $no_ssl2) { return 0; } - if ($keyword eq "CAPIENG" && $no_capieng) { return 0; } - if ($keyword eq "JPAKE" && $no_jpake) { return 0; } - if ($keyword eq "SRP" && $no_srp) { return 0; } - if ($keyword eq "SCTP" && $no_sctp) { return 0; } - if ($keyword eq "DEPRECATED" && $no_deprecated) { return 0; } - - # Nothing recognise as true - return 1; - } - } - - foreach $k (@keywords) { - if ($k =~ /^!(.*)$/) { - $falsesum += &recognise($1,$platforms); - } else { - $truesum *= &recognise($k,$platforms); - } - } - print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug; - return (!$falsesum) && $truesum; -} - -sub print_test_file -{ - (*OUT,my $name,*nums,my $testall,my @symbols)=@_; - my $n = 1; my @e; my @r; - my $sym; my $prev = ""; my $prefSSLeay; - - (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols); - (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:.*/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols); - @symbols=((sort @e),(sort @r)); - - foreach $sym (@symbols) { - (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; - my $v = 0; - $v = 1 if $i=~ /^.*?:.*?:VARIABLE/; - my $p = ($i =~ /^[^:]*:([^:]*):/,$1); - my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1); - if (!defined($nums{$s})) { - print STDERR "Warning: $s does not have a number assigned\n" - if(!$do_update); - } elsif (is_valid($p,1) && is_valid($a,0)) { - my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1); - if ($prev eq $s2) { - print OUT "\t/* The following has already appeared previously */\n"; - print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n"; - } - $prev = $s2; # To warn about duplicates... - - ($nn,$ni)=($nums{$s2} =~ /^(.*?)\\(.*)$/); - if ($v) { - print OUT "\textern int $s2; /* type unknown */ /* $nn $ni */\n"; - } else { - print OUT "\textern int $s2(); /* type unknown */ /* $nn $ni */\n"; - } - } - } -} - -sub get_version { - local *MF; - my $v = '?'; - open MF, 'Makefile' or return $v; - while () { - $v = $1, last if /^VERSION=(.*?)\s*$/; - } - close MF; - return $v; -} - -sub print_def_file -{ - (*OUT,my $name,*nums,my @symbols)=@_; - my $n = 1; my @e; my @r; my @v; my $prev=""; - my $liboptions=""; - my $libname = $name; - my $http_vendor = 'www.openssl.org/'; - my $version = get_version(); - my $what = "OpenSSL: implementation of Secure Socket Layer"; - my $description = "$what $version, $name - http://$http_vendor"; - - if ($W32) - { $libname.="32"; } - elsif ($W16) - { $libname.="16"; } - elsif ($OS2) - { # DLL names should not clash on the whole system. - # However, they should not have any particular relationship - # to the name of the static library. Chose descriptive names - # (must be at most 8 chars). - my %translate = (ssl => 'open_ssl', crypto => 'cryptssl'); - $libname = $translate{$name} || $name; - $liboptions = <) { - chop; - s/#.*$//; - next if /^\s*$/; - @a=split; - if (defined $ret{$a[0]}) { - # This is actually perfectly OK - #print STDERR "Warning: Symbol '",$a[0],"' redefined. old=",$ret{$a[0]},", new=",$a[1],"\n"; - } - if ($max_num > $a[1]) { - print STDERR "Warning: Number decreased from ",$max_num," to ",$a[1],"\n"; - } - elsif ($max_num == $a[1]) { - # This is actually perfectly OK - #print STDERR "Warning: Symbol ",$a[0]," has same number as previous ",$prev,": ",$a[1],"\n"; - if ($a[0] eq $prev) { - $prev_cnt++; - $a[0] .= "{$prev_cnt}"; - } - } - else { - $prev_cnt = 0; - } - if ($#a < 2) { - # Existence will be proven later, in do_defs - $ret{$a[0]}=$a[1]; - $num_noinfo++; - } else { - $ret{$a[0]}=$a[1]."\\".$a[2]; # \\ is a special marker - } - $max_num = $a[1] if $a[1] > $max_num; - $prev=$a[0]; - } - if ($num_noinfo) { - print STDERR "Warning: $num_noinfo symbols were without info."; - if ($do_rewrite) { - printf STDERR " The rewrite will fix this.\n"; - } else { - printf STDERR " You should do a rewrite to fix this.\n"; - } - } - close(IN); - return(%ret); -} - -sub parse_number -{ - (my $str, my $what) = @_; - (my $n, my $i) = split(/\\/,$str); - if ($what eq "n") { - return $n; - } else { - return $i; - } -} - -sub rewrite_numbers -{ - (*OUT,$name,*nums,@symbols)=@_; - my $thing; - - print STDERR "Rewriting $name\n"; - - my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols); - my $r; my %r; my %rsyms; - foreach $r (@r) { - (my $s, my $i) = split /\\/, $r; - my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/; - $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/; - $r{$a} = $s."\\".$i; - $rsyms{$s} = 1; - } - - my %syms = (); - foreach $_ (@symbols) { - (my $n, my $i) = split /\\/; - $syms{$n} = 1; - } - - my @s=sort { - &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") - || $a cmp $b - } keys %nums; - foreach $sym (@s) { - (my $n, my $i) = split /\\/, $nums{$sym}; - next if defined($i) && $i =~ /^.*?:.*?:\w+\(\w+\)/; - next if defined($rsyms{$sym}); - print STDERR "DEBUG: rewrite_numbers for sym = ",$sym,": i = ",$i,", n = ",$n,", rsym{sym} = ",$rsyms{$sym},"syms{sym} = ",$syms{$sym},"\n" if $debug; - $i="NOEXIST::FUNCTION:" - if !defined($i) || $i eq "" || !defined($syms{$sym}); - my $s2 = $sym; - $s2 =~ s/\{[0-9]+\}$//; - printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i; - if (exists $r{$sym}) { - (my $s, $i) = split /\\/,$r{$sym}; - my $s2 = $s; - $s2 =~ s/\{[0-9]+\}$//; - printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i; - } - } -} - -sub update_numbers -{ - (*OUT,$name,*nums,my $start_num, my @symbols)=@_; - my $new_syms = 0; - - print STDERR "Updating $name numbers\n"; - - my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols); - my $r; my %r; my %rsyms; - foreach $r (@r) { - (my $s, my $i) = split /\\/, $r; - my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/; - $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/; - $r{$a} = $s."\\".$i; - $rsyms{$s} = 1; - } - - foreach $sym (@symbols) { - (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; - next if $i =~ /^.*?:.*?:\w+\(\w+\)/; - next if defined($rsyms{$sym}); - die "ERROR: Symbol $sym had no info attached to it." - if $i eq ""; - if (!exists $nums{$s}) { - $new_syms++; - my $s2 = $s; - $s2 =~ s/\{[0-9]+\}$//; - printf OUT "%s%-39s %d\t%s\n","",$s2, ++$start_num,$i; - if (exists $r{$s}) { - ($s, $i) = split /\\/,$r{$s}; - $s =~ s/\{[0-9]+\}$//; - printf OUT "%s%-39s %d\t%s\n","",$s, $start_num,$i; - } - } - } - if($new_syms) { - print STDERR "$new_syms New symbols added\n"; - } else { - print STDERR "No New symbols Added\n"; - } -} - -sub check_existing -{ - (*nums, my @symbols)=@_; - my %existing; my @remaining; - @remaining=(); - foreach $sym (@symbols) { - (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; - $existing{$s}=1; - } - foreach $sym (keys %nums) { - if (!exists $existing{$sym}) { - push @remaining, $sym; - } - } - if(@remaining) { - print STDERR "The following symbols do not seem to exist:\n"; - foreach $sym (@remaining) { - print STDERR "\t",$sym,"\n"; - } - } -} - diff --git a/lib/libssl/src/util/mkdir-p.pl b/lib/libssl/src/util/mkdir-p.pl deleted file mode 100644 index e73d02b073b..00000000000 --- a/lib/libssl/src/util/mkdir-p.pl +++ /dev/null @@ -1,34 +0,0 @@ -#!/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"; -} diff --git a/lib/libssl/src/util/mkfiles.pl b/lib/libssl/src/util/mkfiles.pl deleted file mode 100644 index 3214f69ea5e..00000000000 --- a/lib/libssl/src/util/mkfiles.pl +++ /dev/null @@ -1,142 +0,0 @@ -#!/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/cmac", -"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", -"crypto/srp", -"ssl", -"apps", -"engines", -"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 () - { - 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/\$[({]([^)}]+)[)}]/$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); -} diff --git a/lib/libssl/src/util/mklink.pl b/lib/libssl/src/util/mklink.pl deleted file mode 100644 index 61db12c68f3..00000000000 --- a/lib/libssl/src/util/mklink.pl +++ /dev/null @@ -1,73 +0,0 @@ -#!/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 () { - 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"; -} diff --git a/lib/libssl/src/util/mkrc.pl b/lib/libssl/src/util/mkrc.pl deleted file mode 100755 index 0ceadcf8d14..00000000000 --- a/lib/libssl/src/util/mkrc.pl +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/env perl -# -open FD,"crypto/opensslv.h"; -while() { - 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 - -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 -___ diff --git a/lib/libssl/src/util/perlpath.pl b/lib/libssl/src/util/perlpath.pl deleted file mode 100644 index a1f236bd984..00000000000 --- a/lib/libssl/src/util/perlpath.pl +++ /dev/null @@ -1,35 +0,0 @@ -#!/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=; - 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"; - } diff --git a/lib/libssl/src/util/pod2man.pl b/lib/libssl/src/util/pod2man.pl deleted file mode 100644 index 025d914f2e8..00000000000 --- a/lib/libssl/src/util/pod2man.pl +++ /dev/null @@ -1,1184 +0,0 @@ -: #!/usr/bin/perl-5.005 - eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' - if $running_under_some_shell; - -$DEF_PM_SECTION = '3pm' || '3'; - -=head1 NAME - -pod2man - translate embedded Perl pod directives into man pages - -=head1 SYNOPSIS - -B -[ B<--section=>I ] -[ B<--release=>I ] -[ B<--center=>I ] -[ B<--date=>I ] -[ B<--fixed=>I ] -[ B<--official> ] -[ B<--lax> ] -I - -=head1 DESCRIPTION - -B converts its input file containing embedded pod directives (see -L) into nroff source suitable for viewing with nroff(1) or -troff(1) using the man(7) macro set. - -Besides the obvious pod conversions, B also takes care of -func(), func(n), and simple variable references like $foo or @bar so -you don't have to use code escapes for them; complex expressions like -C<$fred{'stuff'}> will still need to be escaped, though. Other nagging -little roffish things that it catches include translating the minus in -something like foo-bar, making a long dash--like this--into a real em -dash, fixing up "paired quotes", putting a little space after the -parens in something like func(), making C++ and PI look right, making -double underbars have a little tiny space between them, making ALLCAPS -a teeny bit smaller in troff(1), and escaping backslashes so you don't -have to. - -=head1 OPTIONS - -=over 8 - -=item center - -Set the centered header to a specific string. The default is -"User Contributed Perl Documentation", unless the C<--official> flag is -given, in which case the default is "Perl Programmers Reference Guide". - -=item date - -Set the left-hand footer string to this value. By default, -the modification date of the input file will be used. - -=item fixed - -The fixed font to use for code refs. Defaults to CW. - -=item official - -Set the default header to indicate that this page is of -the standard release in case C<--center> is not given. - -=item release - -Set the centered footer. By default, this is the current -perl release. - -=item section - -Set the section for the C<.TH> macro. The standard conventions on -sections are to use 1 for user commands, 2 for system calls, 3 for -functions, 4 for devices, 5 for file formats, 6 for games, 7 for -miscellaneous information, and 8 for administrator commands. This works -best if you put your Perl man pages in a separate tree, like -F. By default, section 1 will be used -unless the file ends in F<.pm> in which case section 3 will be selected. - -=item lax - -Don't complain when required sections aren't present. - -=back - -=head1 Anatomy of a Proper Man Page - -For those not sure of the proper layout of a man page, here's -an example of the skeleton of a proper man page. Head of the -major headers should be setout as a C<=head1> directive, and -are historically written in the rather startling ALL UPPER CASE -format, although this is not mandatory. -Minor headers may be included using C<=head2>, and are -typically in mixed case. - -=over 10 - -=item NAME - -Mandatory section; should be a comma-separated list of programs or -functions documented by this podpage, such as: - - foo, bar - programs to do something - -=item SYNOPSIS - -A short usage summary for programs and functions, which -may someday be deemed mandatory. - -=item DESCRIPTION - -Long drawn out discussion of the program. It's a good idea to break this -up into subsections using the C<=head2> directives, like - - =head2 A Sample Subection - - =head2 Yet Another Sample Subection - -=item OPTIONS - -Some people make this separate from the description. - -=item RETURN VALUE - -What the program or function returns if successful. - -=item ERRORS - -Exceptions, return codes, exit stati, and errno settings. - -=item EXAMPLES - -Give some example uses of the program. - -=item ENVIRONMENT - -Envariables this program might care about. - -=item FILES - -All files used by the program. You should probably use the FEE -for these. - -=item SEE ALSO - -Other man pages to check out, like man(1), man(7), makewhatis(8), or catman(8). - -=item NOTES - -Miscellaneous commentary. - -=item CAVEATS - -Things to take special care with; sometimes called WARNINGS. - -=item DIAGNOSTICS - -All possible messages the program can print out--and -what they mean. - -=item BUGS - -Things that are broken or just don't work quite right. - -=item RESTRICTIONS - -Bugs you don't plan to fix :-) - -=item AUTHOR - -Who wrote it (or AUTHORS if multiple). - -=item HISTORY - -Programs derived from other sources sometimes have this, or -you might keep a modification log here. - -=back - -=head1 EXAMPLES - - pod2man program > program.1 - pod2man some_module.pm > /usr/perl/man/man3/some_module.3 - pod2man --section=7 note.pod > note.7 - -=head1 DIAGNOSTICS - -The following diagnostics are generated by B. Items -marked "(W)" are non-fatal, whereas the "(F)" errors will cause -B to immediately exit with a non-zero status. - -=over 4 - -=item bad option in paragraph %d of %s: ``%s'' should be [%s]<%s> - -(W) If you start include an option, you should set it off -as bold, italic, or code. - -=item can't open %s: %s - -(F) The input file wasn't available for the given reason. - -=item Improper man page - no dash in NAME header in paragraph %d of %s - -(W) The NAME header did not have an isolated dash in it. This is -considered important. - -=item Invalid man page - no NAME line in %s - -(F) You did not include a NAME header, which is essential. - -=item roff font should be 1 or 2 chars, not `%s' (F) - -(F) The font specified with the C<--fixed> option was not -a one- or two-digit roff font. - -=item %s is missing required section: %s - -(W) Required sections include NAME, DESCRIPTION, and if you're -using a section starting with a 3, also a SYNOPSIS. Actually, -not having a NAME is a fatal. - -=item Unknown escape: %s in %s - -(W) An unknown HTML entity (probably for an 8-bit character) was given via -a CE> directive. Besides amp, lt, gt, and quot, recognized -entities are Aacute, aacute, Acirc, acirc, AElig, aelig, Agrave, agrave, -Aring, aring, Atilde, atilde, Auml, auml, Ccedil, ccedil, Eacute, eacute, -Ecirc, ecirc, Egrave, egrave, ETH, eth, Euml, euml, Iacute, iacute, Icirc, -icirc, Igrave, igrave, Iuml, iuml, Ntilde, ntilde, Oacute, oacute, Ocirc, -ocirc, Ograve, ograve, Oslash, oslash, Otilde, otilde, Ouml, ouml, szlig, -THORN, thorn, Uacute, uacute, Ucirc, ucirc, Ugrave, ugrave, Uuml, uuml, -Yacute, yacute, and yuml. - -=item Unmatched =back - -(W) You have a C<=back> without a corresponding C<=over>. - -=item Unrecognized pod directive: %s - -(W) You specified a pod directive that isn't in the known list of -C<=head1>, C<=head2>, C<=item>, C<=over>, C<=back>, or C<=cut>. - - -=back - -=head1 NOTES - -If you would like to print out a lot of man page continuously, you -probably want to set the C and D registers to set contiguous page -numbering and even/odd paging, at least on some versions of man(7). -Settting the F register will get you some additional experimental -indexing: - - troff -man -rC1 -rD1 -rF1 perl.1 perldata.1 perlsyn.1 ... - -The indexing merely outputs messages via C<.tm> for each -major page, section, subsection, item, and any CE> -directives. - - -=head1 RESTRICTIONS - -None at this time. - -=head1 BUGS - -The =over and =back directives don't really work right. They -take absolute positions instead of offsets, don't nest well, and -making people count is suboptimal in any event. - -=head1 AUTHORS - -Original prototype by Larry Wall, but so massively hacked over by -Tom Christiansen such that Larry probably doesn't recognize it anymore. - -=cut - -$/ = ""; -$cutting = 1; -@Indices = (); - -# We try first to get the version number from a local binary, in case we're -# running an installed version of Perl to produce documentation from an -# uninstalled newer version's pod files. -if ($^O ne 'plan9' and $^O ne 'dos' and $^O ne 'os2' and $^O ne 'MSWin32') { - my $perl = (-x './perl' && -f './perl' ) ? - './perl' : - ((-x '../perl' && -f '../perl') ? - '../perl' : - ''); - ($version,$patch) = `$perl -e 'print $]'` =~ /^(\d\.\d{3})(\d{2})?/ if $perl; -} -# No luck; we'll just go with the running Perl's version -($version,$patch) = $] =~ /^(.{5})(\d{2})?/ unless $version; -$DEF_RELEASE = "perl $version"; -$DEF_RELEASE .= ", patch $patch" if $patch; - - -sub makedate { - my $secs = shift; - my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secs); - my $mname = (qw{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec})[$mon]; - $year += 1900; - return "$mday/$mname/$year"; -} - -use Getopt::Long; - -$DEF_SECTION = 1; -$DEF_CENTER = "User Contributed Perl Documentation"; -$STD_CENTER = "Perl Programmers Reference Guide"; -$DEF_FIXED = 'CW'; -$DEF_LAX = 0; - -sub usage { - warn "$0: @_\n" if @_; - die <"; -$Filename = $name; -if ($section =~ /^1/) { - require File::Basename; - $name = uc File::Basename::basename($name); -} -$name =~ s/\.(pod|p[lm])$//i; - -# Lose everything up to the first of -# */lib/*perl* standard or site_perl module -# */*perl*/lib from -D prefix=/opt/perl -# */*perl*/ random module hierarchy -# which works. -$name =~ s-//+-/-g; -if ($name =~ s-^.*?/lib/[^/]*perl[^/]*/--i - or $name =~ s-^.*?/[^/]*perl[^/]*/lib/--i - or $name =~ s-^.*?/[^/]*perl[^/]*/--i) { - # Lose ^site(_perl)?/. - $name =~ s-^site(_perl)?/--; - # Lose ^arch/. (XXX should we use Config? Just for archname?) - $name =~ s~^(.*-$^O|$^O-.*)/~~o; - # Lose ^version/. - $name =~ s-^\d+\.\d+/--; -} - -# Translate Getopt/Long to Getopt::Long, etc. -$name =~ s(/)(::)g; - -if ($name ne 'something') { - FCHECK: { - open(F, "< $ARGV[0]") || die "can't open $ARGV[0]: $!"; - while () { - next unless /^=\b/; - if (/^=head1\s+NAME\s*$/) { # an /m would forgive mistakes - $_ = ; - unless (/\s*-+\s+/) { - $oops++; - warn "$0: Improper man page - no dash in NAME header in paragraph $. of $ARGV[0]\n" - } else { - my @n = split /\s+-+\s+/; - if (@n != 2) { - $oops++; - warn "$0: Improper man page - malformed NAME header in paragraph $. of $ARGV[0]\n" - } - else { - $n[0] =~ s/\n/ /g; - $n[1] =~ s/\n/ /g; - %namedesc = @n; - } - } - last FCHECK; - } - next if /^=cut\b/; # DB_File and Net::Ping have =cut before NAME - next if /^=pod\b/; # It is OK to have =pod before NAME - next if /^=(for|begin|end)\s+comment\b/; # It is OK to have =for =begin or =end comment before NAME - die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax; - } - die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax; - } - close F; -} - -print <<"END"; -.rn '' }` -''' \$RCSfile\$\$Revision\$\$Date\$ -''' -''' \$Log\$ -''' -.de Sh -.br -.if t .Sp -.ne 5 -.PP -\\fB\\\\\$1\\fR -.PP -.. -.de Sp -.if t .sp .5v -.if n .sp -.. -.de Ip -.br -.ie \\\\n(.\$>=3 .ne \\\\\$3 -.el .ne 3 -.IP "\\\\\$1" \\\\\$2 -.. -.de Vb -.ft $CFont -.nf -.ne \\\\\$1 -.. -.de Ve -.ft R - -.fi -.. -''' -''' -''' Set up \\*(-- to give an unbreakable dash; -''' string Tr holds user defined translation string. -''' Bell System Logo is used as a dummy character. -''' -.tr \\(*W-|\\(bv\\*(Tr -.ie n \\{\\ -.ds -- \\(*W- -.ds PI pi -.if (\\n(.H=4u)&(1m=24u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-12u'-\\" diablo 10 pitch -.if (\\n(.H=4u)&(1m=20u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-8u'-\\" diablo 12 pitch -.ds L" "" -.ds R" "" -''' \\*(M", \\*(S", \\*(N" and \\*(T" are the equivalent of -''' \\*(L" and \\*(R", except that they are used on ".xx" lines, -''' such as .IP and .SH, which do another additional levels of -''' double-quote interpretation -.ds M" """ -.ds S" """ -.ds N" """"" -.ds T" """"" -.ds L' ' -.ds R' ' -.ds M' ' -.ds S' ' -.ds N' ' -.ds T' ' -'br\\} -.el\\{\\ -.ds -- \\(em\\| -.tr \\*(Tr -.ds L" `` -.ds R" '' -.ds M" `` -.ds S" '' -.ds N" `` -.ds T" '' -.ds L' ` -.ds R' ' -.ds M' ` -.ds S' ' -.ds N' ` -.ds T' ' -.ds PI \\(*p -'br\\} -END - -print <<'END'; -.\" If the F register is turned on, we'll generate -.\" index entries out stderr for the following things: -.\" TH Title -.\" SH Header -.\" Sh Subsection -.\" Ip Item -.\" X<> Xref (embedded -.\" Of course, you have to process the output yourself -.\" in some meaninful fashion. -.if \nF \{ -.de IX -.tm Index:\\$1\t\\n%\t"\\$2" -.. -.nr % 0 -.rr F -.\} -END - -print <<"END"; -.TH $name $section "$RP" "$date" "$center" -.UC -END - -push(@Indices, qq{.IX Title "$name $section"}); - -while (($name, $desc) = each %namedesc) { - for ($name, $desc) { s/^\s+//; s/\s+$//; } - push(@Indices, qq(.IX Name "$name - $desc"\n)); -} - -print <<'END'; -.if n .hy 0 -.if n .na -.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' -.de CQ \" put $1 in typewriter font -END -print ".ft $CFont\n"; -print <<'END'; -'if n "\c -'if t \\&\\$1\c -'if n \\&\\$1\c -'if n \&" -\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 -'.ft R -.. -.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 -. \" AM - accent mark definitions -.bd B 3 -. \" fudge factors for nroff and troff -.if n \{\ -. ds #H 0 -. ds #V .8m -. ds #F .3m -. ds #[ \f1 -. ds #] \fP -.\} -.if t \{\ -. ds #H ((1u-(\\\\n(.fu%2u))*.13m) -. ds #V .6m -. ds #F 0 -. ds #[ \& -. ds #] \& -.\} -. \" simple accents for nroff and troff -.if n \{\ -. ds ' \& -. ds ` \& -. ds ^ \& -. ds , \& -. ds ~ ~ -. ds ? ? -. ds ! ! -. ds / -. ds q -.\} -.if t \{\ -. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" -. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' -. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' -. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' -. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' -. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' -. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' -. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' -. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' -.\} -. \" troff and (daisy-wheel) nroff accents -.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' -.ds 8 \h'\*(#H'\(*b\h'-\*(#H' -.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] -.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' -.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' -.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] -.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] -.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' -.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' -.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] -.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] -.ds ae a\h'-(\w'a'u*4/10)'e -.ds Ae A\h'-(\w'A'u*4/10)'E -.ds oe o\h'-(\w'o'u*4/10)'e -.ds Oe O\h'-(\w'O'u*4/10)'E -. \" corrections for vroff -.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' -.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' -. \" for low resolution devices (crt and lpr) -.if \n(.H>23 .if \n(.V>19 \ -\{\ -. ds : e -. ds 8 ss -. ds v \h'-1'\o'\(aa\(ga' -. ds _ \h'-1'^ -. ds . \h'-1'. -. ds 3 3 -. ds o a -. ds d- d\h'-1'\(ga -. ds D- D\h'-1'\(hy -. ds th \o'bp' -. ds Th \o'LP' -. ds ae ae -. ds Ae AE -. ds oe oe -. ds Oe OE -.\} -.rm #[ #] #H #V #F C -END - -$indent = 0; - -$begun = ""; - -# Unrolling [^A-Z>]|[A-Z](?!<) gives: // MRE pp 165. -my $nonest = '(?:[^A-Z>]*(?:[A-Z](?!<)[^A-Z>]*)*)'; - -while (<>) { - if ($cutting) { - next unless /^=/; - $cutting = 0; - } - if ($begun) { - if (/^=end\s+$begun/) { - $begun = ""; - } - elsif ($begun =~ /^(roff|man)$/) { - print STDOUT $_; - } - next; - } - chomp; - - # Translate verbatim paragraph - - if (/^\s/) { - @lines = split(/\n/); - for (@lines) { - 1 while s - {^( [^\t]* ) \t ( \t* ) } - { $1 . ' ' x (8 - (length($1)%8) + 8 * (length($2))) }ex; - s/\\/\\e/g; - s/\A/\\&/s; - } - $lines = @lines; - makespace() unless $verbatim++; - print ".Vb $lines\n"; - print join("\n", @lines), "\n"; - print ".Ve\n"; - $needspace = 0; - next; - } - - $verbatim = 0; - - if (/^=for\s+(\S+)\s*/s) { - if ($1 eq "man" or $1 eq "roff") { - print STDOUT $',"\n\n"; - } else { - # ignore unknown for - } - next; - } - elsif (/^=begin\s+(\S+)\s*/s) { - $begun = $1; - if ($1 eq "man" or $1 eq "roff") { - print STDOUT $'."\n\n"; - } - next; - } - - # check for things that'll hosed our noremap scheme; affects $_ - init_noremap(); - - if (!/^=item/) { - - # trofficate backslashes; must do it before what happens below - s/\\/noremap('\\e')/ge; - - # protect leading periods and quotes against *roff - # mistaking them for directives - s/^(?:[A-Z]<)?[.']/\\&$&/gm; - - # first hide the escapes in case we need to - # intuit something and get it wrong due to fmting - - 1 while s/([A-Z]<$nonest>)/noremap($1)/ge; - - # func() is a reference to a perl function - s{ - \b - ( - [:\w]+ \(\) - ) - } {I<$1>}gx; - - # func(n) is a reference to a perl function or a man page - s{ - ([:\w]+) - ( - \( [^\051]+ \) - ) - } {I<$1>\\|$2}gx; - - # convert simple variable references - s/(\s+)([\$\@%][\w:]+)(?!\()/${1}C<$2>/g; - - if (m{ ( - [\-\w]+ - \( - [^\051]*? - [\@\$,] - [^\051]*? - \) - ) - }x && $` !~ /([LCI]<[^<>]*|-)$/ && !/^=\w/) - { - warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [LCI]<$1>\n"; - $oops++; - } - - while (/(-[a-zA-Z])\b/g && $` !~ /[\w\-]$/) { - warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [CB]<$1>\n"; - $oops++; - } - - # put it back so we get the <> processed again; - clear_noremap(0); # 0 means leave the E's - - } else { - # trofficate backslashes - s/\\/noremap('\\e')/ge; - - } - - # need to hide E<> first; they're processed in clear_noremap - s/(E<[^<>]+>)/noremap($1)/ge; - - - $maxnest = 10; - while ($maxnest-- && /[A-Z]/font($1) . $2 . font('R')/eg; - - # files and filelike refs in italics - s/F<($nonest)>/I<$1>/g; - - # no break -- usually we want C<> for this - s/S<($nonest)>/nobreak($1)/eg; - - # LREF: a la HREF L - s:L<([^|>]+)\|[^>]+>:$1:g; - - # LREF: a manpage(3f) - s:L<([a-zA-Z][^\s\/]+)(\([^\)]+\))?>:the I<$1>$2 manpage:g; - - # LREF: an =item on another manpage - s{ - L< - ([^/]+) - / - ( - [:\w]+ - (\(\))? - ) - > - } {the C<$2> entry in the I<$1> manpage}gx; - - # LREF: an =item on this manpage - s{ - ((?: - L< - / - ( - [:\w]+ - (\(\))? - ) - > - (,?\s+(and\s+)?)? - )+) - } { internal_lrefs($1) }gex; - - # LREF: a =head2 (head1?), maybe on a manpage, maybe right here - # the "func" can disambiguate - s{ - L< - (?: - ([a-zA-Z]\S+?) / - )? - "?(.*?)"? - > - }{ - do { - $1 # if no $1, assume it means on this page. - ? "the section on I<$2> in the I<$1> manpage" - : "the section on I<$2>" - } - }gesx; # s in case it goes over multiple lines, so . matches \n - - s/Z<>/\\&/g; - - # comes last because not subject to reprocessing - s/C<($nonest)>/noremap("${CFont_embed}${1}\\fR")/eg; - } - - if (s/^=//) { - $needspace = 0; # Assume this. - - s/\n/ /g; - - ($Cmd, $_) = split(' ', $_, 2); - - $dotlevel = 1; - if ($Cmd eq 'head1') { - $dotlevel = 1; - } - elsif ($Cmd eq 'head2') { - $dotlevel = 1; - } - elsif ($Cmd eq 'item') { - $dotlevel = 2; - } - - if (defined $_) { - &escapes($dotlevel); - s/"/""/g; - } - - clear_noremap(1); - - if ($Cmd eq 'cut') { - $cutting = 1; - } - elsif ($Cmd eq 'head1') { - s/\s+$//; - delete $wanna_see{$_} if exists $wanna_see{$_}; - print qq{.SH "$_"\n}; - push(@Indices, qq{.IX Header "$_"\n}); - } - elsif ($Cmd eq 'head2') { - print qq{.Sh "$_"\n}; - push(@Indices, qq{.IX Subsection "$_"\n}); - } - elsif ($Cmd eq 'over') { - push(@indent,$indent); - $indent += ($_ + 0) || 5; - } - elsif ($Cmd eq 'back') { - $indent = pop(@indent); - warn "$0: Unmatched =back in paragraph $. of $ARGV\n" unless defined $indent; - $needspace = 1; - } - elsif ($Cmd eq 'item') { - s/^\*( |$)/\\(bu$1/g; - # if you know how to get ":s please do - s/\\\*\(L"([^"]+?)\\\*\(R"/'$1'/g; - s/\\\*\(L"([^"]+?)""/'$1'/g; - s/[^"]""([^"]+?)""[^"]/'$1'/g; - # here do something about the $" in perlvar? - print STDOUT qq{.Ip "$_" $indent\n}; - push(@Indices, qq{.IX Item "$_"\n}); - } - elsif ($Cmd eq 'pod') { - # this is just a comment - } - else { - warn "$0: Unrecognized pod directive in paragraph $. of $ARGV: $Cmd\n"; - } - } - else { - if ($needspace) { - &makespace; - } - &escapes(0); - clear_noremap(1); - print $_, "\n"; - $needspace = 1; - } -} - -print <<"END"; - -.rn }` '' -END - -if (%wanna_see && !$lax) { - @missing = keys %wanna_see; - warn "$0: $Filename is missing required section" - . (@missing > 1 && "s") - . ": @missing\n"; - $oops++; -} - -foreach (@Indices) { print "$_\n"; } - -exit; -#exit ($oops != 0); - -######################################################################### - -sub nobreak { - my $string = shift; - $string =~ s/ /\\ /g; - $string; -} - -sub escapes { - my $indot = shift; - - s/X<(.*?)>/mkindex($1)/ge; - - # translate the minus in foo-bar into foo\-bar for roff - s/([^0-9a-z-])-([^-])/$1\\-$2/g; - - # make -- into the string version \*(-- (defined above) - s/\b--\b/\\*(--/g; - s/"--([^"])/"\\*(--$1/g; # should be a better way - s/([^"])--"/$1\\*(--"/g; - - # fix up quotes; this is somewhat tricky - my $dotmacroL = 'L'; - my $dotmacroR = 'R'; - if ( $indot == 1 ) { - $dotmacroL = 'M'; - $dotmacroR = 'S'; - } - elsif ( $indot >= 2 ) { - $dotmacroL = 'N'; - $dotmacroR = 'T'; - } - if (!/""/) { - s/(^|\s)(['"])/noremap("$1\\*($dotmacroL$2")/ge; - s/(['"])($|[\-\s,;\\!?.])/noremap("\\*($dotmacroR$1$2")/ge; - } - - #s/(?!")(?:.)--(?!")(?:.)/\\*(--/g; - #s/(?:(?!")(?:.)--(?:"))|(?:(?:")--(?!")(?:.))/\\*(--/g; - - - # make sure that func() keeps a bit a space tween the parens - ### s/\b\(\)/\\|()/g; - ### s/\b\(\)/(\\|)/g; - - # make C++ into \*C+, which is a squinched version (defined above) - s/\bC\+\+/\\*(C+/g; - - # make double underbars have a little tiny space between them - s/__/_\\|_/g; - - # PI goes to \*(PI (defined above) - s/\bPI\b/noremap('\\*(PI')/ge; - - # make all caps a teeny bit smaller, but don't muck with embedded code literals - my $hidCFont = font('C'); - if ($Cmd !~ /^head1/) { # SH already makes smaller - # /g isn't enough; 1 while or we'll be off - -# 1 while s{ -# (?!$hidCFont)(..|^.|^) -# \b -# ( -# [A-Z][\/A-Z+:\-\d_$.]+ -# ) -# (s?) -# \b -# } {$1\\s-1$2\\s0}gmox; - - 1 while s{ - (?!$hidCFont)(..|^.|^) - ( - \b[A-Z]{2,}[\/A-Z+:\-\d_\$]*\b - ) - } { - $1 . noremap( '\\s-1' . $2 . '\\s0' ) - }egmox; - - } -} - -# make troff just be normal, but make small nroff get quoted -# decided to just put the quotes in the text; sigh; -sub ccvt { - local($_,$prev) = @_; - noremap(qq{.CQ "$_" \n\\&}); -} - -sub makespace { - if ($indent) { - print ".Sp\n"; - } - else { - print ".PP\n"; - } -} - -sub mkindex { - my ($entry) = @_; - my @entries = split m:\s*/\s*:, $entry; - push @Indices, ".IX Xref " . join ' ', map {qq("$_")} @entries; - return ''; -} - -sub font { - local($font) = shift; - return '\\f' . noremap($font); -} - -sub noremap { - local($thing_to_hide) = shift; - $thing_to_hide =~ tr/\000-\177/\200-\377/; - return $thing_to_hide; -} - -sub init_noremap { - # escape high bit characters in input stream - s/([\200-\377])/"E<".ord($1).">"/ge; -} - -sub clear_noremap { - my $ready_to_print = $_[0]; - - tr/\200-\377/\000-\177/; - - # trofficate backslashes - # s/(?!\\e)(?:..|^.|^)\\/\\e/g; - - # now for the E<>s, which have been hidden until now - # otherwise the interative \w<> processing would have - # been hosed by the E - s { - E< - ( - ( \d + ) - | ( [A-Za-z]+ ) - ) - > - } { - do { - defined $2 - ? chr($2) - : - exists $HTML_Escapes{$3} - ? do { $HTML_Escapes{$3} } - : do { - warn "$0: Unknown escape in paragraph $. of $ARGV: ``$&''\n"; - "E<$1>"; - } - } - }egx if $ready_to_print; -} - -sub internal_lrefs { - local($_) = shift; - local $trailing_and = s/and\s+$// ? "and " : ""; - - s{L]+)>}{$1}g; - my(@items) = split( /(?:,?\s+(?:and\s+)?)/ ); - my $retstr = "the "; - my $i; - for ($i = 0; $i <= $#items; $i++) { - $retstr .= "C<$items[$i]>"; - $retstr .= ", " if @items > 2 && $i != $#items; - $retstr .= " and " if $i+2 == @items; - } - - $retstr .= " entr" . ( @items > 1 ? "ies" : "y" ) - . " elsewhere in this document"; - # terminal space to avoid words running together (pattern used - # strips terminal spaces) - $retstr .= " " if length $trailing_and; - $retstr .= $trailing_and; - - return $retstr; - -} - -BEGIN { -%HTML_Escapes = ( - 'amp' => '&', # ampersand - 'lt' => '<', # left chevron, less-than - 'gt' => '>', # right chevron, greater-than - 'quot' => '"', # double quote - - "Aacute" => "A\\*'", # capital A, acute accent - "aacute" => "a\\*'", # small a, acute accent - "Acirc" => "A\\*^", # capital A, circumflex accent - "acirc" => "a\\*^", # small a, circumflex accent - "AElig" => '\*(AE', # capital AE diphthong (ligature) - "aelig" => '\*(ae', # small ae diphthong (ligature) - "Agrave" => "A\\*`", # capital A, grave accent - "agrave" => "A\\*`", # small a, grave accent - "Aring" => 'A\\*o', # capital A, ring - "aring" => 'a\\*o', # small a, ring - "Atilde" => 'A\\*~', # capital A, tilde - "atilde" => 'a\\*~', # small a, tilde - "Auml" => 'A\\*:', # capital A, dieresis or umlaut mark - "auml" => 'a\\*:', # small a, dieresis or umlaut mark - "Ccedil" => 'C\\*,', # capital C, cedilla - "ccedil" => 'c\\*,', # small c, cedilla - "Eacute" => "E\\*'", # capital E, acute accent - "eacute" => "e\\*'", # small e, acute accent - "Ecirc" => "E\\*^", # capital E, circumflex accent - "ecirc" => "e\\*^", # small e, circumflex accent - "Egrave" => "E\\*`", # capital E, grave accent - "egrave" => "e\\*`", # small e, grave accent - "ETH" => '\\*(D-', # capital Eth, Icelandic - "eth" => '\\*(d-', # small eth, Icelandic - "Euml" => "E\\*:", # capital E, dieresis or umlaut mark - "euml" => "e\\*:", # small e, dieresis or umlaut mark - "Iacute" => "I\\*'", # capital I, acute accent - "iacute" => "i\\*'", # small i, acute accent - "Icirc" => "I\\*^", # capital I, circumflex accent - "icirc" => "i\\*^", # small i, circumflex accent - "Igrave" => "I\\*`", # capital I, grave accent - "igrave" => "i\\*`", # small i, grave accent - "Iuml" => "I\\*:", # capital I, dieresis or umlaut mark - "iuml" => "i\\*:", # small i, dieresis or umlaut mark - "Ntilde" => 'N\*~', # capital N, tilde - "ntilde" => 'n\*~', # small n, tilde - "Oacute" => "O\\*'", # capital O, acute accent - "oacute" => "o\\*'", # small o, acute accent - "Ocirc" => "O\\*^", # capital O, circumflex accent - "ocirc" => "o\\*^", # small o, circumflex accent - "Ograve" => "O\\*`", # capital O, grave accent - "ograve" => "o\\*`", # small o, grave accent - "Oslash" => "O\\*/", # capital O, slash - "oslash" => "o\\*/", # small o, slash - "Otilde" => "O\\*~", # capital O, tilde - "otilde" => "o\\*~", # small o, tilde - "Ouml" => "O\\*:", # capital O, dieresis or umlaut mark - "ouml" => "o\\*:", # small o, dieresis or umlaut mark - "szlig" => '\*8', # small sharp s, German (sz ligature) - "THORN" => '\\*(Th', # capital THORN, Icelandic - "thorn" => '\\*(th',, # small thorn, Icelandic - "Uacute" => "U\\*'", # capital U, acute accent - "uacute" => "u\\*'", # small u, acute accent - "Ucirc" => "U\\*^", # capital U, circumflex accent - "ucirc" => "u\\*^", # small u, circumflex accent - "Ugrave" => "U\\*`", # capital U, grave accent - "ugrave" => "u\\*`", # small u, grave accent - "Uuml" => "U\\*:", # capital U, dieresis or umlaut mark - "uuml" => "u\\*:", # small u, dieresis or umlaut mark - "Yacute" => "Y\\*'", # capital Y, acute accent - "yacute" => "y\\*'", # small y, acute accent - "yuml" => "y\\*:", # small y, dieresis or umlaut mark -); -} - diff --git a/lib/libssl/src/util/pod2mantest b/lib/libssl/src/util/pod2mantest deleted file mode 100644 index 384e683df4c..00000000000 --- a/lib/libssl/src/util/pod2mantest +++ /dev/null @@ -1,58 +0,0 @@ -#!/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" diff --git a/lib/libssl/src/util/pod2mantest.pod b/lib/libssl/src/util/pod2mantest.pod deleted file mode 100644 index 5d2539a17fb..00000000000 --- a/lib/libssl/src/util/pod2mantest.pod +++ /dev/null @@ -1,15 +0,0 @@ -=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 diff --git a/lib/libssl/src/util/point.sh b/lib/libssl/src/util/point.sh deleted file mode 100644 index da39899cb19..00000000000 --- a/lib/libssl/src/util/point.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/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" - diff --git a/lib/libssl/src/util/selftest.pl b/lib/libssl/src/util/selftest.pl deleted file mode 100644 index 7b32e9f4ff2..00000000000 --- a/lib/libssl/src/util/selftest.pl +++ /dev/null @@ -1,201 +0,0 @@ -#!/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,") { - $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,") { - 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 \n#include \n#include \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 \n#include \n#include \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,") { - 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,") { - $ok=2 if /^platform: $platform/; - } - close(IN); -} - -if ($ok != 2) { - print OUT "Failure!\n"; - if (open(IN,") { - print OUT; - } - close(IN); - print OUT $sep; - } else { - print OUT "make.log not found!\n"; - } - if (open(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 () { - if (/$sep/) { - print "[...]\n"; - last; - } - print; -} -print "\nTest report in file $report\n"; - diff --git a/lib/libssl/src/util/sp-diff.pl b/lib/libssl/src/util/sp-diff.pl deleted file mode 100644 index 9d6c60387fa..00000000000 --- a/lib/libssl/src/util/sp-diff.pl +++ /dev/null @@ -1,80 +0,0 @@ -#!/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 () - { - $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); - } - diff --git a/lib/libssl/src/util/speed.sh b/lib/libssl/src/util/speed.sh deleted file mode 100644 index f489706197b..00000000000 --- a/lib/libssl/src/util/speed.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/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 - diff --git a/lib/libssl/src/util/src-dep.pl b/lib/libssl/src/util/src-dep.pl deleted file mode 100644 index ad997e47468..00000000000 --- a/lib/libssl/src/util/src-dep.pl +++ /dev/null @@ -1,147 +0,0 @@ -#!/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 () - { - 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 () - { - 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); - } - diff --git a/lib/libssl/src/util/tab_num.pl b/lib/libssl/src/util/tab_num.pl deleted file mode 100644 index a81ed0edc24..00000000000 --- a/lib/libssl/src/util/tab_num.pl +++ /dev/null @@ -1,17 +0,0 @@ -#!/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++; - } -