diff options
author | afresh1 <> | 2014-04-17 19:20:52 +0000 |
---|---|---|
committer | afresh1 <> | 2014-04-17 19:20:52 +0000 |
commit | 2bb4d4ac7a2751306ac55c3ce2fe3af26d8ef965 (patch) | |
tree | 8bc06712ef3cbf999c98aaad3dbe7c906415d1ec /src/lib | |
parent | c11dca95113fafb94fe3b60390be510b2e8f85d5 (diff) | |
download | openbsd-2bb4d4ac7a2751306ac55c3ce2fe3af26d8ef965.tar.gz openbsd-2bb4d4ac7a2751306ac55c3ce2fe3af26d8ef965.tar.bz2 openbsd-2bb4d4ac7a2751306ac55c3ce2fe3af26d8ef965.zip |
Remove unused ssl utils
This code is the reason perl has a name as a write only language.
ok deraadt miod
Diffstat (limited to 'src/lib')
60 files changed, 0 insertions, 11438 deletions
diff --git a/src/lib/libcrypto/util/FreeBSD.sh b/src/lib/libcrypto/util/FreeBSD.sh deleted file mode 100644 index db8edfc6aa..0000000000 --- a/src/lib/libcrypto/util/FreeBSD.sh +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | perl util/perlpath.pl /usr/bin | ||
4 | perl util/ssldir.pl /usr/local | ||
5 | perl util/mk1mf.pl FreeBSD >Makefile.FreeBSD | ||
6 | perl Configure FreeBSD | ||
diff --git a/src/lib/libcrypto/util/add_cr.pl b/src/lib/libcrypto/util/add_cr.pl deleted file mode 100644 index c7b62c11ec..0000000000 --- a/src/lib/libcrypto/util/add_cr.pl +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # This adds a copyright message to a souce code file. | ||
4 | # It also gets the file name correct. | ||
5 | # | ||
6 | # perl util/add_cr.pl *.[ch] */*.[ch] */*/*.[ch] | ||
7 | # | ||
8 | |||
9 | foreach (@ARGV) | ||
10 | { | ||
11 | &dofile($_); | ||
12 | } | ||
13 | |||
14 | sub dofile | ||
15 | { | ||
16 | local($file)=@_; | ||
17 | |||
18 | open(IN,"<$file") || die "unable to open $file:$!\n"; | ||
19 | |||
20 | print STDERR "doing $file\n"; | ||
21 | @in=<IN>; | ||
22 | |||
23 | return(1) if ($in[0] =~ / NOCW /); | ||
24 | |||
25 | @out=(); | ||
26 | open(OUT,">$file.out") || die "unable to open $file.$$:$!\n"; | ||
27 | push(@out,"/* $file */\n"); | ||
28 | if (($in[1] !~ /^\/\* Copyright \(C\) [0-9-]+ Eric Young \(eay\@cryptsoft.com\)/)) | ||
29 | { | ||
30 | push(@out,&Copyright); | ||
31 | $i=2; | ||
32 | @a=grep(/ Copyright \(C\) /,@in); | ||
33 | if ($#a >= 0) | ||
34 | { | ||
35 | while (($i <= $#in) && ($in[$i] ne " */\n")) | ||
36 | { $i++; } | ||
37 | $i++ if ($in[$i] eq " */\n"); | ||
38 | |||
39 | while (($i <= $#in) && ($in[$i] =~ /^\s*$/)) | ||
40 | { $i++; } | ||
41 | |||
42 | push(@out,"\n"); | ||
43 | for ( ; $i <= $#in; $i++) | ||
44 | { push(@out,$in[$i]); } | ||
45 | } | ||
46 | else | ||
47 | { push(@out,@in); } | ||
48 | } | ||
49 | else | ||
50 | { | ||
51 | shift(@in); | ||
52 | push(@out,@in); | ||
53 | } | ||
54 | print OUT @out; | ||
55 | close(IN); | ||
56 | close(OUT); | ||
57 | rename("$file","$file.orig") || die "unable to rename $file:$!\n"; | ||
58 | rename("$file.out",$file) || die "unable to rename $file.out:$!\n"; | ||
59 | } | ||
60 | |||
61 | |||
62 | |||
63 | sub Copyright | ||
64 | { | ||
65 | return <<'EOF'; | ||
66 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
67 | * All rights reserved. | ||
68 | * | ||
69 | * This package is an SSL implementation written | ||
70 | * by Eric Young (eay@cryptsoft.com). | ||
71 | * The implementation was written so as to conform with Netscapes SSL. | ||
72 | * | ||
73 | * This library is free for commercial and non-commercial use as long as | ||
74 | * the following conditions are aheared to. The following conditions | ||
75 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
76 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
77 | * included with this distribution is covered by the same copyright terms | ||
78 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
79 | * | ||
80 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
81 | * the code are not to be removed. | ||
82 | * If this package is used in a product, Eric Young should be given attribution | ||
83 | * as the author of the parts of the library used. | ||
84 | * This can be in the form of a textual message at program startup or | ||
85 | * in documentation (online or textual) provided with the package. | ||
86 | * | ||
87 | * Redistribution and use in source and binary forms, with or without | ||
88 | * modification, are permitted provided that the following conditions | ||
89 | * are met: | ||
90 | * 1. Redistributions of source code must retain the copyright | ||
91 | * notice, this list of conditions and the following disclaimer. | ||
92 | * 2. Redistributions in binary form must reproduce the above copyright | ||
93 | * notice, this list of conditions and the following disclaimer in the | ||
94 | * documentation and/or other materials provided with the distribution. | ||
95 | * 3. All advertising materials mentioning features or use of this software | ||
96 | * must display the following acknowledgement: | ||
97 | * "This product includes cryptographic software written by | ||
98 | * Eric Young (eay@cryptsoft.com)" | ||
99 | * The word 'cryptographic' can be left out if the rouines from the library | ||
100 | * being used are not cryptographic related :-). | ||
101 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
102 | * the apps directory (application code) you must include an acknowledgement: | ||
103 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
104 | * | ||
105 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
106 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
107 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
108 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
109 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
110 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
111 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
112 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
113 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
114 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
115 | * SUCH DAMAGE. | ||
116 | * | ||
117 | * The licence and distribution terms for any publically available version or | ||
118 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
119 | * copied and put under another distribution licence | ||
120 | * [including the GNU Public Licence.] | ||
121 | */ | ||
122 | EOF | ||
123 | } | ||
diff --git a/src/lib/libcrypto/util/ck_errf.pl b/src/lib/libcrypto/util/ck_errf.pl deleted file mode 100644 index f13af5c50b..0000000000 --- a/src/lib/libcrypto/util/ck_errf.pl +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # This is just a quick script to scan for cases where the 'error' | ||
4 | # function name in a XXXerr() macro is wrong. | ||
5 | # | ||
6 | # Run in the top level by going | ||
7 | # perl util/ck_errf.pl */*.c */*/*.c | ||
8 | # | ||
9 | |||
10 | my $err_strict = 0; | ||
11 | my $bad = 0; | ||
12 | |||
13 | foreach $file (@ARGV) | ||
14 | { | ||
15 | if ($file eq "-strict") | ||
16 | { | ||
17 | $err_strict = 1; | ||
18 | next; | ||
19 | } | ||
20 | open(IN,"<$file") || die "unable to open $file\n"; | ||
21 | $func=""; | ||
22 | while (<IN>) | ||
23 | { | ||
24 | if (!/;$/ && /^([a-zA-Z].*[\s*])?([A-Za-z_0-9]+)\(.*[),]/) | ||
25 | { | ||
26 | /^([^()]*(\([^()]*\)[^()]*)*)\(/; | ||
27 | $1 =~ /([A-Za-z_0-9]*)$/; | ||
28 | $func = $1; | ||
29 | $func =~ tr/A-Z/a-z/; | ||
30 | } | ||
31 | if (/([A-Z0-9]+)err\(([^,]+)/ && ! /ckerr_ignore/) | ||
32 | { | ||
33 | $errlib=$1; | ||
34 | $n=$2; | ||
35 | |||
36 | if ($func eq "") | ||
37 | { print "$file:$.:???:$n\n"; $bad = 1; next; } | ||
38 | |||
39 | if ($n !~ /([^_]+)_F_(.+)$/) | ||
40 | { | ||
41 | # print "check -$file:$.:$func:$n\n"; | ||
42 | next; | ||
43 | } | ||
44 | $lib=$1; | ||
45 | $n=$2; | ||
46 | |||
47 | if ($lib ne $errlib) | ||
48 | { print "$file:$.:$func:$n [${errlib}err]\n"; $bad = 1; next; } | ||
49 | |||
50 | $n =~ tr/A-Z/a-z/; | ||
51 | if (($n ne $func) && ($errlib ne "SYS")) | ||
52 | { print "$file:$.:$func:$n\n"; $bad = 1; next; } | ||
53 | # print "$func:$1\n"; | ||
54 | } | ||
55 | } | ||
56 | close(IN); | ||
57 | } | ||
58 | |||
59 | if ($bad && $err_strict) | ||
60 | { | ||
61 | print STDERR "FATAL: error discrepancy\n"; | ||
62 | exit 1; | ||
63 | } | ||
64 | |||
diff --git a/src/lib/libcrypto/util/clean-depend.pl b/src/lib/libcrypto/util/clean-depend.pl deleted file mode 100644 index d3525b0ed0..0000000000 --- a/src/lib/libcrypto/util/clean-depend.pl +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | #!/usr/local/bin/perl -w | ||
2 | # Clean the dependency list in a makefile of standard includes... | ||
3 | # Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999 | ||
4 | |||
5 | use strict; | ||
6 | |||
7 | while(<STDIN>) { | ||
8 | print; | ||
9 | last if /^# DO NOT DELETE THIS LINE/; | ||
10 | } | ||
11 | |||
12 | my %files; | ||
13 | |||
14 | my $thisfile=""; | ||
15 | while(<STDIN>) { | ||
16 | my ($dummy, $file,$deps)=/^((.*):)? (.*)$/; | ||
17 | my $origfile=""; | ||
18 | $thisfile=$file if defined $file; | ||
19 | next if !defined $deps; | ||
20 | $origfile=$thisfile; | ||
21 | $origfile=~s/\.o$/.c/; | ||
22 | my @deps=split ' ',$deps; | ||
23 | @deps=grep(!/^\//,@deps); | ||
24 | @deps=grep(!/^\\$/,@deps); | ||
25 | @deps=grep(!/^$origfile$/,@deps); | ||
26 | # pull out the kludged kerberos header (if present). | ||
27 | @deps=grep(!/^[.\/]+\/krb5.h/,@deps); | ||
28 | push @{$files{$thisfile}},@deps; | ||
29 | } | ||
30 | |||
31 | my $file; | ||
32 | foreach $file (sort keys %files) { | ||
33 | my $len=0; | ||
34 | my $dep; | ||
35 | my $origfile=$file; | ||
36 | $origfile=~s/\.o$/.c/; | ||
37 | $file=~s/^\.\///; | ||
38 | push @{$files{$file}},$origfile; | ||
39 | my $prevdep=""; | ||
40 | |||
41 | # Remove leading ./ before sorting | ||
42 | my @deps = map { $_ =~ s/^\.\///; $_ } @{$files{$file}}; | ||
43 | |||
44 | foreach $dep (sort @deps) { | ||
45 | $dep=~s/^\.\///; | ||
46 | next if $prevdep eq $dep; # to exterminate duplicates... | ||
47 | $prevdep = $dep; | ||
48 | $len=0 if $len+length($dep)+1 >= 80; | ||
49 | if($len == 0) { | ||
50 | print "\n$file:"; | ||
51 | $len=length($file)+1; | ||
52 | } | ||
53 | print " $dep"; | ||
54 | $len+=length($dep)+1; | ||
55 | } | ||
56 | } | ||
57 | |||
58 | print "\n"; | ||
diff --git a/src/lib/libcrypto/util/copy.pl b/src/lib/libcrypto/util/copy.pl deleted file mode 100644 index eba6d5815e..0000000000 --- a/src/lib/libcrypto/util/copy.pl +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | use Fcntl; | ||
4 | |||
5 | |||
6 | # copy.pl | ||
7 | |||
8 | # Perl script 'copy' comment. On Windows the built in "copy" command also | ||
9 | # copies timestamps: this messes up Makefile dependencies. | ||
10 | |||
11 | my $stripcr = 0; | ||
12 | |||
13 | my $arg; | ||
14 | |||
15 | foreach $arg (@ARGV) { | ||
16 | if ($arg eq "-stripcr") | ||
17 | { | ||
18 | $stripcr = 1; | ||
19 | next; | ||
20 | } | ||
21 | $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... | ||
22 | foreach (glob $arg) | ||
23 | { | ||
24 | push @filelist, $_; | ||
25 | } | ||
26 | } | ||
27 | |||
28 | $fnum = @filelist; | ||
29 | |||
30 | if ($fnum <= 1) | ||
31 | { | ||
32 | die "Need at least two filenames"; | ||
33 | } | ||
34 | |||
35 | $dest = pop @filelist; | ||
36 | |||
37 | if ($fnum > 2 && ! -d $dest) | ||
38 | { | ||
39 | die "Destination must be a directory"; | ||
40 | } | ||
41 | |||
42 | foreach (@filelist) | ||
43 | { | ||
44 | if (-d $dest) | ||
45 | { | ||
46 | $dfile = $_; | ||
47 | $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|; | ||
48 | $dfile = "$dest/$dfile"; | ||
49 | } | ||
50 | else | ||
51 | { | ||
52 | $dfile = $dest; | ||
53 | } | ||
54 | sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_"; | ||
55 | sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY) | ||
56 | || die "Can't Open $dfile"; | ||
57 | while (sysread IN, $buf, 10240) | ||
58 | { | ||
59 | if ($stripcr) | ||
60 | { | ||
61 | $buf =~ tr/\015//d; | ||
62 | } | ||
63 | syswrite(OUT, $buf, length($buf)); | ||
64 | } | ||
65 | close(IN); | ||
66 | close(OUT); | ||
67 | print "Copying: $_ to $dfile\n"; | ||
68 | } | ||
69 | |||
70 | |||
diff --git a/src/lib/libcrypto/util/deleof.pl b/src/lib/libcrypto/util/deleof.pl deleted file mode 100644 index 155acd88ff..0000000000 --- a/src/lib/libcrypto/util/deleof.pl +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | while (<>) | ||
4 | { | ||
5 | |||
6 | last if (/^# DO NOT DELETE THIS LINE/); | ||
7 | } | ||
diff --git a/src/lib/libcrypto/util/dirname.pl b/src/lib/libcrypto/util/dirname.pl deleted file mode 100644 index d7a66d96ac..0000000000 --- a/src/lib/libcrypto/util/dirname.pl +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | if ($#ARGV < 0) { | ||
4 | die "dirname.pl: too few arguments\n"; | ||
5 | } elsif ($#ARGV > 0) { | ||
6 | die "dirname.pl: too many arguments\n"; | ||
7 | } | ||
8 | |||
9 | my $d = $ARGV[0]; | ||
10 | |||
11 | if ($d =~ m|.*/.*|) { | ||
12 | $d =~ s|/[^/]*$||; | ||
13 | } else { | ||
14 | $d = "."; | ||
15 | } | ||
16 | |||
17 | print $d,"\n"; | ||
18 | exit(0); | ||
diff --git a/src/lib/libcrypto/util/domd b/src/lib/libcrypto/util/domd deleted file mode 100644 index bab48cb7a2..0000000000 --- a/src/lib/libcrypto/util/domd +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # Do a makedepend, only leave out the standard headers | ||
3 | # Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999 | ||
4 | |||
5 | TOP=$1 | ||
6 | shift | ||
7 | if [ "$1" = "-MD" ]; then | ||
8 | shift | ||
9 | MAKEDEPEND=$1 | ||
10 | shift | ||
11 | fi | ||
12 | if [ "$MAKEDEPEND" = "" ]; then MAKEDEPEND=makedepend; fi | ||
13 | |||
14 | cp Makefile Makefile.save | ||
15 | # fake the presence of Kerberos | ||
16 | touch $TOP/krb5.h | ||
17 | if expr "$MAKEDEPEND" : '.*gcc$' > /dev/null; then | ||
18 | args="" | ||
19 | while [ $# -gt 0 ]; do | ||
20 | if [ "$1" != "--" ]; then args="$args $1"; fi | ||
21 | shift | ||
22 | done | ||
23 | sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp | ||
24 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp | ||
25 | ${MAKEDEPEND} -Werror -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp || exit 1 | ||
26 | ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new | ||
27 | RC=$? | ||
28 | rm -f Makefile.tmp | ||
29 | else | ||
30 | ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@ && \ | ||
31 | ${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new | ||
32 | RC=$? | ||
33 | fi | ||
34 | mv Makefile.new Makefile | ||
35 | # unfake the presence of Kerberos | ||
36 | rm $TOP/krb5.h | ||
37 | |||
38 | exit $RC | ||
diff --git a/src/lib/libcrypto/util/err-ins.pl b/src/lib/libcrypto/util/err-ins.pl deleted file mode 100644 index 31b70df8d0..0000000000 --- a/src/lib/libcrypto/util/err-ins.pl +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # tack error codes onto the end of a file | ||
4 | # | ||
5 | |||
6 | open(ERR,$ARGV[0]) || die "unable to open error file '$ARGV[0]':$!\n"; | ||
7 | @err=<ERR>; | ||
8 | close(ERR); | ||
9 | |||
10 | open(IN,$ARGV[1]) || die "unable to open header file '$ARGV[1]':$!\n"; | ||
11 | |||
12 | @out=""; | ||
13 | while (<IN>) | ||
14 | { | ||
15 | push(@out,$_); | ||
16 | last if /BEGIN ERROR CODES/; | ||
17 | } | ||
18 | close(IN); | ||
19 | |||
20 | open(OUT,">$ARGV[1]") || die "unable to open header file '$ARGV[1]':$1\n"; | ||
21 | print OUT @out; | ||
22 | print OUT @err; | ||
23 | print OUT <<"EOF"; | ||
24 | |||
25 | #ifdef __cplusplus | ||
26 | } | ||
27 | #endif | ||
28 | #endif | ||
29 | |||
30 | EOF | ||
31 | close(OUT); | ||
32 | |||
33 | |||
diff --git a/src/lib/libcrypto/util/extract-names.pl b/src/lib/libcrypto/util/extract-names.pl deleted file mode 100644 index 35bd6ed843..0000000000 --- a/src/lib/libcrypto/util/extract-names.pl +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | $/ = ""; # Eat a paragraph at once. | ||
4 | while(<STDIN>) { | ||
5 | chop; | ||
6 | s/\n/ /gm; | ||
7 | if (/^=head1 /) { | ||
8 | $name = 0; | ||
9 | } elsif ($name) { | ||
10 | if (/ - /) { | ||
11 | s/ - .*//; | ||
12 | s/,\s+/,/g; | ||
13 | s/\s+,/,/g; | ||
14 | s/^\s+//g; | ||
15 | s/\s+$//g; | ||
16 | s/\s/_/g; | ||
17 | push @words, split ','; | ||
18 | } | ||
19 | } | ||
20 | if (/^=head1 *NAME *$/) { | ||
21 | $name = 1; | ||
22 | } | ||
23 | } | ||
24 | |||
25 | print join("\n", @words),"\n"; | ||
26 | |||
diff --git a/src/lib/libcrypto/util/extract-section.pl b/src/lib/libcrypto/util/extract-section.pl deleted file mode 100644 index 7a0ba4f69a..0000000000 --- a/src/lib/libcrypto/util/extract-section.pl +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | while(<STDIN>) { | ||
4 | if (/=for\s+comment\s+openssl_manual_section:(\S+)/) | ||
5 | { | ||
6 | print "$1\n"; | ||
7 | exit 0; | ||
8 | } | ||
9 | } | ||
10 | |||
11 | print "$ARGV[0]\n"; | ||
12 | |||
diff --git a/src/lib/libcrypto/util/files.pl b/src/lib/libcrypto/util/files.pl deleted file mode 100644 index 41f033e3b9..0000000000 --- a/src/lib/libcrypto/util/files.pl +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # used to generate the file MINFO for use by util/mk1mf.pl | ||
4 | # It is basically a list of all variables from the passed makefile | ||
5 | # | ||
6 | |||
7 | $s=""; | ||
8 | while (<>) | ||
9 | { | ||
10 | chop; | ||
11 | s/#.*//; | ||
12 | if (/^(\S+)\s*=\s*(.*)$/) | ||
13 | { | ||
14 | $o=""; | ||
15 | ($s,$b)=($1,$2); | ||
16 | for (;;) | ||
17 | { | ||
18 | if ($b =~ /\\$/) | ||
19 | { | ||
20 | chop($b); | ||
21 | $o.=$b." "; | ||
22 | $b=<>; | ||
23 | chop($b); | ||
24 | } | ||
25 | else | ||
26 | { | ||
27 | $o.=$b." "; | ||
28 | last; | ||
29 | } | ||
30 | } | ||
31 | $o =~ s/^\s+//; | ||
32 | $o =~ s/\s+$//; | ||
33 | $o =~ s/\s+/ /g; | ||
34 | |||
35 | $o =~ s/\$[({]([^)}]+)[)}]/$sym{$1}/g; | ||
36 | $sym{$s}=$o; | ||
37 | } | ||
38 | } | ||
39 | |||
40 | $pwd=`pwd`; chop($pwd); | ||
41 | |||
42 | if ($sym{'TOP'} eq ".") | ||
43 | { | ||
44 | $n=0; | ||
45 | $dir="."; | ||
46 | } | ||
47 | else { | ||
48 | $n=split(/\//,$sym{'TOP'}); | ||
49 | @_=split(/\//,$pwd); | ||
50 | $z=$#_-$n+1; | ||
51 | foreach $i ($z .. $#_) { $dir.=$_[$i]."/"; } | ||
52 | chop($dir); | ||
53 | } | ||
54 | |||
55 | print "RELATIVE_DIRECTORY=$dir\n"; | ||
56 | |||
57 | foreach (sort keys %sym) | ||
58 | { | ||
59 | print "$_=$sym{$_}\n"; | ||
60 | } | ||
61 | print "RELATIVE_DIRECTORY=\n"; | ||
diff --git a/src/lib/libcrypto/util/install.sh b/src/lib/libcrypto/util/install.sh deleted file mode 100644 index e1d0c982df..0000000000 --- a/src/lib/libcrypto/util/install.sh +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # install - install a program, script, or datafile | ||
4 | # This comes from X11R5; it is not part of GNU. | ||
5 | # | ||
6 | # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ | ||
7 | # | ||
8 | # This script is compatible with the BSD install script, but was written | ||
9 | # from scratch. | ||
10 | # | ||
11 | |||
12 | |||
13 | # set DOITPROG to echo to test this script | ||
14 | |||
15 | doit="${DOITPROG:-}" | ||
16 | |||
17 | |||
18 | # put in absolute paths if you don't have them in your path; or use env. vars. | ||
19 | |||
20 | mvprog="${MVPROG:-mv}" | ||
21 | cpprog="${CPPROG:-cp}" | ||
22 | chmodprog="${CHMODPROG:-chmod}" | ||
23 | chownprog="${CHOWNPROG:-chown}" | ||
24 | chgrpprog="${CHGRPPROG:-chgrp}" | ||
25 | stripprog="${STRIPPROG:-strip}" | ||
26 | rmprog="${RMPROG:-rm}" | ||
27 | |||
28 | instcmd="$mvprog" | ||
29 | chmodcmd="" | ||
30 | chowncmd="" | ||
31 | chgrpcmd="" | ||
32 | stripcmd="" | ||
33 | rmcmd="$rmprog -f" | ||
34 | src="" | ||
35 | dst="" | ||
36 | |||
37 | while [ x"$1" != x ]; do | ||
38 | case $1 in | ||
39 | -c) instcmd="$cpprog" | ||
40 | shift | ||
41 | continue;; | ||
42 | |||
43 | -m) chmodcmd="$chmodprog $2" | ||
44 | shift | ||
45 | shift | ||
46 | continue;; | ||
47 | |||
48 | -o) chowncmd="$chownprog $2" | ||
49 | shift | ||
50 | shift | ||
51 | continue;; | ||
52 | |||
53 | -g) chgrpcmd="$chgrpprog $2" | ||
54 | shift | ||
55 | shift | ||
56 | continue;; | ||
57 | |||
58 | -s) stripcmd="$stripprog" | ||
59 | shift | ||
60 | continue;; | ||
61 | |||
62 | *) if [ x"$src" = x ] | ||
63 | then | ||
64 | src=$1 | ||
65 | else | ||
66 | dst=$1 | ||
67 | fi | ||
68 | shift | ||
69 | continue;; | ||
70 | esac | ||
71 | done | ||
72 | |||
73 | if [ x"$src" = x ] | ||
74 | then | ||
75 | echo "install: no input file specified" | ||
76 | exit 1 | ||
77 | fi | ||
78 | |||
79 | if [ x"$dst" = x ] | ||
80 | then | ||
81 | echo "install: no destination specified" | ||
82 | exit 1 | ||
83 | fi | ||
84 | |||
85 | |||
86 | # if destination is a directory, append the input filename; if your system | ||
87 | # does not like double slashes in filenames, you may need to add some logic | ||
88 | |||
89 | if [ -d $dst ] | ||
90 | then | ||
91 | dst="$dst"/`basename $src` | ||
92 | fi | ||
93 | |||
94 | |||
95 | # get rid of the old one and mode the new one in | ||
96 | |||
97 | $doit $rmcmd $dst | ||
98 | $doit $instcmd $src $dst | ||
99 | |||
100 | |||
101 | # and set any options; do chmod last to preserve setuid bits | ||
102 | |||
103 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; fi | ||
104 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; fi | ||
105 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; fi | ||
106 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; fi | ||
107 | |||
108 | exit 0 | ||
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl deleted file mode 100644 index 48de99f66c..0000000000 --- a/src/lib/libcrypto/util/mk1mf.pl +++ /dev/null | |||
@@ -1,1230 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # A bit of an evil hack but it post processes the file ../MINFO which | ||
3 | # is generated by `make files` in the top directory. | ||
4 | # This script outputs one mega makefile that has no shell stuff or any | ||
5 | # funny stuff | ||
6 | # | ||
7 | |||
8 | $INSTALLTOP="/usr/local/ssl"; | ||
9 | $OPENSSLDIR="/usr/local/ssl"; | ||
10 | $OPTIONS=""; | ||
11 | $ssl_version=""; | ||
12 | $banner="\t\@echo Building OpenSSL"; | ||
13 | |||
14 | my $no_static_engine = 1; | ||
15 | my $engines = ""; | ||
16 | my $otherlibs = ""; | ||
17 | local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic | ||
18 | local $zlib_lib = ""; | ||
19 | local $perl_asm = 0; # 1 to autobuild asm files from perl scripts | ||
20 | |||
21 | my $ex_l_libs = ""; | ||
22 | |||
23 | # Options to import from top level Makefile | ||
24 | |||
25 | my %mf_import = ( | ||
26 | VERSION => \$ssl_version, | ||
27 | OPTIONS => \$OPTIONS, | ||
28 | INSTALLTOP => \$INSTALLTOP, | ||
29 | OPENSSLDIR => \$OPENSSLDIR, | ||
30 | PLATFORM => \$mf_platform, | ||
31 | CFLAG => \$mf_cflag, | ||
32 | DEPFLAG => \$mf_depflag, | ||
33 | CPUID_OBJ => \$mf_cpuid_asm, | ||
34 | BN_ASM => \$mf_bn_asm, | ||
35 | DES_ENC => \$mf_des_asm, | ||
36 | AES_ENC => \$mf_aes_asm, | ||
37 | BF_ENC => \$mf_bf_asm, | ||
38 | CAST_ENC => \$mf_cast_asm, | ||
39 | RC4_ENC => \$mf_rc4_asm, | ||
40 | RC5_ENC => \$mf_rc5_asm, | ||
41 | MD5_ASM_OBJ => \$mf_md5_asm, | ||
42 | SHA1_ASM_OBJ => \$mf_sha_asm, | ||
43 | RMD160_ASM_OBJ => \$mf_rmd_asm, | ||
44 | WP_ASM_OBJ => \$mf_wp_asm, | ||
45 | CMLL_ENC => \$mf_cm_asm, | ||
46 | BASEADDR => \$baseaddr, | ||
47 | FIPSDIR => \$fipsdir, | ||
48 | ); | ||
49 | |||
50 | |||
51 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; | ||
52 | while(<IN>) { | ||
53 | my ($mf_opt, $mf_ref); | ||
54 | while (($mf_opt, $mf_ref) = each %mf_import) { | ||
55 | if (/^$mf_opt\s*=\s*(.*)$/) { | ||
56 | $$mf_ref = $1; | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | close(IN); | ||
61 | |||
62 | $debug = 1 if $mf_platform =~ /^debug-/; | ||
63 | |||
64 | die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq ""; | ||
65 | |||
66 | $infile="MINFO"; | ||
67 | |||
68 | %ops=( | ||
69 | "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", | ||
70 | "VC-WIN64I", "Microsoft C/C++ - Win64/IA-64", | ||
71 | "VC-WIN64A", "Microsoft C/C++ - Win64/x64", | ||
72 | "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", | ||
73 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", | ||
74 | "Mingw32", "GNU C++ - Windows NT or 9x", | ||
75 | "Mingw32-files", "Create files with DOS copy ...", | ||
76 | "BC-NT", "Borland C++ 4.5 - Windows NT", | ||
77 | "linux-elf","Linux elf", | ||
78 | "ultrix-mips","DEC mips ultrix", | ||
79 | "FreeBSD","FreeBSD distribution", | ||
80 | "OS2-EMX", "EMX GCC OS/2", | ||
81 | "netware-clib", "CodeWarrior for NetWare - CLib - with WinSock Sockets", | ||
82 | "netware-clib-bsdsock", "CodeWarrior for NetWare - CLib - with BSD Sockets", | ||
83 | "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets", | ||
84 | "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets", | ||
85 | "default","cc under unix", | ||
86 | "auto", "auto detect from top level Makefile" | ||
87 | ); | ||
88 | |||
89 | $platform=""; | ||
90 | my $xcflags=""; | ||
91 | foreach (@ARGV) | ||
92 | { | ||
93 | if (!&read_options && !defined($ops{$_})) | ||
94 | { | ||
95 | print STDERR "unknown option - $_\n"; | ||
96 | print STDERR "usage: perl mk1mf.pl [options] [system]\n"; | ||
97 | print STDERR "\nwhere [system] can be one of the following\n"; | ||
98 | foreach $i (sort keys %ops) | ||
99 | { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; } | ||
100 | print STDERR <<"EOF"; | ||
101 | and [options] can be one of | ||
102 | no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest | ||
103 | no-ripemd | ||
104 | no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher | ||
105 | no-bf no-cast no-aes no-camellia no-seed | ||
106 | no-rsa no-dsa no-dh - Skip this public key cipher | ||
107 | no-ssl2 no-ssl3 - Skip this version of SSL | ||
108 | just-ssl - remove all non-ssl keys/digest | ||
109 | no-asm - No x86 asm | ||
110 | no-krb5 - No KRB5 | ||
111 | no-srp - No SRP | ||
112 | no-ec - No EC | ||
113 | no-ecdsa - No ECDSA | ||
114 | no-ecdh - No ECDH | ||
115 | no-engine - No engine | ||
116 | no-hw - No hw | ||
117 | nasm - Use NASM for x86 asm | ||
118 | nw-nasm - Use NASM x86 asm for NetWare | ||
119 | nw-mwasm - Use Metrowerks x86 asm for NetWare | ||
120 | gaswin - Use GNU as with Mingw32 | ||
121 | no-socks - No socket code | ||
122 | no-err - No error strings | ||
123 | dll/shlib - Build shared libraries (MS) | ||
124 | debug - Debug build | ||
125 | profile - Profiling build | ||
126 | gcc - Use Gcc (unix) | ||
127 | |||
128 | Values that can be set | ||
129 | TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler | ||
130 | |||
131 | -L<ex_lib_path> -l<ex_lib> - extra library flags (unix) | ||
132 | -<ex_cc_flags> - extra 'cc' flags, | ||
133 | added (MS), or replace (unix) | ||
134 | EOF | ||
135 | exit(1); | ||
136 | } | ||
137 | $platform=$_; | ||
138 | } | ||
139 | foreach (grep(!/^$/, split(/ /, $OPTIONS))) | ||
140 | { | ||
141 | print STDERR "unknown option - $_\n" if !&read_options; | ||
142 | } | ||
143 | |||
144 | $no_static_engine = 0 if (!$shlib); | ||
145 | |||
146 | $no_mdc2=1 if ($no_des); | ||
147 | |||
148 | $no_ssl3=1 if ($no_md5 || $no_sha); | ||
149 | $no_ssl3=1 if ($no_rsa && $no_dh); | ||
150 | |||
151 | $no_ssl2=1 if ($no_md5); | ||
152 | $no_ssl2=1 if ($no_rsa); | ||
153 | |||
154 | $out_def="out"; | ||
155 | $inc_def="outinc"; | ||
156 | $tmp_def="tmp"; | ||
157 | |||
158 | $perl="perl" unless defined $perl; | ||
159 | $mkdir="-mkdir" unless defined $mkdir; | ||
160 | |||
161 | ($ssl,$crypto)=("ssl","crypto"); | ||
162 | $ranlib="echo ranlib"; | ||
163 | |||
164 | $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; | ||
165 | $src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.'; | ||
166 | $bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:''; | ||
167 | |||
168 | # $bin_dir.=$o causes a core dump on my sparc :-( | ||
169 | |||
170 | |||
171 | $NT=0; | ||
172 | |||
173 | push(@INC,"util/pl","pl"); | ||
174 | |||
175 | if ($platform eq "auto") { | ||
176 | $platform = $mf_platform; | ||
177 | print STDERR "Imported platform $mf_platform\n"; | ||
178 | } | ||
179 | |||
180 | if (($platform =~ /VC-(.+)/)) | ||
181 | { | ||
182 | $FLAVOR=$1; | ||
183 | $NT = 1 if $1 eq "NT"; | ||
184 | require 'VC-32.pl'; | ||
185 | } | ||
186 | elsif ($platform eq "Mingw32") | ||
187 | { | ||
188 | require 'Mingw32.pl'; | ||
189 | } | ||
190 | elsif ($platform eq "Mingw32-files") | ||
191 | { | ||
192 | require 'Mingw32f.pl'; | ||
193 | } | ||
194 | elsif ($platform eq "BC-NT") | ||
195 | { | ||
196 | $bc=1; | ||
197 | require 'BC-32.pl'; | ||
198 | } | ||
199 | elsif ($platform eq "FreeBSD") | ||
200 | { | ||
201 | require 'unix.pl'; | ||
202 | $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer'; | ||
203 | } | ||
204 | elsif ($platform eq "linux-elf") | ||
205 | { | ||
206 | require "unix.pl"; | ||
207 | require "linux.pl"; | ||
208 | $unix=1; | ||
209 | } | ||
210 | elsif ($platform eq "ultrix-mips") | ||
211 | { | ||
212 | require "unix.pl"; | ||
213 | require "ultrix.pl"; | ||
214 | $unix=1; | ||
215 | } | ||
216 | elsif ($platform eq "OS2-EMX") | ||
217 | { | ||
218 | $wc=1; | ||
219 | require 'OS2-EMX.pl'; | ||
220 | } | ||
221 | elsif (($platform eq "netware-clib") || ($platform eq "netware-libc") || | ||
222 | ($platform eq "netware-clib-bsdsock") || ($platform eq "netware-libc-bsdsock")) | ||
223 | { | ||
224 | $LIBC=1 if $platform eq "netware-libc" || $platform eq "netware-libc-bsdsock"; | ||
225 | $BSDSOCK=1 if ($platform eq "netware-libc-bsdsock") || ($platform eq "netware-clib-bsdsock"); | ||
226 | require 'netware.pl'; | ||
227 | } | ||
228 | else | ||
229 | { | ||
230 | require "unix.pl"; | ||
231 | |||
232 | $unix=1; | ||
233 | $cflags.=' -DTERMIO'; | ||
234 | } | ||
235 | |||
236 | $fipsdir =~ s/\//${o}/g; | ||
237 | |||
238 | $out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":""); | ||
239 | $tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":""); | ||
240 | $inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def; | ||
241 | |||
242 | $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); | ||
243 | |||
244 | $cflags= "$xcflags$cflags" if $xcflags ne ""; | ||
245 | |||
246 | $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; | ||
247 | $cflags.=" -DOPENSSL_NO_AES" if $no_aes; | ||
248 | $cflags.=" -DOPENSSL_NO_CAMELLIA" if $no_camellia; | ||
249 | $cflags.=" -DOPENSSL_NO_SEED" if $no_seed; | ||
250 | $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; | ||
251 | $cflags.=" -DOPENSSL_NO_RC4" if $no_rc4; | ||
252 | $cflags.=" -DOPENSSL_NO_RC5" if $no_rc5; | ||
253 | $cflags.=" -DOPENSSL_NO_MD2" if $no_md2; | ||
254 | $cflags.=" -DOPENSSL_NO_MD4" if $no_md4; | ||
255 | $cflags.=" -DOPENSSL_NO_MD5" if $no_md5; | ||
256 | $cflags.=" -DOPENSSL_NO_SHA" if $no_sha; | ||
257 | $cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; | ||
258 | $cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd; | ||
259 | $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; | ||
260 | $cflags.=" -DOPENSSL_NO_BF" if $no_bf; | ||
261 | $cflags.=" -DOPENSSL_NO_CAST" if $no_cast; | ||
262 | $cflags.=" -DOPENSSL_NO_DES" if $no_des; | ||
263 | $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; | ||
264 | $cflags.=" -DOPENSSL_NO_DSA" if $no_dsa; | ||
265 | $cflags.=" -DOPENSSL_NO_DH" if $no_dh; | ||
266 | $cflags.=" -DOPENSSL_NO_WHIRLPOOL" if $no_whirlpool; | ||
267 | $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock; | ||
268 | $cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2; | ||
269 | $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; | ||
270 | $cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext; | ||
271 | $cflags.=" -DOPENSSL_NO_SRP" if $no_srp; | ||
272 | $cflags.=" -DOPENSSL_NO_CMS" if $no_cms; | ||
273 | $cflags.=" -DOPENSSL_NO_ERR" if $no_err; | ||
274 | $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; | ||
275 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; | ||
276 | $cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa; | ||
277 | $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; | ||
278 | $cflags.=" -DOPENSSL_NO_GOST" if $no_gost; | ||
279 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; | ||
280 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; | ||
281 | $cflags.=" -DOPENSSL_FIPS" if $fips; | ||
282 | $cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; | ||
283 | $cflags.=" -DOPENSSL_NO_EC2M" if $no_ec2m; | ||
284 | $cflags.= " -DZLIB" if $zlib_opt; | ||
285 | $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; | ||
286 | |||
287 | if ($no_static_engine) | ||
288 | { | ||
289 | $cflags .= " -DOPENSSL_NO_STATIC_ENGINE"; | ||
290 | } | ||
291 | else | ||
292 | { | ||
293 | $cflags .= " -DOPENSSL_NO_DYNAMIC_ENGINE"; | ||
294 | } | ||
295 | |||
296 | #$cflags.=" -DRSAref" if $rsaref ne ""; | ||
297 | |||
298 | ## if ($unix) | ||
299 | ## { $cflags="$c_flags" if ($c_flags ne ""); } | ||
300 | ##else | ||
301 | { $cflags="$c_flags$cflags" if ($c_flags ne ""); } | ||
302 | |||
303 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); | ||
304 | |||
305 | |||
306 | %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", | ||
307 | "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); | ||
308 | |||
309 | if ($msdos) | ||
310 | { | ||
311 | $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n"; | ||
312 | $banner.="\t\@echo top level directory, if you don't have perl, you will\n"; | ||
313 | $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n"; | ||
314 | $banner.="\t\@echo documentation for details.\n"; | ||
315 | } | ||
316 | |||
317 | # have to do this to allow $(CC) under unix | ||
318 | $link="$bin_dir$link" if ($link !~ /^\$/); | ||
319 | |||
320 | $INSTALLTOP =~ s|/|$o|g; | ||
321 | $OPENSSLDIR =~ s|/|$o|g; | ||
322 | |||
323 | ############################################# | ||
324 | # We parse in input file and 'store' info for later printing. | ||
325 | open(IN,"<$infile") || die "unable to open $infile:$!\n"; | ||
326 | $_=<IN>; | ||
327 | for (;;) | ||
328 | { | ||
329 | chop; | ||
330 | |||
331 | ($key,$val)=/^([^=]+)=(.*)/; | ||
332 | if ($key eq "RELATIVE_DIRECTORY") | ||
333 | { | ||
334 | if ($lib ne "") | ||
335 | { | ||
336 | $uc=$lib; | ||
337 | $uc =~ s/^lib(.*)\.a/$1/; | ||
338 | $uc =~ tr/a-z/A-Z/; | ||
339 | $lib_nam{$uc}=$uc; | ||
340 | $lib_obj{$uc}.=$libobj." "; | ||
341 | } | ||
342 | last if ($val eq "FINISHED"); | ||
343 | $lib=""; | ||
344 | $libobj=""; | ||
345 | $dir=$val; | ||
346 | } | ||
347 | |||
348 | if ($key eq "KRB5_INCLUDES") | ||
349 | { $cflags .= " $val";} | ||
350 | |||
351 | if ($key eq "ZLIB_INCLUDE") | ||
352 | { $cflags .= " $val" if $val ne "";} | ||
353 | |||
354 | if ($key eq "LIBZLIB") | ||
355 | { $zlib_lib = "$val" if $val ne "";} | ||
356 | |||
357 | if ($key eq "LIBKRB5") | ||
358 | { $ex_libs .= " $val" if $val ne "";} | ||
359 | |||
360 | if ($key eq "TEST") | ||
361 | { $test.=&var_add($dir,$val, 0); } | ||
362 | |||
363 | if (($key eq "PROGS") || ($key eq "E_OBJ")) | ||
364 | { $e_exe.=&var_add($dir,$val, 0); } | ||
365 | |||
366 | if ($key eq "LIB") | ||
367 | { | ||
368 | $lib=$val; | ||
369 | $lib =~ s/^.*\/([^\/]+)$/$1/; | ||
370 | } | ||
371 | if ($key eq "LIBNAME" && $no_static_engine) | ||
372 | { | ||
373 | $lib=$val; | ||
374 | $lib =~ s/^.*\/([^\/]+)$/$1/; | ||
375 | $otherlibs .= " $lib"; | ||
376 | } | ||
377 | |||
378 | if ($key eq "EXHEADER") | ||
379 | { $exheader.=&var_add($dir,$val, 1); } | ||
380 | |||
381 | if ($key eq "HEADER") | ||
382 | { $header.=&var_add($dir,$val, 1); } | ||
383 | |||
384 | if ($key eq "LIBOBJ" && ($dir ne "engines" || !$no_static_engine)) | ||
385 | { $libobj=&var_add($dir,$val, 0); } | ||
386 | if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine) | ||
387 | { $engines.=$val } | ||
388 | |||
389 | if (!($_=<IN>)) | ||
390 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } | ||
391 | } | ||
392 | close(IN); | ||
393 | |||
394 | if ($shlib) | ||
395 | { | ||
396 | $extra_install= <<"EOF"; | ||
397 | \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}bin\" | ||
398 | \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}bin\" | ||
399 | \$(CP) \"\$(L_SSL)\" \"\$(INSTALLTOP)${o}lib\" | ||
400 | \$(CP) \"\$(L_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" | ||
401 | EOF | ||
402 | if ($no_static_engine) | ||
403 | { | ||
404 | $extra_install .= <<"EOF" | ||
405 | \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\" | ||
406 | \$(CP) \"\$(E_SHLIB)\" \"\$(INSTALLTOP)${o}lib${o}engines\" | ||
407 | EOF | ||
408 | } | ||
409 | } | ||
410 | else | ||
411 | { | ||
412 | $extra_install= <<"EOF"; | ||
413 | \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}lib\" | ||
414 | \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" | ||
415 | EOF | ||
416 | $ex_libs .= " $zlib_lib" if $zlib_opt == 1; | ||
417 | if ($fips) | ||
418 | { | ||
419 | $build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)"; | ||
420 | $ex_l_libs .= " \$(O_FIPSCANISTER)"; | ||
421 | } | ||
422 | } | ||
423 | |||
424 | $defs= <<"EOF"; | ||
425 | # This makefile has been automatically generated from the OpenSSL distribution. | ||
426 | # This single makefile will build the complete OpenSSL distribution and | ||
427 | # by default leave the 'intertesting' output files in .${o}out and the stuff | ||
428 | # that needs deleting in .${o}tmp. | ||
429 | # The file was generated by running 'make makefile.one', which | ||
430 | # does a 'make files', which writes all the environment variables from all | ||
431 | # the makefiles to the file call MINFO. This file is used by | ||
432 | # util${o}mk1mf.pl to generate makefile.one. | ||
433 | # The 'makefile per directory' system suites me when developing this | ||
434 | # library and also so I can 'distribute' indervidual library sections. | ||
435 | # The one monster makefile better suits building in non-unix | ||
436 | # environments. | ||
437 | |||
438 | EOF | ||
439 | |||
440 | $defs .= $preamble if defined $preamble; | ||
441 | |||
442 | $defs.= <<"EOF"; | ||
443 | INSTALLTOP=$INSTALLTOP | ||
444 | OPENSSLDIR=$OPENSSLDIR | ||
445 | |||
446 | # Set your compiler options | ||
447 | PLATFORM=$platform | ||
448 | CC=$bin_dir${cc} | ||
449 | CFLAG=$cflags | ||
450 | APP_CFLAG=$app_cflag | ||
451 | LIB_CFLAG=$lib_cflag | ||
452 | SHLIB_CFLAG=$shl_cflag | ||
453 | APP_EX_OBJ=$app_ex_obj | ||
454 | SHLIB_EX_OBJ=$shlib_ex_obj | ||
455 | # add extra libraries to this define, for solaris -lsocket -lnsl would | ||
456 | # be added | ||
457 | EX_LIBS=$ex_libs | ||
458 | |||
459 | # The OpenSSL directory | ||
460 | SRC_D=$src_dir | ||
461 | |||
462 | LINK=$link | ||
463 | LFLAGS=$lflags | ||
464 | RSC=$rsc | ||
465 | |||
466 | # The output directory for everything intersting | ||
467 | OUT_D=$out_dir | ||
468 | # The output directory for all the temporary muck | ||
469 | TMP_D=$tmp_dir | ||
470 | # The output directory for the header files | ||
471 | INC_D=$inc_dir | ||
472 | INCO_D=$inc_dir${o}openssl | ||
473 | |||
474 | PERL=$perl | ||
475 | CP=$cp | ||
476 | RM=$rm | ||
477 | RANLIB=$ranlib | ||
478 | MKDIR=$mkdir | ||
479 | MKLIB=$bin_dir$mklib | ||
480 | MLFLAGS=$mlflags | ||
481 | ASM=$bin_dir$asm | ||
482 | |||
483 | # FIPS validated module and support file locations | ||
484 | |||
485 | FIPSDIR=$fipsdir | ||
486 | BASEADDR=$baseaddr | ||
487 | FIPSLIB_D=\$(FIPSDIR)${o}lib | ||
488 | FIPS_PREMAIN_SRC=\$(FIPSLIB_D)${o}fips_premain.c | ||
489 | O_FIPSCANISTER=\$(FIPSLIB_D)${o}fipscanister.lib | ||
490 | FIPS_SHA1_EXE=\$(FIPSDIR)${o}bin${o}fips_standalone_sha1${exep} | ||
491 | E_PREMAIN_DSO=fips_premain_dso | ||
492 | PREMAIN_DSO_EXE=\$(BIN_D)${o}fips_premain_dso$exep | ||
493 | FIPSLINK=\$(PERL) \$(FIPSDIR)${o}bin${o}fipslink.pl | ||
494 | |||
495 | ###################################################### | ||
496 | # You should not need to touch anything below this point | ||
497 | ###################################################### | ||
498 | |||
499 | E_EXE=openssl | ||
500 | SSL=$ssl | ||
501 | CRYPTO=$crypto | ||
502 | |||
503 | # BIN_D - Binary output directory | ||
504 | # TEST_D - Binary test file output directory | ||
505 | # LIB_D - library output directory | ||
506 | # ENG_D - dynamic engine output directory | ||
507 | # Note: if you change these point to different directories then uncomment out | ||
508 | # the lines around the 'NB' comment below. | ||
509 | # | ||
510 | BIN_D=\$(OUT_D) | ||
511 | TEST_D=\$(OUT_D) | ||
512 | LIB_D=\$(OUT_D) | ||
513 | ENG_D=\$(OUT_D) | ||
514 | |||
515 | # INCL_D - local library directory | ||
516 | # OBJ_D - temp object file directory | ||
517 | OBJ_D=\$(TMP_D) | ||
518 | INCL_D=\$(TMP_D) | ||
519 | |||
520 | O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp | ||
521 | O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp | ||
522 | SO_SSL= $plib\$(SSL)$so_shlibp | ||
523 | SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp | ||
524 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp | ||
525 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp | ||
526 | |||
527 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs | ||
528 | |||
529 | ###################################################### | ||
530 | # Don't touch anything below this point | ||
531 | ###################################################### | ||
532 | |||
533 | INC=-I\$(INC_D) -I\$(INCL_D) | ||
534 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) | ||
535 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) | ||
536 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) | ||
537 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) | ||
538 | |||
539 | ############################################# | ||
540 | EOF | ||
541 | |||
542 | $rules=<<"EOF"; | ||
543 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe $build_targets | ||
544 | |||
545 | banner: | ||
546 | $banner | ||
547 | |||
548 | \$(TMP_D): | ||
549 | \$(MKDIR) \"\$(TMP_D)\" | ||
550 | # NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different | ||
551 | #\$(BIN_D): | ||
552 | # \$(MKDIR) \$(BIN_D) | ||
553 | # | ||
554 | #\$(TEST_D): | ||
555 | # \$(MKDIR) \$(TEST_D) | ||
556 | |||
557 | \$(LIB_D): | ||
558 | \$(MKDIR) \"\$(LIB_D)\" | ||
559 | |||
560 | \$(INCO_D): \$(INC_D) | ||
561 | \$(MKDIR) \"\$(INCO_D)\" | ||
562 | |||
563 | \$(INC_D): | ||
564 | \$(MKDIR) \"\$(INC_D)\" | ||
565 | |||
566 | headers: \$(HEADER) \$(EXHEADER) | ||
567 | @ | ||
568 | |||
569 | lib: \$(LIBS_DEP) \$(E_SHLIB) | ||
570 | |||
571 | exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep | ||
572 | |||
573 | install: all | ||
574 | \$(MKDIR) \"\$(INSTALLTOP)\" | ||
575 | \$(MKDIR) \"\$(INSTALLTOP)${o}bin\" | ||
576 | \$(MKDIR) \"\$(INSTALLTOP)${o}include\" | ||
577 | \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\" | ||
578 | \$(MKDIR) \"\$(INSTALLTOP)${o}lib\" | ||
579 | \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\" | ||
580 | \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\" | ||
581 | \$(MKDIR) \"\$(OPENSSLDIR)\" | ||
582 | \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\" | ||
583 | $extra_install | ||
584 | |||
585 | |||
586 | test: \$(T_EXE) | ||
587 | cd \$(BIN_D) | ||
588 | ..${o}ms${o}test | ||
589 | |||
590 | clean: | ||
591 | \$(RM) \$(TMP_D)$o*.* | ||
592 | |||
593 | vclean: | ||
594 | \$(RM) \$(TMP_D)$o*.* | ||
595 | \$(RM) \$(OUT_D)$o*.* | ||
596 | |||
597 | EOF | ||
598 | |||
599 | my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform"; | ||
600 | $platform_cpp_symbol =~ s/-/_/g; | ||
601 | if (open(IN,"crypto/buildinf.h")) | ||
602 | { | ||
603 | # Remove entry for this platform in existing file buildinf.h. | ||
604 | |||
605 | my $old_buildinf_h = ""; | ||
606 | while (<IN>) | ||
607 | { | ||
608 | if (/^\#ifdef $platform_cpp_symbol$/) | ||
609 | { | ||
610 | while (<IN>) { last if (/^\#endif/); } | ||
611 | } | ||
612 | else | ||
613 | { | ||
614 | $old_buildinf_h .= $_; | ||
615 | } | ||
616 | } | ||
617 | close(IN); | ||
618 | |||
619 | open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h"; | ||
620 | print OUT $old_buildinf_h; | ||
621 | close(OUT); | ||
622 | } | ||
623 | |||
624 | open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h"; | ||
625 | printf OUT <<EOF; | ||
626 | #ifdef $platform_cpp_symbol | ||
627 | /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */ | ||
628 | #define CFLAGS "$cc $cflags" | ||
629 | #define PLATFORM "$platform" | ||
630 | EOF | ||
631 | printf OUT " #define DATE \"%s\"\n", scalar gmtime(); | ||
632 | printf OUT "#endif\n"; | ||
633 | close(OUT); | ||
634 | |||
635 | # Strip of trailing ' ' | ||
636 | foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); } | ||
637 | $test=&clean_up_ws($test); | ||
638 | $e_exe=&clean_up_ws($e_exe); | ||
639 | $exheader=&clean_up_ws($exheader); | ||
640 | $header=&clean_up_ws($header); | ||
641 | |||
642 | # First we strip the exheaders from the headers list | ||
643 | foreach (split(/\s+/,$exheader)){ $h{$_}=1; } | ||
644 | foreach (split(/\s+/,$header)) { $h.=$_." " unless $h{$_}; } | ||
645 | chop($h); $header=$h; | ||
646 | |||
647 | $defs.=&do_defs("HEADER",$header,"\$(INCL_D)",""); | ||
648 | $rules.=&do_copy_rule("\$(INCL_D)",$header,""); | ||
649 | |||
650 | $defs.=&do_defs("EXHEADER",$exheader,"\$(INCO_D)",""); | ||
651 | $rules.=&do_copy_rule("\$(INCO_D)",$exheader,""); | ||
652 | |||
653 | $defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj); | ||
654 | $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); | ||
655 | |||
656 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); | ||
657 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); | ||
658 | |||
659 | # Special case rule for fips_premain_dso | ||
660 | |||
661 | if ($fips) | ||
662 | { | ||
663 | $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj", | ||
664 | "\$(FIPS_PREMAIN_SRC)", | ||
665 | "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)", ""); | ||
666 | $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1); | ||
667 | } | ||
668 | |||
669 | foreach (values %lib_nam) | ||
670 | { | ||
671 | $lib_obj=$lib_obj{$_}; | ||
672 | local($slib)=$shlib; | ||
673 | |||
674 | if (($_ eq "SSL") && $no_ssl2 && $no_ssl3) | ||
675 | { | ||
676 | $rules.="\$(O_SSL):\n\n"; | ||
677 | next; | ||
678 | } | ||
679 | |||
680 | $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj); | ||
681 | $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)"; | ||
682 | $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib); | ||
683 | } | ||
684 | |||
685 | # hack to add version info on MSVC | ||
686 | if (($platform eq "VC-WIN32") || ($platform eq "VC-WIN64A") | ||
687 | || ($platform eq "VC-WIN64I") || ($platform eq "VC-NT")) { | ||
688 | $rules.= <<"EOF"; | ||
689 | \$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc | ||
690 | \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc | ||
691 | |||
692 | \$(OBJ_D)\\\$(SSL).res: ms\\version32.rc | ||
693 | \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc | ||
694 | |||
695 | EOF | ||
696 | } | ||
697 | |||
698 | $defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep); | ||
699 | foreach (split(/\s+/,$test)) | ||
700 | { | ||
701 | $t=&bname($_); | ||
702 | $tt="\$(OBJ_D)${o}$t${obj}"; | ||
703 | $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | ||
704 | } | ||
705 | |||
706 | $defs.=&do_defs("E_SHLIB",$engines . $otherlibs,"\$(ENG_D)",$shlibp); | ||
707 | |||
708 | foreach (split(/\s+/,$engines)) | ||
709 | { | ||
710 | $rules.=&do_compile_rule("\$(OBJ_D)","engines${o}e_$_",$lib); | ||
711 | $rules.= &do_lib_rule("\$(OBJ_D)${o}e_${_}.obj","\$(ENG_D)$o$_$shlibp","",$shlib,""); | ||
712 | } | ||
713 | |||
714 | |||
715 | |||
716 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); | ||
717 | |||
718 | if ($fips) | ||
719 | { | ||
720 | if ($shlib) | ||
721 | { | ||
722 | $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)", | ||
723 | "\$(O_CRYPTO)", "$crypto", | ||
724 | $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)"); | ||
725 | } | ||
726 | else | ||
727 | { | ||
728 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)", | ||
729 | "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", ""); | ||
730 | $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)", | ||
731 | "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", ""); | ||
732 | } | ||
733 | } | ||
734 | else | ||
735 | { | ||
736 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib, | ||
737 | "\$(SO_CRYPTO)"); | ||
738 | } | ||
739 | |||
740 | foreach (split(" ",$otherlibs)) | ||
741 | { | ||
742 | my $uc = $_; | ||
743 | $uc =~ tr /a-z/A-Z/; | ||
744 | $rules.= &do_lib_rule("\$(${uc}OBJ)","\$(ENG_D)$o$_$shlibp", "", $shlib, ""); | ||
745 | |||
746 | } | ||
747 | |||
748 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0); | ||
749 | |||
750 | print $defs; | ||
751 | |||
752 | if ($platform eq "linux-elf") { | ||
753 | print <<"EOF"; | ||
754 | # Generate perlasm output files | ||
755 | %.cpp: | ||
756 | (cd \$(\@D)/..; PERL=perl make -f Makefile asm/\$(\@F)) | ||
757 | EOF | ||
758 | } | ||
759 | print "###################################################################\n"; | ||
760 | print $rules; | ||
761 | |||
762 | ############################################### | ||
763 | # strip off any trailing .[och] and append the relative directory | ||
764 | # also remembering to do nothing if we are in one of the dropped | ||
765 | # directories | ||
766 | sub var_add | ||
767 | { | ||
768 | local($dir,$val,$keepext)=@_; | ||
769 | local(@a,$_,$ret); | ||
770 | |||
771 | return("") if $no_engine && $dir =~ /\/engine/; | ||
772 | return("") if $no_hw && $dir =~ /\/hw/; | ||
773 | return("") if $no_idea && $dir =~ /\/idea/; | ||
774 | return("") if $no_aes && $dir =~ /\/aes/; | ||
775 | return("") if $no_camellia && $dir =~ /\/camellia/; | ||
776 | return("") if $no_seed && $dir =~ /\/seed/; | ||
777 | return("") if $no_rc2 && $dir =~ /\/rc2/; | ||
778 | return("") if $no_rc4 && $dir =~ /\/rc4/; | ||
779 | return("") if $no_rc5 && $dir =~ /\/rc5/; | ||
780 | return("") if $no_rsa && $dir =~ /\/rsa/; | ||
781 | return("") if $no_rsa && $dir =~ /^rsaref/; | ||
782 | return("") if $no_dsa && $dir =~ /\/dsa/; | ||
783 | return("") if $no_dh && $dir =~ /\/dh/; | ||
784 | return("") if $no_ec && $dir =~ /\/ec/; | ||
785 | return("") if $no_cms && $dir =~ /\/cms/; | ||
786 | return("") if $no_jpake && $dir =~ /\/jpake/; | ||
787 | if ($no_des && $dir =~ /\/des/) | ||
788 | { | ||
789 | if ($val =~ /read_pwd/) | ||
790 | { return("$dir/read_pwd "); } | ||
791 | else | ||
792 | { return(""); } | ||
793 | } | ||
794 | return("") if $no_mdc2 && $dir =~ /\/mdc2/; | ||
795 | return("") if $no_sock && $dir =~ /\/proxy/; | ||
796 | return("") if $no_bf && $dir =~ /\/bf/; | ||
797 | return("") if $no_cast && $dir =~ /\/cast/; | ||
798 | return("") if $no_whirlpool && $dir =~ /\/whrlpool/; | ||
799 | |||
800 | $val =~ s/^\s*(.*)\s*$/$1/; | ||
801 | @a=split(/\s+/,$val); | ||
802 | grep(s/\.[och]$//,@a) unless $keepext; | ||
803 | |||
804 | @a=grep(!/^e_.*_3d$/,@a) if $no_des; | ||
805 | @a=grep(!/^e_.*_d$/,@a) if $no_des; | ||
806 | @a=grep(!/^e_.*_ae$/,@a) if $no_idea; | ||
807 | @a=grep(!/^e_.*_i$/,@a) if $no_aes; | ||
808 | @a=grep(!/^e_.*_r2$/,@a) if $no_rc2; | ||
809 | @a=grep(!/^e_.*_r5$/,@a) if $no_rc5; | ||
810 | @a=grep(!/^e_.*_bf$/,@a) if $no_bf; | ||
811 | @a=grep(!/^e_.*_c$/,@a) if $no_cast; | ||
812 | @a=grep(!/^e_rc4$/,@a) if $no_rc4; | ||
813 | @a=grep(!/^e_camellia$/,@a) if $no_camellia; | ||
814 | @a=grep(!/^e_seed$/,@a) if $no_seed; | ||
815 | |||
816 | #@a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2; | ||
817 | #@a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3; | ||
818 | |||
819 | @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock; | ||
820 | |||
821 | @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2; | ||
822 | @a=grep(!/(^md4)|(_md4$)/,@a) if $no_md4; | ||
823 | @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5; | ||
824 | @a=grep(!/(rmd)|(ripemd)/,@a) if $no_ripemd; | ||
825 | |||
826 | @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa; | ||
827 | @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa; | ||
828 | @a=grep(!/(^pem_seal$)/,@a) if $no_rsa; | ||
829 | |||
830 | @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa; | ||
831 | @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa; | ||
832 | |||
833 | @a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4; | ||
834 | |||
835 | @a=grep(!/_dhp$/,@a) if $no_dh; | ||
836 | |||
837 | @a=grep(!/(^sha[^1])|(_sha$)|(m_dss$)/,@a) if $no_sha; | ||
838 | @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; | ||
839 | @a=grep(!/_mdc2$/,@a) if $no_mdc2; | ||
840 | |||
841 | @a=grep(!/(srp)/,@a) if $no_srp; | ||
842 | |||
843 | @a=grep(!/^engine$/,@a) if $no_engine; | ||
844 | @a=grep(!/^hw$/,@a) if $no_hw; | ||
845 | @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa; | ||
846 | @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa; | ||
847 | @a=grep(!/^gendsa$/,@a) if $no_sha1; | ||
848 | @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh; | ||
849 | |||
850 | @a=grep(!/(^dh)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; | ||
851 | |||
852 | grep($_="$dir/$_",@a); | ||
853 | @a=grep(!/(^|\/)s_/,@a) if $no_sock; | ||
854 | @a=grep(!/(^|\/)bio_sock/,@a) if $no_sock; | ||
855 | $ret=join(' ',@a)." "; | ||
856 | return($ret); | ||
857 | } | ||
858 | |||
859 | # change things so that each 'token' is only separated by one space | ||
860 | sub clean_up_ws | ||
861 | { | ||
862 | local($w)=@_; | ||
863 | |||
864 | $w =~ s/^\s*(.*)\s*$/$1/; | ||
865 | $w =~ s/\s+/ /g; | ||
866 | return($w); | ||
867 | } | ||
868 | |||
869 | sub do_defs | ||
870 | { | ||
871 | local($var,$files,$location,$postfix)=@_; | ||
872 | local($_,$ret,$pf); | ||
873 | local(*OUT,$tmp,$t); | ||
874 | |||
875 | $files =~ s/\//$o/g if $o ne '/'; | ||
876 | $ret="$var="; | ||
877 | $n=1; | ||
878 | $Vars{$var}.=""; | ||
879 | foreach (split(/ /,$files)) | ||
880 | { | ||
881 | $orig=$_; | ||
882 | $_=&bname($_) unless /^\$/; | ||
883 | if ($n++ == 2) | ||
884 | { | ||
885 | $n=0; | ||
886 | $ret.="\\\n\t"; | ||
887 | } | ||
888 | if (($_ =~ /bss_file/) && ($postfix eq ".h")) | ||
889 | { $pf=".c"; } | ||
890 | else { $pf=$postfix; } | ||
891 | if ($_ =~ /BN_ASM/) { $t="$_ "; } | ||
892 | elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; } | ||
893 | elsif ($_ =~ /AES_ASM/){ $t="$_ "; } | ||
894 | elsif ($_ =~ /DES_ENC/) { $t="$_ "; } | ||
895 | elsif ($_ =~ /BF_ENC/) { $t="$_ "; } | ||
896 | elsif ($_ =~ /CAST_ENC/){ $t="$_ "; } | ||
897 | elsif ($_ =~ /RC4_ENC/) { $t="$_ "; } | ||
898 | elsif ($_ =~ /RC5_ENC/) { $t="$_ "; } | ||
899 | elsif ($_ =~ /MD5_ASM/) { $t="$_ "; } | ||
900 | elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; } | ||
901 | elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; } | ||
902 | elsif ($_ =~ /WHIRLPOOL_ASM/){ $t="$_ "; } | ||
903 | elsif ($_ =~ /CPUID_ASM/){ $t="$_ "; } | ||
904 | else { $t="$location${o}$_$pf "; } | ||
905 | |||
906 | $Vars{$var}.="$t "; | ||
907 | $ret.=$t; | ||
908 | } | ||
909 | # hack to add version info on MSVC | ||
910 | if ($shlib && (($platform eq "VC-WIN32") || ($platfrom eq "VC-WIN64I") || ($platform eq "VC-WIN64A") || ($platform eq "VC-NT"))) | ||
911 | { | ||
912 | if ($var eq "CRYPTOOBJ") | ||
913 | { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; } | ||
914 | elsif ($var eq "SSLOBJ") | ||
915 | { $ret.="\$(OBJ_D)\\\$(SSL).res "; } | ||
916 | } | ||
917 | chomp($ret); | ||
918 | $ret.="\n\n"; | ||
919 | return($ret); | ||
920 | } | ||
921 | |||
922 | # return the name with the leading path removed | ||
923 | sub bname | ||
924 | { | ||
925 | local($ret)=@_; | ||
926 | $ret =~ s/^.*[\\\/]([^\\\/]+)$/$1/; | ||
927 | return($ret); | ||
928 | } | ||
929 | |||
930 | # return the leading path | ||
931 | sub dname | ||
932 | { | ||
933 | my $ret=shift; | ||
934 | $ret =~ s/(^.*)[\\\/][^\\\/]+$/$1/; | ||
935 | return($ret); | ||
936 | } | ||
937 | |||
938 | ############################################################## | ||
939 | # do a rule for each file that says 'compile' to new direcory | ||
940 | # compile the files in '$files' into $to | ||
941 | sub do_compile_rule | ||
942 | { | ||
943 | local($to,$files,$ex)=@_; | ||
944 | local($ret,$_,$n,$d,$s); | ||
945 | |||
946 | $files =~ s/\//$o/g if $o ne '/'; | ||
947 | foreach (split(/\s+/,$files)) | ||
948 | { | ||
949 | $n=&bname($_); | ||
950 | $d=&dname($_); | ||
951 | if (-f "${_}.c") | ||
952 | { | ||
953 | $ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex) | ||
954 | } | ||
955 | elsif (-f ($s="${d}${o}asm${o}${n}.pl") or | ||
956 | ($s=~s/sha256/sha512/ and -f $s) or | ||
957 | -f ($s="${d}${o}${n}.pl")) | ||
958 | { | ||
959 | $ret.=&perlasm_compile_target("$to${o}$n$obj",$s,$n); | ||
960 | } | ||
961 | elsif (-f ($s="${d}${o}asm${o}${n}.S") or | ||
962 | -f ($s="${d}${o}${n}.S")) | ||
963 | { | ||
964 | $ret.=&Sasm_compile_target("$to${o}$n$obj",$s,$n); | ||
965 | } | ||
966 | else { die "no rule for $_"; } | ||
967 | } | ||
968 | return($ret); | ||
969 | } | ||
970 | |||
971 | ############################################################## | ||
972 | # do a rule for each file that says 'compile' to new direcory | ||
973 | sub perlasm_compile_target | ||
974 | { | ||
975 | my($target,$source,$bname)=@_; | ||
976 | my($ret); | ||
977 | |||
978 | $bname =~ s/(.*)\.[^\.]$/$1/; | ||
979 | $ret ="\$(TMP_D)$o$bname.asm: $source\n"; | ||
980 | $ret.="\t\$(PERL) $source $asmtype \$(CFLAG) >\$\@\n\n"; | ||
981 | $ret.="$target: \$(TMP_D)$o$bname.asm\n"; | ||
982 | $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n"; | ||
983 | return($ret); | ||
984 | } | ||
985 | |||
986 | sub Sasm_compile_target | ||
987 | { | ||
988 | my($target,$source,$bname)=@_; | ||
989 | my($ret); | ||
990 | |||
991 | $bname =~ s/(.*)\.[^\.]$/$1/; | ||
992 | $ret ="\$(TMP_D)$o$bname.asm: $source\n"; | ||
993 | $ret.="\t\$(CC) -E \$(CFLAG) $source >\$\@\n\n"; | ||
994 | $ret.="$target: \$(TMP_D)$o$bname.asm\n"; | ||
995 | $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n"; | ||
996 | return($ret); | ||
997 | } | ||
998 | |||
999 | sub cc_compile_target | ||
1000 | { | ||
1001 | local($target,$source,$ex_flags, $srcd)=@_; | ||
1002 | local($ret); | ||
1003 | |||
1004 | $ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/); | ||
1005 | $target =~ s/\//$o/g if $o ne "/"; | ||
1006 | $source =~ s/\//$o/g if $o ne "/"; | ||
1007 | $srcd = "\$(SRC_D)$o" unless defined $srcd; | ||
1008 | $ret ="$target: $srcd$source\n\t"; | ||
1009 | $ret.="\$(CC) ${ofile}$target $ex_flags -c $srcd$source\n\n"; | ||
1010 | return($ret); | ||
1011 | } | ||
1012 | |||
1013 | ############################################################## | ||
1014 | sub do_asm_rule | ||
1015 | { | ||
1016 | local($target,$src)=@_; | ||
1017 | local($ret,@s,@t,$i); | ||
1018 | |||
1019 | $target =~ s/\//$o/g if $o ne "/"; | ||
1020 | $src =~ s/\//$o/g if $o ne "/"; | ||
1021 | |||
1022 | @t=split(/\s+/,$target); | ||
1023 | @s=split(/\s+/,$src); | ||
1024 | |||
1025 | |||
1026 | for ($i=0; $i<=$#s; $i++) | ||
1027 | { | ||
1028 | my $objfile = $t[$i]; | ||
1029 | my $srcfile = $s[$i]; | ||
1030 | |||
1031 | if ($perl_asm == 1) | ||
1032 | { | ||
1033 | my $plasm = $objfile; | ||
1034 | $plasm =~ s/${obj}/.pl/; | ||
1035 | $ret.="$srcfile: $plasm\n"; | ||
1036 | $ret.="\t\$(PERL) $plasm $asmtype \$(CFLAG) >$srcfile\n\n"; | ||
1037 | } | ||
1038 | |||
1039 | $ret.="$objfile: $srcfile\n"; | ||
1040 | $ret.="\t\$(ASM) $afile$objfile \$(SRC_D)$o$srcfile\n\n"; | ||
1041 | } | ||
1042 | return($ret); | ||
1043 | } | ||
1044 | |||
1045 | sub do_shlib_rule | ||
1046 | { | ||
1047 | local($n,$def)=@_; | ||
1048 | local($ret,$nn); | ||
1049 | local($t); | ||
1050 | |||
1051 | ($nn=$n) =~ tr/a-z/A-Z/; | ||
1052 | $ret.="$n.dll: \$(${nn}OBJ)\n"; | ||
1053 | if ($vc && $w32) | ||
1054 | { | ||
1055 | $ret.="\t\$(MKSHLIB) $efile$n.dll $def @<<\n \$(${nn}OBJ_F)\n<<\n"; | ||
1056 | } | ||
1057 | $ret.="\n"; | ||
1058 | return($ret); | ||
1059 | } | ||
1060 | |||
1061 | # do a rule for each file that says 'copy' to new direcory on change | ||
1062 | sub do_copy_rule | ||
1063 | { | ||
1064 | local($to,$files,$p)=@_; | ||
1065 | local($ret,$_,$n,$pp); | ||
1066 | |||
1067 | $files =~ s/\//$o/g if $o ne '/'; | ||
1068 | foreach (split(/\s+/,$files)) | ||
1069 | { | ||
1070 | $n=&bname($_); | ||
1071 | if ($n =~ /bss_file/) | ||
1072 | { $pp=".c"; } | ||
1073 | else { $pp=$p; } | ||
1074 | $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \"\$(SRC_D)$o$_$pp\" \"$to${o}$n$pp\"\n\n"; | ||
1075 | } | ||
1076 | return($ret); | ||
1077 | } | ||
1078 | |||
1079 | sub read_options | ||
1080 | { | ||
1081 | # Many options are handled in a similar way. In particular | ||
1082 | # no-xxx sets zero or more scalars to 1. | ||
1083 | # Process these using a hash containing the option name and | ||
1084 | # reference to the scalars to set. | ||
1085 | |||
1086 | my %valid_options = ( | ||
1087 | "no-rc2" => \$no_rc2, | ||
1088 | "no-rc4" => \$no_rc4, | ||
1089 | "no-rc5" => \$no_rc5, | ||
1090 | "no-idea" => \$no_idea, | ||
1091 | "no-aes" => \$no_aes, | ||
1092 | "no-camellia" => \$no_camellia, | ||
1093 | "no-seed" => \$no_seed, | ||
1094 | "no-des" => \$no_des, | ||
1095 | "no-bf" => \$no_bf, | ||
1096 | "no-cast" => \$no_cast, | ||
1097 | "no-md2" => \$no_md2, | ||
1098 | "no-md4" => \$no_md4, | ||
1099 | "no-md5" => \$no_md5, | ||
1100 | "no-sha" => \$no_sha, | ||
1101 | "no-sha1" => \$no_sha1, | ||
1102 | "no-ripemd" => \$no_ripemd, | ||
1103 | "no-mdc2" => \$no_mdc2, | ||
1104 | "no-whirlpool" => \$no_whirlpool, | ||
1105 | "no-patents" => | ||
1106 | [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa], | ||
1107 | "no-rsa" => \$no_rsa, | ||
1108 | "no-dsa" => \$no_dsa, | ||
1109 | "no-dh" => \$no_dh, | ||
1110 | "no-hmac" => \$no_hmac, | ||
1111 | "no-asm" => \$no_asm, | ||
1112 | "nasm" => \$nasm, | ||
1113 | "nw-nasm" => \$nw_nasm, | ||
1114 | "nw-mwasm" => \$nw_mwasm, | ||
1115 | "gaswin" => \$gaswin, | ||
1116 | "no-ssl2" => \$no_ssl2, | ||
1117 | "no-ssl3" => \$no_ssl3, | ||
1118 | "no-tlsext" => \$no_tlsext, | ||
1119 | "no-srp" => \$no_srp, | ||
1120 | "no-cms" => \$no_cms, | ||
1121 | "no-ec2m" => \$no_ec2m, | ||
1122 | "no-jpake" => \$no_jpake, | ||
1123 | "no-ec_nistp_64_gcc_128" => 0, | ||
1124 | "no-err" => \$no_err, | ||
1125 | "no-sock" => \$no_sock, | ||
1126 | "no-krb5" => \$no_krb5, | ||
1127 | "no-ec" => \$no_ec, | ||
1128 | "no-ecdsa" => \$no_ecdsa, | ||
1129 | "no-ecdh" => \$no_ecdh, | ||
1130 | "no-gost" => \$no_gost, | ||
1131 | "no-engine" => \$no_engine, | ||
1132 | "no-hw" => \$no_hw, | ||
1133 | "no-rsax" => 0, | ||
1134 | "just-ssl" => | ||
1135 | [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast, | ||
1136 | \$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh, | ||
1137 | \$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5, | ||
1138 | \$no_aes, \$no_camellia, \$no_seed, \$no_srp], | ||
1139 | "rsaref" => 0, | ||
1140 | "gcc" => \$gcc, | ||
1141 | "debug" => \$debug, | ||
1142 | "profile" => \$profile, | ||
1143 | "shlib" => \$shlib, | ||
1144 | "dll" => \$shlib, | ||
1145 | "shared" => 0, | ||
1146 | "no-sctp" => 0, | ||
1147 | "no-gmp" => 0, | ||
1148 | "no-rfc3779" => 0, | ||
1149 | "no-montasm" => 0, | ||
1150 | "no-shared" => 0, | ||
1151 | "no-store" => 0, | ||
1152 | "no-zlib" => 0, | ||
1153 | "no-zlib-dynamic" => 0, | ||
1154 | "fips" => \$fips | ||
1155 | ); | ||
1156 | |||
1157 | if (exists $valid_options{$_}) | ||
1158 | { | ||
1159 | my $r = $valid_options{$_}; | ||
1160 | if ( ref $r eq "SCALAR") | ||
1161 | { $$r = 1;} | ||
1162 | elsif ( ref $r eq "ARRAY") | ||
1163 | { | ||
1164 | my $r2; | ||
1165 | foreach $r2 (@$r) | ||
1166 | { | ||
1167 | $$r2 = 1; | ||
1168 | } | ||
1169 | } | ||
1170 | } | ||
1171 | elsif (/^no-comp$/) { $xcflags = "-DOPENSSL_NO_COMP $xcflags"; } | ||
1172 | elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 } | ||
1173 | elsif (/^enable-zlib-dynamic$/) | ||
1174 | { | ||
1175 | $zlib_opt = 2; | ||
1176 | } | ||
1177 | elsif (/^no-static-engine/) | ||
1178 | { | ||
1179 | $no_static_engine = 1; | ||
1180 | } | ||
1181 | elsif (/^enable-static-engine/) | ||
1182 | { | ||
1183 | $no_static_engine = 0; | ||
1184 | } | ||
1185 | # There are also enable-xxx options which correspond to | ||
1186 | # the no-xxx. Since the scalars are enabled by default | ||
1187 | # these can be ignored. | ||
1188 | elsif (/^enable-/) | ||
1189 | { | ||
1190 | my $t = $_; | ||
1191 | $t =~ s/^enable/no/; | ||
1192 | if (exists $valid_options{$t}) | ||
1193 | {return 1;} | ||
1194 | return 0; | ||
1195 | } | ||
1196 | # experimental-xxx is mostly like enable-xxx, but opensslconf.v | ||
1197 | # will still set OPENSSL_NO_xxx unless we set OPENSSL_EXPERIMENTAL_xxx. | ||
1198 | # (No need to fail if we don't know the algorithm -- this is for adventurous users only.) | ||
1199 | elsif (/^experimental-/) | ||
1200 | { | ||
1201 | my $algo, $ALGO; | ||
1202 | ($algo = $_) =~ s/^experimental-//; | ||
1203 | ($ALGO = $algo) =~ tr/[a-z]/[A-Z]/; | ||
1204 | |||
1205 | $xcflags="-DOPENSSL_EXPERIMENTAL_$ALGO $xcflags"; | ||
1206 | |||
1207 | } | ||
1208 | elsif (/^--with-krb5-flavor=(.*)$/) | ||
1209 | { | ||
1210 | my $krb5_flavor = $1; | ||
1211 | if ($krb5_flavor =~ /^force-[Hh]eimdal$/) | ||
1212 | { | ||
1213 | $xcflags="-DKRB5_HEIMDAL $xcflags"; | ||
1214 | } | ||
1215 | elsif ($krb5_flavor =~ /^MIT/i) | ||
1216 | { | ||
1217 | $xcflags="-DKRB5_MIT $xcflags"; | ||
1218 | if ($krb5_flavor =~ /^MIT[._-]*1[._-]*[01]/i) | ||
1219 | { | ||
1220 | $xcflags="-DKRB5_MIT_OLD11 $xcflags" | ||
1221 | } | ||
1222 | } | ||
1223 | } | ||
1224 | elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } | ||
1225 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } | ||
1226 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) | ||
1227 | { $c_flags.="$_ "; } | ||
1228 | else { return(0); } | ||
1229 | return(1); | ||
1230 | } | ||
diff --git a/src/lib/libcrypto/util/mkcerts.sh b/src/lib/libcrypto/util/mkcerts.sh deleted file mode 100644 index 0184fcb70e..0000000000 --- a/src/lib/libcrypto/util/mkcerts.sh +++ /dev/null | |||
@@ -1,220 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # This script will re-make all the required certs. | ||
4 | # cd apps | ||
5 | # sh ../util/mkcerts.sh | ||
6 | # mv ca-cert.pem pca-cert.pem ../certs | ||
7 | # cd .. | ||
8 | # cat certs/*.pem >>apps/server.pem | ||
9 | # cat certs/*.pem >>apps/server2.pem | ||
10 | # SSLEAY=`pwd`/apps/ssleay; export SSLEAY | ||
11 | # sh tools/c_rehash certs | ||
12 | # | ||
13 | |||
14 | CAbits=1024 | ||
15 | SSLEAY="../apps/openssl" | ||
16 | CONF="-config ../apps/openssl.cnf" | ||
17 | |||
18 | # create pca request. | ||
19 | echo creating $CAbits bit PCA cert request | ||
20 | $SSLEAY req $CONF \ | ||
21 | -new -md5 -newkey $CAbits \ | ||
22 | -keyout pca-key.pem \ | ||
23 | -out pca-req.pem -nodes >/dev/null <<EOF | ||
24 | AU | ||
25 | Queensland | ||
26 | . | ||
27 | CryptSoft Pty Ltd | ||
28 | . | ||
29 | Test PCA (1024 bit) | ||
30 | |||
31 | |||
32 | |||
33 | EOF | ||
34 | |||
35 | if [ $? != 0 ]; then | ||
36 | echo problems generating PCA request | ||
37 | exit 1 | ||
38 | fi | ||
39 | |||
40 | #sign it. | ||
41 | echo | ||
42 | echo self signing PCA | ||
43 | $SSLEAY x509 -md5 -days 1461 \ | ||
44 | -req -signkey pca-key.pem \ | ||
45 | -CAcreateserial -CAserial pca-cert.srl \ | ||
46 | -in pca-req.pem -out pca-cert.pem | ||
47 | |||
48 | if [ $? != 0 ]; then | ||
49 | echo problems self signing PCA cert | ||
50 | exit 1 | ||
51 | fi | ||
52 | echo | ||
53 | |||
54 | # create ca request. | ||
55 | echo creating $CAbits bit CA cert request | ||
56 | $SSLEAY req $CONF \ | ||
57 | -new -md5 -newkey $CAbits \ | ||
58 | -keyout ca-key.pem \ | ||
59 | -out ca-req.pem -nodes >/dev/null <<EOF | ||
60 | AU | ||
61 | Queensland | ||
62 | . | ||
63 | CryptSoft Pty Ltd | ||
64 | . | ||
65 | Test CA (1024 bit) | ||
66 | |||
67 | |||
68 | |||
69 | EOF | ||
70 | |||
71 | if [ $? != 0 ]; then | ||
72 | echo problems generating CA request | ||
73 | exit 1 | ||
74 | fi | ||
75 | |||
76 | #sign it. | ||
77 | echo | ||
78 | echo signing CA | ||
79 | $SSLEAY x509 -md5 -days 1461 \ | ||
80 | -req \ | ||
81 | -CAcreateserial -CAserial pca-cert.srl \ | ||
82 | -CA pca-cert.pem -CAkey pca-key.pem \ | ||
83 | -in ca-req.pem -out ca-cert.pem | ||
84 | |||
85 | if [ $? != 0 ]; then | ||
86 | echo problems signing CA cert | ||
87 | exit 1 | ||
88 | fi | ||
89 | echo | ||
90 | |||
91 | # create server request. | ||
92 | echo creating 512 bit server cert request | ||
93 | $SSLEAY req $CONF \ | ||
94 | -new -md5 -newkey 512 \ | ||
95 | -keyout s512-key.pem \ | ||
96 | -out s512-req.pem -nodes >/dev/null <<EOF | ||
97 | AU | ||
98 | Queensland | ||
99 | . | ||
100 | CryptSoft Pty Ltd | ||
101 | . | ||
102 | Server test cert (512 bit) | ||
103 | |||
104 | |||
105 | |||
106 | EOF | ||
107 | |||
108 | if [ $? != 0 ]; then | ||
109 | echo problems generating 512 bit server cert request | ||
110 | exit 1 | ||
111 | fi | ||
112 | |||
113 | #sign it. | ||
114 | echo | ||
115 | echo signing 512 bit server cert | ||
116 | $SSLEAY x509 -md5 -days 365 \ | ||
117 | -req \ | ||
118 | -CAcreateserial -CAserial ca-cert.srl \ | ||
119 | -CA ca-cert.pem -CAkey ca-key.pem \ | ||
120 | -in s512-req.pem -out server.pem | ||
121 | |||
122 | if [ $? != 0 ]; then | ||
123 | echo problems signing 512 bit server cert | ||
124 | exit 1 | ||
125 | fi | ||
126 | echo | ||
127 | |||
128 | # create 1024 bit server request. | ||
129 | echo creating 1024 bit server cert request | ||
130 | $SSLEAY req $CONF \ | ||
131 | -new -md5 -newkey 1024 \ | ||
132 | -keyout s1024key.pem \ | ||
133 | -out s1024req.pem -nodes >/dev/null <<EOF | ||
134 | AU | ||
135 | Queensland | ||
136 | . | ||
137 | CryptSoft Pty Ltd | ||
138 | . | ||
139 | Server test cert (1024 bit) | ||
140 | |||
141 | |||
142 | |||
143 | EOF | ||
144 | |||
145 | if [ $? != 0 ]; then | ||
146 | echo problems generating 1024 bit server cert request | ||
147 | exit 1 | ||
148 | fi | ||
149 | |||
150 | #sign it. | ||
151 | echo | ||
152 | echo signing 1024 bit server cert | ||
153 | $SSLEAY x509 -md5 -days 365 \ | ||
154 | -req \ | ||
155 | -CAcreateserial -CAserial ca-cert.srl \ | ||
156 | -CA ca-cert.pem -CAkey ca-key.pem \ | ||
157 | -in s1024req.pem -out server2.pem | ||
158 | |||
159 | if [ $? != 0 ]; then | ||
160 | echo problems signing 1024 bit server cert | ||
161 | exit 1 | ||
162 | fi | ||
163 | echo | ||
164 | |||
165 | # create 512 bit client request. | ||
166 | echo creating 512 bit client cert request | ||
167 | $SSLEAY req $CONF \ | ||
168 | -new -md5 -newkey 512 \ | ||
169 | -keyout c512-key.pem \ | ||
170 | -out c512-req.pem -nodes >/dev/null <<EOF | ||
171 | AU | ||
172 | Queensland | ||
173 | . | ||
174 | CryptSoft Pty Ltd | ||
175 | . | ||
176 | Client test cert (512 bit) | ||
177 | |||
178 | |||
179 | |||
180 | EOF | ||
181 | |||
182 | if [ $? != 0 ]; then | ||
183 | echo problems generating 512 bit client cert request | ||
184 | exit 1 | ||
185 | fi | ||
186 | |||
187 | #sign it. | ||
188 | echo | ||
189 | echo signing 512 bit client cert | ||
190 | $SSLEAY x509 -md5 -days 365 \ | ||
191 | -req \ | ||
192 | -CAcreateserial -CAserial ca-cert.srl \ | ||
193 | -CA ca-cert.pem -CAkey ca-key.pem \ | ||
194 | -in c512-req.pem -out client.pem | ||
195 | |||
196 | if [ $? != 0 ]; then | ||
197 | echo problems signing 512 bit client cert | ||
198 | exit 1 | ||
199 | fi | ||
200 | |||
201 | echo cleanup | ||
202 | |||
203 | cat pca-key.pem >> pca-cert.pem | ||
204 | cat ca-key.pem >> ca-cert.pem | ||
205 | cat s512-key.pem >> server.pem | ||
206 | cat s1024key.pem >> server2.pem | ||
207 | cat c512-key.pem >> client.pem | ||
208 | |||
209 | for i in pca-cert.pem ca-cert.pem server.pem server2.pem client.pem | ||
210 | do | ||
211 | $SSLEAY x509 -issuer -subject -in $i -noout >$$ | ||
212 | cat $$ | ||
213 | /bin/cat $i >>$$ | ||
214 | /bin/mv $$ $i | ||
215 | done | ||
216 | |||
217 | #/bin/rm -f *key.pem *req.pem *.srl | ||
218 | |||
219 | echo Finished | ||
220 | |||
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl deleted file mode 100644 index 9a8c7b87d1..0000000000 --- a/src/lib/libcrypto/util/mkdef.pl +++ /dev/null | |||
@@ -1,1539 +0,0 @@ | |||
1 | #!/usr/local/bin/perl -w | ||
2 | # | ||
3 | # generate a .def file | ||
4 | # | ||
5 | # It does this by parsing the header files and looking for the | ||
6 | # prototyped functions: it then prunes the output. | ||
7 | # | ||
8 | # Intermediary files are created, call libeay.num and ssleay.num,... | ||
9 | # Previously, they had the following format: | ||
10 | # | ||
11 | # routine-name nnnn | ||
12 | # | ||
13 | # But that isn't enough for a number of reasons, the first on being that | ||
14 | # this format is (needlessly) very Win32-centric, and even then... | ||
15 | # One of the biggest problems is that there's no information about what | ||
16 | # routines should actually be used, which varies with what crypto algorithms | ||
17 | # are disabled. Also, some operating systems (for example VMS with VAX C) | ||
18 | # need to keep track of the global variables as well as the functions. | ||
19 | # | ||
20 | # So, a remake of this script is done so as to include information on the | ||
21 | # kind of symbol it is (function or variable) and what algorithms they're | ||
22 | # part of. This will allow easy translating to .def files or the corresponding | ||
23 | # file in other operating systems (a .opt file for VMS, possibly with a .mar | ||
24 | # file). | ||
25 | # | ||
26 | # The format now becomes: | ||
27 | # | ||
28 | # routine-name nnnn info | ||
29 | # | ||
30 | # and the "info" part is actually a colon-separated string of fields with | ||
31 | # the following meaning: | ||
32 | # | ||
33 | # existence:platform:kind:algorithms | ||
34 | # | ||
35 | # - "existence" can be "EXIST" or "NOEXIST" depending on if the symbol is | ||
36 | # found somewhere in the source, | ||
37 | # - "platforms" is empty if it exists on all platforms, otherwise it contains | ||
38 | # comma-separated list of the platform, just as they are if the symbol exists | ||
39 | # for those platforms, or prepended with a "!" if not. This helps resolve | ||
40 | # symbol name variants for platforms where the names are too long for the | ||
41 | # compiler or linker, or if the systems is case insensitive and there is a | ||
42 | # clash, or the symbol is implemented differently (see | ||
43 | # EXPORT_VAR_AS_FUNCTION). This script assumes renaming of symbols is found | ||
44 | # in the file crypto/symhacks.h. | ||
45 | # The semantics for the platforms is that every item is checked against the | ||
46 | # environment. For the negative items ("!FOO"), if any of them is false | ||
47 | # (i.e. "FOO" is true) in the environment, the corresponding symbol can't be | ||
48 | # used. For the positive itms, if all of them are false in the environment, | ||
49 | # the corresponding symbol can't be used. Any combination of positive and | ||
50 | # negative items are possible, and of course leave room for some redundancy. | ||
51 | # - "kind" is "FUNCTION" or "VARIABLE". The meaning of that is obvious. | ||
52 | # - "algorithms" is a comma-separated list of algorithm names. This helps | ||
53 | # exclude symbols that are part of an algorithm that some user wants to | ||
54 | # exclude. | ||
55 | # | ||
56 | |||
57 | my $debug=0; | ||
58 | |||
59 | my $crypto_num= "util/libeay.num"; | ||
60 | my $ssl_num= "util/ssleay.num"; | ||
61 | my $libname; | ||
62 | |||
63 | my $do_update = 0; | ||
64 | my $do_rewrite = 1; | ||
65 | my $do_crypto = 0; | ||
66 | my $do_ssl = 0; | ||
67 | my $do_ctest = 0; | ||
68 | my $do_ctestall = 0; | ||
69 | my $do_checkexist = 0; | ||
70 | |||
71 | my $VMSVAX=0; | ||
72 | my $VMSNonVAX=0; | ||
73 | my $VMS=0; | ||
74 | my $W32=0; | ||
75 | my $W16=0; | ||
76 | my $NT=0; | ||
77 | my $OS2=0; | ||
78 | # Set this to make typesafe STACK definitions appear in DEF | ||
79 | my $safe_stack_def = 0; | ||
80 | |||
81 | my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", | ||
82 | "EXPORT_VAR_AS_FUNCTION", "ZLIB", "OPENSSL_FIPS" ); | ||
83 | my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); | ||
84 | my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", | ||
85 | "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", | ||
86 | "SHA256", "SHA512", "RIPEMD", | ||
87 | "MDC2", "WHIRLPOOL", "RSA", "DSA", "DH", "EC", "ECDH", "ECDSA", "EC2M", | ||
88 | "HMAC", "AES", "CAMELLIA", "SEED", "GOST", | ||
89 | # EC_NISTP_64_GCC_128 | ||
90 | "EC_NISTP_64_GCC_128", | ||
91 | # Envelope "algorithms" | ||
92 | "EVP", "X509", "ASN1_TYPEDEFS", | ||
93 | # Helper "algorithms" | ||
94 | "BIO", "COMP", "BUFFER", "LHASH", "STACK", "ERR", | ||
95 | "LOCKING", | ||
96 | # External "algorithms" | ||
97 | "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM", | ||
98 | # Engines | ||
99 | "STATIC_ENGINE", "ENGINE", "HW", "GMP", | ||
100 | # RFC3779 | ||
101 | "RFC3779", | ||
102 | # TLS | ||
103 | "TLSEXT", "PSK", "SRP", "HEARTBEATS", | ||
104 | # CMS | ||
105 | "CMS", | ||
106 | # CryptoAPI Engine | ||
107 | "CAPIENG", | ||
108 | # SSL v2 | ||
109 | "SSL2", | ||
110 | # JPAKE | ||
111 | "JPAKE", | ||
112 | # NEXTPROTONEG | ||
113 | "NEXTPROTONEG", | ||
114 | # Deprecated functions | ||
115 | "DEPRECATED", | ||
116 | # Hide SSL internals | ||
117 | "SSL_INTERN", | ||
118 | # SCTP | ||
119 | "SCTP"); | ||
120 | |||
121 | my $options=""; | ||
122 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; | ||
123 | while(<IN>) { | ||
124 | $options=$1 if (/^OPTIONS=(.*)$/); | ||
125 | } | ||
126 | close(IN); | ||
127 | |||
128 | # The following ciphers may be excluded (by Configure). This means functions | ||
129 | # defined with ifndef(NO_XXX) are not included in the .def file, and everything | ||
130 | # in directory xxx is ignored. | ||
131 | my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf; | ||
132 | my $no_cast; my $no_whirlpool; my $no_camellia; my $no_seed; | ||
133 | my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2; | ||
134 | my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; | ||
135 | my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw; | ||
136 | my $no_fp_api; my $no_static_engine=1; my $no_gmp; my $no_deprecated; | ||
137 | my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng; | ||
138 | my $no_jpake; my $no_srp; my $no_ssl2; my $no_ec2m; my $no_nistp_gcc; | ||
139 | my $no_nextprotoneg; my $no_sctp; | ||
140 | |||
141 | my $fips; | ||
142 | |||
143 | my $zlib; | ||
144 | |||
145 | |||
146 | foreach (@ARGV, split(/ /, $options)) | ||
147 | { | ||
148 | $debug=1 if $_ eq "debug"; | ||
149 | $W32=1 if $_ eq "32"; | ||
150 | $W16=1 if $_ eq "16"; | ||
151 | if($_ eq "NT") { | ||
152 | $W32 = 1; | ||
153 | $NT = 1; | ||
154 | } | ||
155 | if ($_ eq "VMS-VAX") { | ||
156 | $VMS=1; | ||
157 | $VMSVAX=1; | ||
158 | } | ||
159 | if ($_ eq "VMS-NonVAX") { | ||
160 | $VMS=1; | ||
161 | $VMSNonVAX=1; | ||
162 | } | ||
163 | $VMS=1 if $_ eq "VMS"; | ||
164 | $OS2=1 if $_ eq "OS2"; | ||
165 | $fips=1 if /^fips/; | ||
166 | if ($_ eq "zlib" || $_ eq "enable-zlib" || $_ eq "zlib-dynamic" | ||
167 | || $_ eq "enable-zlib-dynamic") { | ||
168 | $zlib = 1; | ||
169 | } | ||
170 | |||
171 | $do_ssl=1 if $_ eq "ssleay"; | ||
172 | if ($_ eq "ssl") { | ||
173 | $do_ssl=1; | ||
174 | $libname=$_ | ||
175 | } | ||
176 | $do_crypto=1 if $_ eq "libeay"; | ||
177 | if ($_ eq "crypto") { | ||
178 | $do_crypto=1; | ||
179 | $libname=$_; | ||
180 | } | ||
181 | $no_static_engine=1 if $_ eq "no-static-engine"; | ||
182 | $no_static_engine=0 if $_ eq "enable-static-engine"; | ||
183 | $do_update=1 if $_ eq "update"; | ||
184 | $do_rewrite=1 if $_ eq "rewrite"; | ||
185 | $do_ctest=1 if $_ eq "ctest"; | ||
186 | $do_ctestall=1 if $_ eq "ctestall"; | ||
187 | $do_checkexist=1 if $_ eq "exist"; | ||
188 | #$safe_stack_def=1 if $_ eq "-DDEBUG_SAFESTACK"; | ||
189 | |||
190 | if (/^no-rc2$/) { $no_rc2=1; } | ||
191 | elsif (/^no-rc4$/) { $no_rc4=1; } | ||
192 | elsif (/^no-rc5$/) { $no_rc5=1; } | ||
193 | elsif (/^no-idea$/) { $no_idea=1; } | ||
194 | elsif (/^no-des$/) { $no_des=1; $no_mdc2=1; } | ||
195 | elsif (/^no-bf$/) { $no_bf=1; } | ||
196 | elsif (/^no-cast$/) { $no_cast=1; } | ||
197 | elsif (/^no-whirlpool$/) { $no_whirlpool=1; } | ||
198 | elsif (/^no-md2$/) { $no_md2=1; } | ||
199 | elsif (/^no-md4$/) { $no_md4=1; } | ||
200 | elsif (/^no-md5$/) { $no_md5=1; } | ||
201 | elsif (/^no-sha$/) { $no_sha=1; } | ||
202 | elsif (/^no-ripemd$/) { $no_ripemd=1; } | ||
203 | elsif (/^no-mdc2$/) { $no_mdc2=1; } | ||
204 | elsif (/^no-rsa$/) { $no_rsa=1; } | ||
205 | elsif (/^no-dsa$/) { $no_dsa=1; } | ||
206 | elsif (/^no-dh$/) { $no_dh=1; } | ||
207 | elsif (/^no-ec$/) { $no_ec=1; } | ||
208 | elsif (/^no-ecdsa$/) { $no_ecdsa=1; } | ||
209 | elsif (/^no-ecdh$/) { $no_ecdh=1; } | ||
210 | elsif (/^no-hmac$/) { $no_hmac=1; } | ||
211 | elsif (/^no-aes$/) { $no_aes=1; } | ||
212 | elsif (/^no-camellia$/) { $no_camellia=1; } | ||
213 | elsif (/^no-seed$/) { $no_seed=1; } | ||
214 | elsif (/^no-evp$/) { $no_evp=1; } | ||
215 | elsif (/^no-lhash$/) { $no_lhash=1; } | ||
216 | elsif (/^no-stack$/) { $no_stack=1; } | ||
217 | elsif (/^no-err$/) { $no_err=1; } | ||
218 | elsif (/^no-buffer$/) { $no_buffer=1; } | ||
219 | elsif (/^no-bio$/) { $no_bio=1; } | ||
220 | #elsif (/^no-locking$/) { $no_locking=1; } | ||
221 | elsif (/^no-comp$/) { $no_comp=1; } | ||
222 | elsif (/^no-dso$/) { $no_dso=1; } | ||
223 | elsif (/^no-krb5$/) { $no_krb5=1; } | ||
224 | elsif (/^no-engine$/) { $no_engine=1; } | ||
225 | elsif (/^no-hw$/) { $no_hw=1; } | ||
226 | elsif (/^no-gmp$/) { $no_gmp=1; } | ||
227 | elsif (/^no-rfc3779$/) { $no_rfc3779=1; } | ||
228 | elsif (/^no-tlsext$/) { $no_tlsext=1; } | ||
229 | elsif (/^no-cms$/) { $no_cms=1; } | ||
230 | elsif (/^no-ec2m$/) { $no_ec2m=1; } | ||
231 | elsif (/^no-ec_nistp_64_gcc_128$/) { $no_nistp_gcc=1; } | ||
232 | elsif (/^no-nextprotoneg$/) { $no_nextprotoneg=1; } | ||
233 | elsif (/^no-ssl2$/) { $no_ssl2=1; } | ||
234 | elsif (/^no-capieng$/) { $no_capieng=1; } | ||
235 | elsif (/^no-jpake$/) { $no_jpake=1; } | ||
236 | elsif (/^no-srp$/) { $no_srp=1; } | ||
237 | elsif (/^no-sctp$/) { $no_sctp=1; } | ||
238 | } | ||
239 | |||
240 | |||
241 | if (!$libname) { | ||
242 | if ($do_ssl) { | ||
243 | $libname="SSLEAY"; | ||
244 | } | ||
245 | if ($do_crypto) { | ||
246 | $libname="LIBEAY"; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | # If no platform is given, assume WIN32 | ||
251 | if ($W32 + $W16 + $VMS + $OS2 == 0) { | ||
252 | $W32 = 1; | ||
253 | } | ||
254 | |||
255 | # Add extra knowledge | ||
256 | if ($W16) { | ||
257 | $no_fp_api=1; | ||
258 | } | ||
259 | |||
260 | if (!$do_ssl && !$do_crypto) | ||
261 | { | ||
262 | print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT | OS2 ]\n"; | ||
263 | exit(1); | ||
264 | } | ||
265 | |||
266 | %ssl_list=&load_numbers($ssl_num); | ||
267 | $max_ssl = $max_num; | ||
268 | %crypto_list=&load_numbers($crypto_num); | ||
269 | $max_crypto = $max_num; | ||
270 | |||
271 | my $ssl="ssl/ssl.h"; | ||
272 | $ssl.=" ssl/kssl.h"; | ||
273 | $ssl.=" ssl/tls1.h"; | ||
274 | $ssl.=" ssl/srtp.h"; | ||
275 | |||
276 | my $crypto ="crypto/crypto.h"; | ||
277 | $crypto.=" crypto/cryptlib.h"; | ||
278 | $crypto.=" crypto/o_dir.h"; | ||
279 | $crypto.=" crypto/o_str.h"; | ||
280 | $crypto.=" crypto/o_time.h"; | ||
281 | $crypto.=" crypto/des/des.h crypto/des/des_old.h" ; # unless $no_des; | ||
282 | $crypto.=" crypto/idea/idea.h" ; # unless $no_idea; | ||
283 | $crypto.=" crypto/rc4/rc4.h" ; # unless $no_rc4; | ||
284 | $crypto.=" crypto/rc5/rc5.h" ; # unless $no_rc5; | ||
285 | $crypto.=" crypto/rc2/rc2.h" ; # unless $no_rc2; | ||
286 | $crypto.=" crypto/bf/blowfish.h" ; # unless $no_bf; | ||
287 | $crypto.=" crypto/cast/cast.h" ; # unless $no_cast; | ||
288 | $crypto.=" crypto/whrlpool/whrlpool.h" ; | ||
289 | $crypto.=" crypto/md2/md2.h" ; # unless $no_md2; | ||
290 | $crypto.=" crypto/md4/md4.h" ; # unless $no_md4; | ||
291 | $crypto.=" crypto/md5/md5.h" ; # unless $no_md5; | ||
292 | $crypto.=" crypto/mdc2/mdc2.h" ; # unless $no_mdc2; | ||
293 | $crypto.=" crypto/sha/sha.h" ; # unless $no_sha; | ||
294 | $crypto.=" crypto/ripemd/ripemd.h" ; # unless $no_ripemd; | ||
295 | $crypto.=" crypto/aes/aes.h" ; # unless $no_aes; | ||
296 | $crypto.=" crypto/camellia/camellia.h" ; # unless $no_camellia; | ||
297 | $crypto.=" crypto/seed/seed.h"; # unless $no_seed; | ||
298 | |||
299 | $crypto.=" crypto/bn/bn.h"; | ||
300 | $crypto.=" crypto/rsa/rsa.h" ; # unless $no_rsa; | ||
301 | $crypto.=" crypto/dsa/dsa.h" ; # unless $no_dsa; | ||
302 | $crypto.=" crypto/dh/dh.h" ; # unless $no_dh; | ||
303 | $crypto.=" crypto/ec/ec.h" ; # unless $no_ec; | ||
304 | $crypto.=" crypto/ecdsa/ecdsa.h" ; # unless $no_ecdsa; | ||
305 | $crypto.=" crypto/ecdh/ecdh.h" ; # unless $no_ecdh; | ||
306 | $crypto.=" crypto/hmac/hmac.h" ; # unless $no_hmac; | ||
307 | $crypto.=" crypto/cmac/cmac.h" ; # unless $no_hmac; | ||
308 | |||
309 | $crypto.=" crypto/engine/engine.h"; # unless $no_engine; | ||
310 | $crypto.=" crypto/stack/stack.h" ; # unless $no_stack; | ||
311 | $crypto.=" crypto/buffer/buffer.h" ; # unless $no_buffer; | ||
312 | $crypto.=" crypto/bio/bio.h" ; # unless $no_bio; | ||
313 | $crypto.=" crypto/dso/dso.h" ; # unless $no_dso; | ||
314 | $crypto.=" crypto/lhash/lhash.h" ; # unless $no_lhash; | ||
315 | $crypto.=" crypto/conf/conf.h"; | ||
316 | $crypto.=" crypto/txt_db/txt_db.h"; | ||
317 | |||
318 | $crypto.=" crypto/evp/evp.h" ; # unless $no_evp; | ||
319 | $crypto.=" crypto/objects/objects.h"; | ||
320 | $crypto.=" crypto/pem/pem.h"; | ||
321 | #$crypto.=" crypto/meth/meth.h"; | ||
322 | $crypto.=" crypto/asn1/asn1.h"; | ||
323 | $crypto.=" crypto/asn1/asn1t.h"; | ||
324 | $crypto.=" crypto/asn1/asn1_mac.h"; | ||
325 | $crypto.=" crypto/err/err.h" ; # unless $no_err; | ||
326 | $crypto.=" crypto/pkcs7/pkcs7.h"; | ||
327 | $crypto.=" crypto/pkcs12/pkcs12.h"; | ||
328 | $crypto.=" crypto/x509/x509.h"; | ||
329 | $crypto.=" crypto/x509/x509_vfy.h"; | ||
330 | $crypto.=" crypto/x509v3/x509v3.h"; | ||
331 | $crypto.=" crypto/ts/ts.h"; | ||
332 | $crypto.=" crypto/rand/rand.h"; | ||
333 | $crypto.=" crypto/comp/comp.h" ; # unless $no_comp; | ||
334 | $crypto.=" crypto/ocsp/ocsp.h"; | ||
335 | $crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; | ||
336 | $crypto.=" crypto/krb5/krb5_asn.h"; | ||
337 | #$crypto.=" crypto/store/store.h"; | ||
338 | $crypto.=" crypto/pqueue/pqueue.h"; | ||
339 | $crypto.=" crypto/cms/cms.h"; | ||
340 | $crypto.=" crypto/jpake/jpake.h"; | ||
341 | $crypto.=" crypto/modes/modes.h"; | ||
342 | $crypto.=" crypto/srp/srp.h"; | ||
343 | |||
344 | my $symhacks="crypto/symhacks.h"; | ||
345 | |||
346 | my @ssl_symbols = &do_defs("SSLEAY", $ssl, $symhacks); | ||
347 | my @crypto_symbols = &do_defs("LIBEAY", $crypto, $symhacks); | ||
348 | |||
349 | if ($do_update) { | ||
350 | |||
351 | if ($do_ssl == 1) { | ||
352 | |||
353 | &maybe_add_info("SSLEAY",*ssl_list,@ssl_symbols); | ||
354 | if ($do_rewrite == 1) { | ||
355 | open(OUT, ">$ssl_num"); | ||
356 | &rewrite_numbers(*OUT,"SSLEAY",*ssl_list,@ssl_symbols); | ||
357 | } else { | ||
358 | open(OUT, ">>$ssl_num"); | ||
359 | } | ||
360 | &update_numbers(*OUT,"SSLEAY",*ssl_list,$max_ssl,@ssl_symbols); | ||
361 | close OUT; | ||
362 | } | ||
363 | |||
364 | if($do_crypto == 1) { | ||
365 | |||
366 | &maybe_add_info("LIBEAY",*crypto_list,@crypto_symbols); | ||
367 | if ($do_rewrite == 1) { | ||
368 | open(OUT, ">$crypto_num"); | ||
369 | &rewrite_numbers(*OUT,"LIBEAY",*crypto_list,@crypto_symbols); | ||
370 | } else { | ||
371 | open(OUT, ">>$crypto_num"); | ||
372 | } | ||
373 | &update_numbers(*OUT,"LIBEAY",*crypto_list,$max_crypto,@crypto_symbols); | ||
374 | close OUT; | ||
375 | } | ||
376 | |||
377 | } elsif ($do_checkexist) { | ||
378 | &check_existing(*ssl_list, @ssl_symbols) | ||
379 | if $do_ssl == 1; | ||
380 | &check_existing(*crypto_list, @crypto_symbols) | ||
381 | if $do_crypto == 1; | ||
382 | } elsif ($do_ctest || $do_ctestall) { | ||
383 | |||
384 | print <<"EOF"; | ||
385 | |||
386 | /* Test file to check all DEF file symbols are present by trying | ||
387 | * to link to all of them. This is *not* intended to be run! | ||
388 | */ | ||
389 | |||
390 | int main() | ||
391 | { | ||
392 | EOF | ||
393 | &print_test_file(*STDOUT,"SSLEAY",*ssl_list,$do_ctestall,@ssl_symbols) | ||
394 | if $do_ssl == 1; | ||
395 | |||
396 | &print_test_file(*STDOUT,"LIBEAY",*crypto_list,$do_ctestall,@crypto_symbols) | ||
397 | if $do_crypto == 1; | ||
398 | |||
399 | print "}\n"; | ||
400 | |||
401 | } else { | ||
402 | |||
403 | &print_def_file(*STDOUT,$libname,*ssl_list,@ssl_symbols) | ||
404 | if $do_ssl == 1; | ||
405 | |||
406 | &print_def_file(*STDOUT,$libname,*crypto_list,@crypto_symbols) | ||
407 | if $do_crypto == 1; | ||
408 | |||
409 | } | ||
410 | |||
411 | |||
412 | sub do_defs | ||
413 | { | ||
414 | my($name,$files,$symhacksfile)=@_; | ||
415 | my $file; | ||
416 | my @ret; | ||
417 | my %syms; | ||
418 | my %platform; # For anything undefined, we assume "" | ||
419 | my %kind; # For anything undefined, we assume "FUNCTION" | ||
420 | my %algorithm; # For anything undefined, we assume "" | ||
421 | my %variant; | ||
422 | my %variant_cnt; # To be able to allocate "name{n}" if "name" | ||
423 | # is the same name as the original. | ||
424 | my $cpp; | ||
425 | my %unknown_algorithms = (); | ||
426 | |||
427 | foreach $file (split(/\s+/,$symhacksfile." ".$files)) | ||
428 | { | ||
429 | print STDERR "DEBUG: starting on $file:\n" if $debug; | ||
430 | open(IN,"<$file") || die "unable to open $file:$!\n"; | ||
431 | my $line = "", my $def= ""; | ||
432 | my %tag = ( | ||
433 | (map { $_ => 0 } @known_platforms), | ||
434 | (map { "OPENSSL_SYS_".$_ => 0 } @known_ossl_platforms), | ||
435 | (map { "OPENSSL_NO_".$_ => 0 } @known_algorithms), | ||
436 | NOPROTO => 0, | ||
437 | PERL5 => 0, | ||
438 | _WINDLL => 0, | ||
439 | CONST_STRICT => 0, | ||
440 | TRUE => 1, | ||
441 | ); | ||
442 | my $symhacking = $file eq $symhacksfile; | ||
443 | my @current_platforms = (); | ||
444 | my @current_algorithms = (); | ||
445 | |||
446 | # params: symbol, alias, platforms, kind | ||
447 | # The reason to put this subroutine in a variable is that | ||
448 | # it will otherwise create it's own, unshared, version of | ||
449 | # %tag and %variant... | ||
450 | my $make_variant = sub | ||
451 | { | ||
452 | my ($s, $a, $p, $k) = @_; | ||
453 | my ($a1, $a2); | ||
454 | |||
455 | print STDERR "DEBUG: make_variant: Entered with ",$s,", ",$a,", ",(defined($p)?$p:""),", ",(defined($k)?$k:""),"\n" if $debug; | ||
456 | if (defined($p)) | ||
457 | { | ||
458 | $a1 = join(",",$p, | ||
459 | grep(!/^$/, | ||
460 | map { $tag{$_} == 1 ? $_ : "" } | ||
461 | @known_platforms)); | ||
462 | } | ||
463 | else | ||
464 | { | ||
465 | $a1 = join(",", | ||
466 | grep(!/^$/, | ||
467 | map { $tag{$_} == 1 ? $_ : "" } | ||
468 | @known_platforms)); | ||
469 | } | ||
470 | $a2 = join(",", | ||
471 | grep(!/^$/, | ||
472 | map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : "" } | ||
473 | @known_ossl_platforms)); | ||
474 | print STDERR "DEBUG: make_variant: a1 = $a1; a2 = $a2\n" if $debug; | ||
475 | if ($a1 eq "") { $a1 = $a2; } | ||
476 | elsif ($a1 ne "" && $a2 ne "") { $a1 .= ",".$a2; } | ||
477 | if ($a eq $s) | ||
478 | { | ||
479 | if (!defined($variant_cnt{$s})) | ||
480 | { | ||
481 | $variant_cnt{$s} = 0; | ||
482 | } | ||
483 | $variant_cnt{$s}++; | ||
484 | $a .= "{$variant_cnt{$s}}"; | ||
485 | } | ||
486 | my $toadd = $a.":".$a1.(defined($k)?":".$k:""); | ||
487 | my $togrep = $s.'(\{[0-9]+\})?:'.$a1.(defined($k)?":".$k:""); | ||
488 | if (!grep(/^$togrep$/, | ||
489 | split(/;/, defined($variant{$s})?$variant{$s}:""))) { | ||
490 | if (defined($variant{$s})) { $variant{$s} .= ";"; } | ||
491 | $variant{$s} .= $toadd; | ||
492 | } | ||
493 | print STDERR "DEBUG: make_variant: Exit with variant of ",$s," = ",$variant{$s},"\n" if $debug; | ||
494 | }; | ||
495 | |||
496 | print STDERR "DEBUG: parsing ----------\n" if $debug; | ||
497 | while(<IN>) { | ||
498 | if (/\/\* Error codes for the \w+ functions\. \*\//) | ||
499 | { | ||
500 | undef @tag; | ||
501 | last; | ||
502 | } | ||
503 | if ($line ne '') { | ||
504 | $_ = $line . $_; | ||
505 | $line = ''; | ||
506 | } | ||
507 | |||
508 | if (/\\$/) { | ||
509 | chomp; # remove eol | ||
510 | chop; # remove ending backslash | ||
511 | $line = $_; | ||
512 | next; | ||
513 | } | ||
514 | |||
515 | if(/\/\*/) { | ||
516 | if (not /\*\//) { # multiline comment... | ||
517 | $line = $_; # ... just accumulate | ||
518 | next; | ||
519 | } else { | ||
520 | s/\/\*.*?\*\///gs;# wipe it | ||
521 | } | ||
522 | } | ||
523 | |||
524 | if ($cpp) { | ||
525 | $cpp++ if /^#\s*if/; | ||
526 | $cpp-- if /^#\s*endif/; | ||
527 | next; | ||
528 | } | ||
529 | $cpp = 1 if /^#.*ifdef.*cplusplus/; | ||
530 | |||
531 | s/{[^{}]*}//gs; # ignore {} blocks | ||
532 | print STDERR "DEBUG: \$def=\"$def\"\n" if $debug && $def ne ""; | ||
533 | print STDERR "DEBUG: \$_=\"$_\"\n" if $debug; | ||
534 | if (/^\#\s*ifndef\s+(.*)/) { | ||
535 | push(@tag,"-"); | ||
536 | push(@tag,$1); | ||
537 | $tag{$1}=-1; | ||
538 | print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; | ||
539 | } elsif (/^\#\s*if\s+!defined\(([^\)]+)\)/) { | ||
540 | push(@tag,"-"); | ||
541 | if (/^\#\s*if\s+(!defined\(([^\)]+)\)(\s+\&\&\s+!defined\(([^\)]+)\))*)$/) { | ||
542 | my $tmp_1 = $1; | ||
543 | my $tmp_; | ||
544 | foreach $tmp_ (split '\&\&',$tmp_1) { | ||
545 | $tmp_ =~ /!defined\(([^\)]+)\)/; | ||
546 | print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; | ||
547 | push(@tag,$1); | ||
548 | $tag{$1}=-1; | ||
549 | } | ||
550 | } else { | ||
551 | print STDERR "Warning: $file: complicated expression: $_" if $debug; # because it is O... | ||
552 | print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; | ||
553 | push(@tag,$1); | ||
554 | $tag{$1}=-1; | ||
555 | } | ||
556 | } elsif (/^\#\s*ifdef\s+(\S*)/) { | ||
557 | push(@tag,"-"); | ||
558 | push(@tag,$1); | ||
559 | $tag{$1}=1; | ||
560 | print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; | ||
561 | } elsif (/^\#\s*if\s+defined\(([^\)]+)\)/) { | ||
562 | push(@tag,"-"); | ||
563 | if (/^\#\s*if\s+(defined\(([^\)]+)\)(\s+\|\|\s+defined\(([^\)]+)\))*)$/) { | ||
564 | my $tmp_1 = $1; | ||
565 | my $tmp_; | ||
566 | foreach $tmp_ (split '\|\|',$tmp_1) { | ||
567 | $tmp_ =~ /defined\(([^\)]+)\)/; | ||
568 | print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; | ||
569 | push(@tag,$1); | ||
570 | $tag{$1}=1; | ||
571 | } | ||
572 | } else { | ||
573 | print STDERR "Warning: $file: complicated expression: $_\n" if $debug; # because it is O... | ||
574 | print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; | ||
575 | push(@tag,$1); | ||
576 | $tag{$1}=1; | ||
577 | } | ||
578 | } elsif (/^\#\s*error\s+(\w+) is disabled\./) { | ||
579 | my $tag_i = $#tag; | ||
580 | while($tag[$tag_i] ne "-") { | ||
581 | if ($tag[$tag_i] eq "OPENSSL_NO_".$1) { | ||
582 | $tag{$tag[$tag_i]}=2; | ||
583 | print STDERR "DEBUG: $file: chaged tag $1 = 2\n" if $debug; | ||
584 | } | ||
585 | $tag_i--; | ||
586 | } | ||
587 | } elsif (/^\#\s*endif/) { | ||
588 | my $tag_i = $#tag; | ||
589 | while($tag_i > 0 && $tag[$tag_i] ne "-") { | ||
590 | my $t=$tag[$tag_i]; | ||
591 | print STDERR "DEBUG: \$t=\"$t\"\n" if $debug; | ||
592 | if ($tag{$t}==2) { | ||
593 | $tag{$t}=-1; | ||
594 | } else { | ||
595 | $tag{$t}=0; | ||
596 | } | ||
597 | print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug; | ||
598 | pop(@tag); | ||
599 | if ($t =~ /^OPENSSL_NO_([A-Z0-9_]+)$/) { | ||
600 | $t=$1; | ||
601 | } else { | ||
602 | $t=""; | ||
603 | } | ||
604 | if ($t ne "" | ||
605 | && !grep(/^$t$/, @known_algorithms)) { | ||
606 | $unknown_algorithms{$t} = 1; | ||
607 | #print STDERR "DEBUG: Added as unknown algorithm: $t\n" if $debug; | ||
608 | } | ||
609 | $tag_i--; | ||
610 | } | ||
611 | pop(@tag); | ||
612 | } elsif (/^\#\s*else/) { | ||
613 | my $tag_i = $#tag; | ||
614 | while($tag[$tag_i] ne "-") { | ||
615 | my $t=$tag[$tag_i]; | ||
616 | $tag{$t}= -$tag{$t}; | ||
617 | print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug; | ||
618 | $tag_i--; | ||
619 | } | ||
620 | } elsif (/^\#\s*if\s+1/) { | ||
621 | push(@tag,"-"); | ||
622 | # Dummy tag | ||
623 | push(@tag,"TRUE"); | ||
624 | $tag{"TRUE"}=1; | ||
625 | print STDERR "DEBUG: $file: found 1\n" if $debug; | ||
626 | } elsif (/^\#\s*if\s+0/) { | ||
627 | push(@tag,"-"); | ||
628 | # Dummy tag | ||
629 | push(@tag,"TRUE"); | ||
630 | $tag{"TRUE"}=-1; | ||
631 | print STDERR "DEBUG: $file: found 0\n" if $debug; | ||
632 | } elsif (/^\#\s*define\s+(\w+)\s+(\w+)/ | ||
633 | && $symhacking && $tag{'TRUE'} != -1) { | ||
634 | # This is for aliasing. When we find an alias, | ||
635 | # we have to invert | ||
636 | &$make_variant($1,$2); | ||
637 | print STDERR "DEBUG: $file: defined $1 = $2\n" if $debug; | ||
638 | } | ||
639 | if (/^\#/) { | ||
640 | @current_platforms = | ||
641 | grep(!/^$/, | ||
642 | map { $tag{$_} == 1 ? $_ : | ||
643 | $tag{$_} == -1 ? "!".$_ : "" } | ||
644 | @known_platforms); | ||
645 | push @current_platforms | ||
646 | , grep(!/^$/, | ||
647 | map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : | ||
648 | $tag{"OPENSSL_SYS_".$_} == -1 ? "!".$_ : "" } | ||
649 | @known_ossl_platforms); | ||
650 | @current_algorithms = | ||
651 | grep(!/^$/, | ||
652 | map { $tag{"OPENSSL_NO_".$_} == -1 ? $_ : "" } | ||
653 | @known_algorithms); | ||
654 | $def .= | ||
655 | "#INFO:" | ||
656 | .join(',',@current_platforms).":" | ||
657 | .join(',',@current_algorithms).";"; | ||
658 | next; | ||
659 | } | ||
660 | if ($tag{'TRUE'} != -1) { | ||
661 | if (/^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) { | ||
662 | next; | ||
663 | } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
664 | $def .= "int d2i_$3(void);"; | ||
665 | $def .= "int i2d_$3(void);"; | ||
666 | # Variant for platforms that do not | ||
667 | # have to access globale variables | ||
668 | # in shared libraries through functions | ||
669 | $def .= | ||
670 | "#INFO:" | ||
671 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
672 | .join(',',@current_algorithms).";"; | ||
673 | $def .= "OPENSSL_EXTERN int $2_it;"; | ||
674 | $def .= | ||
675 | "#INFO:" | ||
676 | .join(',',@current_platforms).":" | ||
677 | .join(',',@current_algorithms).";"; | ||
678 | # Variant for platforms that have to | ||
679 | # access globale variables in shared | ||
680 | # libraries through functions | ||
681 | &$make_variant("$2_it","$2_it", | ||
682 | "EXPORT_VAR_AS_FUNCTION", | ||
683 | "FUNCTION"); | ||
684 | next; | ||
685 | } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_fname\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
686 | $def .= "int d2i_$3(void);"; | ||
687 | $def .= "int i2d_$3(void);"; | ||
688 | $def .= "int $3_free(void);"; | ||
689 | $def .= "int $3_new(void);"; | ||
690 | # Variant for platforms that do not | ||
691 | # have to access globale variables | ||
692 | # in shared libraries through functions | ||
693 | $def .= | ||
694 | "#INFO:" | ||
695 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
696 | .join(',',@current_algorithms).";"; | ||
697 | $def .= "OPENSSL_EXTERN int $2_it;"; | ||
698 | $def .= | ||
699 | "#INFO:" | ||
700 | .join(',',@current_platforms).":" | ||
701 | .join(',',@current_algorithms).";"; | ||
702 | # Variant for platforms that have to | ||
703 | # access globale variables in shared | ||
704 | # libraries through functions | ||
705 | &$make_variant("$2_it","$2_it", | ||
706 | "EXPORT_VAR_AS_FUNCTION", | ||
707 | "FUNCTION"); | ||
708 | next; | ||
709 | } elsif (/^\s*DECLARE_ASN1_FUNCTIONS\s*\(\s*(\w*)\s*\)/ || | ||
710 | /^\s*DECLARE_ASN1_FUNCTIONS_const\s*\(\s*(\w*)\s*\)/) { | ||
711 | $def .= "int d2i_$1(void);"; | ||
712 | $def .= "int i2d_$1(void);"; | ||
713 | $def .= "int $1_free(void);"; | ||
714 | $def .= "int $1_new(void);"; | ||
715 | # Variant for platforms that do not | ||
716 | # have to access globale variables | ||
717 | # in shared libraries through functions | ||
718 | $def .= | ||
719 | "#INFO:" | ||
720 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
721 | .join(',',@current_algorithms).";"; | ||
722 | $def .= "OPENSSL_EXTERN int $1_it;"; | ||
723 | $def .= | ||
724 | "#INFO:" | ||
725 | .join(',',@current_platforms).":" | ||
726 | .join(',',@current_algorithms).";"; | ||
727 | # Variant for platforms that have to | ||
728 | # access globale variables in shared | ||
729 | # libraries through functions | ||
730 | &$make_variant("$1_it","$1_it", | ||
731 | "EXPORT_VAR_AS_FUNCTION", | ||
732 | "FUNCTION"); | ||
733 | next; | ||
734 | } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS_const\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
735 | $def .= "int d2i_$2(void);"; | ||
736 | $def .= "int i2d_$2(void);"; | ||
737 | # Variant for platforms that do not | ||
738 | # have to access globale variables | ||
739 | # in shared libraries through functions | ||
740 | $def .= | ||
741 | "#INFO:" | ||
742 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
743 | .join(',',@current_algorithms).";"; | ||
744 | $def .= "OPENSSL_EXTERN int $2_it;"; | ||
745 | $def .= | ||
746 | "#INFO:" | ||
747 | .join(',',@current_platforms).":" | ||
748 | .join(',',@current_algorithms).";"; | ||
749 | # Variant for platforms that have to | ||
750 | # access globale variables in shared | ||
751 | # libraries through functions | ||
752 | &$make_variant("$2_it","$2_it", | ||
753 | "EXPORT_VAR_AS_FUNCTION", | ||
754 | "FUNCTION"); | ||
755 | next; | ||
756 | } elsif (/^\s*DECLARE_ASN1_ALLOC_FUNCTIONS\s*\(\s*(\w*)\s*\)/) { | ||
757 | $def .= "int $1_free(void);"; | ||
758 | $def .= "int $1_new(void);"; | ||
759 | next; | ||
760 | } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
761 | $def .= "int d2i_$2(void);"; | ||
762 | $def .= "int i2d_$2(void);"; | ||
763 | $def .= "int $2_free(void);"; | ||
764 | $def .= "int $2_new(void);"; | ||
765 | # Variant for platforms that do not | ||
766 | # have to access globale variables | ||
767 | # in shared libraries through functions | ||
768 | $def .= | ||
769 | "#INFO:" | ||
770 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
771 | .join(',',@current_algorithms).";"; | ||
772 | $def .= "OPENSSL_EXTERN int $2_it;"; | ||
773 | $def .= | ||
774 | "#INFO:" | ||
775 | .join(',',@current_platforms).":" | ||
776 | .join(',',@current_algorithms).";"; | ||
777 | # Variant for platforms that have to | ||
778 | # access globale variables in shared | ||
779 | # libraries through functions | ||
780 | &$make_variant("$2_it","$2_it", | ||
781 | "EXPORT_VAR_AS_FUNCTION", | ||
782 | "FUNCTION"); | ||
783 | next; | ||
784 | } elsif (/^\s*DECLARE_ASN1_ITEM\s*\(\s*(\w*)\s*\)/) { | ||
785 | # Variant for platforms that do not | ||
786 | # have to access globale variables | ||
787 | # in shared libraries through functions | ||
788 | $def .= | ||
789 | "#INFO:" | ||
790 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
791 | .join(',',@current_algorithms).";"; | ||
792 | $def .= "OPENSSL_EXTERN int $1_it;"; | ||
793 | $def .= | ||
794 | "#INFO:" | ||
795 | .join(',',@current_platforms).":" | ||
796 | .join(',',@current_algorithms).";"; | ||
797 | # Variant for platforms that have to | ||
798 | # access globale variables in shared | ||
799 | # libraries through functions | ||
800 | &$make_variant("$1_it","$1_it", | ||
801 | "EXPORT_VAR_AS_FUNCTION", | ||
802 | "FUNCTION"); | ||
803 | next; | ||
804 | } elsif (/^\s*DECLARE_ASN1_NDEF_FUNCTION\s*\(\s*(\w*)\s*\)/) { | ||
805 | $def .= "int i2d_$1_NDEF(void);"; | ||
806 | } elsif (/^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) { | ||
807 | next; | ||
808 | } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION\s*\(\s*(\w*)\s*\)/) { | ||
809 | $def .= "int $1_print_ctx(void);"; | ||
810 | next; | ||
811 | } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
812 | $def .= "int $2_print_ctx(void);"; | ||
813 | next; | ||
814 | } elsif (/^\s*DECLARE_PKCS12_STACK_OF\s*\(\s*(\w*)\s*\)/) { | ||
815 | next; | ||
816 | } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ || | ||
817 | /^DECLARE_PEM_rw_cb\s*\(\s*(\w*)\s*,/ || | ||
818 | /^DECLARE_PEM_rw_const\s*\(\s*(\w*)\s*,/ ) { | ||
819 | # Things not in Win16 | ||
820 | $def .= | ||
821 | "#INFO:" | ||
822 | .join(',',"!WIN16",@current_platforms).":" | ||
823 | .join(',',@current_algorithms).";"; | ||
824 | $def .= "int PEM_read_$1(void);"; | ||
825 | $def .= "int PEM_write_$1(void);"; | ||
826 | $def .= | ||
827 | "#INFO:" | ||
828 | .join(',',@current_platforms).":" | ||
829 | .join(',',@current_algorithms).";"; | ||
830 | # Things that are everywhere | ||
831 | $def .= "int PEM_read_bio_$1(void);"; | ||
832 | $def .= "int PEM_write_bio_$1(void);"; | ||
833 | next; | ||
834 | } elsif (/^DECLARE_PEM_write\s*\(\s*(\w*)\s*,/ || | ||
835 | /^DECLARE_PEM_write_cb\s*\(\s*(\w*)\s*,/ ) { | ||
836 | # Things not in Win16 | ||
837 | $def .= | ||
838 | "#INFO:" | ||
839 | .join(',',"!WIN16",@current_platforms).":" | ||
840 | .join(',',@current_algorithms).";"; | ||
841 | $def .= "int PEM_write_$1(void);"; | ||
842 | $def .= | ||
843 | "#INFO:" | ||
844 | .join(',',@current_platforms).":" | ||
845 | .join(',',@current_algorithms).";"; | ||
846 | # Things that are everywhere | ||
847 | $def .= "int PEM_write_bio_$1(void);"; | ||
848 | next; | ||
849 | } elsif (/^DECLARE_PEM_read\s*\(\s*(\w*)\s*,/ || | ||
850 | /^DECLARE_PEM_read_cb\s*\(\s*(\w*)\s*,/ ) { | ||
851 | # Things not in Win16 | ||
852 | $def .= | ||
853 | "#INFO:" | ||
854 | .join(',',"!WIN16",@current_platforms).":" | ||
855 | .join(',',@current_algorithms).";"; | ||
856 | $def .= "int PEM_read_$1(void);"; | ||
857 | $def .= | ||
858 | "#INFO:" | ||
859 | .join(',',@current_platforms).":" | ||
860 | .join(',',@current_algorithms).";"; | ||
861 | # Things that are everywhere | ||
862 | $def .= "int PEM_read_bio_$1(void);"; | ||
863 | next; | ||
864 | } elsif (/^OPENSSL_DECLARE_GLOBAL\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
865 | # Variant for platforms that do not | ||
866 | # have to access globale variables | ||
867 | # in shared libraries through functions | ||
868 | $def .= | ||
869 | "#INFO:" | ||
870 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
871 | .join(',',@current_algorithms).";"; | ||
872 | $def .= "OPENSSL_EXTERN int _shadow_$2;"; | ||
873 | $def .= | ||
874 | "#INFO:" | ||
875 | .join(',',@current_platforms).":" | ||
876 | .join(',',@current_algorithms).";"; | ||
877 | # Variant for platforms that have to | ||
878 | # access globale variables in shared | ||
879 | # libraries through functions | ||
880 | &$make_variant("_shadow_$2","_shadow_$2", | ||
881 | "EXPORT_VAR_AS_FUNCTION", | ||
882 | "FUNCTION"); | ||
883 | } elsif ($tag{'CONST_STRICT'} != 1) { | ||
884 | if (/\{|\/\*|\([^\)]*$/) { | ||
885 | $line = $_; | ||
886 | } else { | ||
887 | $def .= $_; | ||
888 | } | ||
889 | } | ||
890 | } | ||
891 | } | ||
892 | close(IN); | ||
893 | |||
894 | my $algs; | ||
895 | my $plays; | ||
896 | |||
897 | print STDERR "DEBUG: postprocessing ----------\n" if $debug; | ||
898 | foreach (split /;/, $def) { | ||
899 | my $s; my $k = "FUNCTION"; my $p; my $a; | ||
900 | s/^[\n\s]*//g; | ||
901 | s/[\n\s]*$//g; | ||
902 | next if(/\#undef/); | ||
903 | next if(/typedef\W/); | ||
904 | next if(/\#define/); | ||
905 | |||
906 | # Reduce argument lists to empty () | ||
907 | # fold round brackets recursively: (t(*v)(t),t) -> (t{}{},t) -> {} | ||
908 | while(/\(.*\)/s) { | ||
909 | s/\([^\(\)]+\)/\{\}/gs; | ||
910 | s/\(\s*\*\s*(\w+)\s*\{\}\s*\)/$1/gs; #(*f{}) -> f | ||
911 | } | ||
912 | # pretend as we didn't use curly braces: {} -> () | ||
913 | s/\{\}/\(\)/gs; | ||
914 | |||
915 | s/STACK_OF\(\)/void/gs; | ||
916 | s/LHASH_OF\(\)/void/gs; | ||
917 | |||
918 | print STDERR "DEBUG: \$_ = \"$_\"\n" if $debug; | ||
919 | if (/^\#INFO:([^:]*):(.*)$/) { | ||
920 | $plats = $1; | ||
921 | $algs = $2; | ||
922 | print STDERR "DEBUG: found info on platforms ($plats) and algorithms ($algs)\n" if $debug; | ||
923 | next; | ||
924 | } elsif (/^\s*OPENSSL_EXTERN\s.*?(\w+(\{[0-9]+\})?)(\[[0-9]*\])*\s*$/) { | ||
925 | $s = $1; | ||
926 | $k = "VARIABLE"; | ||
927 | print STDERR "DEBUG: found external variable $s\n" if $debug; | ||
928 | } elsif (/TYPEDEF_\w+_OF/s) { | ||
929 | next; | ||
930 | } elsif (/(\w+)\s*\(\).*/s) { # first token prior [first] () is | ||
931 | $s = $1; # a function name! | ||
932 | print STDERR "DEBUG: found function $s\n" if $debug; | ||
933 | } elsif (/\(/ and not (/=/)) { | ||
934 | print STDERR "File $file: cannot parse: $_;\n"; | ||
935 | next; | ||
936 | } else { | ||
937 | next; | ||
938 | } | ||
939 | |||
940 | $syms{$s} = 1; | ||
941 | $kind{$s} = $k; | ||
942 | |||
943 | $p = $plats; | ||
944 | $a = $algs; | ||
945 | $a .= ",BF" if($s =~ /EVP_bf/); | ||
946 | $a .= ",CAST" if($s =~ /EVP_cast/); | ||
947 | $a .= ",DES" if($s =~ /EVP_des/); | ||
948 | $a .= ",DSA" if($s =~ /EVP_dss/); | ||
949 | $a .= ",IDEA" if($s =~ /EVP_idea/); | ||
950 | $a .= ",MD2" if($s =~ /EVP_md2/); | ||
951 | $a .= ",MD4" if($s =~ /EVP_md4/); | ||
952 | $a .= ",MD5" if($s =~ /EVP_md5/); | ||
953 | $a .= ",RC2" if($s =~ /EVP_rc2/); | ||
954 | $a .= ",RC4" if($s =~ /EVP_rc4/); | ||
955 | $a .= ",RC5" if($s =~ /EVP_rc5/); | ||
956 | $a .= ",RIPEMD" if($s =~ /EVP_ripemd/); | ||
957 | $a .= ",SHA" if($s =~ /EVP_sha/); | ||
958 | $a .= ",RSA" if($s =~ /EVP_(Open|Seal)(Final|Init)/); | ||
959 | $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/); | ||
960 | $a .= ",RSA" if($s =~ /RSAPrivateKey/); | ||
961 | $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/); | ||
962 | |||
963 | $platform{$s} = | ||
964 | &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); | ||
965 | $algorithm{$s} .= ','.$a; | ||
966 | |||
967 | if (defined($variant{$s})) { | ||
968 | foreach $v (split /;/,$variant{$s}) { | ||
969 | (my $r, my $p, my $k) = split(/:/,$v); | ||
970 | my $ip = join ',',map({ /^!(.*)$/ ? $1 : "!".$_ } split /,/, $p); | ||
971 | $syms{$r} = 1; | ||
972 | if (!defined($k)) { $k = $kind{$s}; } | ||
973 | $kind{$r} = $k."(".$s.")"; | ||
974 | $algorithm{$r} = $algorithm{$s}; | ||
975 | $platform{$r} = &reduce_platforms($platform{$s}.",".$p.",".$p); | ||
976 | $platform{$s} = &reduce_platforms($platform{$s}.','.$ip.','.$ip); | ||
977 | print STDERR "DEBUG: \$variant{\"$s\"} = ",$v,"; \$r = $r; \$p = ",$platform{$r},"; \$a = ",$algorithm{$r},"; \$kind = ",$kind{$r},"\n" if $debug; | ||
978 | } | ||
979 | } | ||
980 | print STDERR "DEBUG: \$s = $s; \$p = ",$platform{$s},"; \$a = ",$algorithm{$s},"; \$kind = ",$kind{$s},"\n" if $debug; | ||
981 | } | ||
982 | } | ||
983 | |||
984 | # Prune the returned symbols | ||
985 | |||
986 | delete $syms{"bn_dump1"}; | ||
987 | $platform{"BIO_s_log"} .= ",!WIN32,!WIN16,!macintosh"; | ||
988 | |||
989 | $platform{"PEM_read_NS_CERT_SEQ"} = "VMS"; | ||
990 | $platform{"PEM_write_NS_CERT_SEQ"} = "VMS"; | ||
991 | $platform{"PEM_read_P8_PRIV_KEY_INFO"} = "VMS"; | ||
992 | $platform{"PEM_write_P8_PRIV_KEY_INFO"} = "VMS"; | ||
993 | $platform{"EVP_sha384"} = "!VMSVAX"; | ||
994 | $platform{"EVP_sha512"} = "!VMSVAX"; | ||
995 | $platform{"SHA384_Init"} = "!VMSVAX"; | ||
996 | $platform{"SHA384_Transform"} = "!VMSVAX"; | ||
997 | $platform{"SHA384_Update"} = "!VMSVAX"; | ||
998 | $platform{"SHA384_Final"} = "!VMSVAX"; | ||
999 | $platform{"SHA384"} = "!VMSVAX"; | ||
1000 | $platform{"SHA512_Init"} = "!VMSVAX"; | ||
1001 | $platform{"SHA512_Transform"} = "!VMSVAX"; | ||
1002 | $platform{"SHA512_Update"} = "!VMSVAX"; | ||
1003 | $platform{"SHA512_Final"} = "!VMSVAX"; | ||
1004 | $platform{"SHA512"} = "!VMSVAX"; | ||
1005 | $platform{"WHIRLPOOL_Init"} = "!VMSVAX"; | ||
1006 | $platform{"WHIRLPOOL"} = "!VMSVAX"; | ||
1007 | $platform{"WHIRLPOOL_BitUpdate"} = "!VMSVAX"; | ||
1008 | $platform{"EVP_whirlpool"} = "!VMSVAX"; | ||
1009 | $platform{"WHIRLPOOL_Final"} = "!VMSVAX"; | ||
1010 | $platform{"WHIRLPOOL_Update"} = "!VMSVAX"; | ||
1011 | |||
1012 | |||
1013 | # Info we know about | ||
1014 | |||
1015 | push @ret, map { $_."\\".&info_string($_,"EXIST", | ||
1016 | $platform{$_}, | ||
1017 | $kind{$_}, | ||
1018 | $algorithm{$_}) } keys %syms; | ||
1019 | |||
1020 | if (keys %unknown_algorithms) { | ||
1021 | print STDERR "WARNING: mkdef.pl doesn't know the following algorithms:\n"; | ||
1022 | print STDERR "\t",join("\n\t",keys %unknown_algorithms),"\n"; | ||
1023 | } | ||
1024 | return(@ret); | ||
1025 | } | ||
1026 | |||
1027 | # Param: string of comma-separated platform-specs. | ||
1028 | sub reduce_platforms | ||
1029 | { | ||
1030 | my ($platforms) = @_; | ||
1031 | my $pl = defined($platforms) ? $platforms : ""; | ||
1032 | my %p = map { $_ => 0 } split /,/, $pl; | ||
1033 | my $ret; | ||
1034 | |||
1035 | print STDERR "DEBUG: Entered reduce_platforms with \"$platforms\"\n" | ||
1036 | if $debug; | ||
1037 | # We do this, because if there's code like the following, it really | ||
1038 | # means the function exists in all cases and should therefore be | ||
1039 | # everywhere. By increasing and decreasing, we may attain 0: | ||
1040 | # | ||
1041 | # ifndef WIN16 | ||
1042 | # int foo(); | ||
1043 | # else | ||
1044 | # int _fat foo(); | ||
1045 | # endif | ||
1046 | foreach $platform (split /,/, $pl) { | ||
1047 | if ($platform =~ /^!(.*)$/) { | ||
1048 | $p{$1}--; | ||
1049 | } else { | ||
1050 | $p{$platform}++; | ||
1051 | } | ||
1052 | } | ||
1053 | foreach $platform (keys %p) { | ||
1054 | if ($p{$platform} == 0) { delete $p{$platform}; } | ||
1055 | } | ||
1056 | |||
1057 | delete $p{""}; | ||
1058 | |||
1059 | $ret = join(',',sort(map { $p{$_} < 0 ? "!".$_ : $_ } keys %p)); | ||
1060 | print STDERR "DEBUG: Exiting reduce_platforms with \"$ret\"\n" | ||
1061 | if $debug; | ||
1062 | return $ret; | ||
1063 | } | ||
1064 | |||
1065 | sub info_string { | ||
1066 | (my $symbol, my $exist, my $platforms, my $kind, my $algorithms) = @_; | ||
1067 | |||
1068 | my %a = defined($algorithms) ? | ||
1069 | map { $_ => 1 } split /,/, $algorithms : (); | ||
1070 | my $k = defined($kind) ? $kind : "FUNCTION"; | ||
1071 | my $ret; | ||
1072 | my $p = &reduce_platforms($platforms); | ||
1073 | |||
1074 | delete $a{""}; | ||
1075 | |||
1076 | $ret = $exist; | ||
1077 | $ret .= ":".$p; | ||
1078 | $ret .= ":".$k; | ||
1079 | $ret .= ":".join(',',sort keys %a); | ||
1080 | return $ret; | ||
1081 | } | ||
1082 | |||
1083 | sub maybe_add_info { | ||
1084 | (my $name, *nums, my @symbols) = @_; | ||
1085 | my $sym; | ||
1086 | my $new_info = 0; | ||
1087 | my %syms=(); | ||
1088 | |||
1089 | print STDERR "Updating $name info\n"; | ||
1090 | foreach $sym (@symbols) { | ||
1091 | (my $s, my $i) = split /\\/, $sym; | ||
1092 | if (defined($nums{$s})) { | ||
1093 | $i =~ s/^(.*?:.*?:\w+)(\(\w+\))?/$1/; | ||
1094 | (my $n, my $dummy) = split /\\/, $nums{$s}; | ||
1095 | if (!defined($dummy) || $i ne $dummy) { | ||
1096 | $nums{$s} = $n."\\".$i; | ||
1097 | $new_info++; | ||
1098 | print STDERR "DEBUG: maybe_add_info for $s: \"$dummy\" => \"$i\"\n" if $debug; | ||
1099 | } | ||
1100 | } | ||
1101 | $syms{$s} = 1; | ||
1102 | } | ||
1103 | |||
1104 | my @s=sort { &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") } keys %nums; | ||
1105 | foreach $sym (@s) { | ||
1106 | (my $n, my $i) = split /\\/, $nums{$sym}; | ||
1107 | if (!defined($syms{$sym}) && $i !~ /^NOEXIST:/) { | ||
1108 | $new_info++; | ||
1109 | print STDERR "DEBUG: maybe_add_info for $sym: -> undefined\n" if $debug; | ||
1110 | } | ||
1111 | } | ||
1112 | if ($new_info) { | ||
1113 | print STDERR "$new_info old symbols got an info update\n"; | ||
1114 | if (!$do_rewrite) { | ||
1115 | print STDERR "You should do a rewrite to fix this.\n"; | ||
1116 | } | ||
1117 | } else { | ||
1118 | print STDERR "No old symbols needed info update\n"; | ||
1119 | } | ||
1120 | } | ||
1121 | |||
1122 | # Param: string of comma-separated keywords, each possibly prefixed with a "!" | ||
1123 | sub is_valid | ||
1124 | { | ||
1125 | my ($keywords_txt,$platforms) = @_; | ||
1126 | my (@keywords) = split /,/,$keywords_txt; | ||
1127 | my ($falsesum, $truesum) = (0, 1); | ||
1128 | |||
1129 | # Param: one keyword | ||
1130 | sub recognise | ||
1131 | { | ||
1132 | my ($keyword,$platforms) = @_; | ||
1133 | |||
1134 | if ($platforms) { | ||
1135 | # platforms | ||
1136 | if ($keyword eq "VMSVAX" && $VMSVAX) { return 1; } | ||
1137 | if ($keyword eq "VMSNonVAX" && $VMSNonVAX) { return 1; } | ||
1138 | if ($keyword eq "VMS" && $VMS) { return 1; } | ||
1139 | if ($keyword eq "WIN32" && $W32) { return 1; } | ||
1140 | if ($keyword eq "WIN16" && $W16) { return 1; } | ||
1141 | if ($keyword eq "WINNT" && $NT) { return 1; } | ||
1142 | if ($keyword eq "OS2" && $OS2) { return 1; } | ||
1143 | # Special platforms: | ||
1144 | # EXPORT_VAR_AS_FUNCTION means that global variables | ||
1145 | # will be represented as functions. This currently | ||
1146 | # only happens on VMS-VAX. | ||
1147 | if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) { | ||
1148 | return 1; | ||
1149 | } | ||
1150 | if ($keyword eq "OPENSSL_FIPS" && $fips) { | ||
1151 | return 1; | ||
1152 | } | ||
1153 | if ($keyword eq "ZLIB" && $zlib) { return 1; } | ||
1154 | return 0; | ||
1155 | } else { | ||
1156 | # algorithms | ||
1157 | if ($keyword eq "RC2" && $no_rc2) { return 0; } | ||
1158 | if ($keyword eq "RC4" && $no_rc4) { return 0; } | ||
1159 | if ($keyword eq "RC5" && $no_rc5) { return 0; } | ||
1160 | if ($keyword eq "IDEA" && $no_idea) { return 0; } | ||
1161 | if ($keyword eq "DES" && $no_des) { return 0; } | ||
1162 | if ($keyword eq "BF" && $no_bf) { return 0; } | ||
1163 | if ($keyword eq "CAST" && $no_cast) { return 0; } | ||
1164 | if ($keyword eq "MD2" && $no_md2) { return 0; } | ||
1165 | if ($keyword eq "MD4" && $no_md4) { return 0; } | ||
1166 | if ($keyword eq "MD5" && $no_md5) { return 0; } | ||
1167 | if ($keyword eq "SHA" && $no_sha) { return 0; } | ||
1168 | if ($keyword eq "RIPEMD" && $no_ripemd) { return 0; } | ||
1169 | if ($keyword eq "MDC2" && $no_mdc2) { return 0; } | ||
1170 | if ($keyword eq "WHIRLPOOL" && $no_whirlpool) { return 0; } | ||
1171 | if ($keyword eq "RSA" && $no_rsa) { return 0; } | ||
1172 | if ($keyword eq "DSA" && $no_dsa) { return 0; } | ||
1173 | if ($keyword eq "DH" && $no_dh) { return 0; } | ||
1174 | if ($keyword eq "EC" && $no_ec) { return 0; } | ||
1175 | if ($keyword eq "ECDSA" && $no_ecdsa) { return 0; } | ||
1176 | if ($keyword eq "ECDH" && $no_ecdh) { return 0; } | ||
1177 | if ($keyword eq "HMAC" && $no_hmac) { return 0; } | ||
1178 | if ($keyword eq "AES" && $no_aes) { return 0; } | ||
1179 | if ($keyword eq "CAMELLIA" && $no_camellia) { return 0; } | ||
1180 | if ($keyword eq "SEED" && $no_seed) { return 0; } | ||
1181 | if ($keyword eq "EVP" && $no_evp) { return 0; } | ||
1182 | if ($keyword eq "LHASH" && $no_lhash) { return 0; } | ||
1183 | if ($keyword eq "STACK" && $no_stack) { return 0; } | ||
1184 | if ($keyword eq "ERR" && $no_err) { return 0; } | ||
1185 | if ($keyword eq "BUFFER" && $no_buffer) { return 0; } | ||
1186 | if ($keyword eq "BIO" && $no_bio) { return 0; } | ||
1187 | if ($keyword eq "COMP" && $no_comp) { return 0; } | ||
1188 | if ($keyword eq "DSO" && $no_dso) { return 0; } | ||
1189 | if ($keyword eq "KRB5" && $no_krb5) { return 0; } | ||
1190 | if ($keyword eq "ENGINE" && $no_engine) { return 0; } | ||
1191 | if ($keyword eq "HW" && $no_hw) { return 0; } | ||
1192 | if ($keyword eq "FP_API" && $no_fp_api) { return 0; } | ||
1193 | if ($keyword eq "STATIC_ENGINE" && $no_static_engine) { return 0; } | ||
1194 | if ($keyword eq "GMP" && $no_gmp) { return 0; } | ||
1195 | if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; } | ||
1196 | if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; } | ||
1197 | if ($keyword eq "PSK" && $no_psk) { return 0; } | ||
1198 | if ($keyword eq "CMS" && $no_cms) { return 0; } | ||
1199 | if ($keyword eq "EC2M" && $no_ec2m) { return 0; } | ||
1200 | if ($keyword eq "NEXTPROTONEG" && $no_nextprotoneg) { return 0; } | ||
1201 | if ($keyword eq "EC_NISTP_64_GCC_128" && $no_nistp_gcc) | ||
1202 | { return 0; } | ||
1203 | if ($keyword eq "SSL2" && $no_ssl2) { return 0; } | ||
1204 | if ($keyword eq "CAPIENG" && $no_capieng) { return 0; } | ||
1205 | if ($keyword eq "JPAKE" && $no_jpake) { return 0; } | ||
1206 | if ($keyword eq "SRP" && $no_srp) { return 0; } | ||
1207 | if ($keyword eq "SCTP" && $no_sctp) { return 0; } | ||
1208 | if ($keyword eq "DEPRECATED" && $no_deprecated) { return 0; } | ||
1209 | |||
1210 | # Nothing recognise as true | ||
1211 | return 1; | ||
1212 | } | ||
1213 | } | ||
1214 | |||
1215 | foreach $k (@keywords) { | ||
1216 | if ($k =~ /^!(.*)$/) { | ||
1217 | $falsesum += &recognise($1,$platforms); | ||
1218 | } else { | ||
1219 | $truesum *= &recognise($k,$platforms); | ||
1220 | } | ||
1221 | } | ||
1222 | print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug; | ||
1223 | return (!$falsesum) && $truesum; | ||
1224 | } | ||
1225 | |||
1226 | sub print_test_file | ||
1227 | { | ||
1228 | (*OUT,my $name,*nums,my $testall,my @symbols)=@_; | ||
1229 | my $n = 1; my @e; my @r; | ||
1230 | my $sym; my $prev = ""; my $prefSSLeay; | ||
1231 | |||
1232 | (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols); | ||
1233 | (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:.*/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols); | ||
1234 | @symbols=((sort @e),(sort @r)); | ||
1235 | |||
1236 | foreach $sym (@symbols) { | ||
1237 | (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; | ||
1238 | my $v = 0; | ||
1239 | $v = 1 if $i=~ /^.*?:.*?:VARIABLE/; | ||
1240 | my $p = ($i =~ /^[^:]*:([^:]*):/,$1); | ||
1241 | my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1); | ||
1242 | if (!defined($nums{$s})) { | ||
1243 | print STDERR "Warning: $s does not have a number assigned\n" | ||
1244 | if(!$do_update); | ||
1245 | } elsif (is_valid($p,1) && is_valid($a,0)) { | ||
1246 | my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1); | ||
1247 | if ($prev eq $s2) { | ||
1248 | print OUT "\t/* The following has already appeared previously */\n"; | ||
1249 | print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n"; | ||
1250 | } | ||
1251 | $prev = $s2; # To warn about duplicates... | ||
1252 | |||
1253 | ($nn,$ni)=($nums{$s2} =~ /^(.*?)\\(.*)$/); | ||
1254 | if ($v) { | ||
1255 | print OUT "\textern int $s2; /* type unknown */ /* $nn $ni */\n"; | ||
1256 | } else { | ||
1257 | print OUT "\textern int $s2(); /* type unknown */ /* $nn $ni */\n"; | ||
1258 | } | ||
1259 | } | ||
1260 | } | ||
1261 | } | ||
1262 | |||
1263 | sub get_version { | ||
1264 | local *MF; | ||
1265 | my $v = '?'; | ||
1266 | open MF, 'Makefile' or return $v; | ||
1267 | while (<MF>) { | ||
1268 | $v = $1, last if /^VERSION=(.*?)\s*$/; | ||
1269 | } | ||
1270 | close MF; | ||
1271 | return $v; | ||
1272 | } | ||
1273 | |||
1274 | sub print_def_file | ||
1275 | { | ||
1276 | (*OUT,my $name,*nums,my @symbols)=@_; | ||
1277 | my $n = 1; my @e; my @r; my @v; my $prev=""; | ||
1278 | my $liboptions=""; | ||
1279 | my $libname = $name; | ||
1280 | my $http_vendor = 'www.openssl.org/'; | ||
1281 | my $version = get_version(); | ||
1282 | my $what = "OpenSSL: implementation of Secure Socket Layer"; | ||
1283 | my $description = "$what $version, $name - http://$http_vendor"; | ||
1284 | |||
1285 | if ($W32) | ||
1286 | { $libname.="32"; } | ||
1287 | elsif ($W16) | ||
1288 | { $libname.="16"; } | ||
1289 | elsif ($OS2) | ||
1290 | { # DLL names should not clash on the whole system. | ||
1291 | # However, they should not have any particular relationship | ||
1292 | # to the name of the static library. Chose descriptive names | ||
1293 | # (must be at most 8 chars). | ||
1294 | my %translate = (ssl => 'open_ssl', crypto => 'cryptssl'); | ||
1295 | $libname = $translate{$name} || $name; | ||
1296 | $liboptions = <<EOO; | ||
1297 | INITINSTANCE | ||
1298 | DATA MULTIPLE NONSHARED | ||
1299 | EOO | ||
1300 | # Vendor field can't contain colon, drat; so we omit http:// | ||
1301 | $description = "\@#$http_vendor:$version#\@$what; DLL for library $name. Build for EMX -Zmtd"; | ||
1302 | } | ||
1303 | |||
1304 | print OUT <<"EOF"; | ||
1305 | ; | ||
1306 | ; Definition file for the DLL version of the $name library from OpenSSL | ||
1307 | ; | ||
1308 | |||
1309 | LIBRARY $libname $liboptions | ||
1310 | |||
1311 | EOF | ||
1312 | |||
1313 | if ($W16) { | ||
1314 | print <<"EOF"; | ||
1315 | CODE PRELOAD MOVEABLE | ||
1316 | DATA PRELOAD MOVEABLE SINGLE | ||
1317 | |||
1318 | EXETYPE WINDOWS | ||
1319 | |||
1320 | HEAPSIZE 4096 | ||
1321 | STACKSIZE 8192 | ||
1322 | |||
1323 | EOF | ||
1324 | } | ||
1325 | |||
1326 | print "EXPORTS\n"; | ||
1327 | |||
1328 | (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:FUNCTION/,@symbols); | ||
1329 | (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:FUNCTION/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:FUNCTION/,@symbols); | ||
1330 | (@v)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:VARIABLE/,@symbols); | ||
1331 | @symbols=((sort @e),(sort @r), (sort @v)); | ||
1332 | |||
1333 | |||
1334 | foreach $sym (@symbols) { | ||
1335 | (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; | ||
1336 | my $v = 0; | ||
1337 | $v = 1 if $i =~ /^.*?:.*?:VARIABLE/; | ||
1338 | if (!defined($nums{$s})) { | ||
1339 | printf STDERR "Warning: $s does not have a number assigned\n" | ||
1340 | if(!$do_update); | ||
1341 | } else { | ||
1342 | (my $n, my $dummy) = split /\\/, $nums{$s}; | ||
1343 | my %pf = (); | ||
1344 | my $p = ($i =~ /^[^:]*:([^:]*):/,$1); | ||
1345 | my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1); | ||
1346 | if (is_valid($p,1) && is_valid($a,0)) { | ||
1347 | my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1); | ||
1348 | if ($prev eq $s2) { | ||
1349 | print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n"; | ||
1350 | } | ||
1351 | $prev = $s2; # To warn about duplicates... | ||
1352 | if($v && !$OS2) { | ||
1353 | printf OUT " %s%-39s @%-8d DATA\n",($W32)?"":"_",$s2,$n; | ||
1354 | } else { | ||
1355 | printf OUT " %s%-39s @%d\n",($W32||$OS2)?"":"_",$s2,$n; | ||
1356 | } | ||
1357 | } | ||
1358 | } | ||
1359 | } | ||
1360 | printf OUT "\n"; | ||
1361 | } | ||
1362 | |||
1363 | sub load_numbers | ||
1364 | { | ||
1365 | my($name)=@_; | ||
1366 | my(@a,%ret); | ||
1367 | |||
1368 | $max_num = 0; | ||
1369 | $num_noinfo = 0; | ||
1370 | $prev = ""; | ||
1371 | $prev_cnt = 0; | ||
1372 | |||
1373 | open(IN,"<$name") || die "unable to open $name:$!\n"; | ||
1374 | while (<IN>) { | ||
1375 | chop; | ||
1376 | s/#.*$//; | ||
1377 | next if /^\s*$/; | ||
1378 | @a=split; | ||
1379 | if (defined $ret{$a[0]}) { | ||
1380 | # This is actually perfectly OK | ||
1381 | #print STDERR "Warning: Symbol '",$a[0],"' redefined. old=",$ret{$a[0]},", new=",$a[1],"\n"; | ||
1382 | } | ||
1383 | if ($max_num > $a[1]) { | ||
1384 | print STDERR "Warning: Number decreased from ",$max_num," to ",$a[1],"\n"; | ||
1385 | } | ||
1386 | elsif ($max_num == $a[1]) { | ||
1387 | # This is actually perfectly OK | ||
1388 | #print STDERR "Warning: Symbol ",$a[0]," has same number as previous ",$prev,": ",$a[1],"\n"; | ||
1389 | if ($a[0] eq $prev) { | ||
1390 | $prev_cnt++; | ||
1391 | $a[0] .= "{$prev_cnt}"; | ||
1392 | } | ||
1393 | } | ||
1394 | else { | ||
1395 | $prev_cnt = 0; | ||
1396 | } | ||
1397 | if ($#a < 2) { | ||
1398 | # Existence will be proven later, in do_defs | ||
1399 | $ret{$a[0]}=$a[1]; | ||
1400 | $num_noinfo++; | ||
1401 | } else { | ||
1402 | $ret{$a[0]}=$a[1]."\\".$a[2]; # \\ is a special marker | ||
1403 | } | ||
1404 | $max_num = $a[1] if $a[1] > $max_num; | ||
1405 | $prev=$a[0]; | ||
1406 | } | ||
1407 | if ($num_noinfo) { | ||
1408 | print STDERR "Warning: $num_noinfo symbols were without info."; | ||
1409 | if ($do_rewrite) { | ||
1410 | printf STDERR " The rewrite will fix this.\n"; | ||
1411 | } else { | ||
1412 | printf STDERR " You should do a rewrite to fix this.\n"; | ||
1413 | } | ||
1414 | } | ||
1415 | close(IN); | ||
1416 | return(%ret); | ||
1417 | } | ||
1418 | |||
1419 | sub parse_number | ||
1420 | { | ||
1421 | (my $str, my $what) = @_; | ||
1422 | (my $n, my $i) = split(/\\/,$str); | ||
1423 | if ($what eq "n") { | ||
1424 | return $n; | ||
1425 | } else { | ||
1426 | return $i; | ||
1427 | } | ||
1428 | } | ||
1429 | |||
1430 | sub rewrite_numbers | ||
1431 | { | ||
1432 | (*OUT,$name,*nums,@symbols)=@_; | ||
1433 | my $thing; | ||
1434 | |||
1435 | print STDERR "Rewriting $name\n"; | ||
1436 | |||
1437 | my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols); | ||
1438 | my $r; my %r; my %rsyms; | ||
1439 | foreach $r (@r) { | ||
1440 | (my $s, my $i) = split /\\/, $r; | ||
1441 | my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/; | ||
1442 | $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/; | ||
1443 | $r{$a} = $s."\\".$i; | ||
1444 | $rsyms{$s} = 1; | ||
1445 | } | ||
1446 | |||
1447 | my %syms = (); | ||
1448 | foreach $_ (@symbols) { | ||
1449 | (my $n, my $i) = split /\\/; | ||
1450 | $syms{$n} = 1; | ||
1451 | } | ||
1452 | |||
1453 | my @s=sort { | ||
1454 | &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") | ||
1455 | || $a cmp $b | ||
1456 | } keys %nums; | ||
1457 | foreach $sym (@s) { | ||
1458 | (my $n, my $i) = split /\\/, $nums{$sym}; | ||
1459 | next if defined($i) && $i =~ /^.*?:.*?:\w+\(\w+\)/; | ||
1460 | next if defined($rsyms{$sym}); | ||
1461 | print STDERR "DEBUG: rewrite_numbers for sym = ",$sym,": i = ",$i,", n = ",$n,", rsym{sym} = ",$rsyms{$sym},"syms{sym} = ",$syms{$sym},"\n" if $debug; | ||
1462 | $i="NOEXIST::FUNCTION:" | ||
1463 | if !defined($i) || $i eq "" || !defined($syms{$sym}); | ||
1464 | my $s2 = $sym; | ||
1465 | $s2 =~ s/\{[0-9]+\}$//; | ||
1466 | printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i; | ||
1467 | if (exists $r{$sym}) { | ||
1468 | (my $s, $i) = split /\\/,$r{$sym}; | ||
1469 | my $s2 = $s; | ||
1470 | $s2 =~ s/\{[0-9]+\}$//; | ||
1471 | printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i; | ||
1472 | } | ||
1473 | } | ||
1474 | } | ||
1475 | |||
1476 | sub update_numbers | ||
1477 | { | ||
1478 | (*OUT,$name,*nums,my $start_num, my @symbols)=@_; | ||
1479 | my $new_syms = 0; | ||
1480 | |||
1481 | print STDERR "Updating $name numbers\n"; | ||
1482 | |||
1483 | my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols); | ||
1484 | my $r; my %r; my %rsyms; | ||
1485 | foreach $r (@r) { | ||
1486 | (my $s, my $i) = split /\\/, $r; | ||
1487 | my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/; | ||
1488 | $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/; | ||
1489 | $r{$a} = $s."\\".$i; | ||
1490 | $rsyms{$s} = 1; | ||
1491 | } | ||
1492 | |||
1493 | foreach $sym (@symbols) { | ||
1494 | (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; | ||
1495 | next if $i =~ /^.*?:.*?:\w+\(\w+\)/; | ||
1496 | next if defined($rsyms{$sym}); | ||
1497 | die "ERROR: Symbol $sym had no info attached to it." | ||
1498 | if $i eq ""; | ||
1499 | if (!exists $nums{$s}) { | ||
1500 | $new_syms++; | ||
1501 | my $s2 = $s; | ||
1502 | $s2 =~ s/\{[0-9]+\}$//; | ||
1503 | printf OUT "%s%-39s %d\t%s\n","",$s2, ++$start_num,$i; | ||
1504 | if (exists $r{$s}) { | ||
1505 | ($s, $i) = split /\\/,$r{$s}; | ||
1506 | $s =~ s/\{[0-9]+\}$//; | ||
1507 | printf OUT "%s%-39s %d\t%s\n","",$s, $start_num,$i; | ||
1508 | } | ||
1509 | } | ||
1510 | } | ||
1511 | if($new_syms) { | ||
1512 | print STDERR "$new_syms New symbols added\n"; | ||
1513 | } else { | ||
1514 | print STDERR "No New symbols Added\n"; | ||
1515 | } | ||
1516 | } | ||
1517 | |||
1518 | sub check_existing | ||
1519 | { | ||
1520 | (*nums, my @symbols)=@_; | ||
1521 | my %existing; my @remaining; | ||
1522 | @remaining=(); | ||
1523 | foreach $sym (@symbols) { | ||
1524 | (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; | ||
1525 | $existing{$s}=1; | ||
1526 | } | ||
1527 | foreach $sym (keys %nums) { | ||
1528 | if (!exists $existing{$sym}) { | ||
1529 | push @remaining, $sym; | ||
1530 | } | ||
1531 | } | ||
1532 | if(@remaining) { | ||
1533 | print STDERR "The following symbols do not seem to exist:\n"; | ||
1534 | foreach $sym (@remaining) { | ||
1535 | print STDERR "\t",$sym,"\n"; | ||
1536 | } | ||
1537 | } | ||
1538 | } | ||
1539 | |||
diff --git a/src/lib/libcrypto/util/mkdir-p.pl b/src/lib/libcrypto/util/mkdir-p.pl deleted file mode 100644 index e73d02b073..0000000000 --- a/src/lib/libcrypto/util/mkdir-p.pl +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | # mkdir-p.pl | ||
4 | |||
5 | # On some systems, the -p option to mkdir (= also create any missing parent | ||
6 | # directories) is not available. | ||
7 | |||
8 | my $arg; | ||
9 | |||
10 | foreach $arg (@ARGV) { | ||
11 | $arg =~ tr|\\|/|; | ||
12 | &do_mkdir_p($arg); | ||
13 | } | ||
14 | |||
15 | |||
16 | sub do_mkdir_p { | ||
17 | local($dir) = @_; | ||
18 | |||
19 | $dir =~ s|/*\Z(?!\n)||s; | ||
20 | |||
21 | if (-d $dir) { | ||
22 | return; | ||
23 | } | ||
24 | |||
25 | if ($dir =~ m|[^/]/|s) { | ||
26 | local($parent) = $dir; | ||
27 | $parent =~ s|[^/]*\Z(?!\n)||s; | ||
28 | |||
29 | do_mkdir_p($parent); | ||
30 | } | ||
31 | |||
32 | mkdir($dir, 0777) || die "Cannot create directory $dir: $!\n"; | ||
33 | print "created directory `$dir'\n"; | ||
34 | } | ||
diff --git a/src/lib/libcrypto/util/mkfiles.pl b/src/lib/libcrypto/util/mkfiles.pl deleted file mode 100644 index 3214f69ea5..0000000000 --- a/src/lib/libcrypto/util/mkfiles.pl +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # This is a hacked version of files.pl for systems that can't do a 'make files'. | ||
4 | # Do a perl util/mkminfo.pl >MINFO to build MINFO | ||
5 | # Written by Steve Henson 1999. | ||
6 | |||
7 | # List of directories to process | ||
8 | |||
9 | my @dirs = ( | ||
10 | ".", | ||
11 | "crypto", | ||
12 | "crypto/md2", | ||
13 | "crypto/md4", | ||
14 | "crypto/md5", | ||
15 | "crypto/sha", | ||
16 | "crypto/mdc2", | ||
17 | "crypto/hmac", | ||
18 | "crypto/cmac", | ||
19 | "crypto/ripemd", | ||
20 | "crypto/des", | ||
21 | "crypto/rc2", | ||
22 | "crypto/rc4", | ||
23 | "crypto/rc5", | ||
24 | "crypto/idea", | ||
25 | "crypto/bf", | ||
26 | "crypto/cast", | ||
27 | "crypto/aes", | ||
28 | "crypto/camellia", | ||
29 | "crypto/seed", | ||
30 | "crypto/modes", | ||
31 | "crypto/bn", | ||
32 | "crypto/rsa", | ||
33 | "crypto/dsa", | ||
34 | "crypto/dso", | ||
35 | "crypto/dh", | ||
36 | "crypto/ec", | ||
37 | "crypto/ecdh", | ||
38 | "crypto/ecdsa", | ||
39 | "crypto/buffer", | ||
40 | "crypto/bio", | ||
41 | "crypto/stack", | ||
42 | "crypto/lhash", | ||
43 | "crypto/rand", | ||
44 | "crypto/err", | ||
45 | "crypto/objects", | ||
46 | "crypto/evp", | ||
47 | "crypto/asn1", | ||
48 | "crypto/pem", | ||
49 | "crypto/x509", | ||
50 | "crypto/x509v3", | ||
51 | "crypto/cms", | ||
52 | "crypto/conf", | ||
53 | "crypto/jpake", | ||
54 | "crypto/txt_db", | ||
55 | "crypto/pkcs7", | ||
56 | "crypto/pkcs12", | ||
57 | "crypto/comp", | ||
58 | "crypto/engine", | ||
59 | "crypto/ocsp", | ||
60 | "crypto/ui", | ||
61 | "crypto/krb5", | ||
62 | #"crypto/store", | ||
63 | "crypto/pqueue", | ||
64 | "crypto/whrlpool", | ||
65 | "crypto/ts", | ||
66 | "crypto/srp", | ||
67 | "ssl", | ||
68 | "apps", | ||
69 | "engines", | ||
70 | "test", | ||
71 | "tools" | ||
72 | ); | ||
73 | |||
74 | %top; | ||
75 | |||
76 | foreach (@dirs) { | ||
77 | &files_dir ($_, "Makefile"); | ||
78 | } | ||
79 | |||
80 | exit(0); | ||
81 | |||
82 | sub files_dir | ||
83 | { | ||
84 | my ($dir, $makefile) = @_; | ||
85 | |||
86 | my %sym; | ||
87 | |||
88 | open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile"; | ||
89 | |||
90 | my $s=""; | ||
91 | |||
92 | while (<IN>) | ||
93 | { | ||
94 | chop; | ||
95 | s/#.*//; | ||
96 | if (/^(\S+)\s*=\s*(.*)$/) | ||
97 | { | ||
98 | $o=""; | ||
99 | ($s,$b)=($1,$2); | ||
100 | for (;;) | ||
101 | { | ||
102 | if ($b =~ /\\$/) | ||
103 | { | ||
104 | chop($b); | ||
105 | $o.=$b." "; | ||
106 | $b=<IN>; | ||
107 | chop($b); | ||
108 | } | ||
109 | else | ||
110 | { | ||
111 | $o.=$b." "; | ||
112 | last; | ||
113 | } | ||
114 | } | ||
115 | $o =~ s/^\s+//; | ||
116 | $o =~ s/\s+$//; | ||
117 | $o =~ s/\s+/ /g; | ||
118 | |||
119 | $o =~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge; | ||
120 | $sym{$s}=($top{$s} or $o); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | print "RELATIVE_DIRECTORY=$dir\n"; | ||
125 | |||
126 | foreach (sort keys %sym) | ||
127 | { | ||
128 | print "$_=$sym{$_}\n"; | ||
129 | } | ||
130 | if ($dir eq "." && defined($sym{"BUILDENV"})) | ||
131 | { | ||
132 | foreach (split(' ',$sym{"BUILDENV"})) | ||
133 | { | ||
134 | /^(.+)=/; | ||
135 | $top{$1}=$sym{$1}; | ||
136 | } | ||
137 | } | ||
138 | |||
139 | print "RELATIVE_DIRECTORY=\n"; | ||
140 | |||
141 | close (IN); | ||
142 | } | ||
diff --git a/src/lib/libcrypto/util/mklink.pl b/src/lib/libcrypto/util/mklink.pl deleted file mode 100644 index 61db12c68f..0000000000 --- a/src/lib/libcrypto/util/mklink.pl +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | # mklink.pl | ||
4 | |||
5 | # The first command line argument is a non-empty relative path | ||
6 | # specifying the "from" directory. | ||
7 | # Each other argument is a file name not containing / and | ||
8 | # names a file in the current directory. | ||
9 | # | ||
10 | # For each of these files, we create in the "from" directory a link | ||
11 | # of the same name pointing to the local file. | ||
12 | # | ||
13 | # We assume that the directory structure is a tree, i.e. that it does | ||
14 | # not contain symbolic links and that the parent of / is never referenced. | ||
15 | # Apart from this, this script should be able to handle even the most | ||
16 | # pathological cases. | ||
17 | |||
18 | use Cwd; | ||
19 | |||
20 | my $from = shift; | ||
21 | my @files = @ARGV; | ||
22 | |||
23 | my @from_path = split(/[\\\/]/, $from); | ||
24 | my $pwd = getcwd(); | ||
25 | chomp($pwd); | ||
26 | my @pwd_path = split(/[\\\/]/, $pwd); | ||
27 | |||
28 | my @to_path = (); | ||
29 | |||
30 | my $dirname; | ||
31 | foreach $dirname (@from_path) { | ||
32 | |||
33 | # In this loop, @to_path always is a relative path from | ||
34 | # @pwd_path (interpreted is an absolute path) to the original pwd. | ||
35 | |||
36 | # At the end, @from_path (as a relative path from the original pwd) | ||
37 | # designates the same directory as the absolute path @pwd_path, | ||
38 | # which means that @to_path then is a path from there to the original pwd. | ||
39 | |||
40 | next if ($dirname eq "" || $dirname eq "."); | ||
41 | |||
42 | if ($dirname eq "..") { | ||
43 | @to_path = (pop(@pwd_path), @to_path); | ||
44 | } else { | ||
45 | @to_path = ("..", @to_path); | ||
46 | push(@pwd_path, $dirname); | ||
47 | } | ||
48 | } | ||
49 | |||
50 | my $to = join('/', @to_path); | ||
51 | |||
52 | my $file; | ||
53 | $symlink_exists=eval {symlink("",""); 1}; | ||
54 | if ($^O eq "msys") { $symlink_exists=0 }; | ||
55 | foreach $file (@files) { | ||
56 | my $err = ""; | ||
57 | if ($symlink_exists) { | ||
58 | unlink "$from/$file"; | ||
59 | symlink("$to/$file", "$from/$file") or $err = " [$!]"; | ||
60 | } else { | ||
61 | unlink "$from/$file"; | ||
62 | open (OLD, "<$file") or die "Can't open $file: $!"; | ||
63 | open (NEW, ">$from/$file") or die "Can't open $from/$file: $!"; | ||
64 | binmode(OLD); | ||
65 | binmode(NEW); | ||
66 | while (<OLD>) { | ||
67 | print NEW $_; | ||
68 | } | ||
69 | close (OLD) or die "Can't close $file: $!"; | ||
70 | close (NEW) or die "Can't close $from/$file: $!"; | ||
71 | } | ||
72 | print $file . " => $from/$file$err\n"; | ||
73 | } | ||
diff --git a/src/lib/libcrypto/util/mkrc.pl b/src/lib/libcrypto/util/mkrc.pl deleted file mode 100755 index 0ceadcf8d1..0000000000 --- a/src/lib/libcrypto/util/mkrc.pl +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | #!/bin/env perl | ||
2 | # | ||
3 | open FD,"crypto/opensslv.h"; | ||
4 | while(<FD>) { | ||
5 | if (/OPENSSL_VERSION_NUMBER\s+(0x[0-9a-f]+)/i) { | ||
6 | $ver = hex($1); | ||
7 | $v1 = ($ver>>28); | ||
8 | $v2 = ($ver>>20)&0xff; | ||
9 | $v3 = ($ver>>12)&0xff; | ||
10 | $v4 = ($ver>> 4)&0xff; | ||
11 | $beta = $ver&0xf; | ||
12 | $version = "$v1.$v2.$v3"; | ||
13 | if ($beta==0xf) { $version .= chr(ord('a')+$v4-1) if ($v4); } | ||
14 | elsif ($beta==0){ $version .= "-dev"; } | ||
15 | else { $version .= "-beta$beta"; } | ||
16 | last; | ||
17 | } | ||
18 | } | ||
19 | close(FD); | ||
20 | |||
21 | $filename = $ARGV[0]; $filename =~ /(.*)\.([^.]+)$/; | ||
22 | $basename = $1; | ||
23 | $extname = $2; | ||
24 | |||
25 | if ($extname =~ /dll/i) { $description = "OpenSSL shared library"; } | ||
26 | else { $description = "OpenSSL application"; } | ||
27 | |||
28 | print <<___; | ||
29 | #include <winver.h> | ||
30 | |||
31 | LANGUAGE 0x09,0x01 | ||
32 | |||
33 | 1 VERSIONINFO | ||
34 | FILEVERSION $v1,$v2,$v3,$v4 | ||
35 | PRODUCTVERSION $v1,$v2,$v3,$v4 | ||
36 | FILEFLAGSMASK 0x3fL | ||
37 | #ifdef _DEBUG | ||
38 | FILEFLAGS 0x01L | ||
39 | #else | ||
40 | FILEFLAGS 0x00L | ||
41 | #endif | ||
42 | FILEOS VOS__WINDOWS32 | ||
43 | FILETYPE VFT_DLL | ||
44 | FILESUBTYPE 0x0L | ||
45 | BEGIN | ||
46 | BLOCK "StringFileInfo" | ||
47 | BEGIN | ||
48 | BLOCK "040904b0" | ||
49 | BEGIN | ||
50 | // Required: | ||
51 | VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0" | ||
52 | VALUE "FileDescription", "$description\\0" | ||
53 | VALUE "FileVersion", "$version\\0" | ||
54 | VALUE "InternalName", "$basename\\0" | ||
55 | VALUE "OriginalFilename", "$filename\\0" | ||
56 | VALUE "ProductName", "The OpenSSL Toolkit\\0" | ||
57 | VALUE "ProductVersion", "$version\\0" | ||
58 | // Optional: | ||
59 | //VALUE "Comments", "\\0" | ||
60 | VALUE "LegalCopyright", "Copyright © 1998-2006 The OpenSSL Project. Copyright © 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0" | ||
61 | //VALUE "LegalTrademarks", "\\0" | ||
62 | //VALUE "PrivateBuild", "\\0" | ||
63 | //VALUE "SpecialBuild", "\\0" | ||
64 | END | ||
65 | END | ||
66 | BLOCK "VarFileInfo" | ||
67 | BEGIN | ||
68 | VALUE "Translation", 0x409, 0x4b0 | ||
69 | END | ||
70 | END | ||
71 | ___ | ||
diff --git a/src/lib/libcrypto/util/perlpath.pl b/src/lib/libcrypto/util/perlpath.pl deleted file mode 100644 index a1f236bd98..0000000000 --- a/src/lib/libcrypto/util/perlpath.pl +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # modify the '#!/usr/local/bin/perl' | ||
4 | # line in all scripts that rely on perl. | ||
5 | # | ||
6 | |||
7 | require "find.pl"; | ||
8 | |||
9 | $#ARGV == 0 || print STDERR "usage: perlpath newpath (eg /usr/bin)\n"; | ||
10 | &find("."); | ||
11 | |||
12 | sub wanted | ||
13 | { | ||
14 | return unless /\.pl$/ || /^[Cc]onfigur/; | ||
15 | |||
16 | open(IN,"<$_") || die "unable to open $dir/$_:$!\n"; | ||
17 | @a=<IN>; | ||
18 | close(IN); | ||
19 | |||
20 | if (-d $ARGV[0]) { | ||
21 | $a[0]="#!$ARGV[0]/perl\n"; | ||
22 | } | ||
23 | else { | ||
24 | $a[0]="#!$ARGV[0]\n"; | ||
25 | } | ||
26 | |||
27 | # Playing it safe... | ||
28 | $new="$_.new"; | ||
29 | open(OUT,">$new") || die "unable to open $dir/$new:$!\n"; | ||
30 | print OUT @a; | ||
31 | close(OUT); | ||
32 | |||
33 | rename($new,$_) || die "unable to rename $dir/$new:$!\n"; | ||
34 | chmod(0755,$_) || die "unable to chmod $dir/$new:$!\n"; | ||
35 | } | ||
diff --git a/src/lib/libcrypto/util/pod2man.pl b/src/lib/libcrypto/util/pod2man.pl deleted file mode 100644 index 025d914f2e..0000000000 --- a/src/lib/libcrypto/util/pod2man.pl +++ /dev/null | |||
@@ -1,1184 +0,0 @@ | |||
1 | : #!/usr/bin/perl-5.005 | ||
2 | eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' | ||
3 | if $running_under_some_shell; | ||
4 | |||
5 | $DEF_PM_SECTION = '3pm' || '3'; | ||
6 | |||
7 | =head1 NAME | ||
8 | |||
9 | pod2man - translate embedded Perl pod directives into man pages | ||
10 | |||
11 | =head1 SYNOPSIS | ||
12 | |||
13 | B<pod2man> | ||
14 | [ B<--section=>I<manext> ] | ||
15 | [ B<--release=>I<relpatch> ] | ||
16 | [ B<--center=>I<string> ] | ||
17 | [ B<--date=>I<string> ] | ||
18 | [ B<--fixed=>I<font> ] | ||
19 | [ B<--official> ] | ||
20 | [ B<--lax> ] | ||
21 | I<inputfile> | ||
22 | |||
23 | =head1 DESCRIPTION | ||
24 | |||
25 | B<pod2man> converts its input file containing embedded pod directives (see | ||
26 | L<perlpod>) into nroff source suitable for viewing with nroff(1) or | ||
27 | troff(1) using the man(7) macro set. | ||
28 | |||
29 | Besides the obvious pod conversions, B<pod2man> also takes care of | ||
30 | func(), func(n), and simple variable references like $foo or @bar so | ||
31 | you don't have to use code escapes for them; complex expressions like | ||
32 | C<$fred{'stuff'}> will still need to be escaped, though. Other nagging | ||
33 | little roffish things that it catches include translating the minus in | ||
34 | something like foo-bar, making a long dash--like this--into a real em | ||
35 | dash, fixing up "paired quotes", putting a little space after the | ||
36 | parens in something like func(), making C++ and PI look right, making | ||
37 | double underbars have a little tiny space between them, making ALLCAPS | ||
38 | a teeny bit smaller in troff(1), and escaping backslashes so you don't | ||
39 | have to. | ||
40 | |||
41 | =head1 OPTIONS | ||
42 | |||
43 | =over 8 | ||
44 | |||
45 | =item center | ||
46 | |||
47 | Set the centered header to a specific string. The default is | ||
48 | "User Contributed Perl Documentation", unless the C<--official> flag is | ||
49 | given, in which case the default is "Perl Programmers Reference Guide". | ||
50 | |||
51 | =item date | ||
52 | |||
53 | Set the left-hand footer string to this value. By default, | ||
54 | the modification date of the input file will be used. | ||
55 | |||
56 | =item fixed | ||
57 | |||
58 | The fixed font to use for code refs. Defaults to CW. | ||
59 | |||
60 | =item official | ||
61 | |||
62 | Set the default header to indicate that this page is of | ||
63 | the standard release in case C<--center> is not given. | ||
64 | |||
65 | =item release | ||
66 | |||
67 | Set the centered footer. By default, this is the current | ||
68 | perl release. | ||
69 | |||
70 | =item section | ||
71 | |||
72 | Set the section for the C<.TH> macro. The standard conventions on | ||
73 | sections are to use 1 for user commands, 2 for system calls, 3 for | ||
74 | functions, 4 for devices, 5 for file formats, 6 for games, 7 for | ||
75 | miscellaneous information, and 8 for administrator commands. This works | ||
76 | best if you put your Perl man pages in a separate tree, like | ||
77 | F</usr/local/perl/man/>. By default, section 1 will be used | ||
78 | unless the file ends in F<.pm> in which case section 3 will be selected. | ||
79 | |||
80 | =item lax | ||
81 | |||
82 | Don't complain when required sections aren't present. | ||
83 | |||
84 | =back | ||
85 | |||
86 | =head1 Anatomy of a Proper Man Page | ||
87 | |||
88 | For those not sure of the proper layout of a man page, here's | ||
89 | an example of the skeleton of a proper man page. Head of the | ||
90 | major headers should be setout as a C<=head1> directive, and | ||
91 | are historically written in the rather startling ALL UPPER CASE | ||
92 | format, although this is not mandatory. | ||
93 | Minor headers may be included using C<=head2>, and are | ||
94 | typically in mixed case. | ||
95 | |||
96 | =over 10 | ||
97 | |||
98 | =item NAME | ||
99 | |||
100 | Mandatory section; should be a comma-separated list of programs or | ||
101 | functions documented by this podpage, such as: | ||
102 | |||
103 | foo, bar - programs to do something | ||
104 | |||
105 | =item SYNOPSIS | ||
106 | |||
107 | A short usage summary for programs and functions, which | ||
108 | may someday be deemed mandatory. | ||
109 | |||
110 | =item DESCRIPTION | ||
111 | |||
112 | Long drawn out discussion of the program. It's a good idea to break this | ||
113 | up into subsections using the C<=head2> directives, like | ||
114 | |||
115 | =head2 A Sample Subection | ||
116 | |||
117 | =head2 Yet Another Sample Subection | ||
118 | |||
119 | =item OPTIONS | ||
120 | |||
121 | Some people make this separate from the description. | ||
122 | |||
123 | =item RETURN VALUE | ||
124 | |||
125 | What the program or function returns if successful. | ||
126 | |||
127 | =item ERRORS | ||
128 | |||
129 | Exceptions, return codes, exit stati, and errno settings. | ||
130 | |||
131 | =item EXAMPLES | ||
132 | |||
133 | Give some example uses of the program. | ||
134 | |||
135 | =item ENVIRONMENT | ||
136 | |||
137 | Envariables this program might care about. | ||
138 | |||
139 | =item FILES | ||
140 | |||
141 | All files used by the program. You should probably use the FE<lt>E<gt> | ||
142 | for these. | ||
143 | |||
144 | =item SEE ALSO | ||
145 | |||
146 | Other man pages to check out, like man(1), man(7), makewhatis(8), or catman(8). | ||
147 | |||
148 | =item NOTES | ||
149 | |||
150 | Miscellaneous commentary. | ||
151 | |||
152 | =item CAVEATS | ||
153 | |||
154 | Things to take special care with; sometimes called WARNINGS. | ||
155 | |||
156 | =item DIAGNOSTICS | ||
157 | |||
158 | All possible messages the program can print out--and | ||
159 | what they mean. | ||
160 | |||
161 | =item BUGS | ||
162 | |||
163 | Things that are broken or just don't work quite right. | ||
164 | |||
165 | =item RESTRICTIONS | ||
166 | |||
167 | Bugs you don't plan to fix :-) | ||
168 | |||
169 | =item AUTHOR | ||
170 | |||
171 | Who wrote it (or AUTHORS if multiple). | ||
172 | |||
173 | =item HISTORY | ||
174 | |||
175 | Programs derived from other sources sometimes have this, or | ||
176 | you might keep a modification log here. | ||
177 | |||
178 | =back | ||
179 | |||
180 | =head1 EXAMPLES | ||
181 | |||
182 | pod2man program > program.1 | ||
183 | pod2man some_module.pm > /usr/perl/man/man3/some_module.3 | ||
184 | pod2man --section=7 note.pod > note.7 | ||
185 | |||
186 | =head1 DIAGNOSTICS | ||
187 | |||
188 | The following diagnostics are generated by B<pod2man>. Items | ||
189 | marked "(W)" are non-fatal, whereas the "(F)" errors will cause | ||
190 | B<pod2man> to immediately exit with a non-zero status. | ||
191 | |||
192 | =over 4 | ||
193 | |||
194 | =item bad option in paragraph %d of %s: ``%s'' should be [%s]<%s> | ||
195 | |||
196 | (W) If you start include an option, you should set it off | ||
197 | as bold, italic, or code. | ||
198 | |||
199 | =item can't open %s: %s | ||
200 | |||
201 | (F) The input file wasn't available for the given reason. | ||
202 | |||
203 | =item Improper man page - no dash in NAME header in paragraph %d of %s | ||
204 | |||
205 | (W) The NAME header did not have an isolated dash in it. This is | ||
206 | considered important. | ||
207 | |||
208 | =item Invalid man page - no NAME line in %s | ||
209 | |||
210 | (F) You did not include a NAME header, which is essential. | ||
211 | |||
212 | =item roff font should be 1 or 2 chars, not `%s' (F) | ||
213 | |||
214 | (F) The font specified with the C<--fixed> option was not | ||
215 | a one- or two-digit roff font. | ||
216 | |||
217 | =item %s is missing required section: %s | ||
218 | |||
219 | (W) Required sections include NAME, DESCRIPTION, and if you're | ||
220 | using a section starting with a 3, also a SYNOPSIS. Actually, | ||
221 | not having a NAME is a fatal. | ||
222 | |||
223 | =item Unknown escape: %s in %s | ||
224 | |||
225 | (W) An unknown HTML entity (probably for an 8-bit character) was given via | ||
226 | a C<EE<lt>E<gt>> directive. Besides amp, lt, gt, and quot, recognized | ||
227 | entities are Aacute, aacute, Acirc, acirc, AElig, aelig, Agrave, agrave, | ||
228 | Aring, aring, Atilde, atilde, Auml, auml, Ccedil, ccedil, Eacute, eacute, | ||
229 | Ecirc, ecirc, Egrave, egrave, ETH, eth, Euml, euml, Iacute, iacute, Icirc, | ||
230 | icirc, Igrave, igrave, Iuml, iuml, Ntilde, ntilde, Oacute, oacute, Ocirc, | ||
231 | ocirc, Ograve, ograve, Oslash, oslash, Otilde, otilde, Ouml, ouml, szlig, | ||
232 | THORN, thorn, Uacute, uacute, Ucirc, ucirc, Ugrave, ugrave, Uuml, uuml, | ||
233 | Yacute, yacute, and yuml. | ||
234 | |||
235 | =item Unmatched =back | ||
236 | |||
237 | (W) You have a C<=back> without a corresponding C<=over>. | ||
238 | |||
239 | =item Unrecognized pod directive: %s | ||
240 | |||
241 | (W) You specified a pod directive that isn't in the known list of | ||
242 | C<=head1>, C<=head2>, C<=item>, C<=over>, C<=back>, or C<=cut>. | ||
243 | |||
244 | |||
245 | =back | ||
246 | |||
247 | =head1 NOTES | ||
248 | |||
249 | If you would like to print out a lot of man page continuously, you | ||
250 | probably want to set the C and D registers to set contiguous page | ||
251 | numbering and even/odd paging, at least on some versions of man(7). | ||
252 | Settting the F register will get you some additional experimental | ||
253 | indexing: | ||
254 | |||
255 | troff -man -rC1 -rD1 -rF1 perl.1 perldata.1 perlsyn.1 ... | ||
256 | |||
257 | The indexing merely outputs messages via C<.tm> for each | ||
258 | major page, section, subsection, item, and any C<XE<lt>E<gt>> | ||
259 | directives. | ||
260 | |||
261 | |||
262 | =head1 RESTRICTIONS | ||
263 | |||
264 | None at this time. | ||
265 | |||
266 | =head1 BUGS | ||
267 | |||
268 | The =over and =back directives don't really work right. They | ||
269 | take absolute positions instead of offsets, don't nest well, and | ||
270 | making people count is suboptimal in any event. | ||
271 | |||
272 | =head1 AUTHORS | ||
273 | |||
274 | Original prototype by Larry Wall, but so massively hacked over by | ||
275 | Tom Christiansen such that Larry probably doesn't recognize it anymore. | ||
276 | |||
277 | =cut | ||
278 | |||
279 | $/ = ""; | ||
280 | $cutting = 1; | ||
281 | @Indices = (); | ||
282 | |||
283 | # We try first to get the version number from a local binary, in case we're | ||
284 | # running an installed version of Perl to produce documentation from an | ||
285 | # uninstalled newer version's pod files. | ||
286 | if ($^O ne 'plan9' and $^O ne 'dos' and $^O ne 'os2' and $^O ne 'MSWin32') { | ||
287 | my $perl = (-x './perl' && -f './perl' ) ? | ||
288 | './perl' : | ||
289 | ((-x '../perl' && -f '../perl') ? | ||
290 | '../perl' : | ||
291 | ''); | ||
292 | ($version,$patch) = `$perl -e 'print $]'` =~ /^(\d\.\d{3})(\d{2})?/ if $perl; | ||
293 | } | ||
294 | # No luck; we'll just go with the running Perl's version | ||
295 | ($version,$patch) = $] =~ /^(.{5})(\d{2})?/ unless $version; | ||
296 | $DEF_RELEASE = "perl $version"; | ||
297 | $DEF_RELEASE .= ", patch $patch" if $patch; | ||
298 | |||
299 | |||
300 | sub makedate { | ||
301 | my $secs = shift; | ||
302 | my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secs); | ||
303 | my $mname = (qw{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec})[$mon]; | ||
304 | $year += 1900; | ||
305 | return "$mday/$mname/$year"; | ||
306 | } | ||
307 | |||
308 | use Getopt::Long; | ||
309 | |||
310 | $DEF_SECTION = 1; | ||
311 | $DEF_CENTER = "User Contributed Perl Documentation"; | ||
312 | $STD_CENTER = "Perl Programmers Reference Guide"; | ||
313 | $DEF_FIXED = 'CW'; | ||
314 | $DEF_LAX = 0; | ||
315 | |||
316 | sub usage { | ||
317 | warn "$0: @_\n" if @_; | ||
318 | die <<EOF; | ||
319 | usage: $0 [options] podpage | ||
320 | Options are: | ||
321 | --section=manext (default "$DEF_SECTION") | ||
322 | --release=relpatch (default "$DEF_RELEASE") | ||
323 | --center=string (default "$DEF_CENTER") | ||
324 | --date=string (default "$DEF_DATE") | ||
325 | --fixed=font (default "$DEF_FIXED") | ||
326 | --official (default NOT) | ||
327 | --lax (default NOT) | ||
328 | EOF | ||
329 | } | ||
330 | |||
331 | $uok = GetOptions( qw( | ||
332 | section=s | ||
333 | release=s | ||
334 | center=s | ||
335 | date=s | ||
336 | fixed=s | ||
337 | official | ||
338 | lax | ||
339 | help)); | ||
340 | |||
341 | $DEF_DATE = makedate((stat($ARGV[0]))[9] || time()); | ||
342 | |||
343 | usage("Usage error!") unless $uok; | ||
344 | usage() if $opt_help; | ||
345 | usage("Need one and only one podpage argument") unless @ARGV == 1; | ||
346 | |||
347 | $section = $opt_section || ($ARGV[0] =~ /\.pm$/ | ||
348 | ? $DEF_PM_SECTION : $DEF_SECTION); | ||
349 | $RP = $opt_release || $DEF_RELEASE; | ||
350 | $center = $opt_center || ($opt_official ? $STD_CENTER : $DEF_CENTER); | ||
351 | $lax = $opt_lax || $DEF_LAX; | ||
352 | |||
353 | $CFont = $opt_fixed || $DEF_FIXED; | ||
354 | |||
355 | if (length($CFont) == 2) { | ||
356 | $CFont_embed = "\\f($CFont"; | ||
357 | } | ||
358 | elsif (length($CFont) == 1) { | ||
359 | $CFont_embed = "\\f$CFont"; | ||
360 | } | ||
361 | else { | ||
362 | die "roff font should be 1 or 2 chars, not `$CFont_embed'"; | ||
363 | } | ||
364 | |||
365 | $date = $opt_date || $DEF_DATE; | ||
366 | |||
367 | for (qw{NAME DESCRIPTION}) { | ||
368 | # for (qw{NAME DESCRIPTION AUTHOR}) { | ||
369 | $wanna_see{$_}++; | ||
370 | } | ||
371 | $wanna_see{SYNOPSIS}++ if $section =~ /^3/; | ||
372 | |||
373 | |||
374 | $name = @ARGV ? $ARGV[0] : "<STDIN>"; | ||
375 | $Filename = $name; | ||
376 | if ($section =~ /^1/) { | ||
377 | require File::Basename; | ||
378 | $name = uc File::Basename::basename($name); | ||
379 | } | ||
380 | $name =~ s/\.(pod|p[lm])$//i; | ||
381 | |||
382 | # Lose everything up to the first of | ||
383 | # */lib/*perl* standard or site_perl module | ||
384 | # */*perl*/lib from -D prefix=/opt/perl | ||
385 | # */*perl*/ random module hierarchy | ||
386 | # which works. | ||
387 | $name =~ s-//+-/-g; | ||
388 | if ($name =~ s-^.*?/lib/[^/]*perl[^/]*/--i | ||
389 | or $name =~ s-^.*?/[^/]*perl[^/]*/lib/--i | ||
390 | or $name =~ s-^.*?/[^/]*perl[^/]*/--i) { | ||
391 | # Lose ^site(_perl)?/. | ||
392 | $name =~ s-^site(_perl)?/--; | ||
393 | # Lose ^arch/. (XXX should we use Config? Just for archname?) | ||
394 | $name =~ s~^(.*-$^O|$^O-.*)/~~o; | ||
395 | # Lose ^version/. | ||
396 | $name =~ s-^\d+\.\d+/--; | ||
397 | } | ||
398 | |||
399 | # Translate Getopt/Long to Getopt::Long, etc. | ||
400 | $name =~ s(/)(::)g; | ||
401 | |||
402 | if ($name ne 'something') { | ||
403 | FCHECK: { | ||
404 | open(F, "< $ARGV[0]") || die "can't open $ARGV[0]: $!"; | ||
405 | while (<F>) { | ||
406 | next unless /^=\b/; | ||
407 | if (/^=head1\s+NAME\s*$/) { # an /m would forgive mistakes | ||
408 | $_ = <F>; | ||
409 | unless (/\s*-+\s+/) { | ||
410 | $oops++; | ||
411 | warn "$0: Improper man page - no dash in NAME header in paragraph $. of $ARGV[0]\n" | ||
412 | } else { | ||
413 | my @n = split /\s+-+\s+/; | ||
414 | if (@n != 2) { | ||
415 | $oops++; | ||
416 | warn "$0: Improper man page - malformed NAME header in paragraph $. of $ARGV[0]\n" | ||
417 | } | ||
418 | else { | ||
419 | $n[0] =~ s/\n/ /g; | ||
420 | $n[1] =~ s/\n/ /g; | ||
421 | %namedesc = @n; | ||
422 | } | ||
423 | } | ||
424 | last FCHECK; | ||
425 | } | ||
426 | next if /^=cut\b/; # DB_File and Net::Ping have =cut before NAME | ||
427 | next if /^=pod\b/; # It is OK to have =pod before NAME | ||
428 | next if /^=(for|begin|end)\s+comment\b/; # It is OK to have =for =begin or =end comment before NAME | ||
429 | die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax; | ||
430 | } | ||
431 | die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax; | ||
432 | } | ||
433 | close F; | ||
434 | } | ||
435 | |||
436 | print <<"END"; | ||
437 | .rn '' }` | ||
438 | ''' \$RCSfile\$\$Revision\$\$Date\$ | ||
439 | ''' | ||
440 | ''' \$Log\$ | ||
441 | ''' | ||
442 | .de Sh | ||
443 | .br | ||
444 | .if t .Sp | ||
445 | .ne 5 | ||
446 | .PP | ||
447 | \\fB\\\\\$1\\fR | ||
448 | .PP | ||
449 | .. | ||
450 | .de Sp | ||
451 | .if t .sp .5v | ||
452 | .if n .sp | ||
453 | .. | ||
454 | .de Ip | ||
455 | .br | ||
456 | .ie \\\\n(.\$>=3 .ne \\\\\$3 | ||
457 | .el .ne 3 | ||
458 | .IP "\\\\\$1" \\\\\$2 | ||
459 | .. | ||
460 | .de Vb | ||
461 | .ft $CFont | ||
462 | .nf | ||
463 | .ne \\\\\$1 | ||
464 | .. | ||
465 | .de Ve | ||
466 | .ft R | ||
467 | |||
468 | .fi | ||
469 | .. | ||
470 | ''' | ||
471 | ''' | ||
472 | ''' Set up \\*(-- to give an unbreakable dash; | ||
473 | ''' string Tr holds user defined translation string. | ||
474 | ''' Bell System Logo is used as a dummy character. | ||
475 | ''' | ||
476 | .tr \\(*W-|\\(bv\\*(Tr | ||
477 | .ie n \\{\\ | ||
478 | .ds -- \\(*W- | ||
479 | .ds PI pi | ||
480 | .if (\\n(.H=4u)&(1m=24u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-12u'-\\" diablo 10 pitch | ||
481 | .if (\\n(.H=4u)&(1m=20u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-8u'-\\" diablo 12 pitch | ||
482 | .ds L" "" | ||
483 | .ds R" "" | ||
484 | ''' \\*(M", \\*(S", \\*(N" and \\*(T" are the equivalent of | ||
485 | ''' \\*(L" and \\*(R", except that they are used on ".xx" lines, | ||
486 | ''' such as .IP and .SH, which do another additional levels of | ||
487 | ''' double-quote interpretation | ||
488 | .ds M" """ | ||
489 | .ds S" """ | ||
490 | .ds N" """"" | ||
491 | .ds T" """"" | ||
492 | .ds L' ' | ||
493 | .ds R' ' | ||
494 | .ds M' ' | ||
495 | .ds S' ' | ||
496 | .ds N' ' | ||
497 | .ds T' ' | ||
498 | 'br\\} | ||
499 | .el\\{\\ | ||
500 | .ds -- \\(em\\| | ||
501 | .tr \\*(Tr | ||
502 | .ds L" `` | ||
503 | .ds R" '' | ||
504 | .ds M" `` | ||
505 | .ds S" '' | ||
506 | .ds N" `` | ||
507 | .ds T" '' | ||
508 | .ds L' ` | ||
509 | .ds R' ' | ||
510 | .ds M' ` | ||
511 | .ds S' ' | ||
512 | .ds N' ` | ||
513 | .ds T' ' | ||
514 | .ds PI \\(*p | ||
515 | 'br\\} | ||
516 | END | ||
517 | |||
518 | print <<'END'; | ||
519 | .\" If the F register is turned on, we'll generate | ||
520 | .\" index entries out stderr for the following things: | ||
521 | .\" TH Title | ||
522 | .\" SH Header | ||
523 | .\" Sh Subsection | ||
524 | .\" Ip Item | ||
525 | .\" X<> Xref (embedded | ||
526 | .\" Of course, you have to process the output yourself | ||
527 | .\" in some meaninful fashion. | ||
528 | .if \nF \{ | ||
529 | .de IX | ||
530 | .tm Index:\\$1\t\\n%\t"\\$2" | ||
531 | .. | ||
532 | .nr % 0 | ||
533 | .rr F | ||
534 | .\} | ||
535 | END | ||
536 | |||
537 | print <<"END"; | ||
538 | .TH $name $section "$RP" "$date" "$center" | ||
539 | .UC | ||
540 | END | ||
541 | |||
542 | push(@Indices, qq{.IX Title "$name $section"}); | ||
543 | |||
544 | while (($name, $desc) = each %namedesc) { | ||
545 | for ($name, $desc) { s/^\s+//; s/\s+$//; } | ||
546 | push(@Indices, qq(.IX Name "$name - $desc"\n)); | ||
547 | } | ||
548 | |||
549 | print <<'END'; | ||
550 | .if n .hy 0 | ||
551 | .if n .na | ||
552 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | ||
553 | .de CQ \" put $1 in typewriter font | ||
554 | END | ||
555 | print ".ft $CFont\n"; | ||
556 | print <<'END'; | ||
557 | 'if n "\c | ||
558 | 'if t \\&\\$1\c | ||
559 | 'if n \\&\\$1\c | ||
560 | 'if n \&" | ||
561 | \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 | ||
562 | '.ft R | ||
563 | .. | ||
564 | .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 | ||
565 | . \" AM - accent mark definitions | ||
566 | .bd B 3 | ||
567 | . \" fudge factors for nroff and troff | ||
568 | .if n \{\ | ||
569 | . ds #H 0 | ||
570 | . ds #V .8m | ||
571 | . ds #F .3m | ||
572 | . ds #[ \f1 | ||
573 | . ds #] \fP | ||
574 | .\} | ||
575 | .if t \{\ | ||
576 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | ||
577 | . ds #V .6m | ||
578 | . ds #F 0 | ||
579 | . ds #[ \& | ||
580 | . ds #] \& | ||
581 | .\} | ||
582 | . \" simple accents for nroff and troff | ||
583 | .if n \{\ | ||
584 | . ds ' \& | ||
585 | . ds ` \& | ||
586 | . ds ^ \& | ||
587 | . ds , \& | ||
588 | . ds ~ ~ | ||
589 | . ds ? ? | ||
590 | . ds ! ! | ||
591 | . ds / | ||
592 | . ds q | ||
593 | .\} | ||
594 | .if t \{\ | ||
595 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | ||
596 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | ||
597 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | ||
598 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | ||
599 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | ||
600 | . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' | ||
601 | . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' | ||
602 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | ||
603 | . 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' | ||
604 | .\} | ||
605 | . \" troff and (daisy-wheel) nroff accents | ||
606 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | ||
607 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | ||
608 | .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] | ||
609 | .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' | ||
610 | .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' | ||
611 | .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] | ||
612 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | ||
613 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | ||
614 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | ||
615 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | ||
616 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | ||
617 | .ds ae a\h'-(\w'a'u*4/10)'e | ||
618 | .ds Ae A\h'-(\w'A'u*4/10)'E | ||
619 | .ds oe o\h'-(\w'o'u*4/10)'e | ||
620 | .ds Oe O\h'-(\w'O'u*4/10)'E | ||
621 | . \" corrections for vroff | ||
622 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | ||
623 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | ||
624 | . \" for low resolution devices (crt and lpr) | ||
625 | .if \n(.H>23 .if \n(.V>19 \ | ||
626 | \{\ | ||
627 | . ds : e | ||
628 | . ds 8 ss | ||
629 | . ds v \h'-1'\o'\(aa\(ga' | ||
630 | . ds _ \h'-1'^ | ||
631 | . ds . \h'-1'. | ||
632 | . ds 3 3 | ||
633 | . ds o a | ||
634 | . ds d- d\h'-1'\(ga | ||
635 | . ds D- D\h'-1'\(hy | ||
636 | . ds th \o'bp' | ||
637 | . ds Th \o'LP' | ||
638 | . ds ae ae | ||
639 | . ds Ae AE | ||
640 | . ds oe oe | ||
641 | . ds Oe OE | ||
642 | .\} | ||
643 | .rm #[ #] #H #V #F C | ||
644 | END | ||
645 | |||
646 | $indent = 0; | ||
647 | |||
648 | $begun = ""; | ||
649 | |||
650 | # Unrolling [^A-Z>]|[A-Z](?!<) gives: // MRE pp 165. | ||
651 | my $nonest = '(?:[^A-Z>]*(?:[A-Z](?!<)[^A-Z>]*)*)'; | ||
652 | |||
653 | while (<>) { | ||
654 | if ($cutting) { | ||
655 | next unless /^=/; | ||
656 | $cutting = 0; | ||
657 | } | ||
658 | if ($begun) { | ||
659 | if (/^=end\s+$begun/) { | ||
660 | $begun = ""; | ||
661 | } | ||
662 | elsif ($begun =~ /^(roff|man)$/) { | ||
663 | print STDOUT $_; | ||
664 | } | ||
665 | next; | ||
666 | } | ||
667 | chomp; | ||
668 | |||
669 | # Translate verbatim paragraph | ||
670 | |||
671 | if (/^\s/) { | ||
672 | @lines = split(/\n/); | ||
673 | for (@lines) { | ||
674 | 1 while s | ||
675 | {^( [^\t]* ) \t ( \t* ) } | ||
676 | { $1 . ' ' x (8 - (length($1)%8) + 8 * (length($2))) }ex; | ||
677 | s/\\/\\e/g; | ||
678 | s/\A/\\&/s; | ||
679 | } | ||
680 | $lines = @lines; | ||
681 | makespace() unless $verbatim++; | ||
682 | print ".Vb $lines\n"; | ||
683 | print join("\n", @lines), "\n"; | ||
684 | print ".Ve\n"; | ||
685 | $needspace = 0; | ||
686 | next; | ||
687 | } | ||
688 | |||
689 | $verbatim = 0; | ||
690 | |||
691 | if (/^=for\s+(\S+)\s*/s) { | ||
692 | if ($1 eq "man" or $1 eq "roff") { | ||
693 | print STDOUT $',"\n\n"; | ||
694 | } else { | ||
695 | # ignore unknown for | ||
696 | } | ||
697 | next; | ||
698 | } | ||
699 | elsif (/^=begin\s+(\S+)\s*/s) { | ||
700 | $begun = $1; | ||
701 | if ($1 eq "man" or $1 eq "roff") { | ||
702 | print STDOUT $'."\n\n"; | ||
703 | } | ||
704 | next; | ||
705 | } | ||
706 | |||
707 | # check for things that'll hosed our noremap scheme; affects $_ | ||
708 | init_noremap(); | ||
709 | |||
710 | if (!/^=item/) { | ||
711 | |||
712 | # trofficate backslashes; must do it before what happens below | ||
713 | s/\\/noremap('\\e')/ge; | ||
714 | |||
715 | # protect leading periods and quotes against *roff | ||
716 | # mistaking them for directives | ||
717 | s/^(?:[A-Z]<)?[.']/\\&$&/gm; | ||
718 | |||
719 | # first hide the escapes in case we need to | ||
720 | # intuit something and get it wrong due to fmting | ||
721 | |||
722 | 1 while s/([A-Z]<$nonest>)/noremap($1)/ge; | ||
723 | |||
724 | # func() is a reference to a perl function | ||
725 | s{ | ||
726 | \b | ||
727 | ( | ||
728 | [:\w]+ \(\) | ||
729 | ) | ||
730 | } {I<$1>}gx; | ||
731 | |||
732 | # func(n) is a reference to a perl function or a man page | ||
733 | s{ | ||
734 | ([:\w]+) | ||
735 | ( | ||
736 | \( [^\051]+ \) | ||
737 | ) | ||
738 | } {I<$1>\\|$2}gx; | ||
739 | |||
740 | # convert simple variable references | ||
741 | s/(\s+)([\$\@%][\w:]+)(?!\()/${1}C<$2>/g; | ||
742 | |||
743 | if (m{ ( | ||
744 | [\-\w]+ | ||
745 | \( | ||
746 | [^\051]*? | ||
747 | [\@\$,] | ||
748 | [^\051]*? | ||
749 | \) | ||
750 | ) | ||
751 | }x && $` !~ /([LCI]<[^<>]*|-)$/ && !/^=\w/) | ||
752 | { | ||
753 | warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [LCI]<$1>\n"; | ||
754 | $oops++; | ||
755 | } | ||
756 | |||
757 | while (/(-[a-zA-Z])\b/g && $` !~ /[\w\-]$/) { | ||
758 | warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [CB]<$1>\n"; | ||
759 | $oops++; | ||
760 | } | ||
761 | |||
762 | # put it back so we get the <> processed again; | ||
763 | clear_noremap(0); # 0 means leave the E's | ||
764 | |||
765 | } else { | ||
766 | # trofficate backslashes | ||
767 | s/\\/noremap('\\e')/ge; | ||
768 | |||
769 | } | ||
770 | |||
771 | # need to hide E<> first; they're processed in clear_noremap | ||
772 | s/(E<[^<>]+>)/noremap($1)/ge; | ||
773 | |||
774 | |||
775 | $maxnest = 10; | ||
776 | while ($maxnest-- && /[A-Z]</) { | ||
777 | |||
778 | # can't do C font here | ||
779 | s/([BI])<($nonest)>/font($1) . $2 . font('R')/eg; | ||
780 | |||
781 | # files and filelike refs in italics | ||
782 | s/F<($nonest)>/I<$1>/g; | ||
783 | |||
784 | # no break -- usually we want C<> for this | ||
785 | s/S<($nonest)>/nobreak($1)/eg; | ||
786 | |||
787 | # LREF: a la HREF L<show this text|man/section> | ||
788 | s:L<([^|>]+)\|[^>]+>:$1:g; | ||
789 | |||
790 | # LREF: a manpage(3f) | ||
791 | s:L<([a-zA-Z][^\s\/]+)(\([^\)]+\))?>:the I<$1>$2 manpage:g; | ||
792 | |||
793 | # LREF: an =item on another manpage | ||
794 | s{ | ||
795 | L< | ||
796 | ([^/]+) | ||
797 | / | ||
798 | ( | ||
799 | [:\w]+ | ||
800 | (\(\))? | ||
801 | ) | ||
802 | > | ||
803 | } {the C<$2> entry in the I<$1> manpage}gx; | ||
804 | |||
805 | # LREF: an =item on this manpage | ||
806 | s{ | ||
807 | ((?: | ||
808 | L< | ||
809 | / | ||
810 | ( | ||
811 | [:\w]+ | ||
812 | (\(\))? | ||
813 | ) | ||
814 | > | ||
815 | (,?\s+(and\s+)?)? | ||
816 | )+) | ||
817 | } { internal_lrefs($1) }gex; | ||
818 | |||
819 | # LREF: a =head2 (head1?), maybe on a manpage, maybe right here | ||
820 | # the "func" can disambiguate | ||
821 | s{ | ||
822 | L< | ||
823 | (?: | ||
824 | ([a-zA-Z]\S+?) / | ||
825 | )? | ||
826 | "?(.*?)"? | ||
827 | > | ||
828 | }{ | ||
829 | do { | ||
830 | $1 # if no $1, assume it means on this page. | ||
831 | ? "the section on I<$2> in the I<$1> manpage" | ||
832 | : "the section on I<$2>" | ||
833 | } | ||
834 | }gesx; # s in case it goes over multiple lines, so . matches \n | ||
835 | |||
836 | s/Z<>/\\&/g; | ||
837 | |||
838 | # comes last because not subject to reprocessing | ||
839 | s/C<($nonest)>/noremap("${CFont_embed}${1}\\fR")/eg; | ||
840 | } | ||
841 | |||
842 | if (s/^=//) { | ||
843 | $needspace = 0; # Assume this. | ||
844 | |||
845 | s/\n/ /g; | ||
846 | |||
847 | ($Cmd, $_) = split(' ', $_, 2); | ||
848 | |||
849 | $dotlevel = 1; | ||
850 | if ($Cmd eq 'head1') { | ||
851 | $dotlevel = 1; | ||
852 | } | ||
853 | elsif ($Cmd eq 'head2') { | ||
854 | $dotlevel = 1; | ||
855 | } | ||
856 | elsif ($Cmd eq 'item') { | ||
857 | $dotlevel = 2; | ||
858 | } | ||
859 | |||
860 | if (defined $_) { | ||
861 | &escapes($dotlevel); | ||
862 | s/"/""/g; | ||
863 | } | ||
864 | |||
865 | clear_noremap(1); | ||
866 | |||
867 | if ($Cmd eq 'cut') { | ||
868 | $cutting = 1; | ||
869 | } | ||
870 | elsif ($Cmd eq 'head1') { | ||
871 | s/\s+$//; | ||
872 | delete $wanna_see{$_} if exists $wanna_see{$_}; | ||
873 | print qq{.SH "$_"\n}; | ||
874 | push(@Indices, qq{.IX Header "$_"\n}); | ||
875 | } | ||
876 | elsif ($Cmd eq 'head2') { | ||
877 | print qq{.Sh "$_"\n}; | ||
878 | push(@Indices, qq{.IX Subsection "$_"\n}); | ||
879 | } | ||
880 | elsif ($Cmd eq 'over') { | ||
881 | push(@indent,$indent); | ||
882 | $indent += ($_ + 0) || 5; | ||
883 | } | ||
884 | elsif ($Cmd eq 'back') { | ||
885 | $indent = pop(@indent); | ||
886 | warn "$0: Unmatched =back in paragraph $. of $ARGV\n" unless defined $indent; | ||
887 | $needspace = 1; | ||
888 | } | ||
889 | elsif ($Cmd eq 'item') { | ||
890 | s/^\*( |$)/\\(bu$1/g; | ||
891 | # if you know how to get ":s please do | ||
892 | s/\\\*\(L"([^"]+?)\\\*\(R"/'$1'/g; | ||
893 | s/\\\*\(L"([^"]+?)""/'$1'/g; | ||
894 | s/[^"]""([^"]+?)""[^"]/'$1'/g; | ||
895 | # here do something about the $" in perlvar? | ||
896 | print STDOUT qq{.Ip "$_" $indent\n}; | ||
897 | push(@Indices, qq{.IX Item "$_"\n}); | ||
898 | } | ||
899 | elsif ($Cmd eq 'pod') { | ||
900 | # this is just a comment | ||
901 | } | ||
902 | else { | ||
903 | warn "$0: Unrecognized pod directive in paragraph $. of $ARGV: $Cmd\n"; | ||
904 | } | ||
905 | } | ||
906 | else { | ||
907 | if ($needspace) { | ||
908 | &makespace; | ||
909 | } | ||
910 | &escapes(0); | ||
911 | clear_noremap(1); | ||
912 | print $_, "\n"; | ||
913 | $needspace = 1; | ||
914 | } | ||
915 | } | ||
916 | |||
917 | print <<"END"; | ||
918 | |||
919 | .rn }` '' | ||
920 | END | ||
921 | |||
922 | if (%wanna_see && !$lax) { | ||
923 | @missing = keys %wanna_see; | ||
924 | warn "$0: $Filename is missing required section" | ||
925 | . (@missing > 1 && "s") | ||
926 | . ": @missing\n"; | ||
927 | $oops++; | ||
928 | } | ||
929 | |||
930 | foreach (@Indices) { print "$_\n"; } | ||
931 | |||
932 | exit; | ||
933 | #exit ($oops != 0); | ||
934 | |||
935 | ######################################################################### | ||
936 | |||
937 | sub nobreak { | ||
938 | my $string = shift; | ||
939 | $string =~ s/ /\\ /g; | ||
940 | $string; | ||
941 | } | ||
942 | |||
943 | sub escapes { | ||
944 | my $indot = shift; | ||
945 | |||
946 | s/X<(.*?)>/mkindex($1)/ge; | ||
947 | |||
948 | # translate the minus in foo-bar into foo\-bar for roff | ||
949 | s/([^0-9a-z-])-([^-])/$1\\-$2/g; | ||
950 | |||
951 | # make -- into the string version \*(-- (defined above) | ||
952 | s/\b--\b/\\*(--/g; | ||
953 | s/"--([^"])/"\\*(--$1/g; # should be a better way | ||
954 | s/([^"])--"/$1\\*(--"/g; | ||
955 | |||
956 | # fix up quotes; this is somewhat tricky | ||
957 | my $dotmacroL = 'L'; | ||
958 | my $dotmacroR = 'R'; | ||
959 | if ( $indot == 1 ) { | ||
960 | $dotmacroL = 'M'; | ||
961 | $dotmacroR = 'S'; | ||
962 | } | ||
963 | elsif ( $indot >= 2 ) { | ||
964 | $dotmacroL = 'N'; | ||
965 | $dotmacroR = 'T'; | ||
966 | } | ||
967 | if (!/""/) { | ||
968 | s/(^|\s)(['"])/noremap("$1\\*($dotmacroL$2")/ge; | ||
969 | s/(['"])($|[\-\s,;\\!?.])/noremap("\\*($dotmacroR$1$2")/ge; | ||
970 | } | ||
971 | |||
972 | #s/(?!")(?:.)--(?!")(?:.)/\\*(--/g; | ||
973 | #s/(?:(?!")(?:.)--(?:"))|(?:(?:")--(?!")(?:.))/\\*(--/g; | ||
974 | |||
975 | |||
976 | # make sure that func() keeps a bit a space tween the parens | ||
977 | ### s/\b\(\)/\\|()/g; | ||
978 | ### s/\b\(\)/(\\|)/g; | ||
979 | |||
980 | # make C++ into \*C+, which is a squinched version (defined above) | ||
981 | s/\bC\+\+/\\*(C+/g; | ||
982 | |||
983 | # make double underbars have a little tiny space between them | ||
984 | s/__/_\\|_/g; | ||
985 | |||
986 | # PI goes to \*(PI (defined above) | ||
987 | s/\bPI\b/noremap('\\*(PI')/ge; | ||
988 | |||
989 | # make all caps a teeny bit smaller, but don't muck with embedded code literals | ||
990 | my $hidCFont = font('C'); | ||
991 | if ($Cmd !~ /^head1/) { # SH already makes smaller | ||
992 | # /g isn't enough; 1 while or we'll be off | ||
993 | |||
994 | # 1 while s{ | ||
995 | # (?!$hidCFont)(..|^.|^) | ||
996 | # \b | ||
997 | # ( | ||
998 | # [A-Z][\/A-Z+:\-\d_$.]+ | ||
999 | # ) | ||
1000 | # (s?) | ||
1001 | # \b | ||
1002 | # } {$1\\s-1$2\\s0}gmox; | ||
1003 | |||
1004 | 1 while s{ | ||
1005 | (?!$hidCFont)(..|^.|^) | ||
1006 | ( | ||
1007 | \b[A-Z]{2,}[\/A-Z+:\-\d_\$]*\b | ||
1008 | ) | ||
1009 | } { | ||
1010 | $1 . noremap( '\\s-1' . $2 . '\\s0' ) | ||
1011 | }egmox; | ||
1012 | |||
1013 | } | ||
1014 | } | ||
1015 | |||
1016 | # make troff just be normal, but make small nroff get quoted | ||
1017 | # decided to just put the quotes in the text; sigh; | ||
1018 | sub ccvt { | ||
1019 | local($_,$prev) = @_; | ||
1020 | noremap(qq{.CQ "$_" \n\\&}); | ||
1021 | } | ||
1022 | |||
1023 | sub makespace { | ||
1024 | if ($indent) { | ||
1025 | print ".Sp\n"; | ||
1026 | } | ||
1027 | else { | ||
1028 | print ".PP\n"; | ||
1029 | } | ||
1030 | } | ||
1031 | |||
1032 | sub mkindex { | ||
1033 | my ($entry) = @_; | ||
1034 | my @entries = split m:\s*/\s*:, $entry; | ||
1035 | push @Indices, ".IX Xref " . join ' ', map {qq("$_")} @entries; | ||
1036 | return ''; | ||
1037 | } | ||
1038 | |||
1039 | sub font { | ||
1040 | local($font) = shift; | ||
1041 | return '\\f' . noremap($font); | ||
1042 | } | ||
1043 | |||
1044 | sub noremap { | ||
1045 | local($thing_to_hide) = shift; | ||
1046 | $thing_to_hide =~ tr/\000-\177/\200-\377/; | ||
1047 | return $thing_to_hide; | ||
1048 | } | ||
1049 | |||
1050 | sub init_noremap { | ||
1051 | # escape high bit characters in input stream | ||
1052 | s/([\200-\377])/"E<".ord($1).">"/ge; | ||
1053 | } | ||
1054 | |||
1055 | sub clear_noremap { | ||
1056 | my $ready_to_print = $_[0]; | ||
1057 | |||
1058 | tr/\200-\377/\000-\177/; | ||
1059 | |||
1060 | # trofficate backslashes | ||
1061 | # s/(?!\\e)(?:..|^.|^)\\/\\e/g; | ||
1062 | |||
1063 | # now for the E<>s, which have been hidden until now | ||
1064 | # otherwise the interative \w<> processing would have | ||
1065 | # been hosed by the E<gt> | ||
1066 | s { | ||
1067 | E< | ||
1068 | ( | ||
1069 | ( \d + ) | ||
1070 | | ( [A-Za-z]+ ) | ||
1071 | ) | ||
1072 | > | ||
1073 | } { | ||
1074 | do { | ||
1075 | defined $2 | ||
1076 | ? chr($2) | ||
1077 | : | ||
1078 | exists $HTML_Escapes{$3} | ||
1079 | ? do { $HTML_Escapes{$3} } | ||
1080 | : do { | ||
1081 | warn "$0: Unknown escape in paragraph $. of $ARGV: ``$&''\n"; | ||
1082 | "E<$1>"; | ||
1083 | } | ||
1084 | } | ||
1085 | }egx if $ready_to_print; | ||
1086 | } | ||
1087 | |||
1088 | sub internal_lrefs { | ||
1089 | local($_) = shift; | ||
1090 | local $trailing_and = s/and\s+$// ? "and " : ""; | ||
1091 | |||
1092 | s{L</([^>]+)>}{$1}g; | ||
1093 | my(@items) = split( /(?:,?\s+(?:and\s+)?)/ ); | ||
1094 | my $retstr = "the "; | ||
1095 | my $i; | ||
1096 | for ($i = 0; $i <= $#items; $i++) { | ||
1097 | $retstr .= "C<$items[$i]>"; | ||
1098 | $retstr .= ", " if @items > 2 && $i != $#items; | ||
1099 | $retstr .= " and " if $i+2 == @items; | ||
1100 | } | ||
1101 | |||
1102 | $retstr .= " entr" . ( @items > 1 ? "ies" : "y" ) | ||
1103 | . " elsewhere in this document"; | ||
1104 | # terminal space to avoid words running together (pattern used | ||
1105 | # strips terminal spaces) | ||
1106 | $retstr .= " " if length $trailing_and; | ||
1107 | $retstr .= $trailing_and; | ||
1108 | |||
1109 | return $retstr; | ||
1110 | |||
1111 | } | ||
1112 | |||
1113 | BEGIN { | ||
1114 | %HTML_Escapes = ( | ||
1115 | 'amp' => '&', # ampersand | ||
1116 | 'lt' => '<', # left chevron, less-than | ||
1117 | 'gt' => '>', # right chevron, greater-than | ||
1118 | 'quot' => '"', # double quote | ||
1119 | |||
1120 | "Aacute" => "A\\*'", # capital A, acute accent | ||
1121 | "aacute" => "a\\*'", # small a, acute accent | ||
1122 | "Acirc" => "A\\*^", # capital A, circumflex accent | ||
1123 | "acirc" => "a\\*^", # small a, circumflex accent | ||
1124 | "AElig" => '\*(AE', # capital AE diphthong (ligature) | ||
1125 | "aelig" => '\*(ae', # small ae diphthong (ligature) | ||
1126 | "Agrave" => "A\\*`", # capital A, grave accent | ||
1127 | "agrave" => "A\\*`", # small a, grave accent | ||
1128 | "Aring" => 'A\\*o', # capital A, ring | ||
1129 | "aring" => 'a\\*o', # small a, ring | ||
1130 | "Atilde" => 'A\\*~', # capital A, tilde | ||
1131 | "atilde" => 'a\\*~', # small a, tilde | ||
1132 | "Auml" => 'A\\*:', # capital A, dieresis or umlaut mark | ||
1133 | "auml" => 'a\\*:', # small a, dieresis or umlaut mark | ||
1134 | "Ccedil" => 'C\\*,', # capital C, cedilla | ||
1135 | "ccedil" => 'c\\*,', # small c, cedilla | ||
1136 | "Eacute" => "E\\*'", # capital E, acute accent | ||
1137 | "eacute" => "e\\*'", # small e, acute accent | ||
1138 | "Ecirc" => "E\\*^", # capital E, circumflex accent | ||
1139 | "ecirc" => "e\\*^", # small e, circumflex accent | ||
1140 | "Egrave" => "E\\*`", # capital E, grave accent | ||
1141 | "egrave" => "e\\*`", # small e, grave accent | ||
1142 | "ETH" => '\\*(D-', # capital Eth, Icelandic | ||
1143 | "eth" => '\\*(d-', # small eth, Icelandic | ||
1144 | "Euml" => "E\\*:", # capital E, dieresis or umlaut mark | ||
1145 | "euml" => "e\\*:", # small e, dieresis or umlaut mark | ||
1146 | "Iacute" => "I\\*'", # capital I, acute accent | ||
1147 | "iacute" => "i\\*'", # small i, acute accent | ||
1148 | "Icirc" => "I\\*^", # capital I, circumflex accent | ||
1149 | "icirc" => "i\\*^", # small i, circumflex accent | ||
1150 | "Igrave" => "I\\*`", # capital I, grave accent | ||
1151 | "igrave" => "i\\*`", # small i, grave accent | ||
1152 | "Iuml" => "I\\*:", # capital I, dieresis or umlaut mark | ||
1153 | "iuml" => "i\\*:", # small i, dieresis or umlaut mark | ||
1154 | "Ntilde" => 'N\*~', # capital N, tilde | ||
1155 | "ntilde" => 'n\*~', # small n, tilde | ||
1156 | "Oacute" => "O\\*'", # capital O, acute accent | ||
1157 | "oacute" => "o\\*'", # small o, acute accent | ||
1158 | "Ocirc" => "O\\*^", # capital O, circumflex accent | ||
1159 | "ocirc" => "o\\*^", # small o, circumflex accent | ||
1160 | "Ograve" => "O\\*`", # capital O, grave accent | ||
1161 | "ograve" => "o\\*`", # small o, grave accent | ||
1162 | "Oslash" => "O\\*/", # capital O, slash | ||
1163 | "oslash" => "o\\*/", # small o, slash | ||
1164 | "Otilde" => "O\\*~", # capital O, tilde | ||
1165 | "otilde" => "o\\*~", # small o, tilde | ||
1166 | "Ouml" => "O\\*:", # capital O, dieresis or umlaut mark | ||
1167 | "ouml" => "o\\*:", # small o, dieresis or umlaut mark | ||
1168 | "szlig" => '\*8', # small sharp s, German (sz ligature) | ||
1169 | "THORN" => '\\*(Th', # capital THORN, Icelandic | ||
1170 | "thorn" => '\\*(th',, # small thorn, Icelandic | ||
1171 | "Uacute" => "U\\*'", # capital U, acute accent | ||
1172 | "uacute" => "u\\*'", # small u, acute accent | ||
1173 | "Ucirc" => "U\\*^", # capital U, circumflex accent | ||
1174 | "ucirc" => "u\\*^", # small u, circumflex accent | ||
1175 | "Ugrave" => "U\\*`", # capital U, grave accent | ||
1176 | "ugrave" => "u\\*`", # small u, grave accent | ||
1177 | "Uuml" => "U\\*:", # capital U, dieresis or umlaut mark | ||
1178 | "uuml" => "u\\*:", # small u, dieresis or umlaut mark | ||
1179 | "Yacute" => "Y\\*'", # capital Y, acute accent | ||
1180 | "yacute" => "y\\*'", # small y, acute accent | ||
1181 | "yuml" => "y\\*:", # small y, dieresis or umlaut mark | ||
1182 | ); | ||
1183 | } | ||
1184 | |||
diff --git a/src/lib/libcrypto/util/pod2mantest b/src/lib/libcrypto/util/pod2mantest deleted file mode 100644 index 384e683df4..0000000000 --- a/src/lib/libcrypto/util/pod2mantest +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # This script is used by test/Makefile to check whether a sane 'pod2man' | ||
4 | # is installed. | ||
5 | # ('make install' should not try to run 'pod2man' if it does not exist or if | ||
6 | # it is a broken 'pod2man' version that is known to cause trouble. if we find | ||
7 | # the system 'pod2man' to be broken, we use our own copy instead) | ||
8 | # | ||
9 | # In any case, output an appropriate command line for running (or not | ||
10 | # running) pod2man. | ||
11 | |||
12 | |||
13 | IFS=: | ||
14 | if test "$OSTYPE" = "msdosdjgpp"; then IFS=";"; fi | ||
15 | |||
16 | try_without_dir=true | ||
17 | # First we try "pod2man", then "$dir/pod2man" for each item in $PATH. | ||
18 | for dir in dummy${IFS}$PATH; do | ||
19 | if [ "$try_without_dir" = true ]; then | ||
20 | # first iteration | ||
21 | pod2man=pod2man | ||
22 | try_without_dir=false | ||
23 | else | ||
24 | # second and later iterations | ||
25 | pod2man="$dir/pod2man" | ||
26 | if [ ! -f "$pod2man" ]; then # '-x' is not available on Ultrix | ||
27 | pod2man='' | ||
28 | fi | ||
29 | fi | ||
30 | |||
31 | if [ ! "$pod2man" = '' ]; then | ||
32 | failure=none | ||
33 | |||
34 | if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | fgrep OpenSSL >/dev/null; then | ||
35 | : | ||
36 | else | ||
37 | failure=BasicTest | ||
38 | fi | ||
39 | |||
40 | if [ "$failure" = none ]; then | ||
41 | if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | grep '^MARKER - ' >/dev/null; then | ||
42 | failure=MultilineTest | ||
43 | fi | ||
44 | fi | ||
45 | |||
46 | |||
47 | if [ "$failure" = none ]; then | ||
48 | echo "$pod2man" | ||
49 | exit 0 | ||
50 | fi | ||
51 | |||
52 | echo "$pod2man does not work properly ('$failure' failed). Looking for another pod2man ..." >&2 | ||
53 | fi | ||
54 | done | ||
55 | |||
56 | echo "No working pod2man found. Consider installing a new version." >&2 | ||
57 | echo "As a workaround, we'll use a bundled old copy of pod2man.pl." >&2 | ||
58 | echo "$1 ../../util/pod2man.pl" | ||
diff --git a/src/lib/libcrypto/util/pod2mantest.pod b/src/lib/libcrypto/util/pod2mantest.pod deleted file mode 100644 index 5d2539a17f..0000000000 --- a/src/lib/libcrypto/util/pod2mantest.pod +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | foo, bar, | ||
6 | MARKER - test of multiline name section | ||
7 | |||
8 | =head1 DESCRIPTION | ||
9 | |||
10 | This is a test .pod file to see if we have a buggy pod2man or not. | ||
11 | If we have a buggy implementation, we will get a line matching the | ||
12 | regular expression "^ +MARKER - test of multiline name section *$" | ||
13 | at the end of the resulting document. | ||
14 | |||
15 | =cut | ||
diff --git a/src/lib/libcrypto/util/point.sh b/src/lib/libcrypto/util/point.sh deleted file mode 100644 index da39899cb1..0000000000 --- a/src/lib/libcrypto/util/point.sh +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | rm -f "$2" | ||
4 | if test "$OSTYPE" = msdosdjgpp || test "x$PLATFORM" = xmingw ; then | ||
5 | cp "$1" "$2" | ||
6 | else | ||
7 | ln -s "$1" "$2" | ||
8 | fi | ||
9 | echo "$2 => $1" | ||
10 | |||
diff --git a/src/lib/libcrypto/util/selftest.pl b/src/lib/libcrypto/util/selftest.pl deleted file mode 100644 index 7b32e9f4ff..0000000000 --- a/src/lib/libcrypto/util/selftest.pl +++ /dev/null | |||
@@ -1,201 +0,0 @@ | |||
1 | #!/usr/local/bin/perl -w | ||
2 | # | ||
3 | # Run the test suite and generate a report | ||
4 | # | ||
5 | |||
6 | if (! -f "Configure") { | ||
7 | print "Please run perl util/selftest.pl in the OpenSSL directory.\n"; | ||
8 | exit 1; | ||
9 | } | ||
10 | |||
11 | my $report="testlog"; | ||
12 | my $os="??"; | ||
13 | my $version="??"; | ||
14 | my $platform0="??"; | ||
15 | my $platform="??"; | ||
16 | my $options="??"; | ||
17 | my $last="??"; | ||
18 | my $ok=0; | ||
19 | my $cc="cc"; | ||
20 | my $cversion="??"; | ||
21 | my $sep="-----------------------------------------------------------------------------\n"; | ||
22 | 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"; | ||
23 | |||
24 | open(OUT,">$report") or die; | ||
25 | |||
26 | print OUT "OpenSSL self-test report:\n\n"; | ||
27 | |||
28 | $uname=`uname -a`; | ||
29 | $uname="??\n" if $uname eq ""; | ||
30 | |||
31 | $c=`sh config -t`; | ||
32 | foreach $_ (split("\n",$c)) { | ||
33 | $os=$1 if (/Operating system: (.*)$/); | ||
34 | $platform0=$1 if (/Configuring for (.*)$/); | ||
35 | } | ||
36 | |||
37 | system "sh config" if (! -f "Makefile"); | ||
38 | |||
39 | if (open(IN,"<Makefile")) { | ||
40 | while (<IN>) { | ||
41 | $version=$1 if (/^VERSION=(.*)$/); | ||
42 | $platform=$1 if (/^PLATFORM=(.*)$/); | ||
43 | $options=$1 if (/^OPTIONS=(.*)$/); | ||
44 | $cc=$1 if (/^CC= *(.*)$/); | ||
45 | } | ||
46 | close(IN); | ||
47 | } else { | ||
48 | print OUT "Error running config!\n"; | ||
49 | } | ||
50 | |||
51 | $cversion=`$cc -v 2>&1`; | ||
52 | $cversion=`$cc -V 2>&1` if $cversion =~ "[Uu]sage"; | ||
53 | $cversion=`$cc -V |head -1` if $cversion =~ "Error"; | ||
54 | $cversion=`$cc --version` if $cversion eq ""; | ||
55 | $cversion =~ s/Reading specs.*\n//; | ||
56 | $cversion =~ s/usage.*\n//; | ||
57 | chomp $cversion; | ||
58 | |||
59 | if (open(IN,"<CHANGES")) { | ||
60 | while(<IN>) { | ||
61 | if (/\*\) (.{0,55})/ && !/applies to/) { | ||
62 | $last=$1; | ||
63 | last; | ||
64 | } | ||
65 | } | ||
66 | close(IN); | ||
67 | } | ||
68 | |||
69 | print OUT "OpenSSL version: $version\n"; | ||
70 | print OUT "Last change: $last...\n"; | ||
71 | print OUT "Options: $options\n" if $options ne ""; | ||
72 | print OUT "OS (uname): $uname"; | ||
73 | print OUT "OS (config): $os\n"; | ||
74 | print OUT "Target (default): $platform0\n"; | ||
75 | print OUT "Target: $platform\n"; | ||
76 | print OUT "Compiler: $cversion\n"; | ||
77 | print OUT "\n"; | ||
78 | |||
79 | print "Checking compiler...\n"; | ||
80 | if (open(TEST,">cctest.c")) { | ||
81 | print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <errno.h>\nmain(){printf(\"Hello world\\n\");}\n"; | ||
82 | close(TEST); | ||
83 | system("$cc -o cctest cctest.c"); | ||
84 | if (`./cctest` !~ /Hello world/) { | ||
85 | print OUT "Compiler doesn't work.\n"; | ||
86 | print OUT $not_our_fault; | ||
87 | goto err; | ||
88 | } | ||
89 | system("ar r cctest.a /dev/null"); | ||
90 | if (not -f "cctest.a") { | ||
91 | print OUT "Check your archive tool (ar).\n"; | ||
92 | print OUT $not_our_fault; | ||
93 | goto err; | ||
94 | } | ||
95 | } else { | ||
96 | print OUT "Can't create cctest.c\n"; | ||
97 | } | ||
98 | if (open(TEST,">cctest.c")) { | ||
99 | print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <openssl/opensslv.h>\nmain(){printf(OPENSSL_VERSION_TEXT);}\n"; | ||
100 | close(TEST); | ||
101 | system("$cc -o cctest -Iinclude cctest.c"); | ||
102 | $cctest = `./cctest`; | ||
103 | if ($cctest !~ /OpenSSL $version/) { | ||
104 | if ($cctest =~ /OpenSSL/) { | ||
105 | print OUT "#include uses headers from different OpenSSL version!\n"; | ||
106 | } else { | ||
107 | print OUT "Can't compile test program!\n"; | ||
108 | } | ||
109 | print OUT $not_our_fault; | ||
110 | goto err; | ||
111 | } | ||
112 | } else { | ||
113 | print OUT "Can't create cctest.c\n"; | ||
114 | } | ||
115 | |||
116 | print "Running make...\n"; | ||
117 | if (system("make 2>&1 | tee make.log") > 255) { | ||
118 | |||
119 | print OUT "make failed!\n"; | ||
120 | if (open(IN,"<make.log")) { | ||
121 | print OUT $sep; | ||
122 | while (<IN>) { | ||
123 | print OUT; | ||
124 | } | ||
125 | close(IN); | ||
126 | print OUT $sep; | ||
127 | } else { | ||
128 | print OUT "make.log not found!\n"; | ||
129 | } | ||
130 | goto err; | ||
131 | } | ||
132 | |||
133 | # Not sure why this is here. The tests themselves can detect if their | ||
134 | # particular feature isn't included, and should therefore skip themselves. | ||
135 | # To skip *all* tests just because one algorithm isn't included is like | ||
136 | # shooting mosquito with an elephant gun... | ||
137 | # -- Richard Levitte, inspired by problem report 1089 | ||
138 | # | ||
139 | #$_=$options; | ||
140 | #s/no-asm//; | ||
141 | #s/no-shared//; | ||
142 | #s/no-krb5//; | ||
143 | #if (/no-/) | ||
144 | #{ | ||
145 | # print OUT "Test skipped.\n"; | ||
146 | # goto err; | ||
147 | #} | ||
148 | |||
149 | print "Running make test...\n"; | ||
150 | if (system("make test 2>&1 | tee maketest.log") > 255) | ||
151 | { | ||
152 | print OUT "make test failed!\n"; | ||
153 | } else { | ||
154 | $ok=1; | ||
155 | } | ||
156 | |||
157 | if ($ok and open(IN,"<maketest.log")) { | ||
158 | while (<IN>) { | ||
159 | $ok=2 if /^platform: $platform/; | ||
160 | } | ||
161 | close(IN); | ||
162 | } | ||
163 | |||
164 | if ($ok != 2) { | ||
165 | print OUT "Failure!\n"; | ||
166 | if (open(IN,"<make.log")) { | ||
167 | print OUT $sep; | ||
168 | while (<IN>) { | ||
169 | print OUT; | ||
170 | } | ||
171 | close(IN); | ||
172 | print OUT $sep; | ||
173 | } else { | ||
174 | print OUT "make.log not found!\n"; | ||
175 | } | ||
176 | if (open(IN,"<maketest.log")) { | ||
177 | while (<IN>) { | ||
178 | print OUT; | ||
179 | } | ||
180 | close(IN); | ||
181 | print OUT $sep; | ||
182 | } else { | ||
183 | print OUT "maketest.log not found!\n"; | ||
184 | } | ||
185 | } else { | ||
186 | print OUT "Test passed.\n"; | ||
187 | } | ||
188 | err: | ||
189 | close(OUT); | ||
190 | |||
191 | print "\n"; | ||
192 | open(IN,"<$report") or die; | ||
193 | while (<IN>) { | ||
194 | if (/$sep/) { | ||
195 | print "[...]\n"; | ||
196 | last; | ||
197 | } | ||
198 | print; | ||
199 | } | ||
200 | print "\nTest report in file $report\n"; | ||
201 | |||
diff --git a/src/lib/libcrypto/util/sp-diff.pl b/src/lib/libcrypto/util/sp-diff.pl deleted file mode 100644 index 9d6c60387f..0000000000 --- a/src/lib/libcrypto/util/sp-diff.pl +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # This file takes as input, the files that have been output from | ||
4 | # ssleay speed. | ||
5 | # It prints a table of the relative differences with %100 being 'no difference' | ||
6 | # | ||
7 | |||
8 | ($#ARGV == 1) || die "$0 speedout1 speedout2\n"; | ||
9 | |||
10 | %one=&loadfile($ARGV[0]); | ||
11 | %two=&loadfile($ARGV[1]); | ||
12 | |||
13 | $line=0; | ||
14 | foreach $a ("md2","md4","md5","sha","sha1","rc4","des cfb","des cbc","des ede3", | ||
15 | "idea cfb","idea cbc","rc2 cfb","rc2 cbc","blowfish cbc","cast cbc") | ||
16 | { | ||
17 | if (defined($one{$a,8}) && defined($two{$a,8})) | ||
18 | { | ||
19 | print "type 8 byte% 64 byte% 256 byte% 1024 byte% 8192 byte%\n" | ||
20 | unless $line; | ||
21 | $line++; | ||
22 | printf "%-12s ",$a; | ||
23 | foreach $b (8,64,256,1024,8192) | ||
24 | { | ||
25 | $r=$two{$a,$b}/$one{$a,$b}*100; | ||
26 | printf "%12.2f",$r; | ||
27 | } | ||
28 | print "\n"; | ||
29 | } | ||
30 | } | ||
31 | |||
32 | foreach $a ( | ||
33 | "rsa 512","rsa 1024","rsa 2048","rsa 4096", | ||
34 | "dsa 512","dsa 1024","dsa 2048", | ||
35 | ) | ||
36 | { | ||
37 | if (defined($one{$a,1}) && defined($two{$a,1})) | ||
38 | { | ||
39 | $r1=($one{$a,1}/$two{$a,1})*100; | ||
40 | $r2=($one{$a,2}/$two{$a,2})*100; | ||
41 | printf "$a bits %% %6.2f %% %6.2f\n",$r1,$r2; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | sub loadfile | ||
46 | { | ||
47 | local($file)=@_; | ||
48 | local($_,%ret); | ||
49 | |||
50 | open(IN,"<$file") || die "unable to open '$file' for input\n"; | ||
51 | $header=1; | ||
52 | while (<IN>) | ||
53 | { | ||
54 | $header=0 if /^[dr]sa/; | ||
55 | if (/^type/) { $header=0; next; } | ||
56 | next if $header; | ||
57 | chop; | ||
58 | @a=split; | ||
59 | if ($a[0] =~ /^[dr]sa$/) | ||
60 | { | ||
61 | ($n,$t1,$t2)=($_ =~ /^([dr]sa\s+\d+)\s+bits\s+([.\d]+)s\s+([.\d]+)/); | ||
62 | $ret{$n,1}=$t1; | ||
63 | $ret{$n,2}=$t2; | ||
64 | } | ||
65 | else | ||
66 | { | ||
67 | $n=join(' ',grep(/[^k]$/,@a)); | ||
68 | @k=grep(s/k$//,@a); | ||
69 | |||
70 | $ret{$n, 8}=$k[0]; | ||
71 | $ret{$n, 64}=$k[1]; | ||
72 | $ret{$n, 256}=$k[2]; | ||
73 | $ret{$n,1024}=$k[3]; | ||
74 | $ret{$n,8192}=$k[4]; | ||
75 | } | ||
76 | } | ||
77 | close(IN); | ||
78 | return(%ret); | ||
79 | } | ||
80 | |||
diff --git a/src/lib/libcrypto/util/speed.sh b/src/lib/libcrypto/util/speed.sh deleted file mode 100644 index f489706197..0000000000 --- a/src/lib/libcrypto/util/speed.sh +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # | ||
4 | # This is a ugly script use, in conjuction with editing the 'b' | ||
5 | # configuration in the $(TOP)/Configure script which will | ||
6 | # output when finished a file called speed.log which is the | ||
7 | # timings of SSLeay with various options turned on or off. | ||
8 | # | ||
9 | # from the $(TOP) directory | ||
10 | # Edit Configure, modifying things to do with the b/bl-4c-2c etc | ||
11 | # configurations. | ||
12 | # | ||
13 | |||
14 | make clean | ||
15 | perl Configure b | ||
16 | make | ||
17 | apps/ssleay version -v -b -f >speed.1 | ||
18 | apps/ssleay speed >speed.1l | ||
19 | |||
20 | perl Configure bl-4c-2c | ||
21 | /bin/rm -f crypto/rc4/*.o crypto/bn/bn*.o crypto/md2/md2_dgst.o | ||
22 | make | ||
23 | apps/ssleay speed rc4 rsa md2 >speed.2l | ||
24 | |||
25 | perl Configure bl-4c-ri | ||
26 | /bin/rm -f crypto/rc4/rc4*.o | ||
27 | make | ||
28 | apps/ssleay speed rc4 >speed.3l | ||
29 | |||
30 | perl Configure b2-is-ri-dp | ||
31 | /bin/rm -f crypto/idea/i_*.o crypto/rc4/*.o crypto/des/ecb_enc.o crypto/bn/bn*.o | ||
32 | apps/ssleay speed rsa rc4 idea des >speed.4l | ||
33 | |||
34 | cat speed.1 >speed.log | ||
35 | cat speed.1l >>speed.log | ||
36 | perl util/sp-diff.pl speed.1l speed.2l >>speed.log | ||
37 | perl util/sp-diff.pl speed.1l speed.3l >>speed.log | ||
38 | perl util/sp-diff.pl speed.1l speed.4l >>speed.log | ||
39 | |||
diff --git a/src/lib/libcrypto/util/src-dep.pl b/src/lib/libcrypto/util/src-dep.pl deleted file mode 100644 index ad997e4746..0000000000 --- a/src/lib/libcrypto/util/src-dep.pl +++ /dev/null | |||
@@ -1,147 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | # we make up an array of | ||
4 | # $file{function_name}=filename; | ||
5 | # $unres{filename}="func1 func2 ...." | ||
6 | $debug=1; | ||
7 | #$nm_func="parse_linux"; | ||
8 | $nm_func="parse_solaris"; | ||
9 | |||
10 | foreach (@ARGV) | ||
11 | { | ||
12 | &$nm_func($_); | ||
13 | } | ||
14 | |||
15 | foreach $file (sort keys %unres) | ||
16 | { | ||
17 | @a=split(/\s+/,$unres{$file}); | ||
18 | %ff=(); | ||
19 | foreach $func (@a) | ||
20 | { | ||
21 | $f=$file{$func}; | ||
22 | $ff{$f}=1 if $f ne ""; | ||
23 | } | ||
24 | |||
25 | foreach $a (keys %ff) | ||
26 | { $we_need{$file}.="$a "; } | ||
27 | } | ||
28 | |||
29 | foreach $file (sort keys %we_need) | ||
30 | { | ||
31 | # print " $file $we_need{$file}\n"; | ||
32 | foreach $bit (split(/\s+/,$we_need{$file})) | ||
33 | { push(@final,&walk($bit)); } | ||
34 | |||
35 | foreach (@final) { $fin{$_}=1; } | ||
36 | @final=""; | ||
37 | foreach (sort keys %fin) | ||
38 | { push(@final,$_); } | ||
39 | |||
40 | print "$file: @final\n"; | ||
41 | } | ||
42 | |||
43 | sub walk | ||
44 | { | ||
45 | local($f)=@_; | ||
46 | local(@a,%seen,@ret,$r); | ||
47 | |||
48 | @ret=""; | ||
49 | $f =~ s/^\s+//; | ||
50 | $f =~ s/\s+$//; | ||
51 | return "" if ($f =~ "^\s*$"); | ||
52 | |||
53 | return(split(/\s/,$done{$f})) if defined ($done{$f}); | ||
54 | |||
55 | return if $in{$f} > 0; | ||
56 | $in{$f}++; | ||
57 | push(@ret,$f); | ||
58 | foreach $r (split(/\s+/,$we_need{$f})) | ||
59 | { | ||
60 | push(@ret,&walk($r)); | ||
61 | } | ||
62 | $in{$f}--; | ||
63 | $done{$f}=join(" ",@ret); | ||
64 | return(@ret); | ||
65 | } | ||
66 | |||
67 | sub parse_linux | ||
68 | { | ||
69 | local($name)=@_; | ||
70 | |||
71 | open(IN,"nm $name|") || die "unable to run 'nn $name':$!\n"; | ||
72 | while (<IN>) | ||
73 | { | ||
74 | chop; | ||
75 | next if /^\s*$/; | ||
76 | if (/^[^[](.*):$/) | ||
77 | { | ||
78 | $file=$1; | ||
79 | $file="$1.c" if /\[(.*).o\]/; | ||
80 | print STDERR "$file\n"; | ||
81 | $we_need{$file}=" "; | ||
82 | next; | ||
83 | } | ||
84 | |||
85 | @a=split(/\s*\|\s*/); | ||
86 | next unless $#a == 7; | ||
87 | next unless $a[4] eq "GLOB"; | ||
88 | if ($a[6] eq "UNDEF") | ||
89 | { | ||
90 | $unres{$file}.=$a[7]." "; | ||
91 | } | ||
92 | else | ||
93 | { | ||
94 | if ($file{$a[7]} ne "") | ||
95 | { | ||
96 | print STDERR "duplicate definition of $a[7],\n$file{$a[7]} and $file \n"; | ||
97 | } | ||
98 | else | ||
99 | { | ||
100 | $file{$a[7]}=$file; | ||
101 | } | ||
102 | } | ||
103 | } | ||
104 | close(IN); | ||
105 | } | ||
106 | |||
107 | sub parse_solaris | ||
108 | { | ||
109 | local($name)=@_; | ||
110 | |||
111 | open(IN,"nm $name|") || die "unable to run 'nn $name':$!\n"; | ||
112 | while (<IN>) | ||
113 | { | ||
114 | chop; | ||
115 | next if /^\s*$/; | ||
116 | if (/^(\S+):$/) | ||
117 | { | ||
118 | $file=$1; | ||
119 | #$file="$1.c" if $file =~ /^(.*).o$/; | ||
120 | print STDERR "$file\n"; | ||
121 | $we_need{$file}=" "; | ||
122 | next; | ||
123 | } | ||
124 | @a=split(/\s*\|\s*/); | ||
125 | next unless $#a == 7; | ||
126 | next unless $a[4] eq "GLOB"; | ||
127 | if ($a[6] eq "UNDEF") | ||
128 | { | ||
129 | $unres{$file}.=$a[7]." "; | ||
130 | print STDERR "$file needs $a[7]\n" if $debug; | ||
131 | } | ||
132 | else | ||
133 | { | ||
134 | if ($file{$a[7]} ne "") | ||
135 | { | ||
136 | print STDERR "duplicate definition of $a[7],\n$file{$a[7]} and $file \n"; | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | $file{$a[7]}=$file; | ||
141 | print STDERR "$file has $a[7]\n" if $debug; | ||
142 | } | ||
143 | } | ||
144 | } | ||
145 | close(IN); | ||
146 | } | ||
147 | |||
diff --git a/src/lib/libcrypto/util/tab_num.pl b/src/lib/libcrypto/util/tab_num.pl deleted file mode 100644 index a81ed0edc2..0000000000 --- a/src/lib/libcrypto/util/tab_num.pl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | $num=1; | ||
4 | $width=40; | ||
5 | |||
6 | while (<>) | ||
7 | { | ||
8 | chop; | ||
9 | |||
10 | $i=length($_); | ||
11 | |||
12 | $n=$width-$i; | ||
13 | $i=int(($n+7)/8); | ||
14 | print $_.("\t" x $i).$num."\n"; | ||
15 | $num++; | ||
16 | } | ||
17 | |||
diff --git a/src/lib/libssl/src/util/FreeBSD.sh b/src/lib/libssl/src/util/FreeBSD.sh deleted file mode 100644 index db8edfc6aa..0000000000 --- a/src/lib/libssl/src/util/FreeBSD.sh +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | perl util/perlpath.pl /usr/bin | ||
4 | perl util/ssldir.pl /usr/local | ||
5 | perl util/mk1mf.pl FreeBSD >Makefile.FreeBSD | ||
6 | perl Configure FreeBSD | ||
diff --git a/src/lib/libssl/src/util/add_cr.pl b/src/lib/libssl/src/util/add_cr.pl deleted file mode 100644 index c7b62c11ec..0000000000 --- a/src/lib/libssl/src/util/add_cr.pl +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # This adds a copyright message to a souce code file. | ||
4 | # It also gets the file name correct. | ||
5 | # | ||
6 | # perl util/add_cr.pl *.[ch] */*.[ch] */*/*.[ch] | ||
7 | # | ||
8 | |||
9 | foreach (@ARGV) | ||
10 | { | ||
11 | &dofile($_); | ||
12 | } | ||
13 | |||
14 | sub dofile | ||
15 | { | ||
16 | local($file)=@_; | ||
17 | |||
18 | open(IN,"<$file") || die "unable to open $file:$!\n"; | ||
19 | |||
20 | print STDERR "doing $file\n"; | ||
21 | @in=<IN>; | ||
22 | |||
23 | return(1) if ($in[0] =~ / NOCW /); | ||
24 | |||
25 | @out=(); | ||
26 | open(OUT,">$file.out") || die "unable to open $file.$$:$!\n"; | ||
27 | push(@out,"/* $file */\n"); | ||
28 | if (($in[1] !~ /^\/\* Copyright \(C\) [0-9-]+ Eric Young \(eay\@cryptsoft.com\)/)) | ||
29 | { | ||
30 | push(@out,&Copyright); | ||
31 | $i=2; | ||
32 | @a=grep(/ Copyright \(C\) /,@in); | ||
33 | if ($#a >= 0) | ||
34 | { | ||
35 | while (($i <= $#in) && ($in[$i] ne " */\n")) | ||
36 | { $i++; } | ||
37 | $i++ if ($in[$i] eq " */\n"); | ||
38 | |||
39 | while (($i <= $#in) && ($in[$i] =~ /^\s*$/)) | ||
40 | { $i++; } | ||
41 | |||
42 | push(@out,"\n"); | ||
43 | for ( ; $i <= $#in; $i++) | ||
44 | { push(@out,$in[$i]); } | ||
45 | } | ||
46 | else | ||
47 | { push(@out,@in); } | ||
48 | } | ||
49 | else | ||
50 | { | ||
51 | shift(@in); | ||
52 | push(@out,@in); | ||
53 | } | ||
54 | print OUT @out; | ||
55 | close(IN); | ||
56 | close(OUT); | ||
57 | rename("$file","$file.orig") || die "unable to rename $file:$!\n"; | ||
58 | rename("$file.out",$file) || die "unable to rename $file.out:$!\n"; | ||
59 | } | ||
60 | |||
61 | |||
62 | |||
63 | sub Copyright | ||
64 | { | ||
65 | return <<'EOF'; | ||
66 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
67 | * All rights reserved. | ||
68 | * | ||
69 | * This package is an SSL implementation written | ||
70 | * by Eric Young (eay@cryptsoft.com). | ||
71 | * The implementation was written so as to conform with Netscapes SSL. | ||
72 | * | ||
73 | * This library is free for commercial and non-commercial use as long as | ||
74 | * the following conditions are aheared to. The following conditions | ||
75 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
76 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
77 | * included with this distribution is covered by the same copyright terms | ||
78 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
79 | * | ||
80 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
81 | * the code are not to be removed. | ||
82 | * If this package is used in a product, Eric Young should be given attribution | ||
83 | * as the author of the parts of the library used. | ||
84 | * This can be in the form of a textual message at program startup or | ||
85 | * in documentation (online or textual) provided with the package. | ||
86 | * | ||
87 | * Redistribution and use in source and binary forms, with or without | ||
88 | * modification, are permitted provided that the following conditions | ||
89 | * are met: | ||
90 | * 1. Redistributions of source code must retain the copyright | ||
91 | * notice, this list of conditions and the following disclaimer. | ||
92 | * 2. Redistributions in binary form must reproduce the above copyright | ||
93 | * notice, this list of conditions and the following disclaimer in the | ||
94 | * documentation and/or other materials provided with the distribution. | ||
95 | * 3. All advertising materials mentioning features or use of this software | ||
96 | * must display the following acknowledgement: | ||
97 | * "This product includes cryptographic software written by | ||
98 | * Eric Young (eay@cryptsoft.com)" | ||
99 | * The word 'cryptographic' can be left out if the rouines from the library | ||
100 | * being used are not cryptographic related :-). | ||
101 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
102 | * the apps directory (application code) you must include an acknowledgement: | ||
103 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
104 | * | ||
105 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
106 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
107 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
108 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
109 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
110 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
111 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
112 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
113 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
114 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
115 | * SUCH DAMAGE. | ||
116 | * | ||
117 | * The licence and distribution terms for any publically available version or | ||
118 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
119 | * copied and put under another distribution licence | ||
120 | * [including the GNU Public Licence.] | ||
121 | */ | ||
122 | EOF | ||
123 | } | ||
diff --git a/src/lib/libssl/src/util/ck_errf.pl b/src/lib/libssl/src/util/ck_errf.pl deleted file mode 100644 index f13af5c50b..0000000000 --- a/src/lib/libssl/src/util/ck_errf.pl +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # This is just a quick script to scan for cases where the 'error' | ||
4 | # function name in a XXXerr() macro is wrong. | ||
5 | # | ||
6 | # Run in the top level by going | ||
7 | # perl util/ck_errf.pl */*.c */*/*.c | ||
8 | # | ||
9 | |||
10 | my $err_strict = 0; | ||
11 | my $bad = 0; | ||
12 | |||
13 | foreach $file (@ARGV) | ||
14 | { | ||
15 | if ($file eq "-strict") | ||
16 | { | ||
17 | $err_strict = 1; | ||
18 | next; | ||
19 | } | ||
20 | open(IN,"<$file") || die "unable to open $file\n"; | ||
21 | $func=""; | ||
22 | while (<IN>) | ||
23 | { | ||
24 | if (!/;$/ && /^([a-zA-Z].*[\s*])?([A-Za-z_0-9]+)\(.*[),]/) | ||
25 | { | ||
26 | /^([^()]*(\([^()]*\)[^()]*)*)\(/; | ||
27 | $1 =~ /([A-Za-z_0-9]*)$/; | ||
28 | $func = $1; | ||
29 | $func =~ tr/A-Z/a-z/; | ||
30 | } | ||
31 | if (/([A-Z0-9]+)err\(([^,]+)/ && ! /ckerr_ignore/) | ||
32 | { | ||
33 | $errlib=$1; | ||
34 | $n=$2; | ||
35 | |||
36 | if ($func eq "") | ||
37 | { print "$file:$.:???:$n\n"; $bad = 1; next; } | ||
38 | |||
39 | if ($n !~ /([^_]+)_F_(.+)$/) | ||
40 | { | ||
41 | # print "check -$file:$.:$func:$n\n"; | ||
42 | next; | ||
43 | } | ||
44 | $lib=$1; | ||
45 | $n=$2; | ||
46 | |||
47 | if ($lib ne $errlib) | ||
48 | { print "$file:$.:$func:$n [${errlib}err]\n"; $bad = 1; next; } | ||
49 | |||
50 | $n =~ tr/A-Z/a-z/; | ||
51 | if (($n ne $func) && ($errlib ne "SYS")) | ||
52 | { print "$file:$.:$func:$n\n"; $bad = 1; next; } | ||
53 | # print "$func:$1\n"; | ||
54 | } | ||
55 | } | ||
56 | close(IN); | ||
57 | } | ||
58 | |||
59 | if ($bad && $err_strict) | ||
60 | { | ||
61 | print STDERR "FATAL: error discrepancy\n"; | ||
62 | exit 1; | ||
63 | } | ||
64 | |||
diff --git a/src/lib/libssl/src/util/clean-depend.pl b/src/lib/libssl/src/util/clean-depend.pl deleted file mode 100644 index d3525b0ed0..0000000000 --- a/src/lib/libssl/src/util/clean-depend.pl +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | #!/usr/local/bin/perl -w | ||
2 | # Clean the dependency list in a makefile of standard includes... | ||
3 | # Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999 | ||
4 | |||
5 | use strict; | ||
6 | |||
7 | while(<STDIN>) { | ||
8 | print; | ||
9 | last if /^# DO NOT DELETE THIS LINE/; | ||
10 | } | ||
11 | |||
12 | my %files; | ||
13 | |||
14 | my $thisfile=""; | ||
15 | while(<STDIN>) { | ||
16 | my ($dummy, $file,$deps)=/^((.*):)? (.*)$/; | ||
17 | my $origfile=""; | ||
18 | $thisfile=$file if defined $file; | ||
19 | next if !defined $deps; | ||
20 | $origfile=$thisfile; | ||
21 | $origfile=~s/\.o$/.c/; | ||
22 | my @deps=split ' ',$deps; | ||
23 | @deps=grep(!/^\//,@deps); | ||
24 | @deps=grep(!/^\\$/,@deps); | ||
25 | @deps=grep(!/^$origfile$/,@deps); | ||
26 | # pull out the kludged kerberos header (if present). | ||
27 | @deps=grep(!/^[.\/]+\/krb5.h/,@deps); | ||
28 | push @{$files{$thisfile}},@deps; | ||
29 | } | ||
30 | |||
31 | my $file; | ||
32 | foreach $file (sort keys %files) { | ||
33 | my $len=0; | ||
34 | my $dep; | ||
35 | my $origfile=$file; | ||
36 | $origfile=~s/\.o$/.c/; | ||
37 | $file=~s/^\.\///; | ||
38 | push @{$files{$file}},$origfile; | ||
39 | my $prevdep=""; | ||
40 | |||
41 | # Remove leading ./ before sorting | ||
42 | my @deps = map { $_ =~ s/^\.\///; $_ } @{$files{$file}}; | ||
43 | |||
44 | foreach $dep (sort @deps) { | ||
45 | $dep=~s/^\.\///; | ||
46 | next if $prevdep eq $dep; # to exterminate duplicates... | ||
47 | $prevdep = $dep; | ||
48 | $len=0 if $len+length($dep)+1 >= 80; | ||
49 | if($len == 0) { | ||
50 | print "\n$file:"; | ||
51 | $len=length($file)+1; | ||
52 | } | ||
53 | print " $dep"; | ||
54 | $len+=length($dep)+1; | ||
55 | } | ||
56 | } | ||
57 | |||
58 | print "\n"; | ||
diff --git a/src/lib/libssl/src/util/copy.pl b/src/lib/libssl/src/util/copy.pl deleted file mode 100644 index eba6d5815e..0000000000 --- a/src/lib/libssl/src/util/copy.pl +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | use Fcntl; | ||
4 | |||
5 | |||
6 | # copy.pl | ||
7 | |||
8 | # Perl script 'copy' comment. On Windows the built in "copy" command also | ||
9 | # copies timestamps: this messes up Makefile dependencies. | ||
10 | |||
11 | my $stripcr = 0; | ||
12 | |||
13 | my $arg; | ||
14 | |||
15 | foreach $arg (@ARGV) { | ||
16 | if ($arg eq "-stripcr") | ||
17 | { | ||
18 | $stripcr = 1; | ||
19 | next; | ||
20 | } | ||
21 | $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... | ||
22 | foreach (glob $arg) | ||
23 | { | ||
24 | push @filelist, $_; | ||
25 | } | ||
26 | } | ||
27 | |||
28 | $fnum = @filelist; | ||
29 | |||
30 | if ($fnum <= 1) | ||
31 | { | ||
32 | die "Need at least two filenames"; | ||
33 | } | ||
34 | |||
35 | $dest = pop @filelist; | ||
36 | |||
37 | if ($fnum > 2 && ! -d $dest) | ||
38 | { | ||
39 | die "Destination must be a directory"; | ||
40 | } | ||
41 | |||
42 | foreach (@filelist) | ||
43 | { | ||
44 | if (-d $dest) | ||
45 | { | ||
46 | $dfile = $_; | ||
47 | $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|; | ||
48 | $dfile = "$dest/$dfile"; | ||
49 | } | ||
50 | else | ||
51 | { | ||
52 | $dfile = $dest; | ||
53 | } | ||
54 | sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_"; | ||
55 | sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY) | ||
56 | || die "Can't Open $dfile"; | ||
57 | while (sysread IN, $buf, 10240) | ||
58 | { | ||
59 | if ($stripcr) | ||
60 | { | ||
61 | $buf =~ tr/\015//d; | ||
62 | } | ||
63 | syswrite(OUT, $buf, length($buf)); | ||
64 | } | ||
65 | close(IN); | ||
66 | close(OUT); | ||
67 | print "Copying: $_ to $dfile\n"; | ||
68 | } | ||
69 | |||
70 | |||
diff --git a/src/lib/libssl/src/util/deleof.pl b/src/lib/libssl/src/util/deleof.pl deleted file mode 100644 index 155acd88ff..0000000000 --- a/src/lib/libssl/src/util/deleof.pl +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | while (<>) | ||
4 | { | ||
5 | |||
6 | last if (/^# DO NOT DELETE THIS LINE/); | ||
7 | } | ||
diff --git a/src/lib/libssl/src/util/dirname.pl b/src/lib/libssl/src/util/dirname.pl deleted file mode 100644 index d7a66d96ac..0000000000 --- a/src/lib/libssl/src/util/dirname.pl +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | if ($#ARGV < 0) { | ||
4 | die "dirname.pl: too few arguments\n"; | ||
5 | } elsif ($#ARGV > 0) { | ||
6 | die "dirname.pl: too many arguments\n"; | ||
7 | } | ||
8 | |||
9 | my $d = $ARGV[0]; | ||
10 | |||
11 | if ($d =~ m|.*/.*|) { | ||
12 | $d =~ s|/[^/]*$||; | ||
13 | } else { | ||
14 | $d = "."; | ||
15 | } | ||
16 | |||
17 | print $d,"\n"; | ||
18 | exit(0); | ||
diff --git a/src/lib/libssl/src/util/domd b/src/lib/libssl/src/util/domd deleted file mode 100644 index bab48cb7a2..0000000000 --- a/src/lib/libssl/src/util/domd +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # Do a makedepend, only leave out the standard headers | ||
3 | # Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999 | ||
4 | |||
5 | TOP=$1 | ||
6 | shift | ||
7 | if [ "$1" = "-MD" ]; then | ||
8 | shift | ||
9 | MAKEDEPEND=$1 | ||
10 | shift | ||
11 | fi | ||
12 | if [ "$MAKEDEPEND" = "" ]; then MAKEDEPEND=makedepend; fi | ||
13 | |||
14 | cp Makefile Makefile.save | ||
15 | # fake the presence of Kerberos | ||
16 | touch $TOP/krb5.h | ||
17 | if expr "$MAKEDEPEND" : '.*gcc$' > /dev/null; then | ||
18 | args="" | ||
19 | while [ $# -gt 0 ]; do | ||
20 | if [ "$1" != "--" ]; then args="$args $1"; fi | ||
21 | shift | ||
22 | done | ||
23 | sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp | ||
24 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp | ||
25 | ${MAKEDEPEND} -Werror -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp || exit 1 | ||
26 | ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new | ||
27 | RC=$? | ||
28 | rm -f Makefile.tmp | ||
29 | else | ||
30 | ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@ && \ | ||
31 | ${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new | ||
32 | RC=$? | ||
33 | fi | ||
34 | mv Makefile.new Makefile | ||
35 | # unfake the presence of Kerberos | ||
36 | rm $TOP/krb5.h | ||
37 | |||
38 | exit $RC | ||
diff --git a/src/lib/libssl/src/util/err-ins.pl b/src/lib/libssl/src/util/err-ins.pl deleted file mode 100644 index 31b70df8d0..0000000000 --- a/src/lib/libssl/src/util/err-ins.pl +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # tack error codes onto the end of a file | ||
4 | # | ||
5 | |||
6 | open(ERR,$ARGV[0]) || die "unable to open error file '$ARGV[0]':$!\n"; | ||
7 | @err=<ERR>; | ||
8 | close(ERR); | ||
9 | |||
10 | open(IN,$ARGV[1]) || die "unable to open header file '$ARGV[1]':$!\n"; | ||
11 | |||
12 | @out=""; | ||
13 | while (<IN>) | ||
14 | { | ||
15 | push(@out,$_); | ||
16 | last if /BEGIN ERROR CODES/; | ||
17 | } | ||
18 | close(IN); | ||
19 | |||
20 | open(OUT,">$ARGV[1]") || die "unable to open header file '$ARGV[1]':$1\n"; | ||
21 | print OUT @out; | ||
22 | print OUT @err; | ||
23 | print OUT <<"EOF"; | ||
24 | |||
25 | #ifdef __cplusplus | ||
26 | } | ||
27 | #endif | ||
28 | #endif | ||
29 | |||
30 | EOF | ||
31 | close(OUT); | ||
32 | |||
33 | |||
diff --git a/src/lib/libssl/src/util/extract-names.pl b/src/lib/libssl/src/util/extract-names.pl deleted file mode 100644 index 35bd6ed843..0000000000 --- a/src/lib/libssl/src/util/extract-names.pl +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | $/ = ""; # Eat a paragraph at once. | ||
4 | while(<STDIN>) { | ||
5 | chop; | ||
6 | s/\n/ /gm; | ||
7 | if (/^=head1 /) { | ||
8 | $name = 0; | ||
9 | } elsif ($name) { | ||
10 | if (/ - /) { | ||
11 | s/ - .*//; | ||
12 | s/,\s+/,/g; | ||
13 | s/\s+,/,/g; | ||
14 | s/^\s+//g; | ||
15 | s/\s+$//g; | ||
16 | s/\s/_/g; | ||
17 | push @words, split ','; | ||
18 | } | ||
19 | } | ||
20 | if (/^=head1 *NAME *$/) { | ||
21 | $name = 1; | ||
22 | } | ||
23 | } | ||
24 | |||
25 | print join("\n", @words),"\n"; | ||
26 | |||
diff --git a/src/lib/libssl/src/util/extract-section.pl b/src/lib/libssl/src/util/extract-section.pl deleted file mode 100644 index 7a0ba4f69a..0000000000 --- a/src/lib/libssl/src/util/extract-section.pl +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | while(<STDIN>) { | ||
4 | if (/=for\s+comment\s+openssl_manual_section:(\S+)/) | ||
5 | { | ||
6 | print "$1\n"; | ||
7 | exit 0; | ||
8 | } | ||
9 | } | ||
10 | |||
11 | print "$ARGV[0]\n"; | ||
12 | |||
diff --git a/src/lib/libssl/src/util/files.pl b/src/lib/libssl/src/util/files.pl deleted file mode 100644 index 41f033e3b9..0000000000 --- a/src/lib/libssl/src/util/files.pl +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # used to generate the file MINFO for use by util/mk1mf.pl | ||
4 | # It is basically a list of all variables from the passed makefile | ||
5 | # | ||
6 | |||
7 | $s=""; | ||
8 | while (<>) | ||
9 | { | ||
10 | chop; | ||
11 | s/#.*//; | ||
12 | if (/^(\S+)\s*=\s*(.*)$/) | ||
13 | { | ||
14 | $o=""; | ||
15 | ($s,$b)=($1,$2); | ||
16 | for (;;) | ||
17 | { | ||
18 | if ($b =~ /\\$/) | ||
19 | { | ||
20 | chop($b); | ||
21 | $o.=$b." "; | ||
22 | $b=<>; | ||
23 | chop($b); | ||
24 | } | ||
25 | else | ||
26 | { | ||
27 | $o.=$b." "; | ||
28 | last; | ||
29 | } | ||
30 | } | ||
31 | $o =~ s/^\s+//; | ||
32 | $o =~ s/\s+$//; | ||
33 | $o =~ s/\s+/ /g; | ||
34 | |||
35 | $o =~ s/\$[({]([^)}]+)[)}]/$sym{$1}/g; | ||
36 | $sym{$s}=$o; | ||
37 | } | ||
38 | } | ||
39 | |||
40 | $pwd=`pwd`; chop($pwd); | ||
41 | |||
42 | if ($sym{'TOP'} eq ".") | ||
43 | { | ||
44 | $n=0; | ||
45 | $dir="."; | ||
46 | } | ||
47 | else { | ||
48 | $n=split(/\//,$sym{'TOP'}); | ||
49 | @_=split(/\//,$pwd); | ||
50 | $z=$#_-$n+1; | ||
51 | foreach $i ($z .. $#_) { $dir.=$_[$i]."/"; } | ||
52 | chop($dir); | ||
53 | } | ||
54 | |||
55 | print "RELATIVE_DIRECTORY=$dir\n"; | ||
56 | |||
57 | foreach (sort keys %sym) | ||
58 | { | ||
59 | print "$_=$sym{$_}\n"; | ||
60 | } | ||
61 | print "RELATIVE_DIRECTORY=\n"; | ||
diff --git a/src/lib/libssl/src/util/install.sh b/src/lib/libssl/src/util/install.sh deleted file mode 100644 index e1d0c982df..0000000000 --- a/src/lib/libssl/src/util/install.sh +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # install - install a program, script, or datafile | ||
4 | # This comes from X11R5; it is not part of GNU. | ||
5 | # | ||
6 | # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ | ||
7 | # | ||
8 | # This script is compatible with the BSD install script, but was written | ||
9 | # from scratch. | ||
10 | # | ||
11 | |||
12 | |||
13 | # set DOITPROG to echo to test this script | ||
14 | |||
15 | doit="${DOITPROG:-}" | ||
16 | |||
17 | |||
18 | # put in absolute paths if you don't have them in your path; or use env. vars. | ||
19 | |||
20 | mvprog="${MVPROG:-mv}" | ||
21 | cpprog="${CPPROG:-cp}" | ||
22 | chmodprog="${CHMODPROG:-chmod}" | ||
23 | chownprog="${CHOWNPROG:-chown}" | ||
24 | chgrpprog="${CHGRPPROG:-chgrp}" | ||
25 | stripprog="${STRIPPROG:-strip}" | ||
26 | rmprog="${RMPROG:-rm}" | ||
27 | |||
28 | instcmd="$mvprog" | ||
29 | chmodcmd="" | ||
30 | chowncmd="" | ||
31 | chgrpcmd="" | ||
32 | stripcmd="" | ||
33 | rmcmd="$rmprog -f" | ||
34 | src="" | ||
35 | dst="" | ||
36 | |||
37 | while [ x"$1" != x ]; do | ||
38 | case $1 in | ||
39 | -c) instcmd="$cpprog" | ||
40 | shift | ||
41 | continue;; | ||
42 | |||
43 | -m) chmodcmd="$chmodprog $2" | ||
44 | shift | ||
45 | shift | ||
46 | continue;; | ||
47 | |||
48 | -o) chowncmd="$chownprog $2" | ||
49 | shift | ||
50 | shift | ||
51 | continue;; | ||
52 | |||
53 | -g) chgrpcmd="$chgrpprog $2" | ||
54 | shift | ||
55 | shift | ||
56 | continue;; | ||
57 | |||
58 | -s) stripcmd="$stripprog" | ||
59 | shift | ||
60 | continue;; | ||
61 | |||
62 | *) if [ x"$src" = x ] | ||
63 | then | ||
64 | src=$1 | ||
65 | else | ||
66 | dst=$1 | ||
67 | fi | ||
68 | shift | ||
69 | continue;; | ||
70 | esac | ||
71 | done | ||
72 | |||
73 | if [ x"$src" = x ] | ||
74 | then | ||
75 | echo "install: no input file specified" | ||
76 | exit 1 | ||
77 | fi | ||
78 | |||
79 | if [ x"$dst" = x ] | ||
80 | then | ||
81 | echo "install: no destination specified" | ||
82 | exit 1 | ||
83 | fi | ||
84 | |||
85 | |||
86 | # if destination is a directory, append the input filename; if your system | ||
87 | # does not like double slashes in filenames, you may need to add some logic | ||
88 | |||
89 | if [ -d $dst ] | ||
90 | then | ||
91 | dst="$dst"/`basename $src` | ||
92 | fi | ||
93 | |||
94 | |||
95 | # get rid of the old one and mode the new one in | ||
96 | |||
97 | $doit $rmcmd $dst | ||
98 | $doit $instcmd $src $dst | ||
99 | |||
100 | |||
101 | # and set any options; do chmod last to preserve setuid bits | ||
102 | |||
103 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; fi | ||
104 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; fi | ||
105 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; fi | ||
106 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; fi | ||
107 | |||
108 | exit 0 | ||
diff --git a/src/lib/libssl/src/util/mk1mf.pl b/src/lib/libssl/src/util/mk1mf.pl deleted file mode 100644 index 48de99f66c..0000000000 --- a/src/lib/libssl/src/util/mk1mf.pl +++ /dev/null | |||
@@ -1,1230 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # A bit of an evil hack but it post processes the file ../MINFO which | ||
3 | # is generated by `make files` in the top directory. | ||
4 | # This script outputs one mega makefile that has no shell stuff or any | ||
5 | # funny stuff | ||
6 | # | ||
7 | |||
8 | $INSTALLTOP="/usr/local/ssl"; | ||
9 | $OPENSSLDIR="/usr/local/ssl"; | ||
10 | $OPTIONS=""; | ||
11 | $ssl_version=""; | ||
12 | $banner="\t\@echo Building OpenSSL"; | ||
13 | |||
14 | my $no_static_engine = 1; | ||
15 | my $engines = ""; | ||
16 | my $otherlibs = ""; | ||
17 | local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic | ||
18 | local $zlib_lib = ""; | ||
19 | local $perl_asm = 0; # 1 to autobuild asm files from perl scripts | ||
20 | |||
21 | my $ex_l_libs = ""; | ||
22 | |||
23 | # Options to import from top level Makefile | ||
24 | |||
25 | my %mf_import = ( | ||
26 | VERSION => \$ssl_version, | ||
27 | OPTIONS => \$OPTIONS, | ||
28 | INSTALLTOP => \$INSTALLTOP, | ||
29 | OPENSSLDIR => \$OPENSSLDIR, | ||
30 | PLATFORM => \$mf_platform, | ||
31 | CFLAG => \$mf_cflag, | ||
32 | DEPFLAG => \$mf_depflag, | ||
33 | CPUID_OBJ => \$mf_cpuid_asm, | ||
34 | BN_ASM => \$mf_bn_asm, | ||
35 | DES_ENC => \$mf_des_asm, | ||
36 | AES_ENC => \$mf_aes_asm, | ||
37 | BF_ENC => \$mf_bf_asm, | ||
38 | CAST_ENC => \$mf_cast_asm, | ||
39 | RC4_ENC => \$mf_rc4_asm, | ||
40 | RC5_ENC => \$mf_rc5_asm, | ||
41 | MD5_ASM_OBJ => \$mf_md5_asm, | ||
42 | SHA1_ASM_OBJ => \$mf_sha_asm, | ||
43 | RMD160_ASM_OBJ => \$mf_rmd_asm, | ||
44 | WP_ASM_OBJ => \$mf_wp_asm, | ||
45 | CMLL_ENC => \$mf_cm_asm, | ||
46 | BASEADDR => \$baseaddr, | ||
47 | FIPSDIR => \$fipsdir, | ||
48 | ); | ||
49 | |||
50 | |||
51 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; | ||
52 | while(<IN>) { | ||
53 | my ($mf_opt, $mf_ref); | ||
54 | while (($mf_opt, $mf_ref) = each %mf_import) { | ||
55 | if (/^$mf_opt\s*=\s*(.*)$/) { | ||
56 | $$mf_ref = $1; | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | close(IN); | ||
61 | |||
62 | $debug = 1 if $mf_platform =~ /^debug-/; | ||
63 | |||
64 | die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq ""; | ||
65 | |||
66 | $infile="MINFO"; | ||
67 | |||
68 | %ops=( | ||
69 | "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", | ||
70 | "VC-WIN64I", "Microsoft C/C++ - Win64/IA-64", | ||
71 | "VC-WIN64A", "Microsoft C/C++ - Win64/x64", | ||
72 | "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", | ||
73 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", | ||
74 | "Mingw32", "GNU C++ - Windows NT or 9x", | ||
75 | "Mingw32-files", "Create files with DOS copy ...", | ||
76 | "BC-NT", "Borland C++ 4.5 - Windows NT", | ||
77 | "linux-elf","Linux elf", | ||
78 | "ultrix-mips","DEC mips ultrix", | ||
79 | "FreeBSD","FreeBSD distribution", | ||
80 | "OS2-EMX", "EMX GCC OS/2", | ||
81 | "netware-clib", "CodeWarrior for NetWare - CLib - with WinSock Sockets", | ||
82 | "netware-clib-bsdsock", "CodeWarrior for NetWare - CLib - with BSD Sockets", | ||
83 | "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets", | ||
84 | "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets", | ||
85 | "default","cc under unix", | ||
86 | "auto", "auto detect from top level Makefile" | ||
87 | ); | ||
88 | |||
89 | $platform=""; | ||
90 | my $xcflags=""; | ||
91 | foreach (@ARGV) | ||
92 | { | ||
93 | if (!&read_options && !defined($ops{$_})) | ||
94 | { | ||
95 | print STDERR "unknown option - $_\n"; | ||
96 | print STDERR "usage: perl mk1mf.pl [options] [system]\n"; | ||
97 | print STDERR "\nwhere [system] can be one of the following\n"; | ||
98 | foreach $i (sort keys %ops) | ||
99 | { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; } | ||
100 | print STDERR <<"EOF"; | ||
101 | and [options] can be one of | ||
102 | no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest | ||
103 | no-ripemd | ||
104 | no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher | ||
105 | no-bf no-cast no-aes no-camellia no-seed | ||
106 | no-rsa no-dsa no-dh - Skip this public key cipher | ||
107 | no-ssl2 no-ssl3 - Skip this version of SSL | ||
108 | just-ssl - remove all non-ssl keys/digest | ||
109 | no-asm - No x86 asm | ||
110 | no-krb5 - No KRB5 | ||
111 | no-srp - No SRP | ||
112 | no-ec - No EC | ||
113 | no-ecdsa - No ECDSA | ||
114 | no-ecdh - No ECDH | ||
115 | no-engine - No engine | ||
116 | no-hw - No hw | ||
117 | nasm - Use NASM for x86 asm | ||
118 | nw-nasm - Use NASM x86 asm for NetWare | ||
119 | nw-mwasm - Use Metrowerks x86 asm for NetWare | ||
120 | gaswin - Use GNU as with Mingw32 | ||
121 | no-socks - No socket code | ||
122 | no-err - No error strings | ||
123 | dll/shlib - Build shared libraries (MS) | ||
124 | debug - Debug build | ||
125 | profile - Profiling build | ||
126 | gcc - Use Gcc (unix) | ||
127 | |||
128 | Values that can be set | ||
129 | TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler | ||
130 | |||
131 | -L<ex_lib_path> -l<ex_lib> - extra library flags (unix) | ||
132 | -<ex_cc_flags> - extra 'cc' flags, | ||
133 | added (MS), or replace (unix) | ||
134 | EOF | ||
135 | exit(1); | ||
136 | } | ||
137 | $platform=$_; | ||
138 | } | ||
139 | foreach (grep(!/^$/, split(/ /, $OPTIONS))) | ||
140 | { | ||
141 | print STDERR "unknown option - $_\n" if !&read_options; | ||
142 | } | ||
143 | |||
144 | $no_static_engine = 0 if (!$shlib); | ||
145 | |||
146 | $no_mdc2=1 if ($no_des); | ||
147 | |||
148 | $no_ssl3=1 if ($no_md5 || $no_sha); | ||
149 | $no_ssl3=1 if ($no_rsa && $no_dh); | ||
150 | |||
151 | $no_ssl2=1 if ($no_md5); | ||
152 | $no_ssl2=1 if ($no_rsa); | ||
153 | |||
154 | $out_def="out"; | ||
155 | $inc_def="outinc"; | ||
156 | $tmp_def="tmp"; | ||
157 | |||
158 | $perl="perl" unless defined $perl; | ||
159 | $mkdir="-mkdir" unless defined $mkdir; | ||
160 | |||
161 | ($ssl,$crypto)=("ssl","crypto"); | ||
162 | $ranlib="echo ranlib"; | ||
163 | |||
164 | $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; | ||
165 | $src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.'; | ||
166 | $bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:''; | ||
167 | |||
168 | # $bin_dir.=$o causes a core dump on my sparc :-( | ||
169 | |||
170 | |||
171 | $NT=0; | ||
172 | |||
173 | push(@INC,"util/pl","pl"); | ||
174 | |||
175 | if ($platform eq "auto") { | ||
176 | $platform = $mf_platform; | ||
177 | print STDERR "Imported platform $mf_platform\n"; | ||
178 | } | ||
179 | |||
180 | if (($platform =~ /VC-(.+)/)) | ||
181 | { | ||
182 | $FLAVOR=$1; | ||
183 | $NT = 1 if $1 eq "NT"; | ||
184 | require 'VC-32.pl'; | ||
185 | } | ||
186 | elsif ($platform eq "Mingw32") | ||
187 | { | ||
188 | require 'Mingw32.pl'; | ||
189 | } | ||
190 | elsif ($platform eq "Mingw32-files") | ||
191 | { | ||
192 | require 'Mingw32f.pl'; | ||
193 | } | ||
194 | elsif ($platform eq "BC-NT") | ||
195 | { | ||
196 | $bc=1; | ||
197 | require 'BC-32.pl'; | ||
198 | } | ||
199 | elsif ($platform eq "FreeBSD") | ||
200 | { | ||
201 | require 'unix.pl'; | ||
202 | $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer'; | ||
203 | } | ||
204 | elsif ($platform eq "linux-elf") | ||
205 | { | ||
206 | require "unix.pl"; | ||
207 | require "linux.pl"; | ||
208 | $unix=1; | ||
209 | } | ||
210 | elsif ($platform eq "ultrix-mips") | ||
211 | { | ||
212 | require "unix.pl"; | ||
213 | require "ultrix.pl"; | ||
214 | $unix=1; | ||
215 | } | ||
216 | elsif ($platform eq "OS2-EMX") | ||
217 | { | ||
218 | $wc=1; | ||
219 | require 'OS2-EMX.pl'; | ||
220 | } | ||
221 | elsif (($platform eq "netware-clib") || ($platform eq "netware-libc") || | ||
222 | ($platform eq "netware-clib-bsdsock") || ($platform eq "netware-libc-bsdsock")) | ||
223 | { | ||
224 | $LIBC=1 if $platform eq "netware-libc" || $platform eq "netware-libc-bsdsock"; | ||
225 | $BSDSOCK=1 if ($platform eq "netware-libc-bsdsock") || ($platform eq "netware-clib-bsdsock"); | ||
226 | require 'netware.pl'; | ||
227 | } | ||
228 | else | ||
229 | { | ||
230 | require "unix.pl"; | ||
231 | |||
232 | $unix=1; | ||
233 | $cflags.=' -DTERMIO'; | ||
234 | } | ||
235 | |||
236 | $fipsdir =~ s/\//${o}/g; | ||
237 | |||
238 | $out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":""); | ||
239 | $tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":""); | ||
240 | $inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def; | ||
241 | |||
242 | $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); | ||
243 | |||
244 | $cflags= "$xcflags$cflags" if $xcflags ne ""; | ||
245 | |||
246 | $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; | ||
247 | $cflags.=" -DOPENSSL_NO_AES" if $no_aes; | ||
248 | $cflags.=" -DOPENSSL_NO_CAMELLIA" if $no_camellia; | ||
249 | $cflags.=" -DOPENSSL_NO_SEED" if $no_seed; | ||
250 | $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; | ||
251 | $cflags.=" -DOPENSSL_NO_RC4" if $no_rc4; | ||
252 | $cflags.=" -DOPENSSL_NO_RC5" if $no_rc5; | ||
253 | $cflags.=" -DOPENSSL_NO_MD2" if $no_md2; | ||
254 | $cflags.=" -DOPENSSL_NO_MD4" if $no_md4; | ||
255 | $cflags.=" -DOPENSSL_NO_MD5" if $no_md5; | ||
256 | $cflags.=" -DOPENSSL_NO_SHA" if $no_sha; | ||
257 | $cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; | ||
258 | $cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd; | ||
259 | $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; | ||
260 | $cflags.=" -DOPENSSL_NO_BF" if $no_bf; | ||
261 | $cflags.=" -DOPENSSL_NO_CAST" if $no_cast; | ||
262 | $cflags.=" -DOPENSSL_NO_DES" if $no_des; | ||
263 | $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; | ||
264 | $cflags.=" -DOPENSSL_NO_DSA" if $no_dsa; | ||
265 | $cflags.=" -DOPENSSL_NO_DH" if $no_dh; | ||
266 | $cflags.=" -DOPENSSL_NO_WHIRLPOOL" if $no_whirlpool; | ||
267 | $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock; | ||
268 | $cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2; | ||
269 | $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; | ||
270 | $cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext; | ||
271 | $cflags.=" -DOPENSSL_NO_SRP" if $no_srp; | ||
272 | $cflags.=" -DOPENSSL_NO_CMS" if $no_cms; | ||
273 | $cflags.=" -DOPENSSL_NO_ERR" if $no_err; | ||
274 | $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; | ||
275 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; | ||
276 | $cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa; | ||
277 | $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; | ||
278 | $cflags.=" -DOPENSSL_NO_GOST" if $no_gost; | ||
279 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; | ||
280 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; | ||
281 | $cflags.=" -DOPENSSL_FIPS" if $fips; | ||
282 | $cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; | ||
283 | $cflags.=" -DOPENSSL_NO_EC2M" if $no_ec2m; | ||
284 | $cflags.= " -DZLIB" if $zlib_opt; | ||
285 | $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; | ||
286 | |||
287 | if ($no_static_engine) | ||
288 | { | ||
289 | $cflags .= " -DOPENSSL_NO_STATIC_ENGINE"; | ||
290 | } | ||
291 | else | ||
292 | { | ||
293 | $cflags .= " -DOPENSSL_NO_DYNAMIC_ENGINE"; | ||
294 | } | ||
295 | |||
296 | #$cflags.=" -DRSAref" if $rsaref ne ""; | ||
297 | |||
298 | ## if ($unix) | ||
299 | ## { $cflags="$c_flags" if ($c_flags ne ""); } | ||
300 | ##else | ||
301 | { $cflags="$c_flags$cflags" if ($c_flags ne ""); } | ||
302 | |||
303 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); | ||
304 | |||
305 | |||
306 | %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", | ||
307 | "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); | ||
308 | |||
309 | if ($msdos) | ||
310 | { | ||
311 | $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n"; | ||
312 | $banner.="\t\@echo top level directory, if you don't have perl, you will\n"; | ||
313 | $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n"; | ||
314 | $banner.="\t\@echo documentation for details.\n"; | ||
315 | } | ||
316 | |||
317 | # have to do this to allow $(CC) under unix | ||
318 | $link="$bin_dir$link" if ($link !~ /^\$/); | ||
319 | |||
320 | $INSTALLTOP =~ s|/|$o|g; | ||
321 | $OPENSSLDIR =~ s|/|$o|g; | ||
322 | |||
323 | ############################################# | ||
324 | # We parse in input file and 'store' info for later printing. | ||
325 | open(IN,"<$infile") || die "unable to open $infile:$!\n"; | ||
326 | $_=<IN>; | ||
327 | for (;;) | ||
328 | { | ||
329 | chop; | ||
330 | |||
331 | ($key,$val)=/^([^=]+)=(.*)/; | ||
332 | if ($key eq "RELATIVE_DIRECTORY") | ||
333 | { | ||
334 | if ($lib ne "") | ||
335 | { | ||
336 | $uc=$lib; | ||
337 | $uc =~ s/^lib(.*)\.a/$1/; | ||
338 | $uc =~ tr/a-z/A-Z/; | ||
339 | $lib_nam{$uc}=$uc; | ||
340 | $lib_obj{$uc}.=$libobj." "; | ||
341 | } | ||
342 | last if ($val eq "FINISHED"); | ||
343 | $lib=""; | ||
344 | $libobj=""; | ||
345 | $dir=$val; | ||
346 | } | ||
347 | |||
348 | if ($key eq "KRB5_INCLUDES") | ||
349 | { $cflags .= " $val";} | ||
350 | |||
351 | if ($key eq "ZLIB_INCLUDE") | ||
352 | { $cflags .= " $val" if $val ne "";} | ||
353 | |||
354 | if ($key eq "LIBZLIB") | ||
355 | { $zlib_lib = "$val" if $val ne "";} | ||
356 | |||
357 | if ($key eq "LIBKRB5") | ||
358 | { $ex_libs .= " $val" if $val ne "";} | ||
359 | |||
360 | if ($key eq "TEST") | ||
361 | { $test.=&var_add($dir,$val, 0); } | ||
362 | |||
363 | if (($key eq "PROGS") || ($key eq "E_OBJ")) | ||
364 | { $e_exe.=&var_add($dir,$val, 0); } | ||
365 | |||
366 | if ($key eq "LIB") | ||
367 | { | ||
368 | $lib=$val; | ||
369 | $lib =~ s/^.*\/([^\/]+)$/$1/; | ||
370 | } | ||
371 | if ($key eq "LIBNAME" && $no_static_engine) | ||
372 | { | ||
373 | $lib=$val; | ||
374 | $lib =~ s/^.*\/([^\/]+)$/$1/; | ||
375 | $otherlibs .= " $lib"; | ||
376 | } | ||
377 | |||
378 | if ($key eq "EXHEADER") | ||
379 | { $exheader.=&var_add($dir,$val, 1); } | ||
380 | |||
381 | if ($key eq "HEADER") | ||
382 | { $header.=&var_add($dir,$val, 1); } | ||
383 | |||
384 | if ($key eq "LIBOBJ" && ($dir ne "engines" || !$no_static_engine)) | ||
385 | { $libobj=&var_add($dir,$val, 0); } | ||
386 | if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine) | ||
387 | { $engines.=$val } | ||
388 | |||
389 | if (!($_=<IN>)) | ||
390 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } | ||
391 | } | ||
392 | close(IN); | ||
393 | |||
394 | if ($shlib) | ||
395 | { | ||
396 | $extra_install= <<"EOF"; | ||
397 | \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}bin\" | ||
398 | \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}bin\" | ||
399 | \$(CP) \"\$(L_SSL)\" \"\$(INSTALLTOP)${o}lib\" | ||
400 | \$(CP) \"\$(L_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" | ||
401 | EOF | ||
402 | if ($no_static_engine) | ||
403 | { | ||
404 | $extra_install .= <<"EOF" | ||
405 | \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\" | ||
406 | \$(CP) \"\$(E_SHLIB)\" \"\$(INSTALLTOP)${o}lib${o}engines\" | ||
407 | EOF | ||
408 | } | ||
409 | } | ||
410 | else | ||
411 | { | ||
412 | $extra_install= <<"EOF"; | ||
413 | \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}lib\" | ||
414 | \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" | ||
415 | EOF | ||
416 | $ex_libs .= " $zlib_lib" if $zlib_opt == 1; | ||
417 | if ($fips) | ||
418 | { | ||
419 | $build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)"; | ||
420 | $ex_l_libs .= " \$(O_FIPSCANISTER)"; | ||
421 | } | ||
422 | } | ||
423 | |||
424 | $defs= <<"EOF"; | ||
425 | # This makefile has been automatically generated from the OpenSSL distribution. | ||
426 | # This single makefile will build the complete OpenSSL distribution and | ||
427 | # by default leave the 'intertesting' output files in .${o}out and the stuff | ||
428 | # that needs deleting in .${o}tmp. | ||
429 | # The file was generated by running 'make makefile.one', which | ||
430 | # does a 'make files', which writes all the environment variables from all | ||
431 | # the makefiles to the file call MINFO. This file is used by | ||
432 | # util${o}mk1mf.pl to generate makefile.one. | ||
433 | # The 'makefile per directory' system suites me when developing this | ||
434 | # library and also so I can 'distribute' indervidual library sections. | ||
435 | # The one monster makefile better suits building in non-unix | ||
436 | # environments. | ||
437 | |||
438 | EOF | ||
439 | |||
440 | $defs .= $preamble if defined $preamble; | ||
441 | |||
442 | $defs.= <<"EOF"; | ||
443 | INSTALLTOP=$INSTALLTOP | ||
444 | OPENSSLDIR=$OPENSSLDIR | ||
445 | |||
446 | # Set your compiler options | ||
447 | PLATFORM=$platform | ||
448 | CC=$bin_dir${cc} | ||
449 | CFLAG=$cflags | ||
450 | APP_CFLAG=$app_cflag | ||
451 | LIB_CFLAG=$lib_cflag | ||
452 | SHLIB_CFLAG=$shl_cflag | ||
453 | APP_EX_OBJ=$app_ex_obj | ||
454 | SHLIB_EX_OBJ=$shlib_ex_obj | ||
455 | # add extra libraries to this define, for solaris -lsocket -lnsl would | ||
456 | # be added | ||
457 | EX_LIBS=$ex_libs | ||
458 | |||
459 | # The OpenSSL directory | ||
460 | SRC_D=$src_dir | ||
461 | |||
462 | LINK=$link | ||
463 | LFLAGS=$lflags | ||
464 | RSC=$rsc | ||
465 | |||
466 | # The output directory for everything intersting | ||
467 | OUT_D=$out_dir | ||
468 | # The output directory for all the temporary muck | ||
469 | TMP_D=$tmp_dir | ||
470 | # The output directory for the header files | ||
471 | INC_D=$inc_dir | ||
472 | INCO_D=$inc_dir${o}openssl | ||
473 | |||
474 | PERL=$perl | ||
475 | CP=$cp | ||
476 | RM=$rm | ||
477 | RANLIB=$ranlib | ||
478 | MKDIR=$mkdir | ||
479 | MKLIB=$bin_dir$mklib | ||
480 | MLFLAGS=$mlflags | ||
481 | ASM=$bin_dir$asm | ||
482 | |||
483 | # FIPS validated module and support file locations | ||
484 | |||
485 | FIPSDIR=$fipsdir | ||
486 | BASEADDR=$baseaddr | ||
487 | FIPSLIB_D=\$(FIPSDIR)${o}lib | ||
488 | FIPS_PREMAIN_SRC=\$(FIPSLIB_D)${o}fips_premain.c | ||
489 | O_FIPSCANISTER=\$(FIPSLIB_D)${o}fipscanister.lib | ||
490 | FIPS_SHA1_EXE=\$(FIPSDIR)${o}bin${o}fips_standalone_sha1${exep} | ||
491 | E_PREMAIN_DSO=fips_premain_dso | ||
492 | PREMAIN_DSO_EXE=\$(BIN_D)${o}fips_premain_dso$exep | ||
493 | FIPSLINK=\$(PERL) \$(FIPSDIR)${o}bin${o}fipslink.pl | ||
494 | |||
495 | ###################################################### | ||
496 | # You should not need to touch anything below this point | ||
497 | ###################################################### | ||
498 | |||
499 | E_EXE=openssl | ||
500 | SSL=$ssl | ||
501 | CRYPTO=$crypto | ||
502 | |||
503 | # BIN_D - Binary output directory | ||
504 | # TEST_D - Binary test file output directory | ||
505 | # LIB_D - library output directory | ||
506 | # ENG_D - dynamic engine output directory | ||
507 | # Note: if you change these point to different directories then uncomment out | ||
508 | # the lines around the 'NB' comment below. | ||
509 | # | ||
510 | BIN_D=\$(OUT_D) | ||
511 | TEST_D=\$(OUT_D) | ||
512 | LIB_D=\$(OUT_D) | ||
513 | ENG_D=\$(OUT_D) | ||
514 | |||
515 | # INCL_D - local library directory | ||
516 | # OBJ_D - temp object file directory | ||
517 | OBJ_D=\$(TMP_D) | ||
518 | INCL_D=\$(TMP_D) | ||
519 | |||
520 | O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp | ||
521 | O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp | ||
522 | SO_SSL= $plib\$(SSL)$so_shlibp | ||
523 | SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp | ||
524 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp | ||
525 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp | ||
526 | |||
527 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs | ||
528 | |||
529 | ###################################################### | ||
530 | # Don't touch anything below this point | ||
531 | ###################################################### | ||
532 | |||
533 | INC=-I\$(INC_D) -I\$(INCL_D) | ||
534 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) | ||
535 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) | ||
536 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) | ||
537 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) | ||
538 | |||
539 | ############################################# | ||
540 | EOF | ||
541 | |||
542 | $rules=<<"EOF"; | ||
543 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe $build_targets | ||
544 | |||
545 | banner: | ||
546 | $banner | ||
547 | |||
548 | \$(TMP_D): | ||
549 | \$(MKDIR) \"\$(TMP_D)\" | ||
550 | # NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different | ||
551 | #\$(BIN_D): | ||
552 | # \$(MKDIR) \$(BIN_D) | ||
553 | # | ||
554 | #\$(TEST_D): | ||
555 | # \$(MKDIR) \$(TEST_D) | ||
556 | |||
557 | \$(LIB_D): | ||
558 | \$(MKDIR) \"\$(LIB_D)\" | ||
559 | |||
560 | \$(INCO_D): \$(INC_D) | ||
561 | \$(MKDIR) \"\$(INCO_D)\" | ||
562 | |||
563 | \$(INC_D): | ||
564 | \$(MKDIR) \"\$(INC_D)\" | ||
565 | |||
566 | headers: \$(HEADER) \$(EXHEADER) | ||
567 | @ | ||
568 | |||
569 | lib: \$(LIBS_DEP) \$(E_SHLIB) | ||
570 | |||
571 | exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep | ||
572 | |||
573 | install: all | ||
574 | \$(MKDIR) \"\$(INSTALLTOP)\" | ||
575 | \$(MKDIR) \"\$(INSTALLTOP)${o}bin\" | ||
576 | \$(MKDIR) \"\$(INSTALLTOP)${o}include\" | ||
577 | \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\" | ||
578 | \$(MKDIR) \"\$(INSTALLTOP)${o}lib\" | ||
579 | \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\" | ||
580 | \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\" | ||
581 | \$(MKDIR) \"\$(OPENSSLDIR)\" | ||
582 | \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\" | ||
583 | $extra_install | ||
584 | |||
585 | |||
586 | test: \$(T_EXE) | ||
587 | cd \$(BIN_D) | ||
588 | ..${o}ms${o}test | ||
589 | |||
590 | clean: | ||
591 | \$(RM) \$(TMP_D)$o*.* | ||
592 | |||
593 | vclean: | ||
594 | \$(RM) \$(TMP_D)$o*.* | ||
595 | \$(RM) \$(OUT_D)$o*.* | ||
596 | |||
597 | EOF | ||
598 | |||
599 | my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform"; | ||
600 | $platform_cpp_symbol =~ s/-/_/g; | ||
601 | if (open(IN,"crypto/buildinf.h")) | ||
602 | { | ||
603 | # Remove entry for this platform in existing file buildinf.h. | ||
604 | |||
605 | my $old_buildinf_h = ""; | ||
606 | while (<IN>) | ||
607 | { | ||
608 | if (/^\#ifdef $platform_cpp_symbol$/) | ||
609 | { | ||
610 | while (<IN>) { last if (/^\#endif/); } | ||
611 | } | ||
612 | else | ||
613 | { | ||
614 | $old_buildinf_h .= $_; | ||
615 | } | ||
616 | } | ||
617 | close(IN); | ||
618 | |||
619 | open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h"; | ||
620 | print OUT $old_buildinf_h; | ||
621 | close(OUT); | ||
622 | } | ||
623 | |||
624 | open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h"; | ||
625 | printf OUT <<EOF; | ||
626 | #ifdef $platform_cpp_symbol | ||
627 | /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */ | ||
628 | #define CFLAGS "$cc $cflags" | ||
629 | #define PLATFORM "$platform" | ||
630 | EOF | ||
631 | printf OUT " #define DATE \"%s\"\n", scalar gmtime(); | ||
632 | printf OUT "#endif\n"; | ||
633 | close(OUT); | ||
634 | |||
635 | # Strip of trailing ' ' | ||
636 | foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); } | ||
637 | $test=&clean_up_ws($test); | ||
638 | $e_exe=&clean_up_ws($e_exe); | ||
639 | $exheader=&clean_up_ws($exheader); | ||
640 | $header=&clean_up_ws($header); | ||
641 | |||
642 | # First we strip the exheaders from the headers list | ||
643 | foreach (split(/\s+/,$exheader)){ $h{$_}=1; } | ||
644 | foreach (split(/\s+/,$header)) { $h.=$_." " unless $h{$_}; } | ||
645 | chop($h); $header=$h; | ||
646 | |||
647 | $defs.=&do_defs("HEADER",$header,"\$(INCL_D)",""); | ||
648 | $rules.=&do_copy_rule("\$(INCL_D)",$header,""); | ||
649 | |||
650 | $defs.=&do_defs("EXHEADER",$exheader,"\$(INCO_D)",""); | ||
651 | $rules.=&do_copy_rule("\$(INCO_D)",$exheader,""); | ||
652 | |||
653 | $defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj); | ||
654 | $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); | ||
655 | |||
656 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); | ||
657 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); | ||
658 | |||
659 | # Special case rule for fips_premain_dso | ||
660 | |||
661 | if ($fips) | ||
662 | { | ||
663 | $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj", | ||
664 | "\$(FIPS_PREMAIN_SRC)", | ||
665 | "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)", ""); | ||
666 | $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1); | ||
667 | } | ||
668 | |||
669 | foreach (values %lib_nam) | ||
670 | { | ||
671 | $lib_obj=$lib_obj{$_}; | ||
672 | local($slib)=$shlib; | ||
673 | |||
674 | if (($_ eq "SSL") && $no_ssl2 && $no_ssl3) | ||
675 | { | ||
676 | $rules.="\$(O_SSL):\n\n"; | ||
677 | next; | ||
678 | } | ||
679 | |||
680 | $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj); | ||
681 | $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)"; | ||
682 | $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib); | ||
683 | } | ||
684 | |||
685 | # hack to add version info on MSVC | ||
686 | if (($platform eq "VC-WIN32") || ($platform eq "VC-WIN64A") | ||
687 | || ($platform eq "VC-WIN64I") || ($platform eq "VC-NT")) { | ||
688 | $rules.= <<"EOF"; | ||
689 | \$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc | ||
690 | \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc | ||
691 | |||
692 | \$(OBJ_D)\\\$(SSL).res: ms\\version32.rc | ||
693 | \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc | ||
694 | |||
695 | EOF | ||
696 | } | ||
697 | |||
698 | $defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep); | ||
699 | foreach (split(/\s+/,$test)) | ||
700 | { | ||
701 | $t=&bname($_); | ||
702 | $tt="\$(OBJ_D)${o}$t${obj}"; | ||
703 | $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | ||
704 | } | ||
705 | |||
706 | $defs.=&do_defs("E_SHLIB",$engines . $otherlibs,"\$(ENG_D)",$shlibp); | ||
707 | |||
708 | foreach (split(/\s+/,$engines)) | ||
709 | { | ||
710 | $rules.=&do_compile_rule("\$(OBJ_D)","engines${o}e_$_",$lib); | ||
711 | $rules.= &do_lib_rule("\$(OBJ_D)${o}e_${_}.obj","\$(ENG_D)$o$_$shlibp","",$shlib,""); | ||
712 | } | ||
713 | |||
714 | |||
715 | |||
716 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); | ||
717 | |||
718 | if ($fips) | ||
719 | { | ||
720 | if ($shlib) | ||
721 | { | ||
722 | $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)", | ||
723 | "\$(O_CRYPTO)", "$crypto", | ||
724 | $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)"); | ||
725 | } | ||
726 | else | ||
727 | { | ||
728 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)", | ||
729 | "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", ""); | ||
730 | $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)", | ||
731 | "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", ""); | ||
732 | } | ||
733 | } | ||
734 | else | ||
735 | { | ||
736 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib, | ||
737 | "\$(SO_CRYPTO)"); | ||
738 | } | ||
739 | |||
740 | foreach (split(" ",$otherlibs)) | ||
741 | { | ||
742 | my $uc = $_; | ||
743 | $uc =~ tr /a-z/A-Z/; | ||
744 | $rules.= &do_lib_rule("\$(${uc}OBJ)","\$(ENG_D)$o$_$shlibp", "", $shlib, ""); | ||
745 | |||
746 | } | ||
747 | |||
748 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0); | ||
749 | |||
750 | print $defs; | ||
751 | |||
752 | if ($platform eq "linux-elf") { | ||
753 | print <<"EOF"; | ||
754 | # Generate perlasm output files | ||
755 | %.cpp: | ||
756 | (cd \$(\@D)/..; PERL=perl make -f Makefile asm/\$(\@F)) | ||
757 | EOF | ||
758 | } | ||
759 | print "###################################################################\n"; | ||
760 | print $rules; | ||
761 | |||
762 | ############################################### | ||
763 | # strip off any trailing .[och] and append the relative directory | ||
764 | # also remembering to do nothing if we are in one of the dropped | ||
765 | # directories | ||
766 | sub var_add | ||
767 | { | ||
768 | local($dir,$val,$keepext)=@_; | ||
769 | local(@a,$_,$ret); | ||
770 | |||
771 | return("") if $no_engine && $dir =~ /\/engine/; | ||
772 | return("") if $no_hw && $dir =~ /\/hw/; | ||
773 | return("") if $no_idea && $dir =~ /\/idea/; | ||
774 | return("") if $no_aes && $dir =~ /\/aes/; | ||
775 | return("") if $no_camellia && $dir =~ /\/camellia/; | ||
776 | return("") if $no_seed && $dir =~ /\/seed/; | ||
777 | return("") if $no_rc2 && $dir =~ /\/rc2/; | ||
778 | return("") if $no_rc4 && $dir =~ /\/rc4/; | ||
779 | return("") if $no_rc5 && $dir =~ /\/rc5/; | ||
780 | return("") if $no_rsa && $dir =~ /\/rsa/; | ||
781 | return("") if $no_rsa && $dir =~ /^rsaref/; | ||
782 | return("") if $no_dsa && $dir =~ /\/dsa/; | ||
783 | return("") if $no_dh && $dir =~ /\/dh/; | ||
784 | return("") if $no_ec && $dir =~ /\/ec/; | ||
785 | return("") if $no_cms && $dir =~ /\/cms/; | ||
786 | return("") if $no_jpake && $dir =~ /\/jpake/; | ||
787 | if ($no_des && $dir =~ /\/des/) | ||
788 | { | ||
789 | if ($val =~ /read_pwd/) | ||
790 | { return("$dir/read_pwd "); } | ||
791 | else | ||
792 | { return(""); } | ||
793 | } | ||
794 | return("") if $no_mdc2 && $dir =~ /\/mdc2/; | ||
795 | return("") if $no_sock && $dir =~ /\/proxy/; | ||
796 | return("") if $no_bf && $dir =~ /\/bf/; | ||
797 | return("") if $no_cast && $dir =~ /\/cast/; | ||
798 | return("") if $no_whirlpool && $dir =~ /\/whrlpool/; | ||
799 | |||
800 | $val =~ s/^\s*(.*)\s*$/$1/; | ||
801 | @a=split(/\s+/,$val); | ||
802 | grep(s/\.[och]$//,@a) unless $keepext; | ||
803 | |||
804 | @a=grep(!/^e_.*_3d$/,@a) if $no_des; | ||
805 | @a=grep(!/^e_.*_d$/,@a) if $no_des; | ||
806 | @a=grep(!/^e_.*_ae$/,@a) if $no_idea; | ||
807 | @a=grep(!/^e_.*_i$/,@a) if $no_aes; | ||
808 | @a=grep(!/^e_.*_r2$/,@a) if $no_rc2; | ||
809 | @a=grep(!/^e_.*_r5$/,@a) if $no_rc5; | ||
810 | @a=grep(!/^e_.*_bf$/,@a) if $no_bf; | ||
811 | @a=grep(!/^e_.*_c$/,@a) if $no_cast; | ||
812 | @a=grep(!/^e_rc4$/,@a) if $no_rc4; | ||
813 | @a=grep(!/^e_camellia$/,@a) if $no_camellia; | ||
814 | @a=grep(!/^e_seed$/,@a) if $no_seed; | ||
815 | |||
816 | #@a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2; | ||
817 | #@a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3; | ||
818 | |||
819 | @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock; | ||
820 | |||
821 | @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2; | ||
822 | @a=grep(!/(^md4)|(_md4$)/,@a) if $no_md4; | ||
823 | @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5; | ||
824 | @a=grep(!/(rmd)|(ripemd)/,@a) if $no_ripemd; | ||
825 | |||
826 | @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa; | ||
827 | @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa; | ||
828 | @a=grep(!/(^pem_seal$)/,@a) if $no_rsa; | ||
829 | |||
830 | @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa; | ||
831 | @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa; | ||
832 | |||
833 | @a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4; | ||
834 | |||
835 | @a=grep(!/_dhp$/,@a) if $no_dh; | ||
836 | |||
837 | @a=grep(!/(^sha[^1])|(_sha$)|(m_dss$)/,@a) if $no_sha; | ||
838 | @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; | ||
839 | @a=grep(!/_mdc2$/,@a) if $no_mdc2; | ||
840 | |||
841 | @a=grep(!/(srp)/,@a) if $no_srp; | ||
842 | |||
843 | @a=grep(!/^engine$/,@a) if $no_engine; | ||
844 | @a=grep(!/^hw$/,@a) if $no_hw; | ||
845 | @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa; | ||
846 | @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa; | ||
847 | @a=grep(!/^gendsa$/,@a) if $no_sha1; | ||
848 | @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh; | ||
849 | |||
850 | @a=grep(!/(^dh)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; | ||
851 | |||
852 | grep($_="$dir/$_",@a); | ||
853 | @a=grep(!/(^|\/)s_/,@a) if $no_sock; | ||
854 | @a=grep(!/(^|\/)bio_sock/,@a) if $no_sock; | ||
855 | $ret=join(' ',@a)." "; | ||
856 | return($ret); | ||
857 | } | ||
858 | |||
859 | # change things so that each 'token' is only separated by one space | ||
860 | sub clean_up_ws | ||
861 | { | ||
862 | local($w)=@_; | ||
863 | |||
864 | $w =~ s/^\s*(.*)\s*$/$1/; | ||
865 | $w =~ s/\s+/ /g; | ||
866 | return($w); | ||
867 | } | ||
868 | |||
869 | sub do_defs | ||
870 | { | ||
871 | local($var,$files,$location,$postfix)=@_; | ||
872 | local($_,$ret,$pf); | ||
873 | local(*OUT,$tmp,$t); | ||
874 | |||
875 | $files =~ s/\//$o/g if $o ne '/'; | ||
876 | $ret="$var="; | ||
877 | $n=1; | ||
878 | $Vars{$var}.=""; | ||
879 | foreach (split(/ /,$files)) | ||
880 | { | ||
881 | $orig=$_; | ||
882 | $_=&bname($_) unless /^\$/; | ||
883 | if ($n++ == 2) | ||
884 | { | ||
885 | $n=0; | ||
886 | $ret.="\\\n\t"; | ||
887 | } | ||
888 | if (($_ =~ /bss_file/) && ($postfix eq ".h")) | ||
889 | { $pf=".c"; } | ||
890 | else { $pf=$postfix; } | ||
891 | if ($_ =~ /BN_ASM/) { $t="$_ "; } | ||
892 | elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; } | ||
893 | elsif ($_ =~ /AES_ASM/){ $t="$_ "; } | ||
894 | elsif ($_ =~ /DES_ENC/) { $t="$_ "; } | ||
895 | elsif ($_ =~ /BF_ENC/) { $t="$_ "; } | ||
896 | elsif ($_ =~ /CAST_ENC/){ $t="$_ "; } | ||
897 | elsif ($_ =~ /RC4_ENC/) { $t="$_ "; } | ||
898 | elsif ($_ =~ /RC5_ENC/) { $t="$_ "; } | ||
899 | elsif ($_ =~ /MD5_ASM/) { $t="$_ "; } | ||
900 | elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; } | ||
901 | elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; } | ||
902 | elsif ($_ =~ /WHIRLPOOL_ASM/){ $t="$_ "; } | ||
903 | elsif ($_ =~ /CPUID_ASM/){ $t="$_ "; } | ||
904 | else { $t="$location${o}$_$pf "; } | ||
905 | |||
906 | $Vars{$var}.="$t "; | ||
907 | $ret.=$t; | ||
908 | } | ||
909 | # hack to add version info on MSVC | ||
910 | if ($shlib && (($platform eq "VC-WIN32") || ($platfrom eq "VC-WIN64I") || ($platform eq "VC-WIN64A") || ($platform eq "VC-NT"))) | ||
911 | { | ||
912 | if ($var eq "CRYPTOOBJ") | ||
913 | { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; } | ||
914 | elsif ($var eq "SSLOBJ") | ||
915 | { $ret.="\$(OBJ_D)\\\$(SSL).res "; } | ||
916 | } | ||
917 | chomp($ret); | ||
918 | $ret.="\n\n"; | ||
919 | return($ret); | ||
920 | } | ||
921 | |||
922 | # return the name with the leading path removed | ||
923 | sub bname | ||
924 | { | ||
925 | local($ret)=@_; | ||
926 | $ret =~ s/^.*[\\\/]([^\\\/]+)$/$1/; | ||
927 | return($ret); | ||
928 | } | ||
929 | |||
930 | # return the leading path | ||
931 | sub dname | ||
932 | { | ||
933 | my $ret=shift; | ||
934 | $ret =~ s/(^.*)[\\\/][^\\\/]+$/$1/; | ||
935 | return($ret); | ||
936 | } | ||
937 | |||
938 | ############################################################## | ||
939 | # do a rule for each file that says 'compile' to new direcory | ||
940 | # compile the files in '$files' into $to | ||
941 | sub do_compile_rule | ||
942 | { | ||
943 | local($to,$files,$ex)=@_; | ||
944 | local($ret,$_,$n,$d,$s); | ||
945 | |||
946 | $files =~ s/\//$o/g if $o ne '/'; | ||
947 | foreach (split(/\s+/,$files)) | ||
948 | { | ||
949 | $n=&bname($_); | ||
950 | $d=&dname($_); | ||
951 | if (-f "${_}.c") | ||
952 | { | ||
953 | $ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex) | ||
954 | } | ||
955 | elsif (-f ($s="${d}${o}asm${o}${n}.pl") or | ||
956 | ($s=~s/sha256/sha512/ and -f $s) or | ||
957 | -f ($s="${d}${o}${n}.pl")) | ||
958 | { | ||
959 | $ret.=&perlasm_compile_target("$to${o}$n$obj",$s,$n); | ||
960 | } | ||
961 | elsif (-f ($s="${d}${o}asm${o}${n}.S") or | ||
962 | -f ($s="${d}${o}${n}.S")) | ||
963 | { | ||
964 | $ret.=&Sasm_compile_target("$to${o}$n$obj",$s,$n); | ||
965 | } | ||
966 | else { die "no rule for $_"; } | ||
967 | } | ||
968 | return($ret); | ||
969 | } | ||
970 | |||
971 | ############################################################## | ||
972 | # do a rule for each file that says 'compile' to new direcory | ||
973 | sub perlasm_compile_target | ||
974 | { | ||
975 | my($target,$source,$bname)=@_; | ||
976 | my($ret); | ||
977 | |||
978 | $bname =~ s/(.*)\.[^\.]$/$1/; | ||
979 | $ret ="\$(TMP_D)$o$bname.asm: $source\n"; | ||
980 | $ret.="\t\$(PERL) $source $asmtype \$(CFLAG) >\$\@\n\n"; | ||
981 | $ret.="$target: \$(TMP_D)$o$bname.asm\n"; | ||
982 | $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n"; | ||
983 | return($ret); | ||
984 | } | ||
985 | |||
986 | sub Sasm_compile_target | ||
987 | { | ||
988 | my($target,$source,$bname)=@_; | ||
989 | my($ret); | ||
990 | |||
991 | $bname =~ s/(.*)\.[^\.]$/$1/; | ||
992 | $ret ="\$(TMP_D)$o$bname.asm: $source\n"; | ||
993 | $ret.="\t\$(CC) -E \$(CFLAG) $source >\$\@\n\n"; | ||
994 | $ret.="$target: \$(TMP_D)$o$bname.asm\n"; | ||
995 | $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n"; | ||
996 | return($ret); | ||
997 | } | ||
998 | |||
999 | sub cc_compile_target | ||
1000 | { | ||
1001 | local($target,$source,$ex_flags, $srcd)=@_; | ||
1002 | local($ret); | ||
1003 | |||
1004 | $ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/); | ||
1005 | $target =~ s/\//$o/g if $o ne "/"; | ||
1006 | $source =~ s/\//$o/g if $o ne "/"; | ||
1007 | $srcd = "\$(SRC_D)$o" unless defined $srcd; | ||
1008 | $ret ="$target: $srcd$source\n\t"; | ||
1009 | $ret.="\$(CC) ${ofile}$target $ex_flags -c $srcd$source\n\n"; | ||
1010 | return($ret); | ||
1011 | } | ||
1012 | |||
1013 | ############################################################## | ||
1014 | sub do_asm_rule | ||
1015 | { | ||
1016 | local($target,$src)=@_; | ||
1017 | local($ret,@s,@t,$i); | ||
1018 | |||
1019 | $target =~ s/\//$o/g if $o ne "/"; | ||
1020 | $src =~ s/\//$o/g if $o ne "/"; | ||
1021 | |||
1022 | @t=split(/\s+/,$target); | ||
1023 | @s=split(/\s+/,$src); | ||
1024 | |||
1025 | |||
1026 | for ($i=0; $i<=$#s; $i++) | ||
1027 | { | ||
1028 | my $objfile = $t[$i]; | ||
1029 | my $srcfile = $s[$i]; | ||
1030 | |||
1031 | if ($perl_asm == 1) | ||
1032 | { | ||
1033 | my $plasm = $objfile; | ||
1034 | $plasm =~ s/${obj}/.pl/; | ||
1035 | $ret.="$srcfile: $plasm\n"; | ||
1036 | $ret.="\t\$(PERL) $plasm $asmtype \$(CFLAG) >$srcfile\n\n"; | ||
1037 | } | ||
1038 | |||
1039 | $ret.="$objfile: $srcfile\n"; | ||
1040 | $ret.="\t\$(ASM) $afile$objfile \$(SRC_D)$o$srcfile\n\n"; | ||
1041 | } | ||
1042 | return($ret); | ||
1043 | } | ||
1044 | |||
1045 | sub do_shlib_rule | ||
1046 | { | ||
1047 | local($n,$def)=@_; | ||
1048 | local($ret,$nn); | ||
1049 | local($t); | ||
1050 | |||
1051 | ($nn=$n) =~ tr/a-z/A-Z/; | ||
1052 | $ret.="$n.dll: \$(${nn}OBJ)\n"; | ||
1053 | if ($vc && $w32) | ||
1054 | { | ||
1055 | $ret.="\t\$(MKSHLIB) $efile$n.dll $def @<<\n \$(${nn}OBJ_F)\n<<\n"; | ||
1056 | } | ||
1057 | $ret.="\n"; | ||
1058 | return($ret); | ||
1059 | } | ||
1060 | |||
1061 | # do a rule for each file that says 'copy' to new direcory on change | ||
1062 | sub do_copy_rule | ||
1063 | { | ||
1064 | local($to,$files,$p)=@_; | ||
1065 | local($ret,$_,$n,$pp); | ||
1066 | |||
1067 | $files =~ s/\//$o/g if $o ne '/'; | ||
1068 | foreach (split(/\s+/,$files)) | ||
1069 | { | ||
1070 | $n=&bname($_); | ||
1071 | if ($n =~ /bss_file/) | ||
1072 | { $pp=".c"; } | ||
1073 | else { $pp=$p; } | ||
1074 | $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \"\$(SRC_D)$o$_$pp\" \"$to${o}$n$pp\"\n\n"; | ||
1075 | } | ||
1076 | return($ret); | ||
1077 | } | ||
1078 | |||
1079 | sub read_options | ||
1080 | { | ||
1081 | # Many options are handled in a similar way. In particular | ||
1082 | # no-xxx sets zero or more scalars to 1. | ||
1083 | # Process these using a hash containing the option name and | ||
1084 | # reference to the scalars to set. | ||
1085 | |||
1086 | my %valid_options = ( | ||
1087 | "no-rc2" => \$no_rc2, | ||
1088 | "no-rc4" => \$no_rc4, | ||
1089 | "no-rc5" => \$no_rc5, | ||
1090 | "no-idea" => \$no_idea, | ||
1091 | "no-aes" => \$no_aes, | ||
1092 | "no-camellia" => \$no_camellia, | ||
1093 | "no-seed" => \$no_seed, | ||
1094 | "no-des" => \$no_des, | ||
1095 | "no-bf" => \$no_bf, | ||
1096 | "no-cast" => \$no_cast, | ||
1097 | "no-md2" => \$no_md2, | ||
1098 | "no-md4" => \$no_md4, | ||
1099 | "no-md5" => \$no_md5, | ||
1100 | "no-sha" => \$no_sha, | ||
1101 | "no-sha1" => \$no_sha1, | ||
1102 | "no-ripemd" => \$no_ripemd, | ||
1103 | "no-mdc2" => \$no_mdc2, | ||
1104 | "no-whirlpool" => \$no_whirlpool, | ||
1105 | "no-patents" => | ||
1106 | [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa], | ||
1107 | "no-rsa" => \$no_rsa, | ||
1108 | "no-dsa" => \$no_dsa, | ||
1109 | "no-dh" => \$no_dh, | ||
1110 | "no-hmac" => \$no_hmac, | ||
1111 | "no-asm" => \$no_asm, | ||
1112 | "nasm" => \$nasm, | ||
1113 | "nw-nasm" => \$nw_nasm, | ||
1114 | "nw-mwasm" => \$nw_mwasm, | ||
1115 | "gaswin" => \$gaswin, | ||
1116 | "no-ssl2" => \$no_ssl2, | ||
1117 | "no-ssl3" => \$no_ssl3, | ||
1118 | "no-tlsext" => \$no_tlsext, | ||
1119 | "no-srp" => \$no_srp, | ||
1120 | "no-cms" => \$no_cms, | ||
1121 | "no-ec2m" => \$no_ec2m, | ||
1122 | "no-jpake" => \$no_jpake, | ||
1123 | "no-ec_nistp_64_gcc_128" => 0, | ||
1124 | "no-err" => \$no_err, | ||
1125 | "no-sock" => \$no_sock, | ||
1126 | "no-krb5" => \$no_krb5, | ||
1127 | "no-ec" => \$no_ec, | ||
1128 | "no-ecdsa" => \$no_ecdsa, | ||
1129 | "no-ecdh" => \$no_ecdh, | ||
1130 | "no-gost" => \$no_gost, | ||
1131 | "no-engine" => \$no_engine, | ||
1132 | "no-hw" => \$no_hw, | ||
1133 | "no-rsax" => 0, | ||
1134 | "just-ssl" => | ||
1135 | [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast, | ||
1136 | \$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh, | ||
1137 | \$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5, | ||
1138 | \$no_aes, \$no_camellia, \$no_seed, \$no_srp], | ||
1139 | "rsaref" => 0, | ||
1140 | "gcc" => \$gcc, | ||
1141 | "debug" => \$debug, | ||
1142 | "profile" => \$profile, | ||
1143 | "shlib" => \$shlib, | ||
1144 | "dll" => \$shlib, | ||
1145 | "shared" => 0, | ||
1146 | "no-sctp" => 0, | ||
1147 | "no-gmp" => 0, | ||
1148 | "no-rfc3779" => 0, | ||
1149 | "no-montasm" => 0, | ||
1150 | "no-shared" => 0, | ||
1151 | "no-store" => 0, | ||
1152 | "no-zlib" => 0, | ||
1153 | "no-zlib-dynamic" => 0, | ||
1154 | "fips" => \$fips | ||
1155 | ); | ||
1156 | |||
1157 | if (exists $valid_options{$_}) | ||
1158 | { | ||
1159 | my $r = $valid_options{$_}; | ||
1160 | if ( ref $r eq "SCALAR") | ||
1161 | { $$r = 1;} | ||
1162 | elsif ( ref $r eq "ARRAY") | ||
1163 | { | ||
1164 | my $r2; | ||
1165 | foreach $r2 (@$r) | ||
1166 | { | ||
1167 | $$r2 = 1; | ||
1168 | } | ||
1169 | } | ||
1170 | } | ||
1171 | elsif (/^no-comp$/) { $xcflags = "-DOPENSSL_NO_COMP $xcflags"; } | ||
1172 | elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 } | ||
1173 | elsif (/^enable-zlib-dynamic$/) | ||
1174 | { | ||
1175 | $zlib_opt = 2; | ||
1176 | } | ||
1177 | elsif (/^no-static-engine/) | ||
1178 | { | ||
1179 | $no_static_engine = 1; | ||
1180 | } | ||
1181 | elsif (/^enable-static-engine/) | ||
1182 | { | ||
1183 | $no_static_engine = 0; | ||
1184 | } | ||
1185 | # There are also enable-xxx options which correspond to | ||
1186 | # the no-xxx. Since the scalars are enabled by default | ||
1187 | # these can be ignored. | ||
1188 | elsif (/^enable-/) | ||
1189 | { | ||
1190 | my $t = $_; | ||
1191 | $t =~ s/^enable/no/; | ||
1192 | if (exists $valid_options{$t}) | ||
1193 | {return 1;} | ||
1194 | return 0; | ||
1195 | } | ||
1196 | # experimental-xxx is mostly like enable-xxx, but opensslconf.v | ||
1197 | # will still set OPENSSL_NO_xxx unless we set OPENSSL_EXPERIMENTAL_xxx. | ||
1198 | # (No need to fail if we don't know the algorithm -- this is for adventurous users only.) | ||
1199 | elsif (/^experimental-/) | ||
1200 | { | ||
1201 | my $algo, $ALGO; | ||
1202 | ($algo = $_) =~ s/^experimental-//; | ||
1203 | ($ALGO = $algo) =~ tr/[a-z]/[A-Z]/; | ||
1204 | |||
1205 | $xcflags="-DOPENSSL_EXPERIMENTAL_$ALGO $xcflags"; | ||
1206 | |||
1207 | } | ||
1208 | elsif (/^--with-krb5-flavor=(.*)$/) | ||
1209 | { | ||
1210 | my $krb5_flavor = $1; | ||
1211 | if ($krb5_flavor =~ /^force-[Hh]eimdal$/) | ||
1212 | { | ||
1213 | $xcflags="-DKRB5_HEIMDAL $xcflags"; | ||
1214 | } | ||
1215 | elsif ($krb5_flavor =~ /^MIT/i) | ||
1216 | { | ||
1217 | $xcflags="-DKRB5_MIT $xcflags"; | ||
1218 | if ($krb5_flavor =~ /^MIT[._-]*1[._-]*[01]/i) | ||
1219 | { | ||
1220 | $xcflags="-DKRB5_MIT_OLD11 $xcflags" | ||
1221 | } | ||
1222 | } | ||
1223 | } | ||
1224 | elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } | ||
1225 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } | ||
1226 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) | ||
1227 | { $c_flags.="$_ "; } | ||
1228 | else { return(0); } | ||
1229 | return(1); | ||
1230 | } | ||
diff --git a/src/lib/libssl/src/util/mkcerts.sh b/src/lib/libssl/src/util/mkcerts.sh deleted file mode 100644 index 0184fcb70e..0000000000 --- a/src/lib/libssl/src/util/mkcerts.sh +++ /dev/null | |||
@@ -1,220 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # This script will re-make all the required certs. | ||
4 | # cd apps | ||
5 | # sh ../util/mkcerts.sh | ||
6 | # mv ca-cert.pem pca-cert.pem ../certs | ||
7 | # cd .. | ||
8 | # cat certs/*.pem >>apps/server.pem | ||
9 | # cat certs/*.pem >>apps/server2.pem | ||
10 | # SSLEAY=`pwd`/apps/ssleay; export SSLEAY | ||
11 | # sh tools/c_rehash certs | ||
12 | # | ||
13 | |||
14 | CAbits=1024 | ||
15 | SSLEAY="../apps/openssl" | ||
16 | CONF="-config ../apps/openssl.cnf" | ||
17 | |||
18 | # create pca request. | ||
19 | echo creating $CAbits bit PCA cert request | ||
20 | $SSLEAY req $CONF \ | ||
21 | -new -md5 -newkey $CAbits \ | ||
22 | -keyout pca-key.pem \ | ||
23 | -out pca-req.pem -nodes >/dev/null <<EOF | ||
24 | AU | ||
25 | Queensland | ||
26 | . | ||
27 | CryptSoft Pty Ltd | ||
28 | . | ||
29 | Test PCA (1024 bit) | ||
30 | |||
31 | |||
32 | |||
33 | EOF | ||
34 | |||
35 | if [ $? != 0 ]; then | ||
36 | echo problems generating PCA request | ||
37 | exit 1 | ||
38 | fi | ||
39 | |||
40 | #sign it. | ||
41 | echo | ||
42 | echo self signing PCA | ||
43 | $SSLEAY x509 -md5 -days 1461 \ | ||
44 | -req -signkey pca-key.pem \ | ||
45 | -CAcreateserial -CAserial pca-cert.srl \ | ||
46 | -in pca-req.pem -out pca-cert.pem | ||
47 | |||
48 | if [ $? != 0 ]; then | ||
49 | echo problems self signing PCA cert | ||
50 | exit 1 | ||
51 | fi | ||
52 | echo | ||
53 | |||
54 | # create ca request. | ||
55 | echo creating $CAbits bit CA cert request | ||
56 | $SSLEAY req $CONF \ | ||
57 | -new -md5 -newkey $CAbits \ | ||
58 | -keyout ca-key.pem \ | ||
59 | -out ca-req.pem -nodes >/dev/null <<EOF | ||
60 | AU | ||
61 | Queensland | ||
62 | . | ||
63 | CryptSoft Pty Ltd | ||
64 | . | ||
65 | Test CA (1024 bit) | ||
66 | |||
67 | |||
68 | |||
69 | EOF | ||
70 | |||
71 | if [ $? != 0 ]; then | ||
72 | echo problems generating CA request | ||
73 | exit 1 | ||
74 | fi | ||
75 | |||
76 | #sign it. | ||
77 | echo | ||
78 | echo signing CA | ||
79 | $SSLEAY x509 -md5 -days 1461 \ | ||
80 | -req \ | ||
81 | -CAcreateserial -CAserial pca-cert.srl \ | ||
82 | -CA pca-cert.pem -CAkey pca-key.pem \ | ||
83 | -in ca-req.pem -out ca-cert.pem | ||
84 | |||
85 | if [ $? != 0 ]; then | ||
86 | echo problems signing CA cert | ||
87 | exit 1 | ||
88 | fi | ||
89 | echo | ||
90 | |||
91 | # create server request. | ||
92 | echo creating 512 bit server cert request | ||
93 | $SSLEAY req $CONF \ | ||
94 | -new -md5 -newkey 512 \ | ||
95 | -keyout s512-key.pem \ | ||
96 | -out s512-req.pem -nodes >/dev/null <<EOF | ||
97 | AU | ||
98 | Queensland | ||
99 | . | ||
100 | CryptSoft Pty Ltd | ||
101 | . | ||
102 | Server test cert (512 bit) | ||
103 | |||
104 | |||
105 | |||
106 | EOF | ||
107 | |||
108 | if [ $? != 0 ]; then | ||
109 | echo problems generating 512 bit server cert request | ||
110 | exit 1 | ||
111 | fi | ||
112 | |||
113 | #sign it. | ||
114 | echo | ||
115 | echo signing 512 bit server cert | ||
116 | $SSLEAY x509 -md5 -days 365 \ | ||
117 | -req \ | ||
118 | -CAcreateserial -CAserial ca-cert.srl \ | ||
119 | -CA ca-cert.pem -CAkey ca-key.pem \ | ||
120 | -in s512-req.pem -out server.pem | ||
121 | |||
122 | if [ $? != 0 ]; then | ||
123 | echo problems signing 512 bit server cert | ||
124 | exit 1 | ||
125 | fi | ||
126 | echo | ||
127 | |||
128 | # create 1024 bit server request. | ||
129 | echo creating 1024 bit server cert request | ||
130 | $SSLEAY req $CONF \ | ||
131 | -new -md5 -newkey 1024 \ | ||
132 | -keyout s1024key.pem \ | ||
133 | -out s1024req.pem -nodes >/dev/null <<EOF | ||
134 | AU | ||
135 | Queensland | ||
136 | . | ||
137 | CryptSoft Pty Ltd | ||
138 | . | ||
139 | Server test cert (1024 bit) | ||
140 | |||
141 | |||
142 | |||
143 | EOF | ||
144 | |||
145 | if [ $? != 0 ]; then | ||
146 | echo problems generating 1024 bit server cert request | ||
147 | exit 1 | ||
148 | fi | ||
149 | |||
150 | #sign it. | ||
151 | echo | ||
152 | echo signing 1024 bit server cert | ||
153 | $SSLEAY x509 -md5 -days 365 \ | ||
154 | -req \ | ||
155 | -CAcreateserial -CAserial ca-cert.srl \ | ||
156 | -CA ca-cert.pem -CAkey ca-key.pem \ | ||
157 | -in s1024req.pem -out server2.pem | ||
158 | |||
159 | if [ $? != 0 ]; then | ||
160 | echo problems signing 1024 bit server cert | ||
161 | exit 1 | ||
162 | fi | ||
163 | echo | ||
164 | |||
165 | # create 512 bit client request. | ||
166 | echo creating 512 bit client cert request | ||
167 | $SSLEAY req $CONF \ | ||
168 | -new -md5 -newkey 512 \ | ||
169 | -keyout c512-key.pem \ | ||
170 | -out c512-req.pem -nodes >/dev/null <<EOF | ||
171 | AU | ||
172 | Queensland | ||
173 | . | ||
174 | CryptSoft Pty Ltd | ||
175 | . | ||
176 | Client test cert (512 bit) | ||
177 | |||
178 | |||
179 | |||
180 | EOF | ||
181 | |||
182 | if [ $? != 0 ]; then | ||
183 | echo problems generating 512 bit client cert request | ||
184 | exit 1 | ||
185 | fi | ||
186 | |||
187 | #sign it. | ||
188 | echo | ||
189 | echo signing 512 bit client cert | ||
190 | $SSLEAY x509 -md5 -days 365 \ | ||
191 | -req \ | ||
192 | -CAcreateserial -CAserial ca-cert.srl \ | ||
193 | -CA ca-cert.pem -CAkey ca-key.pem \ | ||
194 | -in c512-req.pem -out client.pem | ||
195 | |||
196 | if [ $? != 0 ]; then | ||
197 | echo problems signing 512 bit client cert | ||
198 | exit 1 | ||
199 | fi | ||
200 | |||
201 | echo cleanup | ||
202 | |||
203 | cat pca-key.pem >> pca-cert.pem | ||
204 | cat ca-key.pem >> ca-cert.pem | ||
205 | cat s512-key.pem >> server.pem | ||
206 | cat s1024key.pem >> server2.pem | ||
207 | cat c512-key.pem >> client.pem | ||
208 | |||
209 | for i in pca-cert.pem ca-cert.pem server.pem server2.pem client.pem | ||
210 | do | ||
211 | $SSLEAY x509 -issuer -subject -in $i -noout >$$ | ||
212 | cat $$ | ||
213 | /bin/cat $i >>$$ | ||
214 | /bin/mv $$ $i | ||
215 | done | ||
216 | |||
217 | #/bin/rm -f *key.pem *req.pem *.srl | ||
218 | |||
219 | echo Finished | ||
220 | |||
diff --git a/src/lib/libssl/src/util/mkdef.pl b/src/lib/libssl/src/util/mkdef.pl deleted file mode 100644 index 9a8c7b87d1..0000000000 --- a/src/lib/libssl/src/util/mkdef.pl +++ /dev/null | |||
@@ -1,1539 +0,0 @@ | |||
1 | #!/usr/local/bin/perl -w | ||
2 | # | ||
3 | # generate a .def file | ||
4 | # | ||
5 | # It does this by parsing the header files and looking for the | ||
6 | # prototyped functions: it then prunes the output. | ||
7 | # | ||
8 | # Intermediary files are created, call libeay.num and ssleay.num,... | ||
9 | # Previously, they had the following format: | ||
10 | # | ||
11 | # routine-name nnnn | ||
12 | # | ||
13 | # But that isn't enough for a number of reasons, the first on being that | ||
14 | # this format is (needlessly) very Win32-centric, and even then... | ||
15 | # One of the biggest problems is that there's no information about what | ||
16 | # routines should actually be used, which varies with what crypto algorithms | ||
17 | # are disabled. Also, some operating systems (for example VMS with VAX C) | ||
18 | # need to keep track of the global variables as well as the functions. | ||
19 | # | ||
20 | # So, a remake of this script is done so as to include information on the | ||
21 | # kind of symbol it is (function or variable) and what algorithms they're | ||
22 | # part of. This will allow easy translating to .def files or the corresponding | ||
23 | # file in other operating systems (a .opt file for VMS, possibly with a .mar | ||
24 | # file). | ||
25 | # | ||
26 | # The format now becomes: | ||
27 | # | ||
28 | # routine-name nnnn info | ||
29 | # | ||
30 | # and the "info" part is actually a colon-separated string of fields with | ||
31 | # the following meaning: | ||
32 | # | ||
33 | # existence:platform:kind:algorithms | ||
34 | # | ||
35 | # - "existence" can be "EXIST" or "NOEXIST" depending on if the symbol is | ||
36 | # found somewhere in the source, | ||
37 | # - "platforms" is empty if it exists on all platforms, otherwise it contains | ||
38 | # comma-separated list of the platform, just as they are if the symbol exists | ||
39 | # for those platforms, or prepended with a "!" if not. This helps resolve | ||
40 | # symbol name variants for platforms where the names are too long for the | ||
41 | # compiler or linker, or if the systems is case insensitive and there is a | ||
42 | # clash, or the symbol is implemented differently (see | ||
43 | # EXPORT_VAR_AS_FUNCTION). This script assumes renaming of symbols is found | ||
44 | # in the file crypto/symhacks.h. | ||
45 | # The semantics for the platforms is that every item is checked against the | ||
46 | # environment. For the negative items ("!FOO"), if any of them is false | ||
47 | # (i.e. "FOO" is true) in the environment, the corresponding symbol can't be | ||
48 | # used. For the positive itms, if all of them are false in the environment, | ||
49 | # the corresponding symbol can't be used. Any combination of positive and | ||
50 | # negative items are possible, and of course leave room for some redundancy. | ||
51 | # - "kind" is "FUNCTION" or "VARIABLE". The meaning of that is obvious. | ||
52 | # - "algorithms" is a comma-separated list of algorithm names. This helps | ||
53 | # exclude symbols that are part of an algorithm that some user wants to | ||
54 | # exclude. | ||
55 | # | ||
56 | |||
57 | my $debug=0; | ||
58 | |||
59 | my $crypto_num= "util/libeay.num"; | ||
60 | my $ssl_num= "util/ssleay.num"; | ||
61 | my $libname; | ||
62 | |||
63 | my $do_update = 0; | ||
64 | my $do_rewrite = 1; | ||
65 | my $do_crypto = 0; | ||
66 | my $do_ssl = 0; | ||
67 | my $do_ctest = 0; | ||
68 | my $do_ctestall = 0; | ||
69 | my $do_checkexist = 0; | ||
70 | |||
71 | my $VMSVAX=0; | ||
72 | my $VMSNonVAX=0; | ||
73 | my $VMS=0; | ||
74 | my $W32=0; | ||
75 | my $W16=0; | ||
76 | my $NT=0; | ||
77 | my $OS2=0; | ||
78 | # Set this to make typesafe STACK definitions appear in DEF | ||
79 | my $safe_stack_def = 0; | ||
80 | |||
81 | my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", | ||
82 | "EXPORT_VAR_AS_FUNCTION", "ZLIB", "OPENSSL_FIPS" ); | ||
83 | my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); | ||
84 | my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", | ||
85 | "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", | ||
86 | "SHA256", "SHA512", "RIPEMD", | ||
87 | "MDC2", "WHIRLPOOL", "RSA", "DSA", "DH", "EC", "ECDH", "ECDSA", "EC2M", | ||
88 | "HMAC", "AES", "CAMELLIA", "SEED", "GOST", | ||
89 | # EC_NISTP_64_GCC_128 | ||
90 | "EC_NISTP_64_GCC_128", | ||
91 | # Envelope "algorithms" | ||
92 | "EVP", "X509", "ASN1_TYPEDEFS", | ||
93 | # Helper "algorithms" | ||
94 | "BIO", "COMP", "BUFFER", "LHASH", "STACK", "ERR", | ||
95 | "LOCKING", | ||
96 | # External "algorithms" | ||
97 | "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM", | ||
98 | # Engines | ||
99 | "STATIC_ENGINE", "ENGINE", "HW", "GMP", | ||
100 | # RFC3779 | ||
101 | "RFC3779", | ||
102 | # TLS | ||
103 | "TLSEXT", "PSK", "SRP", "HEARTBEATS", | ||
104 | # CMS | ||
105 | "CMS", | ||
106 | # CryptoAPI Engine | ||
107 | "CAPIENG", | ||
108 | # SSL v2 | ||
109 | "SSL2", | ||
110 | # JPAKE | ||
111 | "JPAKE", | ||
112 | # NEXTPROTONEG | ||
113 | "NEXTPROTONEG", | ||
114 | # Deprecated functions | ||
115 | "DEPRECATED", | ||
116 | # Hide SSL internals | ||
117 | "SSL_INTERN", | ||
118 | # SCTP | ||
119 | "SCTP"); | ||
120 | |||
121 | my $options=""; | ||
122 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; | ||
123 | while(<IN>) { | ||
124 | $options=$1 if (/^OPTIONS=(.*)$/); | ||
125 | } | ||
126 | close(IN); | ||
127 | |||
128 | # The following ciphers may be excluded (by Configure). This means functions | ||
129 | # defined with ifndef(NO_XXX) are not included in the .def file, and everything | ||
130 | # in directory xxx is ignored. | ||
131 | my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf; | ||
132 | my $no_cast; my $no_whirlpool; my $no_camellia; my $no_seed; | ||
133 | my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2; | ||
134 | my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; | ||
135 | my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw; | ||
136 | my $no_fp_api; my $no_static_engine=1; my $no_gmp; my $no_deprecated; | ||
137 | my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng; | ||
138 | my $no_jpake; my $no_srp; my $no_ssl2; my $no_ec2m; my $no_nistp_gcc; | ||
139 | my $no_nextprotoneg; my $no_sctp; | ||
140 | |||
141 | my $fips; | ||
142 | |||
143 | my $zlib; | ||
144 | |||
145 | |||
146 | foreach (@ARGV, split(/ /, $options)) | ||
147 | { | ||
148 | $debug=1 if $_ eq "debug"; | ||
149 | $W32=1 if $_ eq "32"; | ||
150 | $W16=1 if $_ eq "16"; | ||
151 | if($_ eq "NT") { | ||
152 | $W32 = 1; | ||
153 | $NT = 1; | ||
154 | } | ||
155 | if ($_ eq "VMS-VAX") { | ||
156 | $VMS=1; | ||
157 | $VMSVAX=1; | ||
158 | } | ||
159 | if ($_ eq "VMS-NonVAX") { | ||
160 | $VMS=1; | ||
161 | $VMSNonVAX=1; | ||
162 | } | ||
163 | $VMS=1 if $_ eq "VMS"; | ||
164 | $OS2=1 if $_ eq "OS2"; | ||
165 | $fips=1 if /^fips/; | ||
166 | if ($_ eq "zlib" || $_ eq "enable-zlib" || $_ eq "zlib-dynamic" | ||
167 | || $_ eq "enable-zlib-dynamic") { | ||
168 | $zlib = 1; | ||
169 | } | ||
170 | |||
171 | $do_ssl=1 if $_ eq "ssleay"; | ||
172 | if ($_ eq "ssl") { | ||
173 | $do_ssl=1; | ||
174 | $libname=$_ | ||
175 | } | ||
176 | $do_crypto=1 if $_ eq "libeay"; | ||
177 | if ($_ eq "crypto") { | ||
178 | $do_crypto=1; | ||
179 | $libname=$_; | ||
180 | } | ||
181 | $no_static_engine=1 if $_ eq "no-static-engine"; | ||
182 | $no_static_engine=0 if $_ eq "enable-static-engine"; | ||
183 | $do_update=1 if $_ eq "update"; | ||
184 | $do_rewrite=1 if $_ eq "rewrite"; | ||
185 | $do_ctest=1 if $_ eq "ctest"; | ||
186 | $do_ctestall=1 if $_ eq "ctestall"; | ||
187 | $do_checkexist=1 if $_ eq "exist"; | ||
188 | #$safe_stack_def=1 if $_ eq "-DDEBUG_SAFESTACK"; | ||
189 | |||
190 | if (/^no-rc2$/) { $no_rc2=1; } | ||
191 | elsif (/^no-rc4$/) { $no_rc4=1; } | ||
192 | elsif (/^no-rc5$/) { $no_rc5=1; } | ||
193 | elsif (/^no-idea$/) { $no_idea=1; } | ||
194 | elsif (/^no-des$/) { $no_des=1; $no_mdc2=1; } | ||
195 | elsif (/^no-bf$/) { $no_bf=1; } | ||
196 | elsif (/^no-cast$/) { $no_cast=1; } | ||
197 | elsif (/^no-whirlpool$/) { $no_whirlpool=1; } | ||
198 | elsif (/^no-md2$/) { $no_md2=1; } | ||
199 | elsif (/^no-md4$/) { $no_md4=1; } | ||
200 | elsif (/^no-md5$/) { $no_md5=1; } | ||
201 | elsif (/^no-sha$/) { $no_sha=1; } | ||
202 | elsif (/^no-ripemd$/) { $no_ripemd=1; } | ||
203 | elsif (/^no-mdc2$/) { $no_mdc2=1; } | ||
204 | elsif (/^no-rsa$/) { $no_rsa=1; } | ||
205 | elsif (/^no-dsa$/) { $no_dsa=1; } | ||
206 | elsif (/^no-dh$/) { $no_dh=1; } | ||
207 | elsif (/^no-ec$/) { $no_ec=1; } | ||
208 | elsif (/^no-ecdsa$/) { $no_ecdsa=1; } | ||
209 | elsif (/^no-ecdh$/) { $no_ecdh=1; } | ||
210 | elsif (/^no-hmac$/) { $no_hmac=1; } | ||
211 | elsif (/^no-aes$/) { $no_aes=1; } | ||
212 | elsif (/^no-camellia$/) { $no_camellia=1; } | ||
213 | elsif (/^no-seed$/) { $no_seed=1; } | ||
214 | elsif (/^no-evp$/) { $no_evp=1; } | ||
215 | elsif (/^no-lhash$/) { $no_lhash=1; } | ||
216 | elsif (/^no-stack$/) { $no_stack=1; } | ||
217 | elsif (/^no-err$/) { $no_err=1; } | ||
218 | elsif (/^no-buffer$/) { $no_buffer=1; } | ||
219 | elsif (/^no-bio$/) { $no_bio=1; } | ||
220 | #elsif (/^no-locking$/) { $no_locking=1; } | ||
221 | elsif (/^no-comp$/) { $no_comp=1; } | ||
222 | elsif (/^no-dso$/) { $no_dso=1; } | ||
223 | elsif (/^no-krb5$/) { $no_krb5=1; } | ||
224 | elsif (/^no-engine$/) { $no_engine=1; } | ||
225 | elsif (/^no-hw$/) { $no_hw=1; } | ||
226 | elsif (/^no-gmp$/) { $no_gmp=1; } | ||
227 | elsif (/^no-rfc3779$/) { $no_rfc3779=1; } | ||
228 | elsif (/^no-tlsext$/) { $no_tlsext=1; } | ||
229 | elsif (/^no-cms$/) { $no_cms=1; } | ||
230 | elsif (/^no-ec2m$/) { $no_ec2m=1; } | ||
231 | elsif (/^no-ec_nistp_64_gcc_128$/) { $no_nistp_gcc=1; } | ||
232 | elsif (/^no-nextprotoneg$/) { $no_nextprotoneg=1; } | ||
233 | elsif (/^no-ssl2$/) { $no_ssl2=1; } | ||
234 | elsif (/^no-capieng$/) { $no_capieng=1; } | ||
235 | elsif (/^no-jpake$/) { $no_jpake=1; } | ||
236 | elsif (/^no-srp$/) { $no_srp=1; } | ||
237 | elsif (/^no-sctp$/) { $no_sctp=1; } | ||
238 | } | ||
239 | |||
240 | |||
241 | if (!$libname) { | ||
242 | if ($do_ssl) { | ||
243 | $libname="SSLEAY"; | ||
244 | } | ||
245 | if ($do_crypto) { | ||
246 | $libname="LIBEAY"; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | # If no platform is given, assume WIN32 | ||
251 | if ($W32 + $W16 + $VMS + $OS2 == 0) { | ||
252 | $W32 = 1; | ||
253 | } | ||
254 | |||
255 | # Add extra knowledge | ||
256 | if ($W16) { | ||
257 | $no_fp_api=1; | ||
258 | } | ||
259 | |||
260 | if (!$do_ssl && !$do_crypto) | ||
261 | { | ||
262 | print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT | OS2 ]\n"; | ||
263 | exit(1); | ||
264 | } | ||
265 | |||
266 | %ssl_list=&load_numbers($ssl_num); | ||
267 | $max_ssl = $max_num; | ||
268 | %crypto_list=&load_numbers($crypto_num); | ||
269 | $max_crypto = $max_num; | ||
270 | |||
271 | my $ssl="ssl/ssl.h"; | ||
272 | $ssl.=" ssl/kssl.h"; | ||
273 | $ssl.=" ssl/tls1.h"; | ||
274 | $ssl.=" ssl/srtp.h"; | ||
275 | |||
276 | my $crypto ="crypto/crypto.h"; | ||
277 | $crypto.=" crypto/cryptlib.h"; | ||
278 | $crypto.=" crypto/o_dir.h"; | ||
279 | $crypto.=" crypto/o_str.h"; | ||
280 | $crypto.=" crypto/o_time.h"; | ||
281 | $crypto.=" crypto/des/des.h crypto/des/des_old.h" ; # unless $no_des; | ||
282 | $crypto.=" crypto/idea/idea.h" ; # unless $no_idea; | ||
283 | $crypto.=" crypto/rc4/rc4.h" ; # unless $no_rc4; | ||
284 | $crypto.=" crypto/rc5/rc5.h" ; # unless $no_rc5; | ||
285 | $crypto.=" crypto/rc2/rc2.h" ; # unless $no_rc2; | ||
286 | $crypto.=" crypto/bf/blowfish.h" ; # unless $no_bf; | ||
287 | $crypto.=" crypto/cast/cast.h" ; # unless $no_cast; | ||
288 | $crypto.=" crypto/whrlpool/whrlpool.h" ; | ||
289 | $crypto.=" crypto/md2/md2.h" ; # unless $no_md2; | ||
290 | $crypto.=" crypto/md4/md4.h" ; # unless $no_md4; | ||
291 | $crypto.=" crypto/md5/md5.h" ; # unless $no_md5; | ||
292 | $crypto.=" crypto/mdc2/mdc2.h" ; # unless $no_mdc2; | ||
293 | $crypto.=" crypto/sha/sha.h" ; # unless $no_sha; | ||
294 | $crypto.=" crypto/ripemd/ripemd.h" ; # unless $no_ripemd; | ||
295 | $crypto.=" crypto/aes/aes.h" ; # unless $no_aes; | ||
296 | $crypto.=" crypto/camellia/camellia.h" ; # unless $no_camellia; | ||
297 | $crypto.=" crypto/seed/seed.h"; # unless $no_seed; | ||
298 | |||
299 | $crypto.=" crypto/bn/bn.h"; | ||
300 | $crypto.=" crypto/rsa/rsa.h" ; # unless $no_rsa; | ||
301 | $crypto.=" crypto/dsa/dsa.h" ; # unless $no_dsa; | ||
302 | $crypto.=" crypto/dh/dh.h" ; # unless $no_dh; | ||
303 | $crypto.=" crypto/ec/ec.h" ; # unless $no_ec; | ||
304 | $crypto.=" crypto/ecdsa/ecdsa.h" ; # unless $no_ecdsa; | ||
305 | $crypto.=" crypto/ecdh/ecdh.h" ; # unless $no_ecdh; | ||
306 | $crypto.=" crypto/hmac/hmac.h" ; # unless $no_hmac; | ||
307 | $crypto.=" crypto/cmac/cmac.h" ; # unless $no_hmac; | ||
308 | |||
309 | $crypto.=" crypto/engine/engine.h"; # unless $no_engine; | ||
310 | $crypto.=" crypto/stack/stack.h" ; # unless $no_stack; | ||
311 | $crypto.=" crypto/buffer/buffer.h" ; # unless $no_buffer; | ||
312 | $crypto.=" crypto/bio/bio.h" ; # unless $no_bio; | ||
313 | $crypto.=" crypto/dso/dso.h" ; # unless $no_dso; | ||
314 | $crypto.=" crypto/lhash/lhash.h" ; # unless $no_lhash; | ||
315 | $crypto.=" crypto/conf/conf.h"; | ||
316 | $crypto.=" crypto/txt_db/txt_db.h"; | ||
317 | |||
318 | $crypto.=" crypto/evp/evp.h" ; # unless $no_evp; | ||
319 | $crypto.=" crypto/objects/objects.h"; | ||
320 | $crypto.=" crypto/pem/pem.h"; | ||
321 | #$crypto.=" crypto/meth/meth.h"; | ||
322 | $crypto.=" crypto/asn1/asn1.h"; | ||
323 | $crypto.=" crypto/asn1/asn1t.h"; | ||
324 | $crypto.=" crypto/asn1/asn1_mac.h"; | ||
325 | $crypto.=" crypto/err/err.h" ; # unless $no_err; | ||
326 | $crypto.=" crypto/pkcs7/pkcs7.h"; | ||
327 | $crypto.=" crypto/pkcs12/pkcs12.h"; | ||
328 | $crypto.=" crypto/x509/x509.h"; | ||
329 | $crypto.=" crypto/x509/x509_vfy.h"; | ||
330 | $crypto.=" crypto/x509v3/x509v3.h"; | ||
331 | $crypto.=" crypto/ts/ts.h"; | ||
332 | $crypto.=" crypto/rand/rand.h"; | ||
333 | $crypto.=" crypto/comp/comp.h" ; # unless $no_comp; | ||
334 | $crypto.=" crypto/ocsp/ocsp.h"; | ||
335 | $crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; | ||
336 | $crypto.=" crypto/krb5/krb5_asn.h"; | ||
337 | #$crypto.=" crypto/store/store.h"; | ||
338 | $crypto.=" crypto/pqueue/pqueue.h"; | ||
339 | $crypto.=" crypto/cms/cms.h"; | ||
340 | $crypto.=" crypto/jpake/jpake.h"; | ||
341 | $crypto.=" crypto/modes/modes.h"; | ||
342 | $crypto.=" crypto/srp/srp.h"; | ||
343 | |||
344 | my $symhacks="crypto/symhacks.h"; | ||
345 | |||
346 | my @ssl_symbols = &do_defs("SSLEAY", $ssl, $symhacks); | ||
347 | my @crypto_symbols = &do_defs("LIBEAY", $crypto, $symhacks); | ||
348 | |||
349 | if ($do_update) { | ||
350 | |||
351 | if ($do_ssl == 1) { | ||
352 | |||
353 | &maybe_add_info("SSLEAY",*ssl_list,@ssl_symbols); | ||
354 | if ($do_rewrite == 1) { | ||
355 | open(OUT, ">$ssl_num"); | ||
356 | &rewrite_numbers(*OUT,"SSLEAY",*ssl_list,@ssl_symbols); | ||
357 | } else { | ||
358 | open(OUT, ">>$ssl_num"); | ||
359 | } | ||
360 | &update_numbers(*OUT,"SSLEAY",*ssl_list,$max_ssl,@ssl_symbols); | ||
361 | close OUT; | ||
362 | } | ||
363 | |||
364 | if($do_crypto == 1) { | ||
365 | |||
366 | &maybe_add_info("LIBEAY",*crypto_list,@crypto_symbols); | ||
367 | if ($do_rewrite == 1) { | ||
368 | open(OUT, ">$crypto_num"); | ||
369 | &rewrite_numbers(*OUT,"LIBEAY",*crypto_list,@crypto_symbols); | ||
370 | } else { | ||
371 | open(OUT, ">>$crypto_num"); | ||
372 | } | ||
373 | &update_numbers(*OUT,"LIBEAY",*crypto_list,$max_crypto,@crypto_symbols); | ||
374 | close OUT; | ||
375 | } | ||
376 | |||
377 | } elsif ($do_checkexist) { | ||
378 | &check_existing(*ssl_list, @ssl_symbols) | ||
379 | if $do_ssl == 1; | ||
380 | &check_existing(*crypto_list, @crypto_symbols) | ||
381 | if $do_crypto == 1; | ||
382 | } elsif ($do_ctest || $do_ctestall) { | ||
383 | |||
384 | print <<"EOF"; | ||
385 | |||
386 | /* Test file to check all DEF file symbols are present by trying | ||
387 | * to link to all of them. This is *not* intended to be run! | ||
388 | */ | ||
389 | |||
390 | int main() | ||
391 | { | ||
392 | EOF | ||
393 | &print_test_file(*STDOUT,"SSLEAY",*ssl_list,$do_ctestall,@ssl_symbols) | ||
394 | if $do_ssl == 1; | ||
395 | |||
396 | &print_test_file(*STDOUT,"LIBEAY",*crypto_list,$do_ctestall,@crypto_symbols) | ||
397 | if $do_crypto == 1; | ||
398 | |||
399 | print "}\n"; | ||
400 | |||
401 | } else { | ||
402 | |||
403 | &print_def_file(*STDOUT,$libname,*ssl_list,@ssl_symbols) | ||
404 | if $do_ssl == 1; | ||
405 | |||
406 | &print_def_file(*STDOUT,$libname,*crypto_list,@crypto_symbols) | ||
407 | if $do_crypto == 1; | ||
408 | |||
409 | } | ||
410 | |||
411 | |||
412 | sub do_defs | ||
413 | { | ||
414 | my($name,$files,$symhacksfile)=@_; | ||
415 | my $file; | ||
416 | my @ret; | ||
417 | my %syms; | ||
418 | my %platform; # For anything undefined, we assume "" | ||
419 | my %kind; # For anything undefined, we assume "FUNCTION" | ||
420 | my %algorithm; # For anything undefined, we assume "" | ||
421 | my %variant; | ||
422 | my %variant_cnt; # To be able to allocate "name{n}" if "name" | ||
423 | # is the same name as the original. | ||
424 | my $cpp; | ||
425 | my %unknown_algorithms = (); | ||
426 | |||
427 | foreach $file (split(/\s+/,$symhacksfile." ".$files)) | ||
428 | { | ||
429 | print STDERR "DEBUG: starting on $file:\n" if $debug; | ||
430 | open(IN,"<$file") || die "unable to open $file:$!\n"; | ||
431 | my $line = "", my $def= ""; | ||
432 | my %tag = ( | ||
433 | (map { $_ => 0 } @known_platforms), | ||
434 | (map { "OPENSSL_SYS_".$_ => 0 } @known_ossl_platforms), | ||
435 | (map { "OPENSSL_NO_".$_ => 0 } @known_algorithms), | ||
436 | NOPROTO => 0, | ||
437 | PERL5 => 0, | ||
438 | _WINDLL => 0, | ||
439 | CONST_STRICT => 0, | ||
440 | TRUE => 1, | ||
441 | ); | ||
442 | my $symhacking = $file eq $symhacksfile; | ||
443 | my @current_platforms = (); | ||
444 | my @current_algorithms = (); | ||
445 | |||
446 | # params: symbol, alias, platforms, kind | ||
447 | # The reason to put this subroutine in a variable is that | ||
448 | # it will otherwise create it's own, unshared, version of | ||
449 | # %tag and %variant... | ||
450 | my $make_variant = sub | ||
451 | { | ||
452 | my ($s, $a, $p, $k) = @_; | ||
453 | my ($a1, $a2); | ||
454 | |||
455 | print STDERR "DEBUG: make_variant: Entered with ",$s,", ",$a,", ",(defined($p)?$p:""),", ",(defined($k)?$k:""),"\n" if $debug; | ||
456 | if (defined($p)) | ||
457 | { | ||
458 | $a1 = join(",",$p, | ||
459 | grep(!/^$/, | ||
460 | map { $tag{$_} == 1 ? $_ : "" } | ||
461 | @known_platforms)); | ||
462 | } | ||
463 | else | ||
464 | { | ||
465 | $a1 = join(",", | ||
466 | grep(!/^$/, | ||
467 | map { $tag{$_} == 1 ? $_ : "" } | ||
468 | @known_platforms)); | ||
469 | } | ||
470 | $a2 = join(",", | ||
471 | grep(!/^$/, | ||
472 | map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : "" } | ||
473 | @known_ossl_platforms)); | ||
474 | print STDERR "DEBUG: make_variant: a1 = $a1; a2 = $a2\n" if $debug; | ||
475 | if ($a1 eq "") { $a1 = $a2; } | ||
476 | elsif ($a1 ne "" && $a2 ne "") { $a1 .= ",".$a2; } | ||
477 | if ($a eq $s) | ||
478 | { | ||
479 | if (!defined($variant_cnt{$s})) | ||
480 | { | ||
481 | $variant_cnt{$s} = 0; | ||
482 | } | ||
483 | $variant_cnt{$s}++; | ||
484 | $a .= "{$variant_cnt{$s}}"; | ||
485 | } | ||
486 | my $toadd = $a.":".$a1.(defined($k)?":".$k:""); | ||
487 | my $togrep = $s.'(\{[0-9]+\})?:'.$a1.(defined($k)?":".$k:""); | ||
488 | if (!grep(/^$togrep$/, | ||
489 | split(/;/, defined($variant{$s})?$variant{$s}:""))) { | ||
490 | if (defined($variant{$s})) { $variant{$s} .= ";"; } | ||
491 | $variant{$s} .= $toadd; | ||
492 | } | ||
493 | print STDERR "DEBUG: make_variant: Exit with variant of ",$s," = ",$variant{$s},"\n" if $debug; | ||
494 | }; | ||
495 | |||
496 | print STDERR "DEBUG: parsing ----------\n" if $debug; | ||
497 | while(<IN>) { | ||
498 | if (/\/\* Error codes for the \w+ functions\. \*\//) | ||
499 | { | ||
500 | undef @tag; | ||
501 | last; | ||
502 | } | ||
503 | if ($line ne '') { | ||
504 | $_ = $line . $_; | ||
505 | $line = ''; | ||
506 | } | ||
507 | |||
508 | if (/\\$/) { | ||
509 | chomp; # remove eol | ||
510 | chop; # remove ending backslash | ||
511 | $line = $_; | ||
512 | next; | ||
513 | } | ||
514 | |||
515 | if(/\/\*/) { | ||
516 | if (not /\*\//) { # multiline comment... | ||
517 | $line = $_; # ... just accumulate | ||
518 | next; | ||
519 | } else { | ||
520 | s/\/\*.*?\*\///gs;# wipe it | ||
521 | } | ||
522 | } | ||
523 | |||
524 | if ($cpp) { | ||
525 | $cpp++ if /^#\s*if/; | ||
526 | $cpp-- if /^#\s*endif/; | ||
527 | next; | ||
528 | } | ||
529 | $cpp = 1 if /^#.*ifdef.*cplusplus/; | ||
530 | |||
531 | s/{[^{}]*}//gs; # ignore {} blocks | ||
532 | print STDERR "DEBUG: \$def=\"$def\"\n" if $debug && $def ne ""; | ||
533 | print STDERR "DEBUG: \$_=\"$_\"\n" if $debug; | ||
534 | if (/^\#\s*ifndef\s+(.*)/) { | ||
535 | push(@tag,"-"); | ||
536 | push(@tag,$1); | ||
537 | $tag{$1}=-1; | ||
538 | print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; | ||
539 | } elsif (/^\#\s*if\s+!defined\(([^\)]+)\)/) { | ||
540 | push(@tag,"-"); | ||
541 | if (/^\#\s*if\s+(!defined\(([^\)]+)\)(\s+\&\&\s+!defined\(([^\)]+)\))*)$/) { | ||
542 | my $tmp_1 = $1; | ||
543 | my $tmp_; | ||
544 | foreach $tmp_ (split '\&\&',$tmp_1) { | ||
545 | $tmp_ =~ /!defined\(([^\)]+)\)/; | ||
546 | print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; | ||
547 | push(@tag,$1); | ||
548 | $tag{$1}=-1; | ||
549 | } | ||
550 | } else { | ||
551 | print STDERR "Warning: $file: complicated expression: $_" if $debug; # because it is O... | ||
552 | print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; | ||
553 | push(@tag,$1); | ||
554 | $tag{$1}=-1; | ||
555 | } | ||
556 | } elsif (/^\#\s*ifdef\s+(\S*)/) { | ||
557 | push(@tag,"-"); | ||
558 | push(@tag,$1); | ||
559 | $tag{$1}=1; | ||
560 | print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; | ||
561 | } elsif (/^\#\s*if\s+defined\(([^\)]+)\)/) { | ||
562 | push(@tag,"-"); | ||
563 | if (/^\#\s*if\s+(defined\(([^\)]+)\)(\s+\|\|\s+defined\(([^\)]+)\))*)$/) { | ||
564 | my $tmp_1 = $1; | ||
565 | my $tmp_; | ||
566 | foreach $tmp_ (split '\|\|',$tmp_1) { | ||
567 | $tmp_ =~ /defined\(([^\)]+)\)/; | ||
568 | print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; | ||
569 | push(@tag,$1); | ||
570 | $tag{$1}=1; | ||
571 | } | ||
572 | } else { | ||
573 | print STDERR "Warning: $file: complicated expression: $_\n" if $debug; # because it is O... | ||
574 | print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; | ||
575 | push(@tag,$1); | ||
576 | $tag{$1}=1; | ||
577 | } | ||
578 | } elsif (/^\#\s*error\s+(\w+) is disabled\./) { | ||
579 | my $tag_i = $#tag; | ||
580 | while($tag[$tag_i] ne "-") { | ||
581 | if ($tag[$tag_i] eq "OPENSSL_NO_".$1) { | ||
582 | $tag{$tag[$tag_i]}=2; | ||
583 | print STDERR "DEBUG: $file: chaged tag $1 = 2\n" if $debug; | ||
584 | } | ||
585 | $tag_i--; | ||
586 | } | ||
587 | } elsif (/^\#\s*endif/) { | ||
588 | my $tag_i = $#tag; | ||
589 | while($tag_i > 0 && $tag[$tag_i] ne "-") { | ||
590 | my $t=$tag[$tag_i]; | ||
591 | print STDERR "DEBUG: \$t=\"$t\"\n" if $debug; | ||
592 | if ($tag{$t}==2) { | ||
593 | $tag{$t}=-1; | ||
594 | } else { | ||
595 | $tag{$t}=0; | ||
596 | } | ||
597 | print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug; | ||
598 | pop(@tag); | ||
599 | if ($t =~ /^OPENSSL_NO_([A-Z0-9_]+)$/) { | ||
600 | $t=$1; | ||
601 | } else { | ||
602 | $t=""; | ||
603 | } | ||
604 | if ($t ne "" | ||
605 | && !grep(/^$t$/, @known_algorithms)) { | ||
606 | $unknown_algorithms{$t} = 1; | ||
607 | #print STDERR "DEBUG: Added as unknown algorithm: $t\n" if $debug; | ||
608 | } | ||
609 | $tag_i--; | ||
610 | } | ||
611 | pop(@tag); | ||
612 | } elsif (/^\#\s*else/) { | ||
613 | my $tag_i = $#tag; | ||
614 | while($tag[$tag_i] ne "-") { | ||
615 | my $t=$tag[$tag_i]; | ||
616 | $tag{$t}= -$tag{$t}; | ||
617 | print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug; | ||
618 | $tag_i--; | ||
619 | } | ||
620 | } elsif (/^\#\s*if\s+1/) { | ||
621 | push(@tag,"-"); | ||
622 | # Dummy tag | ||
623 | push(@tag,"TRUE"); | ||
624 | $tag{"TRUE"}=1; | ||
625 | print STDERR "DEBUG: $file: found 1\n" if $debug; | ||
626 | } elsif (/^\#\s*if\s+0/) { | ||
627 | push(@tag,"-"); | ||
628 | # Dummy tag | ||
629 | push(@tag,"TRUE"); | ||
630 | $tag{"TRUE"}=-1; | ||
631 | print STDERR "DEBUG: $file: found 0\n" if $debug; | ||
632 | } elsif (/^\#\s*define\s+(\w+)\s+(\w+)/ | ||
633 | && $symhacking && $tag{'TRUE'} != -1) { | ||
634 | # This is for aliasing. When we find an alias, | ||
635 | # we have to invert | ||
636 | &$make_variant($1,$2); | ||
637 | print STDERR "DEBUG: $file: defined $1 = $2\n" if $debug; | ||
638 | } | ||
639 | if (/^\#/) { | ||
640 | @current_platforms = | ||
641 | grep(!/^$/, | ||
642 | map { $tag{$_} == 1 ? $_ : | ||
643 | $tag{$_} == -1 ? "!".$_ : "" } | ||
644 | @known_platforms); | ||
645 | push @current_platforms | ||
646 | , grep(!/^$/, | ||
647 | map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : | ||
648 | $tag{"OPENSSL_SYS_".$_} == -1 ? "!".$_ : "" } | ||
649 | @known_ossl_platforms); | ||
650 | @current_algorithms = | ||
651 | grep(!/^$/, | ||
652 | map { $tag{"OPENSSL_NO_".$_} == -1 ? $_ : "" } | ||
653 | @known_algorithms); | ||
654 | $def .= | ||
655 | "#INFO:" | ||
656 | .join(',',@current_platforms).":" | ||
657 | .join(',',@current_algorithms).";"; | ||
658 | next; | ||
659 | } | ||
660 | if ($tag{'TRUE'} != -1) { | ||
661 | if (/^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) { | ||
662 | next; | ||
663 | } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
664 | $def .= "int d2i_$3(void);"; | ||
665 | $def .= "int i2d_$3(void);"; | ||
666 | # Variant for platforms that do not | ||
667 | # have to access globale variables | ||
668 | # in shared libraries through functions | ||
669 | $def .= | ||
670 | "#INFO:" | ||
671 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
672 | .join(',',@current_algorithms).";"; | ||
673 | $def .= "OPENSSL_EXTERN int $2_it;"; | ||
674 | $def .= | ||
675 | "#INFO:" | ||
676 | .join(',',@current_platforms).":" | ||
677 | .join(',',@current_algorithms).";"; | ||
678 | # Variant for platforms that have to | ||
679 | # access globale variables in shared | ||
680 | # libraries through functions | ||
681 | &$make_variant("$2_it","$2_it", | ||
682 | "EXPORT_VAR_AS_FUNCTION", | ||
683 | "FUNCTION"); | ||
684 | next; | ||
685 | } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_fname\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
686 | $def .= "int d2i_$3(void);"; | ||
687 | $def .= "int i2d_$3(void);"; | ||
688 | $def .= "int $3_free(void);"; | ||
689 | $def .= "int $3_new(void);"; | ||
690 | # Variant for platforms that do not | ||
691 | # have to access globale variables | ||
692 | # in shared libraries through functions | ||
693 | $def .= | ||
694 | "#INFO:" | ||
695 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
696 | .join(',',@current_algorithms).";"; | ||
697 | $def .= "OPENSSL_EXTERN int $2_it;"; | ||
698 | $def .= | ||
699 | "#INFO:" | ||
700 | .join(',',@current_platforms).":" | ||
701 | .join(',',@current_algorithms).";"; | ||
702 | # Variant for platforms that have to | ||
703 | # access globale variables in shared | ||
704 | # libraries through functions | ||
705 | &$make_variant("$2_it","$2_it", | ||
706 | "EXPORT_VAR_AS_FUNCTION", | ||
707 | "FUNCTION"); | ||
708 | next; | ||
709 | } elsif (/^\s*DECLARE_ASN1_FUNCTIONS\s*\(\s*(\w*)\s*\)/ || | ||
710 | /^\s*DECLARE_ASN1_FUNCTIONS_const\s*\(\s*(\w*)\s*\)/) { | ||
711 | $def .= "int d2i_$1(void);"; | ||
712 | $def .= "int i2d_$1(void);"; | ||
713 | $def .= "int $1_free(void);"; | ||
714 | $def .= "int $1_new(void);"; | ||
715 | # Variant for platforms that do not | ||
716 | # have to access globale variables | ||
717 | # in shared libraries through functions | ||
718 | $def .= | ||
719 | "#INFO:" | ||
720 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
721 | .join(',',@current_algorithms).";"; | ||
722 | $def .= "OPENSSL_EXTERN int $1_it;"; | ||
723 | $def .= | ||
724 | "#INFO:" | ||
725 | .join(',',@current_platforms).":" | ||
726 | .join(',',@current_algorithms).";"; | ||
727 | # Variant for platforms that have to | ||
728 | # access globale variables in shared | ||
729 | # libraries through functions | ||
730 | &$make_variant("$1_it","$1_it", | ||
731 | "EXPORT_VAR_AS_FUNCTION", | ||
732 | "FUNCTION"); | ||
733 | next; | ||
734 | } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS_const\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
735 | $def .= "int d2i_$2(void);"; | ||
736 | $def .= "int i2d_$2(void);"; | ||
737 | # Variant for platforms that do not | ||
738 | # have to access globale variables | ||
739 | # in shared libraries through functions | ||
740 | $def .= | ||
741 | "#INFO:" | ||
742 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
743 | .join(',',@current_algorithms).";"; | ||
744 | $def .= "OPENSSL_EXTERN int $2_it;"; | ||
745 | $def .= | ||
746 | "#INFO:" | ||
747 | .join(',',@current_platforms).":" | ||
748 | .join(',',@current_algorithms).";"; | ||
749 | # Variant for platforms that have to | ||
750 | # access globale variables in shared | ||
751 | # libraries through functions | ||
752 | &$make_variant("$2_it","$2_it", | ||
753 | "EXPORT_VAR_AS_FUNCTION", | ||
754 | "FUNCTION"); | ||
755 | next; | ||
756 | } elsif (/^\s*DECLARE_ASN1_ALLOC_FUNCTIONS\s*\(\s*(\w*)\s*\)/) { | ||
757 | $def .= "int $1_free(void);"; | ||
758 | $def .= "int $1_new(void);"; | ||
759 | next; | ||
760 | } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
761 | $def .= "int d2i_$2(void);"; | ||
762 | $def .= "int i2d_$2(void);"; | ||
763 | $def .= "int $2_free(void);"; | ||
764 | $def .= "int $2_new(void);"; | ||
765 | # Variant for platforms that do not | ||
766 | # have to access globale variables | ||
767 | # in shared libraries through functions | ||
768 | $def .= | ||
769 | "#INFO:" | ||
770 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
771 | .join(',',@current_algorithms).";"; | ||
772 | $def .= "OPENSSL_EXTERN int $2_it;"; | ||
773 | $def .= | ||
774 | "#INFO:" | ||
775 | .join(',',@current_platforms).":" | ||
776 | .join(',',@current_algorithms).";"; | ||
777 | # Variant for platforms that have to | ||
778 | # access globale variables in shared | ||
779 | # libraries through functions | ||
780 | &$make_variant("$2_it","$2_it", | ||
781 | "EXPORT_VAR_AS_FUNCTION", | ||
782 | "FUNCTION"); | ||
783 | next; | ||
784 | } elsif (/^\s*DECLARE_ASN1_ITEM\s*\(\s*(\w*)\s*\)/) { | ||
785 | # Variant for platforms that do not | ||
786 | # have to access globale variables | ||
787 | # in shared libraries through functions | ||
788 | $def .= | ||
789 | "#INFO:" | ||
790 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
791 | .join(',',@current_algorithms).";"; | ||
792 | $def .= "OPENSSL_EXTERN int $1_it;"; | ||
793 | $def .= | ||
794 | "#INFO:" | ||
795 | .join(',',@current_platforms).":" | ||
796 | .join(',',@current_algorithms).";"; | ||
797 | # Variant for platforms that have to | ||
798 | # access globale variables in shared | ||
799 | # libraries through functions | ||
800 | &$make_variant("$1_it","$1_it", | ||
801 | "EXPORT_VAR_AS_FUNCTION", | ||
802 | "FUNCTION"); | ||
803 | next; | ||
804 | } elsif (/^\s*DECLARE_ASN1_NDEF_FUNCTION\s*\(\s*(\w*)\s*\)/) { | ||
805 | $def .= "int i2d_$1_NDEF(void);"; | ||
806 | } elsif (/^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) { | ||
807 | next; | ||
808 | } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION\s*\(\s*(\w*)\s*\)/) { | ||
809 | $def .= "int $1_print_ctx(void);"; | ||
810 | next; | ||
811 | } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
812 | $def .= "int $2_print_ctx(void);"; | ||
813 | next; | ||
814 | } elsif (/^\s*DECLARE_PKCS12_STACK_OF\s*\(\s*(\w*)\s*\)/) { | ||
815 | next; | ||
816 | } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ || | ||
817 | /^DECLARE_PEM_rw_cb\s*\(\s*(\w*)\s*,/ || | ||
818 | /^DECLARE_PEM_rw_const\s*\(\s*(\w*)\s*,/ ) { | ||
819 | # Things not in Win16 | ||
820 | $def .= | ||
821 | "#INFO:" | ||
822 | .join(',',"!WIN16",@current_platforms).":" | ||
823 | .join(',',@current_algorithms).";"; | ||
824 | $def .= "int PEM_read_$1(void);"; | ||
825 | $def .= "int PEM_write_$1(void);"; | ||
826 | $def .= | ||
827 | "#INFO:" | ||
828 | .join(',',@current_platforms).":" | ||
829 | .join(',',@current_algorithms).";"; | ||
830 | # Things that are everywhere | ||
831 | $def .= "int PEM_read_bio_$1(void);"; | ||
832 | $def .= "int PEM_write_bio_$1(void);"; | ||
833 | next; | ||
834 | } elsif (/^DECLARE_PEM_write\s*\(\s*(\w*)\s*,/ || | ||
835 | /^DECLARE_PEM_write_cb\s*\(\s*(\w*)\s*,/ ) { | ||
836 | # Things not in Win16 | ||
837 | $def .= | ||
838 | "#INFO:" | ||
839 | .join(',',"!WIN16",@current_platforms).":" | ||
840 | .join(',',@current_algorithms).";"; | ||
841 | $def .= "int PEM_write_$1(void);"; | ||
842 | $def .= | ||
843 | "#INFO:" | ||
844 | .join(',',@current_platforms).":" | ||
845 | .join(',',@current_algorithms).";"; | ||
846 | # Things that are everywhere | ||
847 | $def .= "int PEM_write_bio_$1(void);"; | ||
848 | next; | ||
849 | } elsif (/^DECLARE_PEM_read\s*\(\s*(\w*)\s*,/ || | ||
850 | /^DECLARE_PEM_read_cb\s*\(\s*(\w*)\s*,/ ) { | ||
851 | # Things not in Win16 | ||
852 | $def .= | ||
853 | "#INFO:" | ||
854 | .join(',',"!WIN16",@current_platforms).":" | ||
855 | .join(',',@current_algorithms).";"; | ||
856 | $def .= "int PEM_read_$1(void);"; | ||
857 | $def .= | ||
858 | "#INFO:" | ||
859 | .join(',',@current_platforms).":" | ||
860 | .join(',',@current_algorithms).";"; | ||
861 | # Things that are everywhere | ||
862 | $def .= "int PEM_read_bio_$1(void);"; | ||
863 | next; | ||
864 | } elsif (/^OPENSSL_DECLARE_GLOBAL\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
865 | # Variant for platforms that do not | ||
866 | # have to access globale variables | ||
867 | # in shared libraries through functions | ||
868 | $def .= | ||
869 | "#INFO:" | ||
870 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
871 | .join(',',@current_algorithms).";"; | ||
872 | $def .= "OPENSSL_EXTERN int _shadow_$2;"; | ||
873 | $def .= | ||
874 | "#INFO:" | ||
875 | .join(',',@current_platforms).":" | ||
876 | .join(',',@current_algorithms).";"; | ||
877 | # Variant for platforms that have to | ||
878 | # access globale variables in shared | ||
879 | # libraries through functions | ||
880 | &$make_variant("_shadow_$2","_shadow_$2", | ||
881 | "EXPORT_VAR_AS_FUNCTION", | ||
882 | "FUNCTION"); | ||
883 | } elsif ($tag{'CONST_STRICT'} != 1) { | ||
884 | if (/\{|\/\*|\([^\)]*$/) { | ||
885 | $line = $_; | ||
886 | } else { | ||
887 | $def .= $_; | ||
888 | } | ||
889 | } | ||
890 | } | ||
891 | } | ||
892 | close(IN); | ||
893 | |||
894 | my $algs; | ||
895 | my $plays; | ||
896 | |||
897 | print STDERR "DEBUG: postprocessing ----------\n" if $debug; | ||
898 | foreach (split /;/, $def) { | ||
899 | my $s; my $k = "FUNCTION"; my $p; my $a; | ||
900 | s/^[\n\s]*//g; | ||
901 | s/[\n\s]*$//g; | ||
902 | next if(/\#undef/); | ||
903 | next if(/typedef\W/); | ||
904 | next if(/\#define/); | ||
905 | |||
906 | # Reduce argument lists to empty () | ||
907 | # fold round brackets recursively: (t(*v)(t),t) -> (t{}{},t) -> {} | ||
908 | while(/\(.*\)/s) { | ||
909 | s/\([^\(\)]+\)/\{\}/gs; | ||
910 | s/\(\s*\*\s*(\w+)\s*\{\}\s*\)/$1/gs; #(*f{}) -> f | ||
911 | } | ||
912 | # pretend as we didn't use curly braces: {} -> () | ||
913 | s/\{\}/\(\)/gs; | ||
914 | |||
915 | s/STACK_OF\(\)/void/gs; | ||
916 | s/LHASH_OF\(\)/void/gs; | ||
917 | |||
918 | print STDERR "DEBUG: \$_ = \"$_\"\n" if $debug; | ||
919 | if (/^\#INFO:([^:]*):(.*)$/) { | ||
920 | $plats = $1; | ||
921 | $algs = $2; | ||
922 | print STDERR "DEBUG: found info on platforms ($plats) and algorithms ($algs)\n" if $debug; | ||
923 | next; | ||
924 | } elsif (/^\s*OPENSSL_EXTERN\s.*?(\w+(\{[0-9]+\})?)(\[[0-9]*\])*\s*$/) { | ||
925 | $s = $1; | ||
926 | $k = "VARIABLE"; | ||
927 | print STDERR "DEBUG: found external variable $s\n" if $debug; | ||
928 | } elsif (/TYPEDEF_\w+_OF/s) { | ||
929 | next; | ||
930 | } elsif (/(\w+)\s*\(\).*/s) { # first token prior [first] () is | ||
931 | $s = $1; # a function name! | ||
932 | print STDERR "DEBUG: found function $s\n" if $debug; | ||
933 | } elsif (/\(/ and not (/=/)) { | ||
934 | print STDERR "File $file: cannot parse: $_;\n"; | ||
935 | next; | ||
936 | } else { | ||
937 | next; | ||
938 | } | ||
939 | |||
940 | $syms{$s} = 1; | ||
941 | $kind{$s} = $k; | ||
942 | |||
943 | $p = $plats; | ||
944 | $a = $algs; | ||
945 | $a .= ",BF" if($s =~ /EVP_bf/); | ||
946 | $a .= ",CAST" if($s =~ /EVP_cast/); | ||
947 | $a .= ",DES" if($s =~ /EVP_des/); | ||
948 | $a .= ",DSA" if($s =~ /EVP_dss/); | ||
949 | $a .= ",IDEA" if($s =~ /EVP_idea/); | ||
950 | $a .= ",MD2" if($s =~ /EVP_md2/); | ||
951 | $a .= ",MD4" if($s =~ /EVP_md4/); | ||
952 | $a .= ",MD5" if($s =~ /EVP_md5/); | ||
953 | $a .= ",RC2" if($s =~ /EVP_rc2/); | ||
954 | $a .= ",RC4" if($s =~ /EVP_rc4/); | ||
955 | $a .= ",RC5" if($s =~ /EVP_rc5/); | ||
956 | $a .= ",RIPEMD" if($s =~ /EVP_ripemd/); | ||
957 | $a .= ",SHA" if($s =~ /EVP_sha/); | ||
958 | $a .= ",RSA" if($s =~ /EVP_(Open|Seal)(Final|Init)/); | ||
959 | $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/); | ||
960 | $a .= ",RSA" if($s =~ /RSAPrivateKey/); | ||
961 | $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/); | ||
962 | |||
963 | $platform{$s} = | ||
964 | &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); | ||
965 | $algorithm{$s} .= ','.$a; | ||
966 | |||
967 | if (defined($variant{$s})) { | ||
968 | foreach $v (split /;/,$variant{$s}) { | ||
969 | (my $r, my $p, my $k) = split(/:/,$v); | ||
970 | my $ip = join ',',map({ /^!(.*)$/ ? $1 : "!".$_ } split /,/, $p); | ||
971 | $syms{$r} = 1; | ||
972 | if (!defined($k)) { $k = $kind{$s}; } | ||
973 | $kind{$r} = $k."(".$s.")"; | ||
974 | $algorithm{$r} = $algorithm{$s}; | ||
975 | $platform{$r} = &reduce_platforms($platform{$s}.",".$p.",".$p); | ||
976 | $platform{$s} = &reduce_platforms($platform{$s}.','.$ip.','.$ip); | ||
977 | print STDERR "DEBUG: \$variant{\"$s\"} = ",$v,"; \$r = $r; \$p = ",$platform{$r},"; \$a = ",$algorithm{$r},"; \$kind = ",$kind{$r},"\n" if $debug; | ||
978 | } | ||
979 | } | ||
980 | print STDERR "DEBUG: \$s = $s; \$p = ",$platform{$s},"; \$a = ",$algorithm{$s},"; \$kind = ",$kind{$s},"\n" if $debug; | ||
981 | } | ||
982 | } | ||
983 | |||
984 | # Prune the returned symbols | ||
985 | |||
986 | delete $syms{"bn_dump1"}; | ||
987 | $platform{"BIO_s_log"} .= ",!WIN32,!WIN16,!macintosh"; | ||
988 | |||
989 | $platform{"PEM_read_NS_CERT_SEQ"} = "VMS"; | ||
990 | $platform{"PEM_write_NS_CERT_SEQ"} = "VMS"; | ||
991 | $platform{"PEM_read_P8_PRIV_KEY_INFO"} = "VMS"; | ||
992 | $platform{"PEM_write_P8_PRIV_KEY_INFO"} = "VMS"; | ||
993 | $platform{"EVP_sha384"} = "!VMSVAX"; | ||
994 | $platform{"EVP_sha512"} = "!VMSVAX"; | ||
995 | $platform{"SHA384_Init"} = "!VMSVAX"; | ||
996 | $platform{"SHA384_Transform"} = "!VMSVAX"; | ||
997 | $platform{"SHA384_Update"} = "!VMSVAX"; | ||
998 | $platform{"SHA384_Final"} = "!VMSVAX"; | ||
999 | $platform{"SHA384"} = "!VMSVAX"; | ||
1000 | $platform{"SHA512_Init"} = "!VMSVAX"; | ||
1001 | $platform{"SHA512_Transform"} = "!VMSVAX"; | ||
1002 | $platform{"SHA512_Update"} = "!VMSVAX"; | ||
1003 | $platform{"SHA512_Final"} = "!VMSVAX"; | ||
1004 | $platform{"SHA512"} = "!VMSVAX"; | ||
1005 | $platform{"WHIRLPOOL_Init"} = "!VMSVAX"; | ||
1006 | $platform{"WHIRLPOOL"} = "!VMSVAX"; | ||
1007 | $platform{"WHIRLPOOL_BitUpdate"} = "!VMSVAX"; | ||
1008 | $platform{"EVP_whirlpool"} = "!VMSVAX"; | ||
1009 | $platform{"WHIRLPOOL_Final"} = "!VMSVAX"; | ||
1010 | $platform{"WHIRLPOOL_Update"} = "!VMSVAX"; | ||
1011 | |||
1012 | |||
1013 | # Info we know about | ||
1014 | |||
1015 | push @ret, map { $_."\\".&info_string($_,"EXIST", | ||
1016 | $platform{$_}, | ||
1017 | $kind{$_}, | ||
1018 | $algorithm{$_}) } keys %syms; | ||
1019 | |||
1020 | if (keys %unknown_algorithms) { | ||
1021 | print STDERR "WARNING: mkdef.pl doesn't know the following algorithms:\n"; | ||
1022 | print STDERR "\t",join("\n\t",keys %unknown_algorithms),"\n"; | ||
1023 | } | ||
1024 | return(@ret); | ||
1025 | } | ||
1026 | |||
1027 | # Param: string of comma-separated platform-specs. | ||
1028 | sub reduce_platforms | ||
1029 | { | ||
1030 | my ($platforms) = @_; | ||
1031 | my $pl = defined($platforms) ? $platforms : ""; | ||
1032 | my %p = map { $_ => 0 } split /,/, $pl; | ||
1033 | my $ret; | ||
1034 | |||
1035 | print STDERR "DEBUG: Entered reduce_platforms with \"$platforms\"\n" | ||
1036 | if $debug; | ||
1037 | # We do this, because if there's code like the following, it really | ||
1038 | # means the function exists in all cases and should therefore be | ||
1039 | # everywhere. By increasing and decreasing, we may attain 0: | ||
1040 | # | ||
1041 | # ifndef WIN16 | ||
1042 | # int foo(); | ||
1043 | # else | ||
1044 | # int _fat foo(); | ||
1045 | # endif | ||
1046 | foreach $platform (split /,/, $pl) { | ||
1047 | if ($platform =~ /^!(.*)$/) { | ||
1048 | $p{$1}--; | ||
1049 | } else { | ||
1050 | $p{$platform}++; | ||
1051 | } | ||
1052 | } | ||
1053 | foreach $platform (keys %p) { | ||
1054 | if ($p{$platform} == 0) { delete $p{$platform}; } | ||
1055 | } | ||
1056 | |||
1057 | delete $p{""}; | ||
1058 | |||
1059 | $ret = join(',',sort(map { $p{$_} < 0 ? "!".$_ : $_ } keys %p)); | ||
1060 | print STDERR "DEBUG: Exiting reduce_platforms with \"$ret\"\n" | ||
1061 | if $debug; | ||
1062 | return $ret; | ||
1063 | } | ||
1064 | |||
1065 | sub info_string { | ||
1066 | (my $symbol, my $exist, my $platforms, my $kind, my $algorithms) = @_; | ||
1067 | |||
1068 | my %a = defined($algorithms) ? | ||
1069 | map { $_ => 1 } split /,/, $algorithms : (); | ||
1070 | my $k = defined($kind) ? $kind : "FUNCTION"; | ||
1071 | my $ret; | ||
1072 | my $p = &reduce_platforms($platforms); | ||
1073 | |||
1074 | delete $a{""}; | ||
1075 | |||
1076 | $ret = $exist; | ||
1077 | $ret .= ":".$p; | ||
1078 | $ret .= ":".$k; | ||
1079 | $ret .= ":".join(',',sort keys %a); | ||
1080 | return $ret; | ||
1081 | } | ||
1082 | |||
1083 | sub maybe_add_info { | ||
1084 | (my $name, *nums, my @symbols) = @_; | ||
1085 | my $sym; | ||
1086 | my $new_info = 0; | ||
1087 | my %syms=(); | ||
1088 | |||
1089 | print STDERR "Updating $name info\n"; | ||
1090 | foreach $sym (@symbols) { | ||
1091 | (my $s, my $i) = split /\\/, $sym; | ||
1092 | if (defined($nums{$s})) { | ||
1093 | $i =~ s/^(.*?:.*?:\w+)(\(\w+\))?/$1/; | ||
1094 | (my $n, my $dummy) = split /\\/, $nums{$s}; | ||
1095 | if (!defined($dummy) || $i ne $dummy) { | ||
1096 | $nums{$s} = $n."\\".$i; | ||
1097 | $new_info++; | ||
1098 | print STDERR "DEBUG: maybe_add_info for $s: \"$dummy\" => \"$i\"\n" if $debug; | ||
1099 | } | ||
1100 | } | ||
1101 | $syms{$s} = 1; | ||
1102 | } | ||
1103 | |||
1104 | my @s=sort { &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") } keys %nums; | ||
1105 | foreach $sym (@s) { | ||
1106 | (my $n, my $i) = split /\\/, $nums{$sym}; | ||
1107 | if (!defined($syms{$sym}) && $i !~ /^NOEXIST:/) { | ||
1108 | $new_info++; | ||
1109 | print STDERR "DEBUG: maybe_add_info for $sym: -> undefined\n" if $debug; | ||
1110 | } | ||
1111 | } | ||
1112 | if ($new_info) { | ||
1113 | print STDERR "$new_info old symbols got an info update\n"; | ||
1114 | if (!$do_rewrite) { | ||
1115 | print STDERR "You should do a rewrite to fix this.\n"; | ||
1116 | } | ||
1117 | } else { | ||
1118 | print STDERR "No old symbols needed info update\n"; | ||
1119 | } | ||
1120 | } | ||
1121 | |||
1122 | # Param: string of comma-separated keywords, each possibly prefixed with a "!" | ||
1123 | sub is_valid | ||
1124 | { | ||
1125 | my ($keywords_txt,$platforms) = @_; | ||
1126 | my (@keywords) = split /,/,$keywords_txt; | ||
1127 | my ($falsesum, $truesum) = (0, 1); | ||
1128 | |||
1129 | # Param: one keyword | ||
1130 | sub recognise | ||
1131 | { | ||
1132 | my ($keyword,$platforms) = @_; | ||
1133 | |||
1134 | if ($platforms) { | ||
1135 | # platforms | ||
1136 | if ($keyword eq "VMSVAX" && $VMSVAX) { return 1; } | ||
1137 | if ($keyword eq "VMSNonVAX" && $VMSNonVAX) { return 1; } | ||
1138 | if ($keyword eq "VMS" && $VMS) { return 1; } | ||
1139 | if ($keyword eq "WIN32" && $W32) { return 1; } | ||
1140 | if ($keyword eq "WIN16" && $W16) { return 1; } | ||
1141 | if ($keyword eq "WINNT" && $NT) { return 1; } | ||
1142 | if ($keyword eq "OS2" && $OS2) { return 1; } | ||
1143 | # Special platforms: | ||
1144 | # EXPORT_VAR_AS_FUNCTION means that global variables | ||
1145 | # will be represented as functions. This currently | ||
1146 | # only happens on VMS-VAX. | ||
1147 | if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) { | ||
1148 | return 1; | ||
1149 | } | ||
1150 | if ($keyword eq "OPENSSL_FIPS" && $fips) { | ||
1151 | return 1; | ||
1152 | } | ||
1153 | if ($keyword eq "ZLIB" && $zlib) { return 1; } | ||
1154 | return 0; | ||
1155 | } else { | ||
1156 | # algorithms | ||
1157 | if ($keyword eq "RC2" && $no_rc2) { return 0; } | ||
1158 | if ($keyword eq "RC4" && $no_rc4) { return 0; } | ||
1159 | if ($keyword eq "RC5" && $no_rc5) { return 0; } | ||
1160 | if ($keyword eq "IDEA" && $no_idea) { return 0; } | ||
1161 | if ($keyword eq "DES" && $no_des) { return 0; } | ||
1162 | if ($keyword eq "BF" && $no_bf) { return 0; } | ||
1163 | if ($keyword eq "CAST" && $no_cast) { return 0; } | ||
1164 | if ($keyword eq "MD2" && $no_md2) { return 0; } | ||
1165 | if ($keyword eq "MD4" && $no_md4) { return 0; } | ||
1166 | if ($keyword eq "MD5" && $no_md5) { return 0; } | ||
1167 | if ($keyword eq "SHA" && $no_sha) { return 0; } | ||
1168 | if ($keyword eq "RIPEMD" && $no_ripemd) { return 0; } | ||
1169 | if ($keyword eq "MDC2" && $no_mdc2) { return 0; } | ||
1170 | if ($keyword eq "WHIRLPOOL" && $no_whirlpool) { return 0; } | ||
1171 | if ($keyword eq "RSA" && $no_rsa) { return 0; } | ||
1172 | if ($keyword eq "DSA" && $no_dsa) { return 0; } | ||
1173 | if ($keyword eq "DH" && $no_dh) { return 0; } | ||
1174 | if ($keyword eq "EC" && $no_ec) { return 0; } | ||
1175 | if ($keyword eq "ECDSA" && $no_ecdsa) { return 0; } | ||
1176 | if ($keyword eq "ECDH" && $no_ecdh) { return 0; } | ||
1177 | if ($keyword eq "HMAC" && $no_hmac) { return 0; } | ||
1178 | if ($keyword eq "AES" && $no_aes) { return 0; } | ||
1179 | if ($keyword eq "CAMELLIA" && $no_camellia) { return 0; } | ||
1180 | if ($keyword eq "SEED" && $no_seed) { return 0; } | ||
1181 | if ($keyword eq "EVP" && $no_evp) { return 0; } | ||
1182 | if ($keyword eq "LHASH" && $no_lhash) { return 0; } | ||
1183 | if ($keyword eq "STACK" && $no_stack) { return 0; } | ||
1184 | if ($keyword eq "ERR" && $no_err) { return 0; } | ||
1185 | if ($keyword eq "BUFFER" && $no_buffer) { return 0; } | ||
1186 | if ($keyword eq "BIO" && $no_bio) { return 0; } | ||
1187 | if ($keyword eq "COMP" && $no_comp) { return 0; } | ||
1188 | if ($keyword eq "DSO" && $no_dso) { return 0; } | ||
1189 | if ($keyword eq "KRB5" && $no_krb5) { return 0; } | ||
1190 | if ($keyword eq "ENGINE" && $no_engine) { return 0; } | ||
1191 | if ($keyword eq "HW" && $no_hw) { return 0; } | ||
1192 | if ($keyword eq "FP_API" && $no_fp_api) { return 0; } | ||
1193 | if ($keyword eq "STATIC_ENGINE" && $no_static_engine) { return 0; } | ||
1194 | if ($keyword eq "GMP" && $no_gmp) { return 0; } | ||
1195 | if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; } | ||
1196 | if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; } | ||
1197 | if ($keyword eq "PSK" && $no_psk) { return 0; } | ||
1198 | if ($keyword eq "CMS" && $no_cms) { return 0; } | ||
1199 | if ($keyword eq "EC2M" && $no_ec2m) { return 0; } | ||
1200 | if ($keyword eq "NEXTPROTONEG" && $no_nextprotoneg) { return 0; } | ||
1201 | if ($keyword eq "EC_NISTP_64_GCC_128" && $no_nistp_gcc) | ||
1202 | { return 0; } | ||
1203 | if ($keyword eq "SSL2" && $no_ssl2) { return 0; } | ||
1204 | if ($keyword eq "CAPIENG" && $no_capieng) { return 0; } | ||
1205 | if ($keyword eq "JPAKE" && $no_jpake) { return 0; } | ||
1206 | if ($keyword eq "SRP" && $no_srp) { return 0; } | ||
1207 | if ($keyword eq "SCTP" && $no_sctp) { return 0; } | ||
1208 | if ($keyword eq "DEPRECATED" && $no_deprecated) { return 0; } | ||
1209 | |||
1210 | # Nothing recognise as true | ||
1211 | return 1; | ||
1212 | } | ||
1213 | } | ||
1214 | |||
1215 | foreach $k (@keywords) { | ||
1216 | if ($k =~ /^!(.*)$/) { | ||
1217 | $falsesum += &recognise($1,$platforms); | ||
1218 | } else { | ||
1219 | $truesum *= &recognise($k,$platforms); | ||
1220 | } | ||
1221 | } | ||
1222 | print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug; | ||
1223 | return (!$falsesum) && $truesum; | ||
1224 | } | ||
1225 | |||
1226 | sub print_test_file | ||
1227 | { | ||
1228 | (*OUT,my $name,*nums,my $testall,my @symbols)=@_; | ||
1229 | my $n = 1; my @e; my @r; | ||
1230 | my $sym; my $prev = ""; my $prefSSLeay; | ||
1231 | |||
1232 | (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols); | ||
1233 | (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:.*/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols); | ||
1234 | @symbols=((sort @e),(sort @r)); | ||
1235 | |||
1236 | foreach $sym (@symbols) { | ||
1237 | (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; | ||
1238 | my $v = 0; | ||
1239 | $v = 1 if $i=~ /^.*?:.*?:VARIABLE/; | ||
1240 | my $p = ($i =~ /^[^:]*:([^:]*):/,$1); | ||
1241 | my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1); | ||
1242 | if (!defined($nums{$s})) { | ||
1243 | print STDERR "Warning: $s does not have a number assigned\n" | ||
1244 | if(!$do_update); | ||
1245 | } elsif (is_valid($p,1) && is_valid($a,0)) { | ||
1246 | my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1); | ||
1247 | if ($prev eq $s2) { | ||
1248 | print OUT "\t/* The following has already appeared previously */\n"; | ||
1249 | print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n"; | ||
1250 | } | ||
1251 | $prev = $s2; # To warn about duplicates... | ||
1252 | |||
1253 | ($nn,$ni)=($nums{$s2} =~ /^(.*?)\\(.*)$/); | ||
1254 | if ($v) { | ||
1255 | print OUT "\textern int $s2; /* type unknown */ /* $nn $ni */\n"; | ||
1256 | } else { | ||
1257 | print OUT "\textern int $s2(); /* type unknown */ /* $nn $ni */\n"; | ||
1258 | } | ||
1259 | } | ||
1260 | } | ||
1261 | } | ||
1262 | |||
1263 | sub get_version { | ||
1264 | local *MF; | ||
1265 | my $v = '?'; | ||
1266 | open MF, 'Makefile' or return $v; | ||
1267 | while (<MF>) { | ||
1268 | $v = $1, last if /^VERSION=(.*?)\s*$/; | ||
1269 | } | ||
1270 | close MF; | ||
1271 | return $v; | ||
1272 | } | ||
1273 | |||
1274 | sub print_def_file | ||
1275 | { | ||
1276 | (*OUT,my $name,*nums,my @symbols)=@_; | ||
1277 | my $n = 1; my @e; my @r; my @v; my $prev=""; | ||
1278 | my $liboptions=""; | ||
1279 | my $libname = $name; | ||
1280 | my $http_vendor = 'www.openssl.org/'; | ||
1281 | my $version = get_version(); | ||
1282 | my $what = "OpenSSL: implementation of Secure Socket Layer"; | ||
1283 | my $description = "$what $version, $name - http://$http_vendor"; | ||
1284 | |||
1285 | if ($W32) | ||
1286 | { $libname.="32"; } | ||
1287 | elsif ($W16) | ||
1288 | { $libname.="16"; } | ||
1289 | elsif ($OS2) | ||
1290 | { # DLL names should not clash on the whole system. | ||
1291 | # However, they should not have any particular relationship | ||
1292 | # to the name of the static library. Chose descriptive names | ||
1293 | # (must be at most 8 chars). | ||
1294 | my %translate = (ssl => 'open_ssl', crypto => 'cryptssl'); | ||
1295 | $libname = $translate{$name} || $name; | ||
1296 | $liboptions = <<EOO; | ||
1297 | INITINSTANCE | ||
1298 | DATA MULTIPLE NONSHARED | ||
1299 | EOO | ||
1300 | # Vendor field can't contain colon, drat; so we omit http:// | ||
1301 | $description = "\@#$http_vendor:$version#\@$what; DLL for library $name. Build for EMX -Zmtd"; | ||
1302 | } | ||
1303 | |||
1304 | print OUT <<"EOF"; | ||
1305 | ; | ||
1306 | ; Definition file for the DLL version of the $name library from OpenSSL | ||
1307 | ; | ||
1308 | |||
1309 | LIBRARY $libname $liboptions | ||
1310 | |||
1311 | EOF | ||
1312 | |||
1313 | if ($W16) { | ||
1314 | print <<"EOF"; | ||
1315 | CODE PRELOAD MOVEABLE | ||
1316 | DATA PRELOAD MOVEABLE SINGLE | ||
1317 | |||
1318 | EXETYPE WINDOWS | ||
1319 | |||
1320 | HEAPSIZE 4096 | ||
1321 | STACKSIZE 8192 | ||
1322 | |||
1323 | EOF | ||
1324 | } | ||
1325 | |||
1326 | print "EXPORTS\n"; | ||
1327 | |||
1328 | (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:FUNCTION/,@symbols); | ||
1329 | (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:FUNCTION/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:FUNCTION/,@symbols); | ||
1330 | (@v)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:VARIABLE/,@symbols); | ||
1331 | @symbols=((sort @e),(sort @r), (sort @v)); | ||
1332 | |||
1333 | |||
1334 | foreach $sym (@symbols) { | ||
1335 | (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; | ||
1336 | my $v = 0; | ||
1337 | $v = 1 if $i =~ /^.*?:.*?:VARIABLE/; | ||
1338 | if (!defined($nums{$s})) { | ||
1339 | printf STDERR "Warning: $s does not have a number assigned\n" | ||
1340 | if(!$do_update); | ||
1341 | } else { | ||
1342 | (my $n, my $dummy) = split /\\/, $nums{$s}; | ||
1343 | my %pf = (); | ||
1344 | my $p = ($i =~ /^[^:]*:([^:]*):/,$1); | ||
1345 | my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1); | ||
1346 | if (is_valid($p,1) && is_valid($a,0)) { | ||
1347 | my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1); | ||
1348 | if ($prev eq $s2) { | ||
1349 | print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n"; | ||
1350 | } | ||
1351 | $prev = $s2; # To warn about duplicates... | ||
1352 | if($v && !$OS2) { | ||
1353 | printf OUT " %s%-39s @%-8d DATA\n",($W32)?"":"_",$s2,$n; | ||
1354 | } else { | ||
1355 | printf OUT " %s%-39s @%d\n",($W32||$OS2)?"":"_",$s2,$n; | ||
1356 | } | ||
1357 | } | ||
1358 | } | ||
1359 | } | ||
1360 | printf OUT "\n"; | ||
1361 | } | ||
1362 | |||
1363 | sub load_numbers | ||
1364 | { | ||
1365 | my($name)=@_; | ||
1366 | my(@a,%ret); | ||
1367 | |||
1368 | $max_num = 0; | ||
1369 | $num_noinfo = 0; | ||
1370 | $prev = ""; | ||
1371 | $prev_cnt = 0; | ||
1372 | |||
1373 | open(IN,"<$name") || die "unable to open $name:$!\n"; | ||
1374 | while (<IN>) { | ||
1375 | chop; | ||
1376 | s/#.*$//; | ||
1377 | next if /^\s*$/; | ||
1378 | @a=split; | ||
1379 | if (defined $ret{$a[0]}) { | ||
1380 | # This is actually perfectly OK | ||
1381 | #print STDERR "Warning: Symbol '",$a[0],"' redefined. old=",$ret{$a[0]},", new=",$a[1],"\n"; | ||
1382 | } | ||
1383 | if ($max_num > $a[1]) { | ||
1384 | print STDERR "Warning: Number decreased from ",$max_num," to ",$a[1],"\n"; | ||
1385 | } | ||
1386 | elsif ($max_num == $a[1]) { | ||
1387 | # This is actually perfectly OK | ||
1388 | #print STDERR "Warning: Symbol ",$a[0]," has same number as previous ",$prev,": ",$a[1],"\n"; | ||
1389 | if ($a[0] eq $prev) { | ||
1390 | $prev_cnt++; | ||
1391 | $a[0] .= "{$prev_cnt}"; | ||
1392 | } | ||
1393 | } | ||
1394 | else { | ||
1395 | $prev_cnt = 0; | ||
1396 | } | ||
1397 | if ($#a < 2) { | ||
1398 | # Existence will be proven later, in do_defs | ||
1399 | $ret{$a[0]}=$a[1]; | ||
1400 | $num_noinfo++; | ||
1401 | } else { | ||
1402 | $ret{$a[0]}=$a[1]."\\".$a[2]; # \\ is a special marker | ||
1403 | } | ||
1404 | $max_num = $a[1] if $a[1] > $max_num; | ||
1405 | $prev=$a[0]; | ||
1406 | } | ||
1407 | if ($num_noinfo) { | ||
1408 | print STDERR "Warning: $num_noinfo symbols were without info."; | ||
1409 | if ($do_rewrite) { | ||
1410 | printf STDERR " The rewrite will fix this.\n"; | ||
1411 | } else { | ||
1412 | printf STDERR " You should do a rewrite to fix this.\n"; | ||
1413 | } | ||
1414 | } | ||
1415 | close(IN); | ||
1416 | return(%ret); | ||
1417 | } | ||
1418 | |||
1419 | sub parse_number | ||
1420 | { | ||
1421 | (my $str, my $what) = @_; | ||
1422 | (my $n, my $i) = split(/\\/,$str); | ||
1423 | if ($what eq "n") { | ||
1424 | return $n; | ||
1425 | } else { | ||
1426 | return $i; | ||
1427 | } | ||
1428 | } | ||
1429 | |||
1430 | sub rewrite_numbers | ||
1431 | { | ||
1432 | (*OUT,$name,*nums,@symbols)=@_; | ||
1433 | my $thing; | ||
1434 | |||
1435 | print STDERR "Rewriting $name\n"; | ||
1436 | |||
1437 | my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols); | ||
1438 | my $r; my %r; my %rsyms; | ||
1439 | foreach $r (@r) { | ||
1440 | (my $s, my $i) = split /\\/, $r; | ||
1441 | my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/; | ||
1442 | $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/; | ||
1443 | $r{$a} = $s."\\".$i; | ||
1444 | $rsyms{$s} = 1; | ||
1445 | } | ||
1446 | |||
1447 | my %syms = (); | ||
1448 | foreach $_ (@symbols) { | ||
1449 | (my $n, my $i) = split /\\/; | ||
1450 | $syms{$n} = 1; | ||
1451 | } | ||
1452 | |||
1453 | my @s=sort { | ||
1454 | &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") | ||
1455 | || $a cmp $b | ||
1456 | } keys %nums; | ||
1457 | foreach $sym (@s) { | ||
1458 | (my $n, my $i) = split /\\/, $nums{$sym}; | ||
1459 | next if defined($i) && $i =~ /^.*?:.*?:\w+\(\w+\)/; | ||
1460 | next if defined($rsyms{$sym}); | ||
1461 | print STDERR "DEBUG: rewrite_numbers for sym = ",$sym,": i = ",$i,", n = ",$n,", rsym{sym} = ",$rsyms{$sym},"syms{sym} = ",$syms{$sym},"\n" if $debug; | ||
1462 | $i="NOEXIST::FUNCTION:" | ||
1463 | if !defined($i) || $i eq "" || !defined($syms{$sym}); | ||
1464 | my $s2 = $sym; | ||
1465 | $s2 =~ s/\{[0-9]+\}$//; | ||
1466 | printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i; | ||
1467 | if (exists $r{$sym}) { | ||
1468 | (my $s, $i) = split /\\/,$r{$sym}; | ||
1469 | my $s2 = $s; | ||
1470 | $s2 =~ s/\{[0-9]+\}$//; | ||
1471 | printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i; | ||
1472 | } | ||
1473 | } | ||
1474 | } | ||
1475 | |||
1476 | sub update_numbers | ||
1477 | { | ||
1478 | (*OUT,$name,*nums,my $start_num, my @symbols)=@_; | ||
1479 | my $new_syms = 0; | ||
1480 | |||
1481 | print STDERR "Updating $name numbers\n"; | ||
1482 | |||
1483 | my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols); | ||
1484 | my $r; my %r; my %rsyms; | ||
1485 | foreach $r (@r) { | ||
1486 | (my $s, my $i) = split /\\/, $r; | ||
1487 | my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/; | ||
1488 | $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/; | ||
1489 | $r{$a} = $s."\\".$i; | ||
1490 | $rsyms{$s} = 1; | ||
1491 | } | ||
1492 | |||
1493 | foreach $sym (@symbols) { | ||
1494 | (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; | ||
1495 | next if $i =~ /^.*?:.*?:\w+\(\w+\)/; | ||
1496 | next if defined($rsyms{$sym}); | ||
1497 | die "ERROR: Symbol $sym had no info attached to it." | ||
1498 | if $i eq ""; | ||
1499 | if (!exists $nums{$s}) { | ||
1500 | $new_syms++; | ||
1501 | my $s2 = $s; | ||
1502 | $s2 =~ s/\{[0-9]+\}$//; | ||
1503 | printf OUT "%s%-39s %d\t%s\n","",$s2, ++$start_num,$i; | ||
1504 | if (exists $r{$s}) { | ||
1505 | ($s, $i) = split /\\/,$r{$s}; | ||
1506 | $s =~ s/\{[0-9]+\}$//; | ||
1507 | printf OUT "%s%-39s %d\t%s\n","",$s, $start_num,$i; | ||
1508 | } | ||
1509 | } | ||
1510 | } | ||
1511 | if($new_syms) { | ||
1512 | print STDERR "$new_syms New symbols added\n"; | ||
1513 | } else { | ||
1514 | print STDERR "No New symbols Added\n"; | ||
1515 | } | ||
1516 | } | ||
1517 | |||
1518 | sub check_existing | ||
1519 | { | ||
1520 | (*nums, my @symbols)=@_; | ||
1521 | my %existing; my @remaining; | ||
1522 | @remaining=(); | ||
1523 | foreach $sym (@symbols) { | ||
1524 | (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; | ||
1525 | $existing{$s}=1; | ||
1526 | } | ||
1527 | foreach $sym (keys %nums) { | ||
1528 | if (!exists $existing{$sym}) { | ||
1529 | push @remaining, $sym; | ||
1530 | } | ||
1531 | } | ||
1532 | if(@remaining) { | ||
1533 | print STDERR "The following symbols do not seem to exist:\n"; | ||
1534 | foreach $sym (@remaining) { | ||
1535 | print STDERR "\t",$sym,"\n"; | ||
1536 | } | ||
1537 | } | ||
1538 | } | ||
1539 | |||
diff --git a/src/lib/libssl/src/util/mkdir-p.pl b/src/lib/libssl/src/util/mkdir-p.pl deleted file mode 100644 index e73d02b073..0000000000 --- a/src/lib/libssl/src/util/mkdir-p.pl +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | # mkdir-p.pl | ||
4 | |||
5 | # On some systems, the -p option to mkdir (= also create any missing parent | ||
6 | # directories) is not available. | ||
7 | |||
8 | my $arg; | ||
9 | |||
10 | foreach $arg (@ARGV) { | ||
11 | $arg =~ tr|\\|/|; | ||
12 | &do_mkdir_p($arg); | ||
13 | } | ||
14 | |||
15 | |||
16 | sub do_mkdir_p { | ||
17 | local($dir) = @_; | ||
18 | |||
19 | $dir =~ s|/*\Z(?!\n)||s; | ||
20 | |||
21 | if (-d $dir) { | ||
22 | return; | ||
23 | } | ||
24 | |||
25 | if ($dir =~ m|[^/]/|s) { | ||
26 | local($parent) = $dir; | ||
27 | $parent =~ s|[^/]*\Z(?!\n)||s; | ||
28 | |||
29 | do_mkdir_p($parent); | ||
30 | } | ||
31 | |||
32 | mkdir($dir, 0777) || die "Cannot create directory $dir: $!\n"; | ||
33 | print "created directory `$dir'\n"; | ||
34 | } | ||
diff --git a/src/lib/libssl/src/util/mkfiles.pl b/src/lib/libssl/src/util/mkfiles.pl deleted file mode 100644 index 3214f69ea5..0000000000 --- a/src/lib/libssl/src/util/mkfiles.pl +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # This is a hacked version of files.pl for systems that can't do a 'make files'. | ||
4 | # Do a perl util/mkminfo.pl >MINFO to build MINFO | ||
5 | # Written by Steve Henson 1999. | ||
6 | |||
7 | # List of directories to process | ||
8 | |||
9 | my @dirs = ( | ||
10 | ".", | ||
11 | "crypto", | ||
12 | "crypto/md2", | ||
13 | "crypto/md4", | ||
14 | "crypto/md5", | ||
15 | "crypto/sha", | ||
16 | "crypto/mdc2", | ||
17 | "crypto/hmac", | ||
18 | "crypto/cmac", | ||
19 | "crypto/ripemd", | ||
20 | "crypto/des", | ||
21 | "crypto/rc2", | ||
22 | "crypto/rc4", | ||
23 | "crypto/rc5", | ||
24 | "crypto/idea", | ||
25 | "crypto/bf", | ||
26 | "crypto/cast", | ||
27 | "crypto/aes", | ||
28 | "crypto/camellia", | ||
29 | "crypto/seed", | ||
30 | "crypto/modes", | ||
31 | "crypto/bn", | ||
32 | "crypto/rsa", | ||
33 | "crypto/dsa", | ||
34 | "crypto/dso", | ||
35 | "crypto/dh", | ||
36 | "crypto/ec", | ||
37 | "crypto/ecdh", | ||
38 | "crypto/ecdsa", | ||
39 | "crypto/buffer", | ||
40 | "crypto/bio", | ||
41 | "crypto/stack", | ||
42 | "crypto/lhash", | ||
43 | "crypto/rand", | ||
44 | "crypto/err", | ||
45 | "crypto/objects", | ||
46 | "crypto/evp", | ||
47 | "crypto/asn1", | ||
48 | "crypto/pem", | ||
49 | "crypto/x509", | ||
50 | "crypto/x509v3", | ||
51 | "crypto/cms", | ||
52 | "crypto/conf", | ||
53 | "crypto/jpake", | ||
54 | "crypto/txt_db", | ||
55 | "crypto/pkcs7", | ||
56 | "crypto/pkcs12", | ||
57 | "crypto/comp", | ||
58 | "crypto/engine", | ||
59 | "crypto/ocsp", | ||
60 | "crypto/ui", | ||
61 | "crypto/krb5", | ||
62 | #"crypto/store", | ||
63 | "crypto/pqueue", | ||
64 | "crypto/whrlpool", | ||
65 | "crypto/ts", | ||
66 | "crypto/srp", | ||
67 | "ssl", | ||
68 | "apps", | ||
69 | "engines", | ||
70 | "test", | ||
71 | "tools" | ||
72 | ); | ||
73 | |||
74 | %top; | ||
75 | |||
76 | foreach (@dirs) { | ||
77 | &files_dir ($_, "Makefile"); | ||
78 | } | ||
79 | |||
80 | exit(0); | ||
81 | |||
82 | sub files_dir | ||
83 | { | ||
84 | my ($dir, $makefile) = @_; | ||
85 | |||
86 | my %sym; | ||
87 | |||
88 | open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile"; | ||
89 | |||
90 | my $s=""; | ||
91 | |||
92 | while (<IN>) | ||
93 | { | ||
94 | chop; | ||
95 | s/#.*//; | ||
96 | if (/^(\S+)\s*=\s*(.*)$/) | ||
97 | { | ||
98 | $o=""; | ||
99 | ($s,$b)=($1,$2); | ||
100 | for (;;) | ||
101 | { | ||
102 | if ($b =~ /\\$/) | ||
103 | { | ||
104 | chop($b); | ||
105 | $o.=$b." "; | ||
106 | $b=<IN>; | ||
107 | chop($b); | ||
108 | } | ||
109 | else | ||
110 | { | ||
111 | $o.=$b." "; | ||
112 | last; | ||
113 | } | ||
114 | } | ||
115 | $o =~ s/^\s+//; | ||
116 | $o =~ s/\s+$//; | ||
117 | $o =~ s/\s+/ /g; | ||
118 | |||
119 | $o =~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge; | ||
120 | $sym{$s}=($top{$s} or $o); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | print "RELATIVE_DIRECTORY=$dir\n"; | ||
125 | |||
126 | foreach (sort keys %sym) | ||
127 | { | ||
128 | print "$_=$sym{$_}\n"; | ||
129 | } | ||
130 | if ($dir eq "." && defined($sym{"BUILDENV"})) | ||
131 | { | ||
132 | foreach (split(' ',$sym{"BUILDENV"})) | ||
133 | { | ||
134 | /^(.+)=/; | ||
135 | $top{$1}=$sym{$1}; | ||
136 | } | ||
137 | } | ||
138 | |||
139 | print "RELATIVE_DIRECTORY=\n"; | ||
140 | |||
141 | close (IN); | ||
142 | } | ||
diff --git a/src/lib/libssl/src/util/mklink.pl b/src/lib/libssl/src/util/mklink.pl deleted file mode 100644 index 61db12c68f..0000000000 --- a/src/lib/libssl/src/util/mklink.pl +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | # mklink.pl | ||
4 | |||
5 | # The first command line argument is a non-empty relative path | ||
6 | # specifying the "from" directory. | ||
7 | # Each other argument is a file name not containing / and | ||
8 | # names a file in the current directory. | ||
9 | # | ||
10 | # For each of these files, we create in the "from" directory a link | ||
11 | # of the same name pointing to the local file. | ||
12 | # | ||
13 | # We assume that the directory structure is a tree, i.e. that it does | ||
14 | # not contain symbolic links and that the parent of / is never referenced. | ||
15 | # Apart from this, this script should be able to handle even the most | ||
16 | # pathological cases. | ||
17 | |||
18 | use Cwd; | ||
19 | |||
20 | my $from = shift; | ||
21 | my @files = @ARGV; | ||
22 | |||
23 | my @from_path = split(/[\\\/]/, $from); | ||
24 | my $pwd = getcwd(); | ||
25 | chomp($pwd); | ||
26 | my @pwd_path = split(/[\\\/]/, $pwd); | ||
27 | |||
28 | my @to_path = (); | ||
29 | |||
30 | my $dirname; | ||
31 | foreach $dirname (@from_path) { | ||
32 | |||
33 | # In this loop, @to_path always is a relative path from | ||
34 | # @pwd_path (interpreted is an absolute path) to the original pwd. | ||
35 | |||
36 | # At the end, @from_path (as a relative path from the original pwd) | ||
37 | # designates the same directory as the absolute path @pwd_path, | ||
38 | # which means that @to_path then is a path from there to the original pwd. | ||
39 | |||
40 | next if ($dirname eq "" || $dirname eq "."); | ||
41 | |||
42 | if ($dirname eq "..") { | ||
43 | @to_path = (pop(@pwd_path), @to_path); | ||
44 | } else { | ||
45 | @to_path = ("..", @to_path); | ||
46 | push(@pwd_path, $dirname); | ||
47 | } | ||
48 | } | ||
49 | |||
50 | my $to = join('/', @to_path); | ||
51 | |||
52 | my $file; | ||
53 | $symlink_exists=eval {symlink("",""); 1}; | ||
54 | if ($^O eq "msys") { $symlink_exists=0 }; | ||
55 | foreach $file (@files) { | ||
56 | my $err = ""; | ||
57 | if ($symlink_exists) { | ||
58 | unlink "$from/$file"; | ||
59 | symlink("$to/$file", "$from/$file") or $err = " [$!]"; | ||
60 | } else { | ||
61 | unlink "$from/$file"; | ||
62 | open (OLD, "<$file") or die "Can't open $file: $!"; | ||
63 | open (NEW, ">$from/$file") or die "Can't open $from/$file: $!"; | ||
64 | binmode(OLD); | ||
65 | binmode(NEW); | ||
66 | while (<OLD>) { | ||
67 | print NEW $_; | ||
68 | } | ||
69 | close (OLD) or die "Can't close $file: $!"; | ||
70 | close (NEW) or die "Can't close $from/$file: $!"; | ||
71 | } | ||
72 | print $file . " => $from/$file$err\n"; | ||
73 | } | ||
diff --git a/src/lib/libssl/src/util/mkrc.pl b/src/lib/libssl/src/util/mkrc.pl deleted file mode 100755 index 0ceadcf8d1..0000000000 --- a/src/lib/libssl/src/util/mkrc.pl +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | #!/bin/env perl | ||
2 | # | ||
3 | open FD,"crypto/opensslv.h"; | ||
4 | while(<FD>) { | ||
5 | if (/OPENSSL_VERSION_NUMBER\s+(0x[0-9a-f]+)/i) { | ||
6 | $ver = hex($1); | ||
7 | $v1 = ($ver>>28); | ||
8 | $v2 = ($ver>>20)&0xff; | ||
9 | $v3 = ($ver>>12)&0xff; | ||
10 | $v4 = ($ver>> 4)&0xff; | ||
11 | $beta = $ver&0xf; | ||
12 | $version = "$v1.$v2.$v3"; | ||
13 | if ($beta==0xf) { $version .= chr(ord('a')+$v4-1) if ($v4); } | ||
14 | elsif ($beta==0){ $version .= "-dev"; } | ||
15 | else { $version .= "-beta$beta"; } | ||
16 | last; | ||
17 | } | ||
18 | } | ||
19 | close(FD); | ||
20 | |||
21 | $filename = $ARGV[0]; $filename =~ /(.*)\.([^.]+)$/; | ||
22 | $basename = $1; | ||
23 | $extname = $2; | ||
24 | |||
25 | if ($extname =~ /dll/i) { $description = "OpenSSL shared library"; } | ||
26 | else { $description = "OpenSSL application"; } | ||
27 | |||
28 | print <<___; | ||
29 | #include <winver.h> | ||
30 | |||
31 | LANGUAGE 0x09,0x01 | ||
32 | |||
33 | 1 VERSIONINFO | ||
34 | FILEVERSION $v1,$v2,$v3,$v4 | ||
35 | PRODUCTVERSION $v1,$v2,$v3,$v4 | ||
36 | FILEFLAGSMASK 0x3fL | ||
37 | #ifdef _DEBUG | ||
38 | FILEFLAGS 0x01L | ||
39 | #else | ||
40 | FILEFLAGS 0x00L | ||
41 | #endif | ||
42 | FILEOS VOS__WINDOWS32 | ||
43 | FILETYPE VFT_DLL | ||
44 | FILESUBTYPE 0x0L | ||
45 | BEGIN | ||
46 | BLOCK "StringFileInfo" | ||
47 | BEGIN | ||
48 | BLOCK "040904b0" | ||
49 | BEGIN | ||
50 | // Required: | ||
51 | VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0" | ||
52 | VALUE "FileDescription", "$description\\0" | ||
53 | VALUE "FileVersion", "$version\\0" | ||
54 | VALUE "InternalName", "$basename\\0" | ||
55 | VALUE "OriginalFilename", "$filename\\0" | ||
56 | VALUE "ProductName", "The OpenSSL Toolkit\\0" | ||
57 | VALUE "ProductVersion", "$version\\0" | ||
58 | // Optional: | ||
59 | //VALUE "Comments", "\\0" | ||
60 | VALUE "LegalCopyright", "Copyright © 1998-2006 The OpenSSL Project. Copyright © 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0" | ||
61 | //VALUE "LegalTrademarks", "\\0" | ||
62 | //VALUE "PrivateBuild", "\\0" | ||
63 | //VALUE "SpecialBuild", "\\0" | ||
64 | END | ||
65 | END | ||
66 | BLOCK "VarFileInfo" | ||
67 | BEGIN | ||
68 | VALUE "Translation", 0x409, 0x4b0 | ||
69 | END | ||
70 | END | ||
71 | ___ | ||
diff --git a/src/lib/libssl/src/util/perlpath.pl b/src/lib/libssl/src/util/perlpath.pl deleted file mode 100644 index a1f236bd98..0000000000 --- a/src/lib/libssl/src/util/perlpath.pl +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # modify the '#!/usr/local/bin/perl' | ||
4 | # line in all scripts that rely on perl. | ||
5 | # | ||
6 | |||
7 | require "find.pl"; | ||
8 | |||
9 | $#ARGV == 0 || print STDERR "usage: perlpath newpath (eg /usr/bin)\n"; | ||
10 | &find("."); | ||
11 | |||
12 | sub wanted | ||
13 | { | ||
14 | return unless /\.pl$/ || /^[Cc]onfigur/; | ||
15 | |||
16 | open(IN,"<$_") || die "unable to open $dir/$_:$!\n"; | ||
17 | @a=<IN>; | ||
18 | close(IN); | ||
19 | |||
20 | if (-d $ARGV[0]) { | ||
21 | $a[0]="#!$ARGV[0]/perl\n"; | ||
22 | } | ||
23 | else { | ||
24 | $a[0]="#!$ARGV[0]\n"; | ||
25 | } | ||
26 | |||
27 | # Playing it safe... | ||
28 | $new="$_.new"; | ||
29 | open(OUT,">$new") || die "unable to open $dir/$new:$!\n"; | ||
30 | print OUT @a; | ||
31 | close(OUT); | ||
32 | |||
33 | rename($new,$_) || die "unable to rename $dir/$new:$!\n"; | ||
34 | chmod(0755,$_) || die "unable to chmod $dir/$new:$!\n"; | ||
35 | } | ||
diff --git a/src/lib/libssl/src/util/pod2man.pl b/src/lib/libssl/src/util/pod2man.pl deleted file mode 100644 index 025d914f2e..0000000000 --- a/src/lib/libssl/src/util/pod2man.pl +++ /dev/null | |||
@@ -1,1184 +0,0 @@ | |||
1 | : #!/usr/bin/perl-5.005 | ||
2 | eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' | ||
3 | if $running_under_some_shell; | ||
4 | |||
5 | $DEF_PM_SECTION = '3pm' || '3'; | ||
6 | |||
7 | =head1 NAME | ||
8 | |||
9 | pod2man - translate embedded Perl pod directives into man pages | ||
10 | |||
11 | =head1 SYNOPSIS | ||
12 | |||
13 | B<pod2man> | ||
14 | [ B<--section=>I<manext> ] | ||
15 | [ B<--release=>I<relpatch> ] | ||
16 | [ B<--center=>I<string> ] | ||
17 | [ B<--date=>I<string> ] | ||
18 | [ B<--fixed=>I<font> ] | ||
19 | [ B<--official> ] | ||
20 | [ B<--lax> ] | ||
21 | I<inputfile> | ||
22 | |||
23 | =head1 DESCRIPTION | ||
24 | |||
25 | B<pod2man> converts its input file containing embedded pod directives (see | ||
26 | L<perlpod>) into nroff source suitable for viewing with nroff(1) or | ||
27 | troff(1) using the man(7) macro set. | ||
28 | |||
29 | Besides the obvious pod conversions, B<pod2man> also takes care of | ||
30 | func(), func(n), and simple variable references like $foo or @bar so | ||
31 | you don't have to use code escapes for them; complex expressions like | ||
32 | C<$fred{'stuff'}> will still need to be escaped, though. Other nagging | ||
33 | little roffish things that it catches include translating the minus in | ||
34 | something like foo-bar, making a long dash--like this--into a real em | ||
35 | dash, fixing up "paired quotes", putting a little space after the | ||
36 | parens in something like func(), making C++ and PI look right, making | ||
37 | double underbars have a little tiny space between them, making ALLCAPS | ||
38 | a teeny bit smaller in troff(1), and escaping backslashes so you don't | ||
39 | have to. | ||
40 | |||
41 | =head1 OPTIONS | ||
42 | |||
43 | =over 8 | ||
44 | |||
45 | =item center | ||
46 | |||
47 | Set the centered header to a specific string. The default is | ||
48 | "User Contributed Perl Documentation", unless the C<--official> flag is | ||
49 | given, in which case the default is "Perl Programmers Reference Guide". | ||
50 | |||
51 | =item date | ||
52 | |||
53 | Set the left-hand footer string to this value. By default, | ||
54 | the modification date of the input file will be used. | ||
55 | |||
56 | =item fixed | ||
57 | |||
58 | The fixed font to use for code refs. Defaults to CW. | ||
59 | |||
60 | =item official | ||
61 | |||
62 | Set the default header to indicate that this page is of | ||
63 | the standard release in case C<--center> is not given. | ||
64 | |||
65 | =item release | ||
66 | |||
67 | Set the centered footer. By default, this is the current | ||
68 | perl release. | ||
69 | |||
70 | =item section | ||
71 | |||
72 | Set the section for the C<.TH> macro. The standard conventions on | ||
73 | sections are to use 1 for user commands, 2 for system calls, 3 for | ||
74 | functions, 4 for devices, 5 for file formats, 6 for games, 7 for | ||
75 | miscellaneous information, and 8 for administrator commands. This works | ||
76 | best if you put your Perl man pages in a separate tree, like | ||
77 | F</usr/local/perl/man/>. By default, section 1 will be used | ||
78 | unless the file ends in F<.pm> in which case section 3 will be selected. | ||
79 | |||
80 | =item lax | ||
81 | |||
82 | Don't complain when required sections aren't present. | ||
83 | |||
84 | =back | ||
85 | |||
86 | =head1 Anatomy of a Proper Man Page | ||
87 | |||
88 | For those not sure of the proper layout of a man page, here's | ||
89 | an example of the skeleton of a proper man page. Head of the | ||
90 | major headers should be setout as a C<=head1> directive, and | ||
91 | are historically written in the rather startling ALL UPPER CASE | ||
92 | format, although this is not mandatory. | ||
93 | Minor headers may be included using C<=head2>, and are | ||
94 | typically in mixed case. | ||
95 | |||
96 | =over 10 | ||
97 | |||
98 | =item NAME | ||
99 | |||
100 | Mandatory section; should be a comma-separated list of programs or | ||
101 | functions documented by this podpage, such as: | ||
102 | |||
103 | foo, bar - programs to do something | ||
104 | |||
105 | =item SYNOPSIS | ||
106 | |||
107 | A short usage summary for programs and functions, which | ||
108 | may someday be deemed mandatory. | ||
109 | |||
110 | =item DESCRIPTION | ||
111 | |||
112 | Long drawn out discussion of the program. It's a good idea to break this | ||
113 | up into subsections using the C<=head2> directives, like | ||
114 | |||
115 | =head2 A Sample Subection | ||
116 | |||
117 | =head2 Yet Another Sample Subection | ||
118 | |||
119 | =item OPTIONS | ||
120 | |||
121 | Some people make this separate from the description. | ||
122 | |||
123 | =item RETURN VALUE | ||
124 | |||
125 | What the program or function returns if successful. | ||
126 | |||
127 | =item ERRORS | ||
128 | |||
129 | Exceptions, return codes, exit stati, and errno settings. | ||
130 | |||
131 | =item EXAMPLES | ||
132 | |||
133 | Give some example uses of the program. | ||
134 | |||
135 | =item ENVIRONMENT | ||
136 | |||
137 | Envariables this program might care about. | ||
138 | |||
139 | =item FILES | ||
140 | |||
141 | All files used by the program. You should probably use the FE<lt>E<gt> | ||
142 | for these. | ||
143 | |||
144 | =item SEE ALSO | ||
145 | |||
146 | Other man pages to check out, like man(1), man(7), makewhatis(8), or catman(8). | ||
147 | |||
148 | =item NOTES | ||
149 | |||
150 | Miscellaneous commentary. | ||
151 | |||
152 | =item CAVEATS | ||
153 | |||
154 | Things to take special care with; sometimes called WARNINGS. | ||
155 | |||
156 | =item DIAGNOSTICS | ||
157 | |||
158 | All possible messages the program can print out--and | ||
159 | what they mean. | ||
160 | |||
161 | =item BUGS | ||
162 | |||
163 | Things that are broken or just don't work quite right. | ||
164 | |||
165 | =item RESTRICTIONS | ||
166 | |||
167 | Bugs you don't plan to fix :-) | ||
168 | |||
169 | =item AUTHOR | ||
170 | |||
171 | Who wrote it (or AUTHORS if multiple). | ||
172 | |||
173 | =item HISTORY | ||
174 | |||
175 | Programs derived from other sources sometimes have this, or | ||
176 | you might keep a modification log here. | ||
177 | |||
178 | =back | ||
179 | |||
180 | =head1 EXAMPLES | ||
181 | |||
182 | pod2man program > program.1 | ||
183 | pod2man some_module.pm > /usr/perl/man/man3/some_module.3 | ||
184 | pod2man --section=7 note.pod > note.7 | ||
185 | |||
186 | =head1 DIAGNOSTICS | ||
187 | |||
188 | The following diagnostics are generated by B<pod2man>. Items | ||
189 | marked "(W)" are non-fatal, whereas the "(F)" errors will cause | ||
190 | B<pod2man> to immediately exit with a non-zero status. | ||
191 | |||
192 | =over 4 | ||
193 | |||
194 | =item bad option in paragraph %d of %s: ``%s'' should be [%s]<%s> | ||
195 | |||
196 | (W) If you start include an option, you should set it off | ||
197 | as bold, italic, or code. | ||
198 | |||
199 | =item can't open %s: %s | ||
200 | |||
201 | (F) The input file wasn't available for the given reason. | ||
202 | |||
203 | =item Improper man page - no dash in NAME header in paragraph %d of %s | ||
204 | |||
205 | (W) The NAME header did not have an isolated dash in it. This is | ||
206 | considered important. | ||
207 | |||
208 | =item Invalid man page - no NAME line in %s | ||
209 | |||
210 | (F) You did not include a NAME header, which is essential. | ||
211 | |||
212 | =item roff font should be 1 or 2 chars, not `%s' (F) | ||
213 | |||
214 | (F) The font specified with the C<--fixed> option was not | ||
215 | a one- or two-digit roff font. | ||
216 | |||
217 | =item %s is missing required section: %s | ||
218 | |||
219 | (W) Required sections include NAME, DESCRIPTION, and if you're | ||
220 | using a section starting with a 3, also a SYNOPSIS. Actually, | ||
221 | not having a NAME is a fatal. | ||
222 | |||
223 | =item Unknown escape: %s in %s | ||
224 | |||
225 | (W) An unknown HTML entity (probably for an 8-bit character) was given via | ||
226 | a C<EE<lt>E<gt>> directive. Besides amp, lt, gt, and quot, recognized | ||
227 | entities are Aacute, aacute, Acirc, acirc, AElig, aelig, Agrave, agrave, | ||
228 | Aring, aring, Atilde, atilde, Auml, auml, Ccedil, ccedil, Eacute, eacute, | ||
229 | Ecirc, ecirc, Egrave, egrave, ETH, eth, Euml, euml, Iacute, iacute, Icirc, | ||
230 | icirc, Igrave, igrave, Iuml, iuml, Ntilde, ntilde, Oacute, oacute, Ocirc, | ||
231 | ocirc, Ograve, ograve, Oslash, oslash, Otilde, otilde, Ouml, ouml, szlig, | ||
232 | THORN, thorn, Uacute, uacute, Ucirc, ucirc, Ugrave, ugrave, Uuml, uuml, | ||
233 | Yacute, yacute, and yuml. | ||
234 | |||
235 | =item Unmatched =back | ||
236 | |||
237 | (W) You have a C<=back> without a corresponding C<=over>. | ||
238 | |||
239 | =item Unrecognized pod directive: %s | ||
240 | |||
241 | (W) You specified a pod directive that isn't in the known list of | ||
242 | C<=head1>, C<=head2>, C<=item>, C<=over>, C<=back>, or C<=cut>. | ||
243 | |||
244 | |||
245 | =back | ||
246 | |||
247 | =head1 NOTES | ||
248 | |||
249 | If you would like to print out a lot of man page continuously, you | ||
250 | probably want to set the C and D registers to set contiguous page | ||
251 | numbering and even/odd paging, at least on some versions of man(7). | ||
252 | Settting the F register will get you some additional experimental | ||
253 | indexing: | ||
254 | |||
255 | troff -man -rC1 -rD1 -rF1 perl.1 perldata.1 perlsyn.1 ... | ||
256 | |||
257 | The indexing merely outputs messages via C<.tm> for each | ||
258 | major page, section, subsection, item, and any C<XE<lt>E<gt>> | ||
259 | directives. | ||
260 | |||
261 | |||
262 | =head1 RESTRICTIONS | ||
263 | |||
264 | None at this time. | ||
265 | |||
266 | =head1 BUGS | ||
267 | |||
268 | The =over and =back directives don't really work right. They | ||
269 | take absolute positions instead of offsets, don't nest well, and | ||
270 | making people count is suboptimal in any event. | ||
271 | |||
272 | =head1 AUTHORS | ||
273 | |||
274 | Original prototype by Larry Wall, but so massively hacked over by | ||
275 | Tom Christiansen such that Larry probably doesn't recognize it anymore. | ||
276 | |||
277 | =cut | ||
278 | |||
279 | $/ = ""; | ||
280 | $cutting = 1; | ||
281 | @Indices = (); | ||
282 | |||
283 | # We try first to get the version number from a local binary, in case we're | ||
284 | # running an installed version of Perl to produce documentation from an | ||
285 | # uninstalled newer version's pod files. | ||
286 | if ($^O ne 'plan9' and $^O ne 'dos' and $^O ne 'os2' and $^O ne 'MSWin32') { | ||
287 | my $perl = (-x './perl' && -f './perl' ) ? | ||
288 | './perl' : | ||
289 | ((-x '../perl' && -f '../perl') ? | ||
290 | '../perl' : | ||
291 | ''); | ||
292 | ($version,$patch) = `$perl -e 'print $]'` =~ /^(\d\.\d{3})(\d{2})?/ if $perl; | ||
293 | } | ||
294 | # No luck; we'll just go with the running Perl's version | ||
295 | ($version,$patch) = $] =~ /^(.{5})(\d{2})?/ unless $version; | ||
296 | $DEF_RELEASE = "perl $version"; | ||
297 | $DEF_RELEASE .= ", patch $patch" if $patch; | ||
298 | |||
299 | |||
300 | sub makedate { | ||
301 | my $secs = shift; | ||
302 | my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secs); | ||
303 | my $mname = (qw{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec})[$mon]; | ||
304 | $year += 1900; | ||
305 | return "$mday/$mname/$year"; | ||
306 | } | ||
307 | |||
308 | use Getopt::Long; | ||
309 | |||
310 | $DEF_SECTION = 1; | ||
311 | $DEF_CENTER = "User Contributed Perl Documentation"; | ||
312 | $STD_CENTER = "Perl Programmers Reference Guide"; | ||
313 | $DEF_FIXED = 'CW'; | ||
314 | $DEF_LAX = 0; | ||
315 | |||
316 | sub usage { | ||
317 | warn "$0: @_\n" if @_; | ||
318 | die <<EOF; | ||
319 | usage: $0 [options] podpage | ||
320 | Options are: | ||
321 | --section=manext (default "$DEF_SECTION") | ||
322 | --release=relpatch (default "$DEF_RELEASE") | ||
323 | --center=string (default "$DEF_CENTER") | ||
324 | --date=string (default "$DEF_DATE") | ||
325 | --fixed=font (default "$DEF_FIXED") | ||
326 | --official (default NOT) | ||
327 | --lax (default NOT) | ||
328 | EOF | ||
329 | } | ||
330 | |||
331 | $uok = GetOptions( qw( | ||
332 | section=s | ||
333 | release=s | ||
334 | center=s | ||
335 | date=s | ||
336 | fixed=s | ||
337 | official | ||
338 | lax | ||
339 | help)); | ||
340 | |||
341 | $DEF_DATE = makedate((stat($ARGV[0]))[9] || time()); | ||
342 | |||
343 | usage("Usage error!") unless $uok; | ||
344 | usage() if $opt_help; | ||
345 | usage("Need one and only one podpage argument") unless @ARGV == 1; | ||
346 | |||
347 | $section = $opt_section || ($ARGV[0] =~ /\.pm$/ | ||
348 | ? $DEF_PM_SECTION : $DEF_SECTION); | ||
349 | $RP = $opt_release || $DEF_RELEASE; | ||
350 | $center = $opt_center || ($opt_official ? $STD_CENTER : $DEF_CENTER); | ||
351 | $lax = $opt_lax || $DEF_LAX; | ||
352 | |||
353 | $CFont = $opt_fixed || $DEF_FIXED; | ||
354 | |||
355 | if (length($CFont) == 2) { | ||
356 | $CFont_embed = "\\f($CFont"; | ||
357 | } | ||
358 | elsif (length($CFont) == 1) { | ||
359 | $CFont_embed = "\\f$CFont"; | ||
360 | } | ||
361 | else { | ||
362 | die "roff font should be 1 or 2 chars, not `$CFont_embed'"; | ||
363 | } | ||
364 | |||
365 | $date = $opt_date || $DEF_DATE; | ||
366 | |||
367 | for (qw{NAME DESCRIPTION}) { | ||
368 | # for (qw{NAME DESCRIPTION AUTHOR}) { | ||
369 | $wanna_see{$_}++; | ||
370 | } | ||
371 | $wanna_see{SYNOPSIS}++ if $section =~ /^3/; | ||
372 | |||
373 | |||
374 | $name = @ARGV ? $ARGV[0] : "<STDIN>"; | ||
375 | $Filename = $name; | ||
376 | if ($section =~ /^1/) { | ||
377 | require File::Basename; | ||
378 | $name = uc File::Basename::basename($name); | ||
379 | } | ||
380 | $name =~ s/\.(pod|p[lm])$//i; | ||
381 | |||
382 | # Lose everything up to the first of | ||
383 | # */lib/*perl* standard or site_perl module | ||
384 | # */*perl*/lib from -D prefix=/opt/perl | ||
385 | # */*perl*/ random module hierarchy | ||
386 | # which works. | ||
387 | $name =~ s-//+-/-g; | ||
388 | if ($name =~ s-^.*?/lib/[^/]*perl[^/]*/--i | ||
389 | or $name =~ s-^.*?/[^/]*perl[^/]*/lib/--i | ||
390 | or $name =~ s-^.*?/[^/]*perl[^/]*/--i) { | ||
391 | # Lose ^site(_perl)?/. | ||
392 | $name =~ s-^site(_perl)?/--; | ||
393 | # Lose ^arch/. (XXX should we use Config? Just for archname?) | ||
394 | $name =~ s~^(.*-$^O|$^O-.*)/~~o; | ||
395 | # Lose ^version/. | ||
396 | $name =~ s-^\d+\.\d+/--; | ||
397 | } | ||
398 | |||
399 | # Translate Getopt/Long to Getopt::Long, etc. | ||
400 | $name =~ s(/)(::)g; | ||
401 | |||
402 | if ($name ne 'something') { | ||
403 | FCHECK: { | ||
404 | open(F, "< $ARGV[0]") || die "can't open $ARGV[0]: $!"; | ||
405 | while (<F>) { | ||
406 | next unless /^=\b/; | ||
407 | if (/^=head1\s+NAME\s*$/) { # an /m would forgive mistakes | ||
408 | $_ = <F>; | ||
409 | unless (/\s*-+\s+/) { | ||
410 | $oops++; | ||
411 | warn "$0: Improper man page - no dash in NAME header in paragraph $. of $ARGV[0]\n" | ||
412 | } else { | ||
413 | my @n = split /\s+-+\s+/; | ||
414 | if (@n != 2) { | ||
415 | $oops++; | ||
416 | warn "$0: Improper man page - malformed NAME header in paragraph $. of $ARGV[0]\n" | ||
417 | } | ||
418 | else { | ||
419 | $n[0] =~ s/\n/ /g; | ||
420 | $n[1] =~ s/\n/ /g; | ||
421 | %namedesc = @n; | ||
422 | } | ||
423 | } | ||
424 | last FCHECK; | ||
425 | } | ||
426 | next if /^=cut\b/; # DB_File and Net::Ping have =cut before NAME | ||
427 | next if /^=pod\b/; # It is OK to have =pod before NAME | ||
428 | next if /^=(for|begin|end)\s+comment\b/; # It is OK to have =for =begin or =end comment before NAME | ||
429 | die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax; | ||
430 | } | ||
431 | die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax; | ||
432 | } | ||
433 | close F; | ||
434 | } | ||
435 | |||
436 | print <<"END"; | ||
437 | .rn '' }` | ||
438 | ''' \$RCSfile\$\$Revision\$\$Date\$ | ||
439 | ''' | ||
440 | ''' \$Log\$ | ||
441 | ''' | ||
442 | .de Sh | ||
443 | .br | ||
444 | .if t .Sp | ||
445 | .ne 5 | ||
446 | .PP | ||
447 | \\fB\\\\\$1\\fR | ||
448 | .PP | ||
449 | .. | ||
450 | .de Sp | ||
451 | .if t .sp .5v | ||
452 | .if n .sp | ||
453 | .. | ||
454 | .de Ip | ||
455 | .br | ||
456 | .ie \\\\n(.\$>=3 .ne \\\\\$3 | ||
457 | .el .ne 3 | ||
458 | .IP "\\\\\$1" \\\\\$2 | ||
459 | .. | ||
460 | .de Vb | ||
461 | .ft $CFont | ||
462 | .nf | ||
463 | .ne \\\\\$1 | ||
464 | .. | ||
465 | .de Ve | ||
466 | .ft R | ||
467 | |||
468 | .fi | ||
469 | .. | ||
470 | ''' | ||
471 | ''' | ||
472 | ''' Set up \\*(-- to give an unbreakable dash; | ||
473 | ''' string Tr holds user defined translation string. | ||
474 | ''' Bell System Logo is used as a dummy character. | ||
475 | ''' | ||
476 | .tr \\(*W-|\\(bv\\*(Tr | ||
477 | .ie n \\{\\ | ||
478 | .ds -- \\(*W- | ||
479 | .ds PI pi | ||
480 | .if (\\n(.H=4u)&(1m=24u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-12u'-\\" diablo 10 pitch | ||
481 | .if (\\n(.H=4u)&(1m=20u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-8u'-\\" diablo 12 pitch | ||
482 | .ds L" "" | ||
483 | .ds R" "" | ||
484 | ''' \\*(M", \\*(S", \\*(N" and \\*(T" are the equivalent of | ||
485 | ''' \\*(L" and \\*(R", except that they are used on ".xx" lines, | ||
486 | ''' such as .IP and .SH, which do another additional levels of | ||
487 | ''' double-quote interpretation | ||
488 | .ds M" """ | ||
489 | .ds S" """ | ||
490 | .ds N" """"" | ||
491 | .ds T" """"" | ||
492 | .ds L' ' | ||
493 | .ds R' ' | ||
494 | .ds M' ' | ||
495 | .ds S' ' | ||
496 | .ds N' ' | ||
497 | .ds T' ' | ||
498 | 'br\\} | ||
499 | .el\\{\\ | ||
500 | .ds -- \\(em\\| | ||
501 | .tr \\*(Tr | ||
502 | .ds L" `` | ||
503 | .ds R" '' | ||
504 | .ds M" `` | ||
505 | .ds S" '' | ||
506 | .ds N" `` | ||
507 | .ds T" '' | ||
508 | .ds L' ` | ||
509 | .ds R' ' | ||
510 | .ds M' ` | ||
511 | .ds S' ' | ||
512 | .ds N' ` | ||
513 | .ds T' ' | ||
514 | .ds PI \\(*p | ||
515 | 'br\\} | ||
516 | END | ||
517 | |||
518 | print <<'END'; | ||
519 | .\" If the F register is turned on, we'll generate | ||
520 | .\" index entries out stderr for the following things: | ||
521 | .\" TH Title | ||
522 | .\" SH Header | ||
523 | .\" Sh Subsection | ||
524 | .\" Ip Item | ||
525 | .\" X<> Xref (embedded | ||
526 | .\" Of course, you have to process the output yourself | ||
527 | .\" in some meaninful fashion. | ||
528 | .if \nF \{ | ||
529 | .de IX | ||
530 | .tm Index:\\$1\t\\n%\t"\\$2" | ||
531 | .. | ||
532 | .nr % 0 | ||
533 | .rr F | ||
534 | .\} | ||
535 | END | ||
536 | |||
537 | print <<"END"; | ||
538 | .TH $name $section "$RP" "$date" "$center" | ||
539 | .UC | ||
540 | END | ||
541 | |||
542 | push(@Indices, qq{.IX Title "$name $section"}); | ||
543 | |||
544 | while (($name, $desc) = each %namedesc) { | ||
545 | for ($name, $desc) { s/^\s+//; s/\s+$//; } | ||
546 | push(@Indices, qq(.IX Name "$name - $desc"\n)); | ||
547 | } | ||
548 | |||
549 | print <<'END'; | ||
550 | .if n .hy 0 | ||
551 | .if n .na | ||
552 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | ||
553 | .de CQ \" put $1 in typewriter font | ||
554 | END | ||
555 | print ".ft $CFont\n"; | ||
556 | print <<'END'; | ||
557 | 'if n "\c | ||
558 | 'if t \\&\\$1\c | ||
559 | 'if n \\&\\$1\c | ||
560 | 'if n \&" | ||
561 | \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 | ||
562 | '.ft R | ||
563 | .. | ||
564 | .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 | ||
565 | . \" AM - accent mark definitions | ||
566 | .bd B 3 | ||
567 | . \" fudge factors for nroff and troff | ||
568 | .if n \{\ | ||
569 | . ds #H 0 | ||
570 | . ds #V .8m | ||
571 | . ds #F .3m | ||
572 | . ds #[ \f1 | ||
573 | . ds #] \fP | ||
574 | .\} | ||
575 | .if t \{\ | ||
576 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | ||
577 | . ds #V .6m | ||
578 | . ds #F 0 | ||
579 | . ds #[ \& | ||
580 | . ds #] \& | ||
581 | .\} | ||
582 | . \" simple accents for nroff and troff | ||
583 | .if n \{\ | ||
584 | . ds ' \& | ||
585 | . ds ` \& | ||
586 | . ds ^ \& | ||
587 | . ds , \& | ||
588 | . ds ~ ~ | ||
589 | . ds ? ? | ||
590 | . ds ! ! | ||
591 | . ds / | ||
592 | . ds q | ||
593 | .\} | ||
594 | .if t \{\ | ||
595 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | ||
596 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | ||
597 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | ||
598 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | ||
599 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | ||
600 | . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' | ||
601 | . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' | ||
602 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | ||
603 | . 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' | ||
604 | .\} | ||
605 | . \" troff and (daisy-wheel) nroff accents | ||
606 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | ||
607 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | ||
608 | .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] | ||
609 | .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' | ||
610 | .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' | ||
611 | .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] | ||
612 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | ||
613 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | ||
614 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | ||
615 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | ||
616 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | ||
617 | .ds ae a\h'-(\w'a'u*4/10)'e | ||
618 | .ds Ae A\h'-(\w'A'u*4/10)'E | ||
619 | .ds oe o\h'-(\w'o'u*4/10)'e | ||
620 | .ds Oe O\h'-(\w'O'u*4/10)'E | ||
621 | . \" corrections for vroff | ||
622 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | ||
623 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | ||
624 | . \" for low resolution devices (crt and lpr) | ||
625 | .if \n(.H>23 .if \n(.V>19 \ | ||
626 | \{\ | ||
627 | . ds : e | ||
628 | . ds 8 ss | ||
629 | . ds v \h'-1'\o'\(aa\(ga' | ||
630 | . ds _ \h'-1'^ | ||
631 | . ds . \h'-1'. | ||
632 | . ds 3 3 | ||
633 | . ds o a | ||
634 | . ds d- d\h'-1'\(ga | ||
635 | . ds D- D\h'-1'\(hy | ||
636 | . ds th \o'bp' | ||
637 | . ds Th \o'LP' | ||
638 | . ds ae ae | ||
639 | . ds Ae AE | ||
640 | . ds oe oe | ||
641 | . ds Oe OE | ||
642 | .\} | ||
643 | .rm #[ #] #H #V #F C | ||
644 | END | ||
645 | |||
646 | $indent = 0; | ||
647 | |||
648 | $begun = ""; | ||
649 | |||
650 | # Unrolling [^A-Z>]|[A-Z](?!<) gives: // MRE pp 165. | ||
651 | my $nonest = '(?:[^A-Z>]*(?:[A-Z](?!<)[^A-Z>]*)*)'; | ||
652 | |||
653 | while (<>) { | ||
654 | if ($cutting) { | ||
655 | next unless /^=/; | ||
656 | $cutting = 0; | ||
657 | } | ||
658 | if ($begun) { | ||
659 | if (/^=end\s+$begun/) { | ||
660 | $begun = ""; | ||
661 | } | ||
662 | elsif ($begun =~ /^(roff|man)$/) { | ||
663 | print STDOUT $_; | ||
664 | } | ||
665 | next; | ||
666 | } | ||
667 | chomp; | ||
668 | |||
669 | # Translate verbatim paragraph | ||
670 | |||
671 | if (/^\s/) { | ||
672 | @lines = split(/\n/); | ||
673 | for (@lines) { | ||
674 | 1 while s | ||
675 | {^( [^\t]* ) \t ( \t* ) } | ||
676 | { $1 . ' ' x (8 - (length($1)%8) + 8 * (length($2))) }ex; | ||
677 | s/\\/\\e/g; | ||
678 | s/\A/\\&/s; | ||
679 | } | ||
680 | $lines = @lines; | ||
681 | makespace() unless $verbatim++; | ||
682 | print ".Vb $lines\n"; | ||
683 | print join("\n", @lines), "\n"; | ||
684 | print ".Ve\n"; | ||
685 | $needspace = 0; | ||
686 | next; | ||
687 | } | ||
688 | |||
689 | $verbatim = 0; | ||
690 | |||
691 | if (/^=for\s+(\S+)\s*/s) { | ||
692 | if ($1 eq "man" or $1 eq "roff") { | ||
693 | print STDOUT $',"\n\n"; | ||
694 | } else { | ||
695 | # ignore unknown for | ||
696 | } | ||
697 | next; | ||
698 | } | ||
699 | elsif (/^=begin\s+(\S+)\s*/s) { | ||
700 | $begun = $1; | ||
701 | if ($1 eq "man" or $1 eq "roff") { | ||
702 | print STDOUT $'."\n\n"; | ||
703 | } | ||
704 | next; | ||
705 | } | ||
706 | |||
707 | # check for things that'll hosed our noremap scheme; affects $_ | ||
708 | init_noremap(); | ||
709 | |||
710 | if (!/^=item/) { | ||
711 | |||
712 | # trofficate backslashes; must do it before what happens below | ||
713 | s/\\/noremap('\\e')/ge; | ||
714 | |||
715 | # protect leading periods and quotes against *roff | ||
716 | # mistaking them for directives | ||
717 | s/^(?:[A-Z]<)?[.']/\\&$&/gm; | ||
718 | |||
719 | # first hide the escapes in case we need to | ||
720 | # intuit something and get it wrong due to fmting | ||
721 | |||
722 | 1 while s/([A-Z]<$nonest>)/noremap($1)/ge; | ||
723 | |||
724 | # func() is a reference to a perl function | ||
725 | s{ | ||
726 | \b | ||
727 | ( | ||
728 | [:\w]+ \(\) | ||
729 | ) | ||
730 | } {I<$1>}gx; | ||
731 | |||
732 | # func(n) is a reference to a perl function or a man page | ||
733 | s{ | ||
734 | ([:\w]+) | ||
735 | ( | ||
736 | \( [^\051]+ \) | ||
737 | ) | ||
738 | } {I<$1>\\|$2}gx; | ||
739 | |||
740 | # convert simple variable references | ||
741 | s/(\s+)([\$\@%][\w:]+)(?!\()/${1}C<$2>/g; | ||
742 | |||
743 | if (m{ ( | ||
744 | [\-\w]+ | ||
745 | \( | ||
746 | [^\051]*? | ||
747 | [\@\$,] | ||
748 | [^\051]*? | ||
749 | \) | ||
750 | ) | ||
751 | }x && $` !~ /([LCI]<[^<>]*|-)$/ && !/^=\w/) | ||
752 | { | ||
753 | warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [LCI]<$1>\n"; | ||
754 | $oops++; | ||
755 | } | ||
756 | |||
757 | while (/(-[a-zA-Z])\b/g && $` !~ /[\w\-]$/) { | ||
758 | warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [CB]<$1>\n"; | ||
759 | $oops++; | ||
760 | } | ||
761 | |||
762 | # put it back so we get the <> processed again; | ||
763 | clear_noremap(0); # 0 means leave the E's | ||
764 | |||
765 | } else { | ||
766 | # trofficate backslashes | ||
767 | s/\\/noremap('\\e')/ge; | ||
768 | |||
769 | } | ||
770 | |||
771 | # need to hide E<> first; they're processed in clear_noremap | ||
772 | s/(E<[^<>]+>)/noremap($1)/ge; | ||
773 | |||
774 | |||
775 | $maxnest = 10; | ||
776 | while ($maxnest-- && /[A-Z]</) { | ||
777 | |||
778 | # can't do C font here | ||
779 | s/([BI])<($nonest)>/font($1) . $2 . font('R')/eg; | ||
780 | |||
781 | # files and filelike refs in italics | ||
782 | s/F<($nonest)>/I<$1>/g; | ||
783 | |||
784 | # no break -- usually we want C<> for this | ||
785 | s/S<($nonest)>/nobreak($1)/eg; | ||
786 | |||
787 | # LREF: a la HREF L<show this text|man/section> | ||
788 | s:L<([^|>]+)\|[^>]+>:$1:g; | ||
789 | |||
790 | # LREF: a manpage(3f) | ||
791 | s:L<([a-zA-Z][^\s\/]+)(\([^\)]+\))?>:the I<$1>$2 manpage:g; | ||
792 | |||
793 | # LREF: an =item on another manpage | ||
794 | s{ | ||
795 | L< | ||
796 | ([^/]+) | ||
797 | / | ||
798 | ( | ||
799 | [:\w]+ | ||
800 | (\(\))? | ||
801 | ) | ||
802 | > | ||
803 | } {the C<$2> entry in the I<$1> manpage}gx; | ||
804 | |||
805 | # LREF: an =item on this manpage | ||
806 | s{ | ||
807 | ((?: | ||
808 | L< | ||
809 | / | ||
810 | ( | ||
811 | [:\w]+ | ||
812 | (\(\))? | ||
813 | ) | ||
814 | > | ||
815 | (,?\s+(and\s+)?)? | ||
816 | )+) | ||
817 | } { internal_lrefs($1) }gex; | ||
818 | |||
819 | # LREF: a =head2 (head1?), maybe on a manpage, maybe right here | ||
820 | # the "func" can disambiguate | ||
821 | s{ | ||
822 | L< | ||
823 | (?: | ||
824 | ([a-zA-Z]\S+?) / | ||
825 | )? | ||
826 | "?(.*?)"? | ||
827 | > | ||
828 | }{ | ||
829 | do { | ||
830 | $1 # if no $1, assume it means on this page. | ||
831 | ? "the section on I<$2> in the I<$1> manpage" | ||
832 | : "the section on I<$2>" | ||
833 | } | ||
834 | }gesx; # s in case it goes over multiple lines, so . matches \n | ||
835 | |||
836 | s/Z<>/\\&/g; | ||
837 | |||
838 | # comes last because not subject to reprocessing | ||
839 | s/C<($nonest)>/noremap("${CFont_embed}${1}\\fR")/eg; | ||
840 | } | ||
841 | |||
842 | if (s/^=//) { | ||
843 | $needspace = 0; # Assume this. | ||
844 | |||
845 | s/\n/ /g; | ||
846 | |||
847 | ($Cmd, $_) = split(' ', $_, 2); | ||
848 | |||
849 | $dotlevel = 1; | ||
850 | if ($Cmd eq 'head1') { | ||
851 | $dotlevel = 1; | ||
852 | } | ||
853 | elsif ($Cmd eq 'head2') { | ||
854 | $dotlevel = 1; | ||
855 | } | ||
856 | elsif ($Cmd eq 'item') { | ||
857 | $dotlevel = 2; | ||
858 | } | ||
859 | |||
860 | if (defined $_) { | ||
861 | &escapes($dotlevel); | ||
862 | s/"/""/g; | ||
863 | } | ||
864 | |||
865 | clear_noremap(1); | ||
866 | |||
867 | if ($Cmd eq 'cut') { | ||
868 | $cutting = 1; | ||
869 | } | ||
870 | elsif ($Cmd eq 'head1') { | ||
871 | s/\s+$//; | ||
872 | delete $wanna_see{$_} if exists $wanna_see{$_}; | ||
873 | print qq{.SH "$_"\n}; | ||
874 | push(@Indices, qq{.IX Header "$_"\n}); | ||
875 | } | ||
876 | elsif ($Cmd eq 'head2') { | ||
877 | print qq{.Sh "$_"\n}; | ||
878 | push(@Indices, qq{.IX Subsection "$_"\n}); | ||
879 | } | ||
880 | elsif ($Cmd eq 'over') { | ||
881 | push(@indent,$indent); | ||
882 | $indent += ($_ + 0) || 5; | ||
883 | } | ||
884 | elsif ($Cmd eq 'back') { | ||
885 | $indent = pop(@indent); | ||
886 | warn "$0: Unmatched =back in paragraph $. of $ARGV\n" unless defined $indent; | ||
887 | $needspace = 1; | ||
888 | } | ||
889 | elsif ($Cmd eq 'item') { | ||
890 | s/^\*( |$)/\\(bu$1/g; | ||
891 | # if you know how to get ":s please do | ||
892 | s/\\\*\(L"([^"]+?)\\\*\(R"/'$1'/g; | ||
893 | s/\\\*\(L"([^"]+?)""/'$1'/g; | ||
894 | s/[^"]""([^"]+?)""[^"]/'$1'/g; | ||
895 | # here do something about the $" in perlvar? | ||
896 | print STDOUT qq{.Ip "$_" $indent\n}; | ||
897 | push(@Indices, qq{.IX Item "$_"\n}); | ||
898 | } | ||
899 | elsif ($Cmd eq 'pod') { | ||
900 | # this is just a comment | ||
901 | } | ||
902 | else { | ||
903 | warn "$0: Unrecognized pod directive in paragraph $. of $ARGV: $Cmd\n"; | ||
904 | } | ||
905 | } | ||
906 | else { | ||
907 | if ($needspace) { | ||
908 | &makespace; | ||
909 | } | ||
910 | &escapes(0); | ||
911 | clear_noremap(1); | ||
912 | print $_, "\n"; | ||
913 | $needspace = 1; | ||
914 | } | ||
915 | } | ||
916 | |||
917 | print <<"END"; | ||
918 | |||
919 | .rn }` '' | ||
920 | END | ||
921 | |||
922 | if (%wanna_see && !$lax) { | ||
923 | @missing = keys %wanna_see; | ||
924 | warn "$0: $Filename is missing required section" | ||
925 | . (@missing > 1 && "s") | ||
926 | . ": @missing\n"; | ||
927 | $oops++; | ||
928 | } | ||
929 | |||
930 | foreach (@Indices) { print "$_\n"; } | ||
931 | |||
932 | exit; | ||
933 | #exit ($oops != 0); | ||
934 | |||
935 | ######################################################################### | ||
936 | |||
937 | sub nobreak { | ||
938 | my $string = shift; | ||
939 | $string =~ s/ /\\ /g; | ||
940 | $string; | ||
941 | } | ||
942 | |||
943 | sub escapes { | ||
944 | my $indot = shift; | ||
945 | |||
946 | s/X<(.*?)>/mkindex($1)/ge; | ||
947 | |||
948 | # translate the minus in foo-bar into foo\-bar for roff | ||
949 | s/([^0-9a-z-])-([^-])/$1\\-$2/g; | ||
950 | |||
951 | # make -- into the string version \*(-- (defined above) | ||
952 | s/\b--\b/\\*(--/g; | ||
953 | s/"--([^"])/"\\*(--$1/g; # should be a better way | ||
954 | s/([^"])--"/$1\\*(--"/g; | ||
955 | |||
956 | # fix up quotes; this is somewhat tricky | ||
957 | my $dotmacroL = 'L'; | ||
958 | my $dotmacroR = 'R'; | ||
959 | if ( $indot == 1 ) { | ||
960 | $dotmacroL = 'M'; | ||
961 | $dotmacroR = 'S'; | ||
962 | } | ||
963 | elsif ( $indot >= 2 ) { | ||
964 | $dotmacroL = 'N'; | ||
965 | $dotmacroR = 'T'; | ||
966 | } | ||
967 | if (!/""/) { | ||
968 | s/(^|\s)(['"])/noremap("$1\\*($dotmacroL$2")/ge; | ||
969 | s/(['"])($|[\-\s,;\\!?.])/noremap("\\*($dotmacroR$1$2")/ge; | ||
970 | } | ||
971 | |||
972 | #s/(?!")(?:.)--(?!")(?:.)/\\*(--/g; | ||
973 | #s/(?:(?!")(?:.)--(?:"))|(?:(?:")--(?!")(?:.))/\\*(--/g; | ||
974 | |||
975 | |||
976 | # make sure that func() keeps a bit a space tween the parens | ||
977 | ### s/\b\(\)/\\|()/g; | ||
978 | ### s/\b\(\)/(\\|)/g; | ||
979 | |||
980 | # make C++ into \*C+, which is a squinched version (defined above) | ||
981 | s/\bC\+\+/\\*(C+/g; | ||
982 | |||
983 | # make double underbars have a little tiny space between them | ||
984 | s/__/_\\|_/g; | ||
985 | |||
986 | # PI goes to \*(PI (defined above) | ||
987 | s/\bPI\b/noremap('\\*(PI')/ge; | ||
988 | |||
989 | # make all caps a teeny bit smaller, but don't muck with embedded code literals | ||
990 | my $hidCFont = font('C'); | ||
991 | if ($Cmd !~ /^head1/) { # SH already makes smaller | ||
992 | # /g isn't enough; 1 while or we'll be off | ||
993 | |||
994 | # 1 while s{ | ||
995 | # (?!$hidCFont)(..|^.|^) | ||
996 | # \b | ||
997 | # ( | ||
998 | # [A-Z][\/A-Z+:\-\d_$.]+ | ||
999 | # ) | ||
1000 | # (s?) | ||
1001 | # \b | ||
1002 | # } {$1\\s-1$2\\s0}gmox; | ||
1003 | |||
1004 | 1 while s{ | ||
1005 | (?!$hidCFont)(..|^.|^) | ||
1006 | ( | ||
1007 | \b[A-Z]{2,}[\/A-Z+:\-\d_\$]*\b | ||
1008 | ) | ||
1009 | } { | ||
1010 | $1 . noremap( '\\s-1' . $2 . '\\s0' ) | ||
1011 | }egmox; | ||
1012 | |||
1013 | } | ||
1014 | } | ||
1015 | |||
1016 | # make troff just be normal, but make small nroff get quoted | ||
1017 | # decided to just put the quotes in the text; sigh; | ||
1018 | sub ccvt { | ||
1019 | local($_,$prev) = @_; | ||
1020 | noremap(qq{.CQ "$_" \n\\&}); | ||
1021 | } | ||
1022 | |||
1023 | sub makespace { | ||
1024 | if ($indent) { | ||
1025 | print ".Sp\n"; | ||
1026 | } | ||
1027 | else { | ||
1028 | print ".PP\n"; | ||
1029 | } | ||
1030 | } | ||
1031 | |||
1032 | sub mkindex { | ||
1033 | my ($entry) = @_; | ||
1034 | my @entries = split m:\s*/\s*:, $entry; | ||
1035 | push @Indices, ".IX Xref " . join ' ', map {qq("$_")} @entries; | ||
1036 | return ''; | ||
1037 | } | ||
1038 | |||
1039 | sub font { | ||
1040 | local($font) = shift; | ||
1041 | return '\\f' . noremap($font); | ||
1042 | } | ||
1043 | |||
1044 | sub noremap { | ||
1045 | local($thing_to_hide) = shift; | ||
1046 | $thing_to_hide =~ tr/\000-\177/\200-\377/; | ||
1047 | return $thing_to_hide; | ||
1048 | } | ||
1049 | |||
1050 | sub init_noremap { | ||
1051 | # escape high bit characters in input stream | ||
1052 | s/([\200-\377])/"E<".ord($1).">"/ge; | ||
1053 | } | ||
1054 | |||
1055 | sub clear_noremap { | ||
1056 | my $ready_to_print = $_[0]; | ||
1057 | |||
1058 | tr/\200-\377/\000-\177/; | ||
1059 | |||
1060 | # trofficate backslashes | ||
1061 | # s/(?!\\e)(?:..|^.|^)\\/\\e/g; | ||
1062 | |||
1063 | # now for the E<>s, which have been hidden until now | ||
1064 | # otherwise the interative \w<> processing would have | ||
1065 | # been hosed by the E<gt> | ||
1066 | s { | ||
1067 | E< | ||
1068 | ( | ||
1069 | ( \d + ) | ||
1070 | | ( [A-Za-z]+ ) | ||
1071 | ) | ||
1072 | > | ||
1073 | } { | ||
1074 | do { | ||
1075 | defined $2 | ||
1076 | ? chr($2) | ||
1077 | : | ||
1078 | exists $HTML_Escapes{$3} | ||
1079 | ? do { $HTML_Escapes{$3} } | ||
1080 | : do { | ||
1081 | warn "$0: Unknown escape in paragraph $. of $ARGV: ``$&''\n"; | ||
1082 | "E<$1>"; | ||
1083 | } | ||
1084 | } | ||
1085 | }egx if $ready_to_print; | ||
1086 | } | ||
1087 | |||
1088 | sub internal_lrefs { | ||
1089 | local($_) = shift; | ||
1090 | local $trailing_and = s/and\s+$// ? "and " : ""; | ||
1091 | |||
1092 | s{L</([^>]+)>}{$1}g; | ||
1093 | my(@items) = split( /(?:,?\s+(?:and\s+)?)/ ); | ||
1094 | my $retstr = "the "; | ||
1095 | my $i; | ||
1096 | for ($i = 0; $i <= $#items; $i++) { | ||
1097 | $retstr .= "C<$items[$i]>"; | ||
1098 | $retstr .= ", " if @items > 2 && $i != $#items; | ||
1099 | $retstr .= " and " if $i+2 == @items; | ||
1100 | } | ||
1101 | |||
1102 | $retstr .= " entr" . ( @items > 1 ? "ies" : "y" ) | ||
1103 | . " elsewhere in this document"; | ||
1104 | # terminal space to avoid words running together (pattern used | ||
1105 | # strips terminal spaces) | ||
1106 | $retstr .= " " if length $trailing_and; | ||
1107 | $retstr .= $trailing_and; | ||
1108 | |||
1109 | return $retstr; | ||
1110 | |||
1111 | } | ||
1112 | |||
1113 | BEGIN { | ||
1114 | %HTML_Escapes = ( | ||
1115 | 'amp' => '&', # ampersand | ||
1116 | 'lt' => '<', # left chevron, less-than | ||
1117 | 'gt' => '>', # right chevron, greater-than | ||
1118 | 'quot' => '"', # double quote | ||
1119 | |||
1120 | "Aacute" => "A\\*'", # capital A, acute accent | ||
1121 | "aacute" => "a\\*'", # small a, acute accent | ||
1122 | "Acirc" => "A\\*^", # capital A, circumflex accent | ||
1123 | "acirc" => "a\\*^", # small a, circumflex accent | ||
1124 | "AElig" => '\*(AE', # capital AE diphthong (ligature) | ||
1125 | "aelig" => '\*(ae', # small ae diphthong (ligature) | ||
1126 | "Agrave" => "A\\*`", # capital A, grave accent | ||
1127 | "agrave" => "A\\*`", # small a, grave accent | ||
1128 | "Aring" => 'A\\*o', # capital A, ring | ||
1129 | "aring" => 'a\\*o', # small a, ring | ||
1130 | "Atilde" => 'A\\*~', # capital A, tilde | ||
1131 | "atilde" => 'a\\*~', # small a, tilde | ||
1132 | "Auml" => 'A\\*:', # capital A, dieresis or umlaut mark | ||
1133 | "auml" => 'a\\*:', # small a, dieresis or umlaut mark | ||
1134 | "Ccedil" => 'C\\*,', # capital C, cedilla | ||
1135 | "ccedil" => 'c\\*,', # small c, cedilla | ||
1136 | "Eacute" => "E\\*'", # capital E, acute accent | ||
1137 | "eacute" => "e\\*'", # small e, acute accent | ||
1138 | "Ecirc" => "E\\*^", # capital E, circumflex accent | ||
1139 | "ecirc" => "e\\*^", # small e, circumflex accent | ||
1140 | "Egrave" => "E\\*`", # capital E, grave accent | ||
1141 | "egrave" => "e\\*`", # small e, grave accent | ||
1142 | "ETH" => '\\*(D-', # capital Eth, Icelandic | ||
1143 | "eth" => '\\*(d-', # small eth, Icelandic | ||
1144 | "Euml" => "E\\*:", # capital E, dieresis or umlaut mark | ||
1145 | "euml" => "e\\*:", # small e, dieresis or umlaut mark | ||
1146 | "Iacute" => "I\\*'", # capital I, acute accent | ||
1147 | "iacute" => "i\\*'", # small i, acute accent | ||
1148 | "Icirc" => "I\\*^", # capital I, circumflex accent | ||
1149 | "icirc" => "i\\*^", # small i, circumflex accent | ||
1150 | "Igrave" => "I\\*`", # capital I, grave accent | ||
1151 | "igrave" => "i\\*`", # small i, grave accent | ||
1152 | "Iuml" => "I\\*:", # capital I, dieresis or umlaut mark | ||
1153 | "iuml" => "i\\*:", # small i, dieresis or umlaut mark | ||
1154 | "Ntilde" => 'N\*~', # capital N, tilde | ||
1155 | "ntilde" => 'n\*~', # small n, tilde | ||
1156 | "Oacute" => "O\\*'", # capital O, acute accent | ||
1157 | "oacute" => "o\\*'", # small o, acute accent | ||
1158 | "Ocirc" => "O\\*^", # capital O, circumflex accent | ||
1159 | "ocirc" => "o\\*^", # small o, circumflex accent | ||
1160 | "Ograve" => "O\\*`", # capital O, grave accent | ||
1161 | "ograve" => "o\\*`", # small o, grave accent | ||
1162 | "Oslash" => "O\\*/", # capital O, slash | ||
1163 | "oslash" => "o\\*/", # small o, slash | ||
1164 | "Otilde" => "O\\*~", # capital O, tilde | ||
1165 | "otilde" => "o\\*~", # small o, tilde | ||
1166 | "Ouml" => "O\\*:", # capital O, dieresis or umlaut mark | ||
1167 | "ouml" => "o\\*:", # small o, dieresis or umlaut mark | ||
1168 | "szlig" => '\*8', # small sharp s, German (sz ligature) | ||
1169 | "THORN" => '\\*(Th', # capital THORN, Icelandic | ||
1170 | "thorn" => '\\*(th',, # small thorn, Icelandic | ||
1171 | "Uacute" => "U\\*'", # capital U, acute accent | ||
1172 | "uacute" => "u\\*'", # small u, acute accent | ||
1173 | "Ucirc" => "U\\*^", # capital U, circumflex accent | ||
1174 | "ucirc" => "u\\*^", # small u, circumflex accent | ||
1175 | "Ugrave" => "U\\*`", # capital U, grave accent | ||
1176 | "ugrave" => "u\\*`", # small u, grave accent | ||
1177 | "Uuml" => "U\\*:", # capital U, dieresis or umlaut mark | ||
1178 | "uuml" => "u\\*:", # small u, dieresis or umlaut mark | ||
1179 | "Yacute" => "Y\\*'", # capital Y, acute accent | ||
1180 | "yacute" => "y\\*'", # small y, acute accent | ||
1181 | "yuml" => "y\\*:", # small y, dieresis or umlaut mark | ||
1182 | ); | ||
1183 | } | ||
1184 | |||
diff --git a/src/lib/libssl/src/util/pod2mantest b/src/lib/libssl/src/util/pod2mantest deleted file mode 100644 index 384e683df4..0000000000 --- a/src/lib/libssl/src/util/pod2mantest +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # This script is used by test/Makefile to check whether a sane 'pod2man' | ||
4 | # is installed. | ||
5 | # ('make install' should not try to run 'pod2man' if it does not exist or if | ||
6 | # it is a broken 'pod2man' version that is known to cause trouble. if we find | ||
7 | # the system 'pod2man' to be broken, we use our own copy instead) | ||
8 | # | ||
9 | # In any case, output an appropriate command line for running (or not | ||
10 | # running) pod2man. | ||
11 | |||
12 | |||
13 | IFS=: | ||
14 | if test "$OSTYPE" = "msdosdjgpp"; then IFS=";"; fi | ||
15 | |||
16 | try_without_dir=true | ||
17 | # First we try "pod2man", then "$dir/pod2man" for each item in $PATH. | ||
18 | for dir in dummy${IFS}$PATH; do | ||
19 | if [ "$try_without_dir" = true ]; then | ||
20 | # first iteration | ||
21 | pod2man=pod2man | ||
22 | try_without_dir=false | ||
23 | else | ||
24 | # second and later iterations | ||
25 | pod2man="$dir/pod2man" | ||
26 | if [ ! -f "$pod2man" ]; then # '-x' is not available on Ultrix | ||
27 | pod2man='' | ||
28 | fi | ||
29 | fi | ||
30 | |||
31 | if [ ! "$pod2man" = '' ]; then | ||
32 | failure=none | ||
33 | |||
34 | if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | fgrep OpenSSL >/dev/null; then | ||
35 | : | ||
36 | else | ||
37 | failure=BasicTest | ||
38 | fi | ||
39 | |||
40 | if [ "$failure" = none ]; then | ||
41 | if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | grep '^MARKER - ' >/dev/null; then | ||
42 | failure=MultilineTest | ||
43 | fi | ||
44 | fi | ||
45 | |||
46 | |||
47 | if [ "$failure" = none ]; then | ||
48 | echo "$pod2man" | ||
49 | exit 0 | ||
50 | fi | ||
51 | |||
52 | echo "$pod2man does not work properly ('$failure' failed). Looking for another pod2man ..." >&2 | ||
53 | fi | ||
54 | done | ||
55 | |||
56 | echo "No working pod2man found. Consider installing a new version." >&2 | ||
57 | echo "As a workaround, we'll use a bundled old copy of pod2man.pl." >&2 | ||
58 | echo "$1 ../../util/pod2man.pl" | ||
diff --git a/src/lib/libssl/src/util/pod2mantest.pod b/src/lib/libssl/src/util/pod2mantest.pod deleted file mode 100644 index 5d2539a17f..0000000000 --- a/src/lib/libssl/src/util/pod2mantest.pod +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | foo, bar, | ||
6 | MARKER - test of multiline name section | ||
7 | |||
8 | =head1 DESCRIPTION | ||
9 | |||
10 | This is a test .pod file to see if we have a buggy pod2man or not. | ||
11 | If we have a buggy implementation, we will get a line matching the | ||
12 | regular expression "^ +MARKER - test of multiline name section *$" | ||
13 | at the end of the resulting document. | ||
14 | |||
15 | =cut | ||
diff --git a/src/lib/libssl/src/util/point.sh b/src/lib/libssl/src/util/point.sh deleted file mode 100644 index da39899cb1..0000000000 --- a/src/lib/libssl/src/util/point.sh +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | rm -f "$2" | ||
4 | if test "$OSTYPE" = msdosdjgpp || test "x$PLATFORM" = xmingw ; then | ||
5 | cp "$1" "$2" | ||
6 | else | ||
7 | ln -s "$1" "$2" | ||
8 | fi | ||
9 | echo "$2 => $1" | ||
10 | |||
diff --git a/src/lib/libssl/src/util/selftest.pl b/src/lib/libssl/src/util/selftest.pl deleted file mode 100644 index 7b32e9f4ff..0000000000 --- a/src/lib/libssl/src/util/selftest.pl +++ /dev/null | |||
@@ -1,201 +0,0 @@ | |||
1 | #!/usr/local/bin/perl -w | ||
2 | # | ||
3 | # Run the test suite and generate a report | ||
4 | # | ||
5 | |||
6 | if (! -f "Configure") { | ||
7 | print "Please run perl util/selftest.pl in the OpenSSL directory.\n"; | ||
8 | exit 1; | ||
9 | } | ||
10 | |||
11 | my $report="testlog"; | ||
12 | my $os="??"; | ||
13 | my $version="??"; | ||
14 | my $platform0="??"; | ||
15 | my $platform="??"; | ||
16 | my $options="??"; | ||
17 | my $last="??"; | ||
18 | my $ok=0; | ||
19 | my $cc="cc"; | ||
20 | my $cversion="??"; | ||
21 | my $sep="-----------------------------------------------------------------------------\n"; | ||
22 | 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"; | ||
23 | |||
24 | open(OUT,">$report") or die; | ||
25 | |||
26 | print OUT "OpenSSL self-test report:\n\n"; | ||
27 | |||
28 | $uname=`uname -a`; | ||
29 | $uname="??\n" if $uname eq ""; | ||
30 | |||
31 | $c=`sh config -t`; | ||
32 | foreach $_ (split("\n",$c)) { | ||
33 | $os=$1 if (/Operating system: (.*)$/); | ||
34 | $platform0=$1 if (/Configuring for (.*)$/); | ||
35 | } | ||
36 | |||
37 | system "sh config" if (! -f "Makefile"); | ||
38 | |||
39 | if (open(IN,"<Makefile")) { | ||
40 | while (<IN>) { | ||
41 | $version=$1 if (/^VERSION=(.*)$/); | ||
42 | $platform=$1 if (/^PLATFORM=(.*)$/); | ||
43 | $options=$1 if (/^OPTIONS=(.*)$/); | ||
44 | $cc=$1 if (/^CC= *(.*)$/); | ||
45 | } | ||
46 | close(IN); | ||
47 | } else { | ||
48 | print OUT "Error running config!\n"; | ||
49 | } | ||
50 | |||
51 | $cversion=`$cc -v 2>&1`; | ||
52 | $cversion=`$cc -V 2>&1` if $cversion =~ "[Uu]sage"; | ||
53 | $cversion=`$cc -V |head -1` if $cversion =~ "Error"; | ||
54 | $cversion=`$cc --version` if $cversion eq ""; | ||
55 | $cversion =~ s/Reading specs.*\n//; | ||
56 | $cversion =~ s/usage.*\n//; | ||
57 | chomp $cversion; | ||
58 | |||
59 | if (open(IN,"<CHANGES")) { | ||
60 | while(<IN>) { | ||
61 | if (/\*\) (.{0,55})/ && !/applies to/) { | ||
62 | $last=$1; | ||
63 | last; | ||
64 | } | ||
65 | } | ||
66 | close(IN); | ||
67 | } | ||
68 | |||
69 | print OUT "OpenSSL version: $version\n"; | ||
70 | print OUT "Last change: $last...\n"; | ||
71 | print OUT "Options: $options\n" if $options ne ""; | ||
72 | print OUT "OS (uname): $uname"; | ||
73 | print OUT "OS (config): $os\n"; | ||
74 | print OUT "Target (default): $platform0\n"; | ||
75 | print OUT "Target: $platform\n"; | ||
76 | print OUT "Compiler: $cversion\n"; | ||
77 | print OUT "\n"; | ||
78 | |||
79 | print "Checking compiler...\n"; | ||
80 | if (open(TEST,">cctest.c")) { | ||
81 | print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <errno.h>\nmain(){printf(\"Hello world\\n\");}\n"; | ||
82 | close(TEST); | ||
83 | system("$cc -o cctest cctest.c"); | ||
84 | if (`./cctest` !~ /Hello world/) { | ||
85 | print OUT "Compiler doesn't work.\n"; | ||
86 | print OUT $not_our_fault; | ||
87 | goto err; | ||
88 | } | ||
89 | system("ar r cctest.a /dev/null"); | ||
90 | if (not -f "cctest.a") { | ||
91 | print OUT "Check your archive tool (ar).\n"; | ||
92 | print OUT $not_our_fault; | ||
93 | goto err; | ||
94 | } | ||
95 | } else { | ||
96 | print OUT "Can't create cctest.c\n"; | ||
97 | } | ||
98 | if (open(TEST,">cctest.c")) { | ||
99 | print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <openssl/opensslv.h>\nmain(){printf(OPENSSL_VERSION_TEXT);}\n"; | ||
100 | close(TEST); | ||
101 | system("$cc -o cctest -Iinclude cctest.c"); | ||
102 | $cctest = `./cctest`; | ||
103 | if ($cctest !~ /OpenSSL $version/) { | ||
104 | if ($cctest =~ /OpenSSL/) { | ||
105 | print OUT "#include uses headers from different OpenSSL version!\n"; | ||
106 | } else { | ||
107 | print OUT "Can't compile test program!\n"; | ||
108 | } | ||
109 | print OUT $not_our_fault; | ||
110 | goto err; | ||
111 | } | ||
112 | } else { | ||
113 | print OUT "Can't create cctest.c\n"; | ||
114 | } | ||
115 | |||
116 | print "Running make...\n"; | ||
117 | if (system("make 2>&1 | tee make.log") > 255) { | ||
118 | |||
119 | print OUT "make failed!\n"; | ||
120 | if (open(IN,"<make.log")) { | ||
121 | print OUT $sep; | ||
122 | while (<IN>) { | ||
123 | print OUT; | ||
124 | } | ||
125 | close(IN); | ||
126 | print OUT $sep; | ||
127 | } else { | ||
128 | print OUT "make.log not found!\n"; | ||
129 | } | ||
130 | goto err; | ||
131 | } | ||
132 | |||
133 | # Not sure why this is here. The tests themselves can detect if their | ||
134 | # particular feature isn't included, and should therefore skip themselves. | ||
135 | # To skip *all* tests just because one algorithm isn't included is like | ||
136 | # shooting mosquito with an elephant gun... | ||
137 | # -- Richard Levitte, inspired by problem report 1089 | ||
138 | # | ||
139 | #$_=$options; | ||
140 | #s/no-asm//; | ||
141 | #s/no-shared//; | ||
142 | #s/no-krb5//; | ||
143 | #if (/no-/) | ||
144 | #{ | ||
145 | # print OUT "Test skipped.\n"; | ||
146 | # goto err; | ||
147 | #} | ||
148 | |||
149 | print "Running make test...\n"; | ||
150 | if (system("make test 2>&1 | tee maketest.log") > 255) | ||
151 | { | ||
152 | print OUT "make test failed!\n"; | ||
153 | } else { | ||
154 | $ok=1; | ||
155 | } | ||
156 | |||
157 | if ($ok and open(IN,"<maketest.log")) { | ||
158 | while (<IN>) { | ||
159 | $ok=2 if /^platform: $platform/; | ||
160 | } | ||
161 | close(IN); | ||
162 | } | ||
163 | |||
164 | if ($ok != 2) { | ||
165 | print OUT "Failure!\n"; | ||
166 | if (open(IN,"<make.log")) { | ||
167 | print OUT $sep; | ||
168 | while (<IN>) { | ||
169 | print OUT; | ||
170 | } | ||
171 | close(IN); | ||
172 | print OUT $sep; | ||
173 | } else { | ||
174 | print OUT "make.log not found!\n"; | ||
175 | } | ||
176 | if (open(IN,"<maketest.log")) { | ||
177 | while (<IN>) { | ||
178 | print OUT; | ||
179 | } | ||
180 | close(IN); | ||
181 | print OUT $sep; | ||
182 | } else { | ||
183 | print OUT "maketest.log not found!\n"; | ||
184 | } | ||
185 | } else { | ||
186 | print OUT "Test passed.\n"; | ||
187 | } | ||
188 | err: | ||
189 | close(OUT); | ||
190 | |||
191 | print "\n"; | ||
192 | open(IN,"<$report") or die; | ||
193 | while (<IN>) { | ||
194 | if (/$sep/) { | ||
195 | print "[...]\n"; | ||
196 | last; | ||
197 | } | ||
198 | print; | ||
199 | } | ||
200 | print "\nTest report in file $report\n"; | ||
201 | |||
diff --git a/src/lib/libssl/src/util/sp-diff.pl b/src/lib/libssl/src/util/sp-diff.pl deleted file mode 100644 index 9d6c60387f..0000000000 --- a/src/lib/libssl/src/util/sp-diff.pl +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # | ||
3 | # This file takes as input, the files that have been output from | ||
4 | # ssleay speed. | ||
5 | # It prints a table of the relative differences with %100 being 'no difference' | ||
6 | # | ||
7 | |||
8 | ($#ARGV == 1) || die "$0 speedout1 speedout2\n"; | ||
9 | |||
10 | %one=&loadfile($ARGV[0]); | ||
11 | %two=&loadfile($ARGV[1]); | ||
12 | |||
13 | $line=0; | ||
14 | foreach $a ("md2","md4","md5","sha","sha1","rc4","des cfb","des cbc","des ede3", | ||
15 | "idea cfb","idea cbc","rc2 cfb","rc2 cbc","blowfish cbc","cast cbc") | ||
16 | { | ||
17 | if (defined($one{$a,8}) && defined($two{$a,8})) | ||
18 | { | ||
19 | print "type 8 byte% 64 byte% 256 byte% 1024 byte% 8192 byte%\n" | ||
20 | unless $line; | ||
21 | $line++; | ||
22 | printf "%-12s ",$a; | ||
23 | foreach $b (8,64,256,1024,8192) | ||
24 | { | ||
25 | $r=$two{$a,$b}/$one{$a,$b}*100; | ||
26 | printf "%12.2f",$r; | ||
27 | } | ||
28 | print "\n"; | ||
29 | } | ||
30 | } | ||
31 | |||
32 | foreach $a ( | ||
33 | "rsa 512","rsa 1024","rsa 2048","rsa 4096", | ||
34 | "dsa 512","dsa 1024","dsa 2048", | ||
35 | ) | ||
36 | { | ||
37 | if (defined($one{$a,1}) && defined($two{$a,1})) | ||
38 | { | ||
39 | $r1=($one{$a,1}/$two{$a,1})*100; | ||
40 | $r2=($one{$a,2}/$two{$a,2})*100; | ||
41 | printf "$a bits %% %6.2f %% %6.2f\n",$r1,$r2; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | sub loadfile | ||
46 | { | ||
47 | local($file)=@_; | ||
48 | local($_,%ret); | ||
49 | |||
50 | open(IN,"<$file") || die "unable to open '$file' for input\n"; | ||
51 | $header=1; | ||
52 | while (<IN>) | ||
53 | { | ||
54 | $header=0 if /^[dr]sa/; | ||
55 | if (/^type/) { $header=0; next; } | ||
56 | next if $header; | ||
57 | chop; | ||
58 | @a=split; | ||
59 | if ($a[0] =~ /^[dr]sa$/) | ||
60 | { | ||
61 | ($n,$t1,$t2)=($_ =~ /^([dr]sa\s+\d+)\s+bits\s+([.\d]+)s\s+([.\d]+)/); | ||
62 | $ret{$n,1}=$t1; | ||
63 | $ret{$n,2}=$t2; | ||
64 | } | ||
65 | else | ||
66 | { | ||
67 | $n=join(' ',grep(/[^k]$/,@a)); | ||
68 | @k=grep(s/k$//,@a); | ||
69 | |||
70 | $ret{$n, 8}=$k[0]; | ||
71 | $ret{$n, 64}=$k[1]; | ||
72 | $ret{$n, 256}=$k[2]; | ||
73 | $ret{$n,1024}=$k[3]; | ||
74 | $ret{$n,8192}=$k[4]; | ||
75 | } | ||
76 | } | ||
77 | close(IN); | ||
78 | return(%ret); | ||
79 | } | ||
80 | |||
diff --git a/src/lib/libssl/src/util/speed.sh b/src/lib/libssl/src/util/speed.sh deleted file mode 100644 index f489706197..0000000000 --- a/src/lib/libssl/src/util/speed.sh +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # | ||
4 | # This is a ugly script use, in conjuction with editing the 'b' | ||
5 | # configuration in the $(TOP)/Configure script which will | ||
6 | # output when finished a file called speed.log which is the | ||
7 | # timings of SSLeay with various options turned on or off. | ||
8 | # | ||
9 | # from the $(TOP) directory | ||
10 | # Edit Configure, modifying things to do with the b/bl-4c-2c etc | ||
11 | # configurations. | ||
12 | # | ||
13 | |||
14 | make clean | ||
15 | perl Configure b | ||
16 | make | ||
17 | apps/ssleay version -v -b -f >speed.1 | ||
18 | apps/ssleay speed >speed.1l | ||
19 | |||
20 | perl Configure bl-4c-2c | ||
21 | /bin/rm -f crypto/rc4/*.o crypto/bn/bn*.o crypto/md2/md2_dgst.o | ||
22 | make | ||
23 | apps/ssleay speed rc4 rsa md2 >speed.2l | ||
24 | |||
25 | perl Configure bl-4c-ri | ||
26 | /bin/rm -f crypto/rc4/rc4*.o | ||
27 | make | ||
28 | apps/ssleay speed rc4 >speed.3l | ||
29 | |||
30 | perl Configure b2-is-ri-dp | ||
31 | /bin/rm -f crypto/idea/i_*.o crypto/rc4/*.o crypto/des/ecb_enc.o crypto/bn/bn*.o | ||
32 | apps/ssleay speed rsa rc4 idea des >speed.4l | ||
33 | |||
34 | cat speed.1 >speed.log | ||
35 | cat speed.1l >>speed.log | ||
36 | perl util/sp-diff.pl speed.1l speed.2l >>speed.log | ||
37 | perl util/sp-diff.pl speed.1l speed.3l >>speed.log | ||
38 | perl util/sp-diff.pl speed.1l speed.4l >>speed.log | ||
39 | |||
diff --git a/src/lib/libssl/src/util/src-dep.pl b/src/lib/libssl/src/util/src-dep.pl deleted file mode 100644 index ad997e4746..0000000000 --- a/src/lib/libssl/src/util/src-dep.pl +++ /dev/null | |||
@@ -1,147 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | # we make up an array of | ||
4 | # $file{function_name}=filename; | ||
5 | # $unres{filename}="func1 func2 ...." | ||
6 | $debug=1; | ||
7 | #$nm_func="parse_linux"; | ||
8 | $nm_func="parse_solaris"; | ||
9 | |||
10 | foreach (@ARGV) | ||
11 | { | ||
12 | &$nm_func($_); | ||
13 | } | ||
14 | |||
15 | foreach $file (sort keys %unres) | ||
16 | { | ||
17 | @a=split(/\s+/,$unres{$file}); | ||
18 | %ff=(); | ||
19 | foreach $func (@a) | ||
20 | { | ||
21 | $f=$file{$func}; | ||
22 | $ff{$f}=1 if $f ne ""; | ||
23 | } | ||
24 | |||
25 | foreach $a (keys %ff) | ||
26 | { $we_need{$file}.="$a "; } | ||
27 | } | ||
28 | |||
29 | foreach $file (sort keys %we_need) | ||
30 | { | ||
31 | # print " $file $we_need{$file}\n"; | ||
32 | foreach $bit (split(/\s+/,$we_need{$file})) | ||
33 | { push(@final,&walk($bit)); } | ||
34 | |||
35 | foreach (@final) { $fin{$_}=1; } | ||
36 | @final=""; | ||
37 | foreach (sort keys %fin) | ||
38 | { push(@final,$_); } | ||
39 | |||
40 | print "$file: @final\n"; | ||
41 | } | ||
42 | |||
43 | sub walk | ||
44 | { | ||
45 | local($f)=@_; | ||
46 | local(@a,%seen,@ret,$r); | ||
47 | |||
48 | @ret=""; | ||
49 | $f =~ s/^\s+//; | ||
50 | $f =~ s/\s+$//; | ||
51 | return "" if ($f =~ "^\s*$"); | ||
52 | |||
53 | return(split(/\s/,$done{$f})) if defined ($done{$f}); | ||
54 | |||
55 | return if $in{$f} > 0; | ||
56 | $in{$f}++; | ||
57 | push(@ret,$f); | ||
58 | foreach $r (split(/\s+/,$we_need{$f})) | ||
59 | { | ||
60 | push(@ret,&walk($r)); | ||
61 | } | ||
62 | $in{$f}--; | ||
63 | $done{$f}=join(" ",@ret); | ||
64 | return(@ret); | ||
65 | } | ||
66 | |||
67 | sub parse_linux | ||
68 | { | ||
69 | local($name)=@_; | ||
70 | |||
71 | open(IN,"nm $name|") || die "unable to run 'nn $name':$!\n"; | ||
72 | while (<IN>) | ||
73 | { | ||
74 | chop; | ||
75 | next if /^\s*$/; | ||
76 | if (/^[^[](.*):$/) | ||
77 | { | ||
78 | $file=$1; | ||
79 | $file="$1.c" if /\[(.*).o\]/; | ||
80 | print STDERR "$file\n"; | ||
81 | $we_need{$file}=" "; | ||
82 | next; | ||
83 | } | ||
84 | |||
85 | @a=split(/\s*\|\s*/); | ||
86 | next unless $#a == 7; | ||
87 | next unless $a[4] eq "GLOB"; | ||
88 | if ($a[6] eq "UNDEF") | ||
89 | { | ||
90 | $unres{$file}.=$a[7]." "; | ||
91 | } | ||
92 | else | ||
93 | { | ||
94 | if ($file{$a[7]} ne "") | ||
95 | { | ||
96 | print STDERR "duplicate definition of $a[7],\n$file{$a[7]} and $file \n"; | ||
97 | } | ||
98 | else | ||
99 | { | ||
100 | $file{$a[7]}=$file; | ||
101 | } | ||
102 | } | ||
103 | } | ||
104 | close(IN); | ||
105 | } | ||
106 | |||
107 | sub parse_solaris | ||
108 | { | ||
109 | local($name)=@_; | ||
110 | |||
111 | open(IN,"nm $name|") || die "unable to run 'nn $name':$!\n"; | ||
112 | while (<IN>) | ||
113 | { | ||
114 | chop; | ||
115 | next if /^\s*$/; | ||
116 | if (/^(\S+):$/) | ||
117 | { | ||
118 | $file=$1; | ||
119 | #$file="$1.c" if $file =~ /^(.*).o$/; | ||
120 | print STDERR "$file\n"; | ||
121 | $we_need{$file}=" "; | ||
122 | next; | ||
123 | } | ||
124 | @a=split(/\s*\|\s*/); | ||
125 | next unless $#a == 7; | ||
126 | next unless $a[4] eq "GLOB"; | ||
127 | if ($a[6] eq "UNDEF") | ||
128 | { | ||
129 | $unres{$file}.=$a[7]." "; | ||
130 | print STDERR "$file needs $a[7]\n" if $debug; | ||
131 | } | ||
132 | else | ||
133 | { | ||
134 | if ($file{$a[7]} ne "") | ||
135 | { | ||
136 | print STDERR "duplicate definition of $a[7],\n$file{$a[7]} and $file \n"; | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | $file{$a[7]}=$file; | ||
141 | print STDERR "$file has $a[7]\n" if $debug; | ||
142 | } | ||
143 | } | ||
144 | } | ||
145 | close(IN); | ||
146 | } | ||
147 | |||
diff --git a/src/lib/libssl/src/util/tab_num.pl b/src/lib/libssl/src/util/tab_num.pl deleted file mode 100644 index a81ed0edc2..0000000000 --- a/src/lib/libssl/src/util/tab_num.pl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | $num=1; | ||
4 | $width=40; | ||
5 | |||
6 | while (<>) | ||
7 | { | ||
8 | chop; | ||
9 | |||
10 | $i=length($_); | ||
11 | |||
12 | $n=$width-$i; | ||
13 | $i=int(($n+7)/8); | ||
14 | print $_.("\t" x $i).$num."\n"; | ||
15 | $num++; | ||
16 | } | ||
17 | |||