diff options
Diffstat (limited to 'src/lib/libcrypto/util')
-rw-r--r-- | src/lib/libcrypto/util/arx.pl | 15 | ||||
-rw-r--r-- | src/lib/libcrypto/util/checkhash.pl | 222 | ||||
-rw-r--r-- | src/lib/libcrypto/util/copy.pl | 70 | ||||
-rw-r--r-- | src/lib/libcrypto/util/cygwin.sh | 11 | ||||
-rw-r--r-- | src/lib/libcrypto/util/extract-section.pl | 12 | ||||
-rw-r--r-- | src/lib/libcrypto/util/fipslink.pl | 78 | ||||
-rw-r--r-- | src/lib/libcrypto/util/libeay.num | 17 | ||||
-rw-r--r-- | src/lib/libcrypto/util/mk1mf.pl | 22 | ||||
-rw-r--r-- | src/lib/libcrypto/util/mkdef.pl | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/util/mkerr.pl | 810 | ||||
-rwxr-xr-x | src/lib/libcrypto/util/mkrc.pl | 71 | ||||
-rw-r--r-- | src/lib/libcrypto/util/mksdef.pl | 87 | ||||
-rw-r--r-- | src/lib/libcrypto/util/mkstack.pl | 192 | ||||
-rw-r--r-- | src/lib/libcrypto/util/pl/BC-16.pl | 151 | ||||
-rw-r--r-- | src/lib/libcrypto/util/pl/VC-16.pl | 177 | ||||
-rw-r--r-- | src/lib/libcrypto/util/pl/VC-32-GMAKE.pl | 222 | ||||
-rw-r--r-- | src/lib/libcrypto/util/pl/VC-32.pl | 6 | ||||
-rw-r--r-- | src/lib/libcrypto/util/pl/VC-CE.pl | 116 | ||||
-rw-r--r-- | src/lib/libcrypto/util/pl/netware.pl | 532 |
19 files changed, 1696 insertions, 1118 deletions
diff --git a/src/lib/libcrypto/util/arx.pl b/src/lib/libcrypto/util/arx.pl deleted file mode 100644 index ce62625c33..0000000000 --- a/src/lib/libcrypto/util/arx.pl +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | #!/bin/perl | ||
2 | |||
3 | # Simple perl script to wrap round "ar" program and exclude any | ||
4 | # object files in the environment variable EXCL_OBJ | ||
5 | |||
6 | map { s/^.*\/([^\/]*)$/$1/ ; $EXCL{$_} = 1} split(' ', $ENV{EXCL_OBJ}); | ||
7 | |||
8 | #my @ks = keys %EXCL; | ||
9 | #print STDERR "Excluding: @ks \n"; | ||
10 | |||
11 | my @ARGS = grep { !exists $EXCL{$_} } @ARGV; | ||
12 | |||
13 | system @ARGS; | ||
14 | |||
15 | exit $? >> 8; | ||
diff --git a/src/lib/libcrypto/util/checkhash.pl b/src/lib/libcrypto/util/checkhash.pl deleted file mode 100644 index c61fa72178..0000000000 --- a/src/lib/libcrypto/util/checkhash.pl +++ /dev/null | |||
@@ -1,222 +0,0 @@ | |||
1 | #!/usr/bin/env perl -w | ||
2 | |||
3 | my $package = caller; | ||
4 | |||
5 | if (!(defined $package)) | ||
6 | { | ||
7 | my $retval = check_hashes(@ARGV); | ||
8 | exit $retval; | ||
9 | } | ||
10 | |||
11 | 1; | ||
12 | |||
13 | sub check_hashes | ||
14 | { | ||
15 | |||
16 | my @args = @_; | ||
17 | |||
18 | my $change_dir = ""; | ||
19 | my $check_program = "sha/fips_standalone_sha1"; | ||
20 | |||
21 | my $verbose = 0; | ||
22 | my $badfiles = 0; | ||
23 | my $rebuild = 0; | ||
24 | my $force_rewrite = 0; | ||
25 | my $hash_file = "fipshashes.c"; | ||
26 | my $recurse = 0; | ||
27 | |||
28 | my @fingerprint_files; | ||
29 | |||
30 | while (@args) | ||
31 | { | ||
32 | my $arg = $args[0]; | ||
33 | if ($arg eq "-chdir") | ||
34 | { | ||
35 | shift @args; | ||
36 | $change_dir = shift @args; | ||
37 | } | ||
38 | elsif ($arg eq "-rebuild") | ||
39 | { | ||
40 | shift @args; | ||
41 | $rebuild = 1; | ||
42 | } | ||
43 | elsif ($arg eq "-verbose") | ||
44 | { | ||
45 | shift @args; | ||
46 | $verbose = 1; | ||
47 | } | ||
48 | elsif ($arg eq "-force-rewrite") | ||
49 | { | ||
50 | shift @args; | ||
51 | $force_rewrite = 1; | ||
52 | } | ||
53 | elsif ($arg eq "-hash_file") | ||
54 | { | ||
55 | shift @args; | ||
56 | $hash_file = shift @args; | ||
57 | } | ||
58 | elsif ($arg eq "-recurse") | ||
59 | { | ||
60 | shift @args; | ||
61 | $recurse = 1; | ||
62 | } | ||
63 | elsif ($arg eq "-program_path") | ||
64 | { | ||
65 | shift @args; | ||
66 | $check_program = shift @args; | ||
67 | } | ||
68 | else | ||
69 | { | ||
70 | print STDERR "Unknown Option $arg"; | ||
71 | return 1; | ||
72 | } | ||
73 | |||
74 | } | ||
75 | |||
76 | chdir $change_dir if $change_dir ne ""; | ||
77 | |||
78 | if ($recurse) | ||
79 | { | ||
80 | @fingerprint_files = ("fingerprint.sha1", | ||
81 | <*/fingerprint.sha1>); | ||
82 | } | ||
83 | else | ||
84 | { | ||
85 | push @fingerprint_files, $hash_file; | ||
86 | } | ||
87 | |||
88 | foreach $fp (@fingerprint_files) | ||
89 | { | ||
90 | if (!open(IN, "$fp")) | ||
91 | { | ||
92 | print STDERR "Can't open file $fp"; | ||
93 | return 1; | ||
94 | } | ||
95 | print STDERR "Opening Fingerprint file $fp\n" if $verbose; | ||
96 | my $dir = $fp; | ||
97 | $dir =~ s/[^\/]*$//; | ||
98 | while (<IN>) | ||
99 | { | ||
100 | chomp; | ||
101 | if (!(($file, $hash) = /^\"HMAC-SHA1\((.*)\)\s*=\s*(\w*)\",$/)) | ||
102 | { | ||
103 | /^\"/ || next; | ||
104 | print STDERR "FATAL: Invalid syntax in file $fp\n"; | ||
105 | print STDERR "Line:\n$_\n"; | ||
106 | fatal_error(); | ||
107 | return 1; | ||
108 | } | ||
109 | if (!$rebuild && length($hash) != 40) | ||
110 | { | ||
111 | print STDERR "FATAL: Invalid hash length in $fp for file $file\n"; | ||
112 | fatal_error(); | ||
113 | return 1; | ||
114 | } | ||
115 | push @hashed_files, "$dir$file"; | ||
116 | if (exists $hashes{"$dir$file"}) | ||
117 | { | ||
118 | print STDERR "FATAL: Duplicate Hash file $dir$file\n"; | ||
119 | fatal_error(); | ||
120 | return 1; | ||
121 | } | ||
122 | if (! -r "$dir$file") | ||
123 | { | ||
124 | print STDERR "FATAL: Can't access $dir$file\n"; | ||
125 | fatal_error(); | ||
126 | return 1; | ||
127 | } | ||
128 | $hashes{"$dir$file"} = $hash; | ||
129 | } | ||
130 | close IN; | ||
131 | } | ||
132 | |||
133 | @checked_hashes = `$check_program @hashed_files`; | ||
134 | |||
135 | if ($? != 0) | ||
136 | { | ||
137 | print STDERR "Error running hash program $check_program\n"; | ||
138 | fatal_error(); | ||
139 | return 1; | ||
140 | } | ||
141 | |||
142 | if (@checked_hashes != @hashed_files) | ||
143 | { | ||
144 | print STDERR "FATAL: hash count incorrect\n"; | ||
145 | fatal_error(); | ||
146 | return 1; | ||
147 | } | ||
148 | |||
149 | foreach (@checked_hashes) | ||
150 | { | ||
151 | chomp; | ||
152 | if (!(($file, $hash) = /^HMAC-SHA1\((.*)\)\s*=\s*(\w*)$/)) | ||
153 | { | ||
154 | print STDERR "FATAL: Invalid syntax in file $fp\n"; | ||
155 | print STDERR "Line:\n$_\n"; | ||
156 | fatal_error(); | ||
157 | return 1; | ||
158 | } | ||
159 | if (length($hash) != 40) | ||
160 | { | ||
161 | print STDERR "FATAL: Invalid hash length for file $file\n"; | ||
162 | fatal_error(); | ||
163 | return 1; | ||
164 | } | ||
165 | if ($hash ne $hashes{$file}) | ||
166 | { | ||
167 | if ($rebuild) | ||
168 | { | ||
169 | print STDERR "Updating hash on file $file\n"; | ||
170 | $hashes{$file} = $hash; | ||
171 | } | ||
172 | else | ||
173 | { | ||
174 | print STDERR "Hash check failed for file $file\n"; | ||
175 | } | ||
176 | $badfiles++; | ||
177 | } | ||
178 | elsif ($verbose) | ||
179 | { print "Hash Check OK for $file\n";} | ||
180 | } | ||
181 | |||
182 | |||
183 | if ($badfiles && !$rebuild) | ||
184 | { | ||
185 | print STDERR "FATAL: hash mismatch on $badfiles files\n"; | ||
186 | fatal_error(); | ||
187 | return 1; | ||
188 | } | ||
189 | |||
190 | if ($badfiles || $force_rewrite) | ||
191 | { | ||
192 | print "Updating Hash file $hash_file\n"; | ||
193 | if (!open(OUT, ">$hash_file")) | ||
194 | { | ||
195 | print STDERR "Error rewriting $hash_file"; | ||
196 | return 1; | ||
197 | } | ||
198 | print OUT "const char * const FIPS_source_hashes[] = {\n"; | ||
199 | foreach (@hashed_files) | ||
200 | { | ||
201 | print OUT "\"HMAC-SHA1($_)= $hashes{$_}\",\n"; | ||
202 | } | ||
203 | print OUT "};\n"; | ||
204 | close OUT; | ||
205 | } | ||
206 | |||
207 | if (!$badfiles) | ||
208 | { | ||
209 | print "FIPS hash check successful\n"; | ||
210 | } | ||
211 | |||
212 | return 0; | ||
213 | |||
214 | } | ||
215 | |||
216 | |||
217 | sub fatal_error | ||
218 | { | ||
219 | print STDERR "*** Your source code does not match the FIPS validated source ***\n"; | ||
220 | } | ||
221 | |||
222 | |||
diff --git a/src/lib/libcrypto/util/copy.pl b/src/lib/libcrypto/util/copy.pl new file mode 100644 index 0000000000..eba6d5815e --- /dev/null +++ b/src/lib/libcrypto/util/copy.pl | |||
@@ -0,0 +1,70 @@ | |||
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/cygwin.sh b/src/lib/libcrypto/util/cygwin.sh index d6228521e6..a4f2e740b4 100644 --- a/src/lib/libcrypto/util/cygwin.sh +++ b/src/lib/libcrypto/util/cygwin.sh | |||
@@ -8,7 +8,7 @@ | |||
8 | #set -x | 8 | #set -x |
9 | 9 | ||
10 | CONFIG_OPTIONS="--prefix=/usr shared zlib no-idea no-rc5" | 10 | CONFIG_OPTIONS="--prefix=/usr shared zlib no-idea no-rc5" |
11 | INSTALL_PREFIX=/tmp/install/INSTALL | 11 | INSTALL_PREFIX=/tmp/install |
12 | 12 | ||
13 | VERSION= | 13 | VERSION= |
14 | SUBVERSION=$1 | 14 | SUBVERSION=$1 |
@@ -124,12 +124,8 @@ strip usr/bin/*.exe usr/bin/*.dll usr/lib/engines/*.so | |||
124 | chmod u-w usr/lib/engines/*.so | 124 | chmod u-w usr/lib/engines/*.so |
125 | 125 | ||
126 | # Runtime package | 126 | # Runtime package |
127 | tar cjf libopenssl${VERSION//[!0-9]/}-${VERSION}-${SUBVERSION}.tar.bz2 \ | 127 | find etc usr/bin usr/lib/engines usr/share/doc usr/ssl/certs \ |
128 | usr/bin/cyg*dll | 128 | usr/ssl/man/man[157] usr/ssl/misc usr/ssl/openssl.cnf usr/ssl/private \ |
129 | # Base package | ||
130 | find etc usr/bin/openssl.exe usr/bin/c_rehash usr/lib/engines usr/share/doc \ | ||
131 | usr/ssl/certs usr/ssl/man/man[157] usr/ssl/misc usr/ssl/openssl.cnf \ | ||
132 | usr/ssl/private \ | ||
133 | -empty -o \! -type d | | 129 | -empty -o \! -type d | |
134 | tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 - | 130 | tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 - |
135 | # Development package | 131 | # Development package |
@@ -139,7 +135,6 @@ tar cjfT openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 - | |||
139 | 135 | ||
140 | ls -l openssl-${VERSION}-${SUBVERSION}.tar.bz2 | 136 | ls -l openssl-${VERSION}-${SUBVERSION}.tar.bz2 |
141 | ls -l openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 | 137 | ls -l openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 |
142 | ls -l libopenssl${VERSION//[!0-9]/}-${VERSION}-${SUBVERSION}.tar.bz2 | ||
143 | 138 | ||
144 | cleanup | 139 | cleanup |
145 | 140 | ||
diff --git a/src/lib/libcrypto/util/extract-section.pl b/src/lib/libcrypto/util/extract-section.pl new file mode 100644 index 0000000000..7a0ba4f69a --- /dev/null +++ b/src/lib/libcrypto/util/extract-section.pl | |||
@@ -0,0 +1,12 @@ | |||
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/fipslink.pl b/src/lib/libcrypto/util/fipslink.pl deleted file mode 100644 index 3597bc1740..0000000000 --- a/src/lib/libcrypto/util/fipslink.pl +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | sub check_env | ||
4 | { | ||
5 | my @ret; | ||
6 | foreach (@_) | ||
7 | { | ||
8 | die "Environment variable $_ not defined!\n" unless exists $ENV{$_}; | ||
9 | push @ret, $ENV{$_}; | ||
10 | } | ||
11 | return @ret; | ||
12 | } | ||
13 | |||
14 | |||
15 | my ($fips_cc,$fips_cc_args, $fips_link,$fips_target, $fips_libdir, $sha1_exe) | ||
16 | = check_env("FIPS_CC", "FIPS_CC_ARGS", "FIPS_LINK", "FIPS_TARGET", | ||
17 | "FIPSLIB_D", "FIPS_SHA1_EXE"); | ||
18 | |||
19 | |||
20 | |||
21 | if (exists $ENV{"PREMAIN_DSO_EXE"}) | ||
22 | { | ||
23 | $fips_premain_dso = $ENV{"PREMAIN_DSO_EXE"}; | ||
24 | } | ||
25 | else | ||
26 | { | ||
27 | $fips_premain_dso = ""; | ||
28 | } | ||
29 | |||
30 | check_hash($sha1_exe, "fips_premain.c"); | ||
31 | check_hash($sha1_exe, "fipscanister.lib"); | ||
32 | |||
33 | |||
34 | print "Integrity check OK\n"; | ||
35 | |||
36 | print "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c\n"; | ||
37 | system "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c"; | ||
38 | die "First stage Compile failure" if $? != 0; | ||
39 | |||
40 | print "$fips_link @ARGV\n"; | ||
41 | system "$fips_link @ARGV"; | ||
42 | die "First stage Link failure" if $? != 0; | ||
43 | |||
44 | |||
45 | print "$fips_premain_dso $fips_target\n"; | ||
46 | $fips_hash=`$fips_premain_dso $fips_target`; | ||
47 | chomp $fips_hash; | ||
48 | die "Get hash failure" if $? != 0; | ||
49 | |||
50 | |||
51 | print "$fips_cc -DHMAC_SHA1_SIG=\\\"$fips_hash\\\" $fips_cc_args $fips_libdir/fips_premain.c\n"; | ||
52 | system "$fips_cc -DHMAC_SHA1_SIG=\\\"$fips_hash\\\" $fips_cc_args $fips_libdir/fips_premain.c"; | ||
53 | die "Second stage Compile failure" if $? != 0; | ||
54 | |||
55 | |||
56 | print "$fips_link @ARGV\n"; | ||
57 | system "$fips_link @ARGV"; | ||
58 | die "Second stage Link failure" if $? != 0; | ||
59 | |||
60 | sub check_hash | ||
61 | { | ||
62 | my ($sha1_exe, $filename) = @_; | ||
63 | my ($hashfile, $hashval); | ||
64 | |||
65 | open(IN, "${fips_libdir}/${filename}.sha1") || die "Cannot open file hash file ${fips_libdir}/${filename}.sha1"; | ||
66 | $hashfile = <IN>; | ||
67 | close IN; | ||
68 | $hashval = `$sha1_exe ${fips_libdir}/$filename`; | ||
69 | chomp $hashfile; | ||
70 | chomp $hashval; | ||
71 | $hashfile =~ s/^.*=\s+//; | ||
72 | $hashval =~ s/^.*=\s+//; | ||
73 | die "Invalid hash syntax in file" if (length($hashfile) != 40); | ||
74 | die "Invalid hash received for file" if (length($hashval) != 40); | ||
75 | die "***HASH VALUE MISMATCH FOR FILE $filename ***" if ($hashval ne $hashfile); | ||
76 | } | ||
77 | |||
78 | |||
diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num index b23619f20a..c68047e955 100644 --- a/src/lib/libcrypto/util/libeay.num +++ b/src/lib/libcrypto/util/libeay.num | |||
@@ -4178,19 +4178,4 @@ UI_method_get_prompt_constructr 4550 EXIST:VMS:FUNCTION: | |||
4178 | UI_method_set_prompt_constructor 4551 EXIST:!VMS:FUNCTION: | 4178 | UI_method_set_prompt_constructor 4551 EXIST:!VMS:FUNCTION: |
4179 | UI_method_set_prompt_constructr 4551 EXIST:VMS:FUNCTION: | 4179 | UI_method_set_prompt_constructr 4551 EXIST:VMS:FUNCTION: |
4180 | EVP_read_pw_string_min 4552 EXIST::FUNCTION: | 4180 | EVP_read_pw_string_min 4552 EXIST::FUNCTION: |
4181 | CRYPTO_cts128_encrypt 4553 EXIST::FUNCTION: | 4181 | ENGINE_load_aesni 4553 EXIST::FUNCTION:ENGINE |
4182 | CRYPTO_cts128_decrypt_block 4554 EXIST::FUNCTION: | ||
4183 | CRYPTO_cfb128_1_encrypt 4555 EXIST::FUNCTION: | ||
4184 | CRYPTO_cbc128_encrypt 4556 EXIST::FUNCTION: | ||
4185 | CRYPTO_ctr128_encrypt 4557 EXIST::FUNCTION: | ||
4186 | CRYPTO_ofb128_encrypt 4558 EXIST::FUNCTION: | ||
4187 | CRYPTO_cts128_decrypt 4559 EXIST::FUNCTION: | ||
4188 | CRYPTO_cts128_encrypt_block 4560 EXIST::FUNCTION: | ||
4189 | CRYPTO_cbc128_decrypt 4561 EXIST::FUNCTION: | ||
4190 | CRYPTO_cfb128_encrypt 4562 EXIST::FUNCTION: | ||
4191 | CRYPTO_cfb128_8_encrypt 4563 EXIST::FUNCTION: | ||
4192 | OPENSSL_strcasecmp 4564 EXIST::FUNCTION: | ||
4193 | OPENSSL_memcmp 4565 EXIST::FUNCTION: | ||
4194 | OPENSSL_strncasecmp 4566 EXIST::FUNCTION: | ||
4195 | OPENSSL_gmtime 4567 EXIST::FUNCTION: | ||
4196 | OPENSSL_gmtime_adj 4568 EXIST::FUNCTION: | ||
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl index afe8c7326d..780029a03f 100644 --- a/src/lib/libcrypto/util/mk1mf.pl +++ b/src/lib/libcrypto/util/mk1mf.pl | |||
@@ -13,7 +13,6 @@ $banner="\t\@echo Building OpenSSL"; | |||
13 | 13 | ||
14 | my $no_static_engine = 1; | 14 | my $no_static_engine = 1; |
15 | my $engines = ""; | 15 | my $engines = ""; |
16 | my $otherlibs = ""; | ||
17 | local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic | 16 | local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic |
18 | local $zlib_lib = ""; | 17 | local $zlib_lib = ""; |
19 | local $perl_asm = 0; # 1 to autobuild asm files from perl scripts | 18 | local $perl_asm = 0; # 1 to autobuild asm files from perl scripts |
@@ -267,7 +266,6 @@ $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; | |||
267 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; | 266 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; |
268 | $cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa; | 267 | $cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa; |
269 | $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; | 268 | $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; |
270 | $cflags.=" -DOPENSSL_NO_GOST" if $no_gost; | ||
271 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; | 269 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; |
272 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; | 270 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; |
273 | $cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; | 271 | $cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; |
@@ -358,12 +356,6 @@ for (;;) | |||
358 | $lib=$val; | 356 | $lib=$val; |
359 | $lib =~ s/^.*\/([^\/]+)$/$1/; | 357 | $lib =~ s/^.*\/([^\/]+)$/$1/; |
360 | } | 358 | } |
361 | if ($key eq "LIBNAME" && $no_static_engine) | ||
362 | { | ||
363 | $lib=$val; | ||
364 | $lib =~ s/^.*\/([^\/]+)$/$1/; | ||
365 | $otherlibs .= " $lib"; | ||
366 | } | ||
367 | 359 | ||
368 | if ($key eq "EXHEADER") | 360 | if ($key eq "EXHEADER") |
369 | { $exheader.=&var_add($dir,$val, 1); } | 361 | { $exheader.=&var_add($dir,$val, 1); } |
@@ -666,7 +658,7 @@ foreach (split(/\s+/,$test)) | |||
666 | $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | 658 | $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); |
667 | } | 659 | } |
668 | 660 | ||
669 | $defs.=&do_defs("E_SHLIB",$engines . $otherlibs,"\$(ENG_D)",$shlibp); | 661 | $defs.=&do_defs("E_SHLIB",$engines,"\$(ENG_D)",$shlibp); |
670 | 662 | ||
671 | foreach (split(/\s+/,$engines)) | 663 | foreach (split(/\s+/,$engines)) |
672 | { | 664 | { |
@@ -679,14 +671,6 @@ foreach (split(/\s+/,$engines)) | |||
679 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); | 671 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); |
680 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); | 672 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); |
681 | 673 | ||
682 | foreach (split(" ",$otherlibs)) | ||
683 | { | ||
684 | my $uc = $_; | ||
685 | $uc =~ tr /a-z/A-Z/; | ||
686 | $rules.= &do_lib_rule("\$(${uc}OBJ)","\$(ENG_D)$o$_$shlibp", "", $shlib, ""); | ||
687 | |||
688 | } | ||
689 | |||
690 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | 674 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); |
691 | 675 | ||
692 | print $defs; | 676 | print $defs; |
@@ -724,7 +708,6 @@ sub var_add | |||
724 | return("") if $no_dsa && $dir =~ /\/dsa/; | 708 | return("") if $no_dsa && $dir =~ /\/dsa/; |
725 | return("") if $no_dh && $dir =~ /\/dh/; | 709 | return("") if $no_dh && $dir =~ /\/dh/; |
726 | return("") if $no_ec && $dir =~ /\/ec/; | 710 | return("") if $no_ec && $dir =~ /\/ec/; |
727 | return("") if $no_gost && $dir =~ /\/ccgost/; | ||
728 | return("") if $no_cms && $dir =~ /\/cms/; | 711 | return("") if $no_cms && $dir =~ /\/cms/; |
729 | return("") if $no_jpake && $dir =~ /\/jpake/; | 712 | return("") if $no_jpake && $dir =~ /\/jpake/; |
730 | if ($no_des && $dir =~ /\/des/) | 713 | if ($no_des && $dir =~ /\/des/) |
@@ -1064,7 +1047,6 @@ sub read_options | |||
1064 | "no-ec" => \$no_ec, | 1047 | "no-ec" => \$no_ec, |
1065 | "no-ecdsa" => \$no_ecdsa, | 1048 | "no-ecdsa" => \$no_ecdsa, |
1066 | "no-ecdh" => \$no_ecdh, | 1049 | "no-ecdh" => \$no_ecdh, |
1067 | "no-gost" => \$no_gost, | ||
1068 | "no-engine" => \$no_engine, | 1050 | "no-engine" => \$no_engine, |
1069 | "no-hw" => \$no_hw, | 1051 | "no-hw" => \$no_hw, |
1070 | "just-ssl" => | 1052 | "just-ssl" => |
@@ -1155,7 +1137,7 @@ sub read_options | |||
1155 | } | 1137 | } |
1156 | } | 1138 | } |
1157 | } | 1139 | } |
1158 | elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } | 1140 | elsif (/^([^=]*)=(.*)$/ && !/^-D/){ $VARS{$1}=$2; } |
1159 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } | 1141 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } |
1160 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) | 1142 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) |
1161 | { $c_flags.="$_ "; } | 1143 | { $c_flags.="$_ "; } |
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl index ab47329097..a4a17e3ae9 100644 --- a/src/lib/libcrypto/util/mkdef.pl +++ b/src/lib/libcrypto/util/mkdef.pl | |||
@@ -257,8 +257,6 @@ $ssl.=" ssl/tls1.h"; | |||
257 | 257 | ||
258 | my $crypto ="crypto/crypto.h"; | 258 | my $crypto ="crypto/crypto.h"; |
259 | $crypto.=" crypto/o_dir.h"; | 259 | $crypto.=" crypto/o_dir.h"; |
260 | $crypto.=" crypto/o_str.h"; | ||
261 | $crypto.=" crypto/o_time.h"; | ||
262 | $crypto.=" crypto/des/des.h crypto/des/des_old.h" ; # unless $no_des; | 260 | $crypto.=" crypto/des/des.h crypto/des/des_old.h" ; # unless $no_des; |
263 | $crypto.=" crypto/idea/idea.h" ; # unless $no_idea; | 261 | $crypto.=" crypto/idea/idea.h" ; # unless $no_idea; |
264 | $crypto.=" crypto/rc4/rc4.h" ; # unless $no_rc4; | 262 | $crypto.=" crypto/rc4/rc4.h" ; # unless $no_rc4; |
@@ -318,7 +316,6 @@ $crypto.=" crypto/krb5/krb5_asn.h"; | |||
318 | $crypto.=" crypto/pqueue/pqueue.h"; | 316 | $crypto.=" crypto/pqueue/pqueue.h"; |
319 | $crypto.=" crypto/cms/cms.h"; | 317 | $crypto.=" crypto/cms/cms.h"; |
320 | $crypto.=" crypto/jpake/jpake.h"; | 318 | $crypto.=" crypto/jpake/jpake.h"; |
321 | $crypto.=" crypto/modes/modes.h"; | ||
322 | 319 | ||
323 | my $symhacks="crypto/symhacks.h"; | 320 | my $symhacks="crypto/symhacks.h"; |
324 | 321 | ||
diff --git a/src/lib/libcrypto/util/mkerr.pl b/src/lib/libcrypto/util/mkerr.pl new file mode 100644 index 0000000000..15b774f277 --- /dev/null +++ b/src/lib/libcrypto/util/mkerr.pl | |||
@@ -0,0 +1,810 @@ | |||
1 | #!/usr/local/bin/perl -w | ||
2 | |||
3 | my $config = "crypto/err/openssl.ec"; | ||
4 | my $hprefix = "openssl/"; | ||
5 | my $debug = 0; | ||
6 | my $rebuild = 0; | ||
7 | my $static = 1; | ||
8 | my $recurse = 0; | ||
9 | my $reindex = 0; | ||
10 | my $dowrite = 0; | ||
11 | my $staticloader = ""; | ||
12 | |||
13 | my $pack_errcode; | ||
14 | my $load_errcode; | ||
15 | |||
16 | my $errcount; | ||
17 | |||
18 | while (@ARGV) { | ||
19 | my $arg = $ARGV[0]; | ||
20 | if($arg eq "-conf") { | ||
21 | shift @ARGV; | ||
22 | $config = shift @ARGV; | ||
23 | } elsif($arg eq "-hprefix") { | ||
24 | shift @ARGV; | ||
25 | $hprefix = shift @ARGV; | ||
26 | } elsif($arg eq "-debug") { | ||
27 | $debug = 1; | ||
28 | shift @ARGV; | ||
29 | } elsif($arg eq "-rebuild") { | ||
30 | $rebuild = 1; | ||
31 | shift @ARGV; | ||
32 | } elsif($arg eq "-recurse") { | ||
33 | $recurse = 1; | ||
34 | shift @ARGV; | ||
35 | } elsif($arg eq "-reindex") { | ||
36 | $reindex = 1; | ||
37 | shift @ARGV; | ||
38 | } elsif($arg eq "-nostatic") { | ||
39 | $static = 0; | ||
40 | shift @ARGV; | ||
41 | } elsif($arg eq "-staticloader") { | ||
42 | $staticloader = "static "; | ||
43 | shift @ARGV; | ||
44 | } elsif($arg eq "-write") { | ||
45 | $dowrite = 1; | ||
46 | shift @ARGV; | ||
47 | } elsif($arg eq "-help" || $arg eq "-h" || $arg eq "-?" || $arg eq "--help") { | ||
48 | print STDERR <<"EOF"; | ||
49 | mkerr.pl [options] ... | ||
50 | |||
51 | Options: | ||
52 | |||
53 | -conf F Use the config file F instead of the default one: | ||
54 | crypto/err/openssl.ec | ||
55 | |||
56 | -hprefix P Prepend the filenames in generated #include <header> | ||
57 | statements with prefix P. Default: 'openssl/' (without | ||
58 | the quotes, naturally) | ||
59 | |||
60 | -debug Turn on debugging verbose output on stderr. | ||
61 | |||
62 | -rebuild Rebuild all header and C source files, irrespective of the | ||
63 | fact if any error or function codes have been added/removed. | ||
64 | Default: only update files for libraries which saw change | ||
65 | (of course, this requires '-write' as well, or no | ||
66 | files will be touched!) | ||
67 | |||
68 | -recurse scan a preconfigured set of directories / files for error and | ||
69 | function codes: | ||
70 | (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>, <apps/*.c>) | ||
71 | When this option is NOT specified, the filelist is taken from | ||
72 | the commandline instead. Here, wildcards may be embedded. (Be | ||
73 | sure to escape those to prevent the shell from expanding them | ||
74 | for you when you wish mkerr.pl to do so instead.) | ||
75 | Default: take file list to scan from the command line. | ||
76 | |||
77 | -reindex Discard the numeric values previously assigned to the error | ||
78 | and function codes as extracted from the scanned header files; | ||
79 | instead renumber all of them starting from 100. (Note that | ||
80 | the numbers assigned through 'R' records in the config file | ||
81 | remain intact.) | ||
82 | Default: keep previously assigned numbers. (You are warned | ||
83 | when collisions are detected.) | ||
84 | |||
85 | -nostatic Generates a different source code, where these additional | ||
86 | functions are generated for each library specified in the | ||
87 | config file: | ||
88 | void ERR_load_<LIB>_strings(void); | ||
89 | void ERR_unload_<LIB>_strings(void); | ||
90 | void ERR_<LIB>_error(int f, int r, char *fn, int ln); | ||
91 | #define <LIB>err(f,r) ERR_<LIB>_error(f,r,__FILE__,__LINE__) | ||
92 | while the code facilitates the use of these in an environment | ||
93 | where the error support routines are dynamically loaded at | ||
94 | runtime. | ||
95 | Default: 'static' code generation. | ||
96 | |||
97 | -staticloader Prefix generated functions with the 'static' scope modifier. | ||
98 | Default: don't write any scope modifier prefix. | ||
99 | |||
100 | -write Actually (over)write the generated code to the header and C | ||
101 | source files as assigned to each library through the config | ||
102 | file. | ||
103 | Default: don't write. | ||
104 | |||
105 | -help / -h / -? / --help Show this help text. | ||
106 | |||
107 | ... Additional arguments are added to the file list to scan, | ||
108 | assuming '-recurse' was NOT specified on the command line. | ||
109 | |||
110 | EOF | ||
111 | exit 1; | ||
112 | } else { | ||
113 | last; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | if($recurse) { | ||
118 | @source = (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>); | ||
119 | } else { | ||
120 | @source = @ARGV; | ||
121 | } | ||
122 | |||
123 | # Read in the config file | ||
124 | |||
125 | open(IN, "<$config") || die "Can't open config file $config"; | ||
126 | |||
127 | # Parse config file | ||
128 | |||
129 | while(<IN>) | ||
130 | { | ||
131 | if(/^L\s+(\S+)\s+(\S+)\s+(\S+)/) { | ||
132 | $hinc{$1} = $2; | ||
133 | $libinc{$2} = $1; | ||
134 | $cskip{$3} = $1; | ||
135 | if($3 ne "NONE") { | ||
136 | $csrc{$1} = $3; | ||
137 | $fmax{$1} = 100; | ||
138 | $rmax{$1} = 100; | ||
139 | $fassigned{$1} = ":"; | ||
140 | $rassigned{$1} = ":"; | ||
141 | $fnew{$1} = 0; | ||
142 | $rnew{$1} = 0; | ||
143 | } | ||
144 | } elsif (/^F\s+(\S+)/) { | ||
145 | # Add extra function with $1 | ||
146 | } elsif (/^R\s+(\S+)\s+(\S+)/) { | ||
147 | $rextra{$1} = $2; | ||
148 | $rcodes{$1} = $2; | ||
149 | } | ||
150 | } | ||
151 | |||
152 | close IN; | ||
153 | |||
154 | # Scan each header file in turn and make a list of error codes | ||
155 | # and function names | ||
156 | |||
157 | while (($hdr, $lib) = each %libinc) | ||
158 | { | ||
159 | next if($hdr eq "NONE"); | ||
160 | print STDERR "Scanning header file $hdr\n" if $debug; | ||
161 | my $line = "", $def= "", $linenr = 0, $gotfile = 0; | ||
162 | if (open(IN, "<$hdr")) { | ||
163 | $gotfile = 1; | ||
164 | while(<IN>) { | ||
165 | $linenr++; | ||
166 | print STDERR "line: $linenr\r" if $debug; | ||
167 | |||
168 | last if(/BEGIN\s+ERROR\s+CODES/); | ||
169 | if ($line ne '') { | ||
170 | $_ = $line . $_; | ||
171 | $line = ''; | ||
172 | } | ||
173 | |||
174 | if (/\\$/) { | ||
175 | $line = $_; | ||
176 | next; | ||
177 | } | ||
178 | |||
179 | if(/\/\*/) { | ||
180 | if (not /\*\//) { # multiline comment... | ||
181 | $line = $_; # ... just accumulate | ||
182 | next; | ||
183 | } else { | ||
184 | s/\/\*.*?\*\///gs; # wipe it | ||
185 | } | ||
186 | } | ||
187 | |||
188 | if ($cpp) { | ||
189 | $cpp++ if /^#\s*if/; | ||
190 | $cpp-- if /^#\s*endif/; | ||
191 | next; | ||
192 | } | ||
193 | $cpp = 1 if /^#.*ifdef.*cplusplus/; # skip "C" declaration | ||
194 | |||
195 | next if (/^\#/); # skip preprocessor directives | ||
196 | |||
197 | s/{[^{}]*}//gs; # ignore {} blocks | ||
198 | |||
199 | if (/\{|\/\*/) { # Add a } so editor works... | ||
200 | $line = $_; | ||
201 | } else { | ||
202 | $def .= $_; | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | |||
207 | print STDERR " \r" if $debug; | ||
208 | $defnr = 0; | ||
209 | # Delete any DECLARE_ macros | ||
210 | $def =~ s/DECLARE_\w+\([\w,\s]+\)//gs; | ||
211 | foreach (split /;/, $def) { | ||
212 | $defnr++; | ||
213 | print STDERR "def: $defnr\r" if $debug; | ||
214 | |||
215 | # The goal is to collect function names from function declarations. | ||
216 | |||
217 | s/^[\n\s]*//g; | ||
218 | s/[\n\s]*$//g; | ||
219 | |||
220 | # Skip over recognized non-function declarations | ||
221 | next if(/typedef\W/ or /DECLARE_STACK_OF/ or /TYPEDEF_.*_OF/); | ||
222 | |||
223 | # Remove STACK_OF(foo) | ||
224 | s/STACK_OF\(\w+\)/void/; | ||
225 | |||
226 | # Reduce argument lists to empty () | ||
227 | # fold round brackets recursively: (t(*v)(t),t) -> (t{}{},t) -> {} | ||
228 | while(/\(.*\)/s) { | ||
229 | s/\([^\(\)]+\)/\{\}/gs; | ||
230 | s/\(\s*\*\s*(\w+)\s*\{\}\s*\)/$1/gs; #(*f{}) -> f | ||
231 | } | ||
232 | # pretend as we didn't use curly braces: {} -> () | ||
233 | s/\{\}/\(\)/gs; | ||
234 | |||
235 | if (/(\w+)\s*\(\).*/s) { # first token prior [first] () is | ||
236 | my $name = $1; # a function name! | ||
237 | $name =~ tr/[a-z]/[A-Z]/; | ||
238 | $ftrans{$name} = $1; | ||
239 | } elsif (/[\(\)]/ and not (/=/)) { | ||
240 | print STDERR "Header $hdr: cannot parse: $_;\n"; | ||
241 | } | ||
242 | } | ||
243 | |||
244 | print STDERR " \r" if $debug; | ||
245 | |||
246 | next if $reindex; | ||
247 | |||
248 | # Scan function and reason codes and store them: keep a note of the | ||
249 | # maximum code used. | ||
250 | |||
251 | if ($gotfile) { | ||
252 | while(<IN>) { | ||
253 | if(/^\#define\s+(\S+)\s+(\S+)/) { | ||
254 | $name = $1; | ||
255 | $code = $2; | ||
256 | next if $name =~ /^${lib}err/; | ||
257 | unless($name =~ /^${lib}_([RF])_(\w+)$/) { | ||
258 | print STDERR "Invalid error code $name\n"; | ||
259 | next; | ||
260 | } | ||
261 | if($1 eq "R") { | ||
262 | $rcodes{$name} = $code; | ||
263 | if ($rassigned{$lib} =~ /:$code:/) { | ||
264 | print STDERR "!! ERROR: $lib reason code $code assigned twice (collision at $name)\n"; | ||
265 | ++$errcount; | ||
266 | } | ||
267 | $rassigned{$lib} .= "$code:"; | ||
268 | if(!(exists $rextra{$name}) && | ||
269 | ($code > $rmax{$lib}) ) { | ||
270 | $rmax{$lib} = $code; | ||
271 | } | ||
272 | } else { | ||
273 | if ($fassigned{$lib} =~ /:$code:/) { | ||
274 | print STDERR "!! ERROR: $lib function code $code assigned twice (collision at $name)\n"; | ||
275 | ++$errcount; | ||
276 | } | ||
277 | $fassigned{$lib} .= "$code:"; | ||
278 | if($code > $fmax{$lib}) { | ||
279 | $fmax{$lib} = $code; | ||
280 | } | ||
281 | $fcodes{$name} = $code; | ||
282 | } | ||
283 | } | ||
284 | } | ||
285 | } | ||
286 | |||
287 | if ($debug) { | ||
288 | if (defined($fmax{$lib})) { | ||
289 | print STDERR "Max function code fmax" . "{" . "$lib" . "} = $fmax{$lib}\n"; | ||
290 | $fassigned{$lib} =~ m/^:(.*):$/; | ||
291 | @fassigned = sort {$a <=> $b} split(":", $1); | ||
292 | print STDERR " @fassigned\n"; | ||
293 | } | ||
294 | if (defined($rmax{$lib})) { | ||
295 | print STDERR "Max reason code rmax" . "{" . "$lib" . "} = $rmax{$lib}\n"; | ||
296 | $rassigned{$lib} =~ m/^:(.*):$/; | ||
297 | @rassigned = sort {$a <=> $b} split(":", $1); | ||
298 | print STDERR " @rassigned\n"; | ||
299 | } | ||
300 | } | ||
301 | |||
302 | if ($lib eq "SSL") { | ||
303 | if ($rmax{$lib} >= 1000) { | ||
304 | print STDERR "!! ERROR: SSL error codes 1000+ are reserved for alerts.\n"; | ||
305 | print STDERR "!! Any new alerts must be added to $config.\n"; | ||
306 | ++$errcount; | ||
307 | print STDERR "\n"; | ||
308 | } | ||
309 | } | ||
310 | close IN; | ||
311 | } | ||
312 | |||
313 | # Scan each C source file and look for function and reason codes | ||
314 | # This is done by looking for strings that "look like" function or | ||
315 | # reason codes: basically anything consisting of all upper case and | ||
316 | # numerics which has _F_ or _R_ in it and which has the name of an | ||
317 | # error library at the start. This seems to work fine except for the | ||
318 | # oddly named structure BIO_F_CTX which needs to be ignored. | ||
319 | # If a code doesn't exist in list compiled from headers then mark it | ||
320 | # with the value "X" as a place holder to give it a value later. | ||
321 | # Store all function and reason codes found in %ufcodes and %urcodes | ||
322 | # so all those unreferenced can be printed out. | ||
323 | |||
324 | |||
325 | foreach $file (@source) { | ||
326 | # Don't parse the error source file. | ||
327 | next if exists $cskip{$file}; | ||
328 | print STDERR "File loaded: ".$file."\r" if $debug; | ||
329 | open(IN, "<$file") || die "Can't open source file $file\n"; | ||
330 | while(<IN>) { | ||
331 | # skip obsoleted source files entirely! | ||
332 | last if(/^#error\s+obsolete/); | ||
333 | |||
334 | if(/(([A-Z0-9]+)_F_([A-Z0-9_]+))/) { | ||
335 | next unless exists $csrc{$2}; | ||
336 | next if($1 eq "BIO_F_BUFFER_CTX"); | ||
337 | $ufcodes{$1} = 1; | ||
338 | if(!exists $fcodes{$1}) { | ||
339 | $fcodes{$1} = "X"; | ||
340 | $fnew{$2}++; | ||
341 | } | ||
342 | $notrans{$1} = 1 unless exists $ftrans{$3}; | ||
343 | print STDERR "Function: $1\t= $fcodes{$1} (lib: $2, name: $3)\n" if $debug; | ||
344 | } | ||
345 | if(/(([A-Z0-9]+)_R_[A-Z0-9_]+)/) { | ||
346 | next unless exists $csrc{$2}; | ||
347 | $urcodes{$1} = 1; | ||
348 | if(!exists $rcodes{$1}) { | ||
349 | $rcodes{$1} = "X"; | ||
350 | $rnew{$2}++; | ||
351 | } | ||
352 | print STDERR "Reason: $1\t= $rcodes{$1} (lib: $2)\n" if $debug; | ||
353 | } | ||
354 | } | ||
355 | close IN; | ||
356 | } | ||
357 | print STDERR " \n" if $debug; | ||
358 | |||
359 | # Now process each library in turn. | ||
360 | |||
361 | foreach $lib (keys %csrc) | ||
362 | { | ||
363 | my $hfile = $hinc{$lib}; | ||
364 | my $cfile = $csrc{$lib}; | ||
365 | if(!$fnew{$lib} && !$rnew{$lib}) { | ||
366 | print STDERR "$lib:\t\tNo new error codes\n"; | ||
367 | next unless $rebuild; | ||
368 | } else { | ||
369 | print STDERR "$lib:\t\t$fnew{$lib} New Functions,"; | ||
370 | print STDERR " $rnew{$lib} New Reasons.\n"; | ||
371 | next unless $dowrite; | ||
372 | } | ||
373 | |||
374 | # If we get here then we have some new error codes so we | ||
375 | # need to rebuild the header file and C file. | ||
376 | |||
377 | # Make a sorted list of error and reason codes for later use. | ||
378 | |||
379 | my @function = sort grep(/^${lib}_/,keys %fcodes); | ||
380 | my @reasons = sort grep(/^${lib}_/,keys %rcodes); | ||
381 | |||
382 | # Rewrite the header file | ||
383 | |||
384 | if (open(IN, "<$hfile")) { | ||
385 | # Copy across the old file | ||
386 | while(<IN>) { | ||
387 | push @out, $_; | ||
388 | last if (/BEGIN ERROR CODES/); | ||
389 | } | ||
390 | close IN; | ||
391 | } else { | ||
392 | push @out, | ||
393 | "/* ====================================================================\n", | ||
394 | " * Copyright (c) 2001-2010 The OpenSSL Project. All rights reserved.\n", | ||
395 | " *\n", | ||
396 | " * Redistribution and use in source and binary forms, with or without\n", | ||
397 | " * modification, are permitted provided that the following conditions\n", | ||
398 | " * are met:\n", | ||
399 | " *\n", | ||
400 | " * 1. Redistributions of source code must retain the above copyright\n", | ||
401 | " * notice, this list of conditions and the following disclaimer. \n", | ||
402 | " *\n", | ||
403 | " * 2. Redistributions in binary form must reproduce the above copyright\n", | ||
404 | " * notice, this list of conditions and the following disclaimer in\n", | ||
405 | " * the documentation and/or other materials provided with the\n", | ||
406 | " * distribution.\n", | ||
407 | " *\n", | ||
408 | " * 3. All advertising materials mentioning features or use of this\n", | ||
409 | " * software must display the following acknowledgment:\n", | ||
410 | " * \"This product includes software developed by the OpenSSL Project\n", | ||
411 | " * for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n", | ||
412 | " *\n", | ||
413 | " * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n", | ||
414 | " * endorse or promote products derived from this software without\n", | ||
415 | " * prior written permission. For written permission, please contact\n", | ||
416 | " * openssl-core\@openssl.org.\n", | ||
417 | " *\n", | ||
418 | " * 5. Products derived from this software may not be called \"OpenSSL\"\n", | ||
419 | " * nor may \"OpenSSL\" appear in their names without prior written\n", | ||
420 | " * permission of the OpenSSL Project.\n", | ||
421 | " *\n", | ||
422 | " * 6. Redistributions of any form whatsoever must retain the following\n", | ||
423 | " * acknowledgment:\n", | ||
424 | " * \"This product includes software developed by the OpenSSL Project\n", | ||
425 | " * for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n", | ||
426 | " *\n", | ||
427 | " * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n", | ||
428 | " * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n", | ||
429 | " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n", | ||
430 | " * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n", | ||
431 | " * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n", | ||
432 | " * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n", | ||
433 | " * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n", | ||
434 | " * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n", | ||
435 | " * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n", | ||
436 | " * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n", | ||
437 | " * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n", | ||
438 | " * OF THE POSSIBILITY OF SUCH DAMAGE.\n", | ||
439 | " * ====================================================================\n", | ||
440 | " *\n", | ||
441 | " * This product includes cryptographic software written by Eric Young\n", | ||
442 | " * (eay\@cryptsoft.com). This product includes software written by Tim\n", | ||
443 | " * Hudson (tjh\@cryptsoft.com).\n", | ||
444 | " *\n", | ||
445 | " */\n", | ||
446 | "\n", | ||
447 | "#ifndef HEADER_${lib}_ERR_H\n", | ||
448 | "#define HEADER_${lib}_ERR_H\n", | ||
449 | "\n", | ||
450 | "#ifdef __cplusplus\n", | ||
451 | "extern \"C\" {\n", | ||
452 | "#endif\n", | ||
453 | "\n", | ||
454 | "/* BEGIN ERROR CODES */\n"; | ||
455 | } | ||
456 | open (OUT, ">$hfile") || die "Can't Open File $hfile for writing\n"; | ||
457 | |||
458 | print OUT @out; | ||
459 | undef @out; | ||
460 | print OUT <<"EOF"; | ||
461 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
462 | * made after this point may be overwritten when the script is next run. | ||
463 | */ | ||
464 | EOF | ||
465 | if($static) { | ||
466 | print OUT <<"EOF"; | ||
467 | ${staticloader}void ERR_load_${lib}_strings(void); | ||
468 | |||
469 | EOF | ||
470 | } else { | ||
471 | print OUT <<"EOF"; | ||
472 | ${staticloader}void ERR_load_${lib}_strings(void); | ||
473 | ${staticloader}void ERR_unload_${lib}_strings(void); | ||
474 | ${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line); | ||
475 | #define ${lib}err(f,r) ERR_${lib}_error((f),(r),__FILE__,__LINE__) | ||
476 | |||
477 | EOF | ||
478 | } | ||
479 | print OUT <<"EOF"; | ||
480 | /* Error codes for the $lib functions. */ | ||
481 | |||
482 | /* Function codes. */ | ||
483 | EOF | ||
484 | |||
485 | foreach $i (@function) { | ||
486 | $z=6-int(length($i)/8); | ||
487 | if($fcodes{$i} eq "X") { | ||
488 | $fassigned{$lib} =~ m/^:([^:]*):/; | ||
489 | $findcode = $1; | ||
490 | if (!defined($findcode)) { | ||
491 | $findcode = $fmax{$lib}; | ||
492 | } | ||
493 | while ($fassigned{$lib} =~ m/:$findcode:/) { | ||
494 | $findcode++; | ||
495 | } | ||
496 | $fcodes{$i} = $findcode; | ||
497 | $fassigned{$lib} .= "$findcode:"; | ||
498 | print STDERR "New Function code $i\n" if $debug; | ||
499 | } | ||
500 | printf OUT "#define $i%s $fcodes{$i}\n","\t" x $z; | ||
501 | } | ||
502 | |||
503 | print OUT "\n/* Reason codes. */\n"; | ||
504 | |||
505 | foreach $i (@reasons) { | ||
506 | $z=6-int(length($i)/8); | ||
507 | if($rcodes{$i} eq "X") { | ||
508 | $rassigned{$lib} =~ m/^:([^:]*):/; | ||
509 | $findcode = $1; | ||
510 | if (!defined($findcode)) { | ||
511 | $findcode = $rmax{$lib}; | ||
512 | } | ||
513 | while ($rassigned{$lib} =~ m/:$findcode:/) { | ||
514 | $findcode++; | ||
515 | } | ||
516 | $rcodes{$i} = $findcode; | ||
517 | $rassigned{$lib} .= "$findcode:"; | ||
518 | print STDERR "New Reason code $i\n" if $debug; | ||
519 | } | ||
520 | printf OUT "#define $i%s $rcodes{$i}\n","\t" x $z; | ||
521 | } | ||
522 | print OUT <<"EOF"; | ||
523 | |||
524 | #ifdef __cplusplus | ||
525 | } | ||
526 | #endif | ||
527 | #endif | ||
528 | EOF | ||
529 | close OUT; | ||
530 | |||
531 | # Rewrite the C source file containing the error details. | ||
532 | |||
533 | # First, read any existing reason string definitions: | ||
534 | my %err_reason_strings; | ||
535 | if (open(IN,"<$cfile")) { | ||
536 | while (<IN>) { | ||
537 | if (/\b(${lib}_R_\w*)\b.*\"(.*)\"/) { | ||
538 | $err_reason_strings{$1} = $2; | ||
539 | } | ||
540 | if (/\b${lib}_F_(\w*)\b.*\"(.*)\"/) { | ||
541 | if (!exists $ftrans{$1} && ($1 ne $2)) { | ||
542 | print STDERR "WARNING: Mismatched function string $2\n"; | ||
543 | $ftrans{$1} = $2; | ||
544 | } | ||
545 | } | ||
546 | } | ||
547 | close(IN); | ||
548 | } | ||
549 | |||
550 | |||
551 | my $hincf; | ||
552 | if($static) { | ||
553 | $hfile =~ /([^\/]+)$/; | ||
554 | $hincf = "<${hprefix}$1>"; | ||
555 | } else { | ||
556 | $hincf = "\"$hfile\""; | ||
557 | } | ||
558 | |||
559 | # If static we know the error code at compile time so use it | ||
560 | # in error definitions. | ||
561 | |||
562 | if ($static) | ||
563 | { | ||
564 | $pack_errcode = "ERR_LIB_${lib}"; | ||
565 | $load_errcode = "0"; | ||
566 | } | ||
567 | else | ||
568 | { | ||
569 | $pack_errcode = "0"; | ||
570 | $load_errcode = "ERR_LIB_${lib}"; | ||
571 | } | ||
572 | |||
573 | |||
574 | open (OUT,">$cfile") || die "Can't open $cfile for writing"; | ||
575 | |||
576 | print OUT <<"EOF"; | ||
577 | /* $cfile */ | ||
578 | /* ==================================================================== | ||
579 | * Copyright (c) 1999-2010 The OpenSSL Project. All rights reserved. | ||
580 | * | ||
581 | * Redistribution and use in source and binary forms, with or without | ||
582 | * modification, are permitted provided that the following conditions | ||
583 | * are met: | ||
584 | * | ||
585 | * 1. Redistributions of source code must retain the above copyright | ||
586 | * notice, this list of conditions and the following disclaimer. | ||
587 | * | ||
588 | * 2. Redistributions in binary form must reproduce the above copyright | ||
589 | * notice, this list of conditions and the following disclaimer in | ||
590 | * the documentation and/or other materials provided with the | ||
591 | * distribution. | ||
592 | * | ||
593 | * 3. All advertising materials mentioning features or use of this | ||
594 | * software must display the following acknowledgment: | ||
595 | * "This product includes software developed by the OpenSSL Project | ||
596 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
597 | * | ||
598 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
599 | * endorse or promote products derived from this software without | ||
600 | * prior written permission. For written permission, please contact | ||
601 | * openssl-core\@OpenSSL.org. | ||
602 | * | ||
603 | * 5. Products derived from this software may not be called "OpenSSL" | ||
604 | * nor may "OpenSSL" appear in their names without prior written | ||
605 | * permission of the OpenSSL Project. | ||
606 | * | ||
607 | * 6. Redistributions of any form whatsoever must retain the following | ||
608 | * acknowledgment: | ||
609 | * "This product includes software developed by the OpenSSL Project | ||
610 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
611 | * | ||
612 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
613 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
614 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
615 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
616 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
617 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
618 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
619 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
620 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
621 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
622 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
623 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
624 | * ==================================================================== | ||
625 | * | ||
626 | * This product includes cryptographic software written by Eric Young | ||
627 | * (eay\@cryptsoft.com). This product includes software written by Tim | ||
628 | * Hudson (tjh\@cryptsoft.com). | ||
629 | * | ||
630 | */ | ||
631 | |||
632 | /* NOTE: this file was auto generated by the mkerr.pl script: any changes | ||
633 | * made to it will be overwritten when the script next updates this file, | ||
634 | * only reason strings will be preserved. | ||
635 | */ | ||
636 | |||
637 | #include <stdio.h> | ||
638 | #include <openssl/err.h> | ||
639 | #include $hincf | ||
640 | |||
641 | /* BEGIN ERROR CODES */ | ||
642 | #ifndef OPENSSL_NO_ERR | ||
643 | |||
644 | #define ERR_FUNC(func) ERR_PACK($pack_errcode,func,0) | ||
645 | #define ERR_REASON(reason) ERR_PACK($pack_errcode,0,reason) | ||
646 | |||
647 | static ERR_STRING_DATA ${lib}_str_functs[]= | ||
648 | { | ||
649 | EOF | ||
650 | # Add each function code: if a function name is found then use it. | ||
651 | foreach $i (@function) { | ||
652 | my $fn; | ||
653 | $i =~ /^${lib}_F_(\S+)$/; | ||
654 | $fn = $1; | ||
655 | if(exists $ftrans{$fn}) { | ||
656 | $fn = $ftrans{$fn}; | ||
657 | } | ||
658 | # print OUT "{ERR_PACK($pack_errcode,$i,0),\t\"$fn\"},\n"; | ||
659 | print OUT "{ERR_FUNC($i),\t\"$fn\"},\n"; | ||
660 | } | ||
661 | print OUT <<"EOF"; | ||
662 | {0,NULL} | ||
663 | }; | ||
664 | |||
665 | static ERR_STRING_DATA ${lib}_str_reasons[]= | ||
666 | { | ||
667 | EOF | ||
668 | # Add each reason code. | ||
669 | foreach $i (@reasons) { | ||
670 | my $rn; | ||
671 | my $rstr = "ERR_REASON($i)"; | ||
672 | my $nspc = 0; | ||
673 | if (exists $err_reason_strings{$i}) { | ||
674 | $rn = $err_reason_strings{$i}; | ||
675 | } else { | ||
676 | $i =~ /^${lib}_R_(\S+)$/; | ||
677 | $rn = $1; | ||
678 | $rn =~ tr/_[A-Z]/ [a-z]/; | ||
679 | } | ||
680 | $nspc = 40 - length($rstr) unless length($rstr) > 40; | ||
681 | $nspc = " " x $nspc; | ||
682 | print OUT "{${rstr}${nspc},\"$rn\"},\n"; | ||
683 | } | ||
684 | if($static) { | ||
685 | print OUT <<"EOF"; | ||
686 | {0,NULL} | ||
687 | }; | ||
688 | |||
689 | #endif | ||
690 | |||
691 | ${staticloader}void ERR_load_${lib}_strings(void) | ||
692 | { | ||
693 | #ifndef OPENSSL_NO_ERR | ||
694 | |||
695 | if (ERR_func_error_string(${lib}_str_functs[0].error) == NULL) | ||
696 | { | ||
697 | ERR_load_strings($load_errcode,${lib}_str_functs); | ||
698 | ERR_load_strings($load_errcode,${lib}_str_reasons); | ||
699 | } | ||
700 | #endif | ||
701 | } | ||
702 | EOF | ||
703 | } else { | ||
704 | print OUT <<"EOF"; | ||
705 | {0,NULL} | ||
706 | }; | ||
707 | |||
708 | #endif | ||
709 | |||
710 | #ifdef ${lib}_LIB_NAME | ||
711 | static ERR_STRING_DATA ${lib}_lib_name[]= | ||
712 | { | ||
713 | {0 ,${lib}_LIB_NAME}, | ||
714 | {0,NULL} | ||
715 | }; | ||
716 | #endif | ||
717 | |||
718 | |||
719 | static int ${lib}_lib_error_code=0; | ||
720 | static int ${lib}_error_init=1; | ||
721 | |||
722 | ${staticloader}void ERR_load_${lib}_strings(void) | ||
723 | { | ||
724 | if (${lib}_lib_error_code == 0) | ||
725 | ${lib}_lib_error_code=ERR_get_next_error_library(); | ||
726 | |||
727 | if (${lib}_error_init) | ||
728 | { | ||
729 | ${lib}_error_init=0; | ||
730 | #ifndef OPENSSL_NO_ERR | ||
731 | ERR_load_strings(${lib}_lib_error_code,${lib}_str_functs); | ||
732 | ERR_load_strings(${lib}_lib_error_code,${lib}_str_reasons); | ||
733 | #endif | ||
734 | |||
735 | #ifdef ${lib}_LIB_NAME | ||
736 | ${lib}_lib_name->error = ERR_PACK(${lib}_lib_error_code,0,0); | ||
737 | ERR_load_strings(0,${lib}_lib_name); | ||
738 | #endif | ||
739 | } | ||
740 | } | ||
741 | |||
742 | ${staticloader}void ERR_unload_${lib}_strings(void) | ||
743 | { | ||
744 | if (${lib}_error_init == 0) | ||
745 | { | ||
746 | #ifndef OPENSSL_NO_ERR | ||
747 | ERR_unload_strings(${lib}_lib_error_code,${lib}_str_functs); | ||
748 | ERR_unload_strings(${lib}_lib_error_code,${lib}_str_reasons); | ||
749 | #endif | ||
750 | |||
751 | #ifdef ${lib}_LIB_NAME | ||
752 | ERR_unload_strings(0,${lib}_lib_name); | ||
753 | #endif | ||
754 | ${lib}_error_init=1; | ||
755 | } | ||
756 | } | ||
757 | |||
758 | ${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line) | ||
759 | { | ||
760 | if (${lib}_lib_error_code == 0) | ||
761 | ${lib}_lib_error_code=ERR_get_next_error_library(); | ||
762 | ERR_PUT_error(${lib}_lib_error_code,function,reason,file,line); | ||
763 | } | ||
764 | EOF | ||
765 | |||
766 | } | ||
767 | |||
768 | close OUT; | ||
769 | undef %err_reason_strings; | ||
770 | } | ||
771 | |||
772 | if($debug && defined(%notrans)) { | ||
773 | print STDERR "The following function codes were not translated:\n"; | ||
774 | foreach(sort keys %notrans) | ||
775 | { | ||
776 | print STDERR "$_\n"; | ||
777 | } | ||
778 | } | ||
779 | |||
780 | # Make a list of unreferenced function and reason codes | ||
781 | |||
782 | foreach (keys %fcodes) { | ||
783 | push (@funref, $_) unless exists $ufcodes{$_}; | ||
784 | } | ||
785 | |||
786 | foreach (keys %rcodes) { | ||
787 | push (@runref, $_) unless exists $urcodes{$_}; | ||
788 | } | ||
789 | |||
790 | if($debug && defined(@funref) ) { | ||
791 | print STDERR "The following function codes were not referenced:\n"; | ||
792 | foreach(sort @funref) | ||
793 | { | ||
794 | print STDERR "$_\n"; | ||
795 | } | ||
796 | } | ||
797 | |||
798 | if($debug && defined(@runref) ) { | ||
799 | print STDERR "The following reason codes were not referenced:\n"; | ||
800 | foreach(sort @runref) | ||
801 | { | ||
802 | print STDERR "$_\n"; | ||
803 | } | ||
804 | } | ||
805 | |||
806 | if($errcount) { | ||
807 | print STDERR "There were errors, failing...\n\n"; | ||
808 | exit $errcount; | ||
809 | } | ||
810 | |||
diff --git a/src/lib/libcrypto/util/mkrc.pl b/src/lib/libcrypto/util/mkrc.pl new file mode 100755 index 0000000000..0ceadcf8d1 --- /dev/null +++ b/src/lib/libcrypto/util/mkrc.pl | |||
@@ -0,0 +1,71 @@ | |||
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/mksdef.pl b/src/lib/libcrypto/util/mksdef.pl deleted file mode 100644 index 065dc675f1..0000000000 --- a/src/lib/libcrypto/util/mksdef.pl +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | |||
2 | # Perl script to split libeay32.def into two distinct DEF files for use in | ||
3 | # fipdso mode. It works out symbols in each case by running "link" command and | ||
4 | # parsing the output to find the list of missing symbols then splitting | ||
5 | # libeay32.def based on the result. | ||
6 | |||
7 | |||
8 | # Get list of unknown symbols | ||
9 | |||
10 | my @deferr = `link @ARGV`; | ||
11 | |||
12 | my $preamble = ""; | ||
13 | my @fipsdll; | ||
14 | my @fipsrest; | ||
15 | my %nosym; | ||
16 | |||
17 | # Add symbols to a hash for easy lookup | ||
18 | |||
19 | foreach (@deferr) | ||
20 | { | ||
21 | if (/^.*symbol (\S+)$/) | ||
22 | { | ||
23 | $nosym{$1} = 1; | ||
24 | } | ||
25 | } | ||
26 | |||
27 | open (IN, "ms/libeay32.def") || die "Can't Open DEF file for spliting"; | ||
28 | |||
29 | my $started = 0; | ||
30 | |||
31 | # Parse libeay32.def into two arrays depending on whether the symbol matches | ||
32 | # the missing list. | ||
33 | |||
34 | |||
35 | foreach (<IN>) | ||
36 | { | ||
37 | if (/^\s*(\S+)\s*(\@\S+)\s*$/) | ||
38 | { | ||
39 | $started = 1; | ||
40 | if (exists $nosym{$1}) | ||
41 | { | ||
42 | push @fipsrest, $_; | ||
43 | } | ||
44 | else | ||
45 | { | ||
46 | my $imptmp = sprintf " %-39s %s\n", | ||
47 | "$1=libosslfips.$1", $2; | ||
48 | push @fipsrest, $imptmp; | ||
49 | push @fipsdll, "\t$1\n"; | ||
50 | } | ||
51 | } | ||
52 | $preamble .= $_ unless $started; | ||
53 | } | ||
54 | |||
55 | close IN; | ||
56 | |||
57 | # Hack! Add some additional exports needed for libcryptofips.dll | ||
58 | # | ||
59 | |||
60 | push @fipsdll, "\tOPENSSL_showfatal\n"; | ||
61 | push @fipsdll, "\tOPENSSL_cpuid_setup\n"; | ||
62 | |||
63 | # Write out DEF files for each array | ||
64 | |||
65 | write_def("ms/libosslfips.def", "LIBOSSLFIPS", $preamble, \@fipsdll); | ||
66 | write_def("ms/libeayfips.def", "", $preamble, \@fipsrest); | ||
67 | |||
68 | |||
69 | sub write_def | ||
70 | { | ||
71 | my ($fnam, $defname, $preamble, $rdefs) = @_; | ||
72 | open (OUT, ">$fnam") || die "Can't Open DEF file $fnam for Writing\n"; | ||
73 | |||
74 | if ($defname ne "") | ||
75 | { | ||
76 | $preamble =~ s/LIBEAY32/$defname/g; | ||
77 | $preamble =~ s/LIBEAY/$defname/g; | ||
78 | } | ||
79 | print OUT $preamble; | ||
80 | foreach (@$rdefs) | ||
81 | { | ||
82 | print OUT $_; | ||
83 | } | ||
84 | close OUT; | ||
85 | } | ||
86 | |||
87 | |||
diff --git a/src/lib/libcrypto/util/mkstack.pl b/src/lib/libcrypto/util/mkstack.pl new file mode 100644 index 0000000000..6a43757c95 --- /dev/null +++ b/src/lib/libcrypto/util/mkstack.pl | |||
@@ -0,0 +1,192 @@ | |||
1 | #!/usr/local/bin/perl -w | ||
2 | |||
3 | # This is a utility that searches out "DECLARE_STACK_OF()" | ||
4 | # declarations in .h and .c files, and updates/creates/replaces | ||
5 | # the corresponding macro declarations in crypto/stack/safestack.h. | ||
6 | # As it's not generally possible to have macros that generate macros, | ||
7 | # we need to control this from the "outside", here in this script. | ||
8 | # | ||
9 | # Geoff Thorpe, June, 2000 (with massive Perl-hacking | ||
10 | # help from Steve Robb) | ||
11 | |||
12 | my $safestack = "crypto/stack/safestack"; | ||
13 | |||
14 | my $do_write; | ||
15 | while (@ARGV) { | ||
16 | my $arg = $ARGV[0]; | ||
17 | if($arg eq "-write") { | ||
18 | $do_write = 1; | ||
19 | } | ||
20 | shift @ARGV; | ||
21 | } | ||
22 | |||
23 | |||
24 | @source = (<crypto/*.[ch]>, <crypto/*/*.[ch]>, <ssl/*.[ch]>, <apps/*.[ch]>); | ||
25 | foreach $file (@source) { | ||
26 | next if -l $file; | ||
27 | |||
28 | # Open the .c/.h file for reading | ||
29 | open(IN, "< $file") || die "Can't open $file for reading: $!"; | ||
30 | |||
31 | while(<IN>) { | ||
32 | if (/^DECLARE_STACK_OF\(([^)]+)\)/) { | ||
33 | push @stacklst, $1; | ||
34 | } | ||
35 | if (/^DECLARE_SPECIAL_STACK_OF\(([^,\s]+)\s*,\s*([^>\s]+)\)/) { | ||
36 | push @sstacklst, [$1, $2]; | ||
37 | } | ||
38 | if (/^DECLARE_ASN1_SET_OF\(([^)]+)\)/) { | ||
39 | push @asn1setlst, $1; | ||
40 | } | ||
41 | if (/^DECLARE_PKCS12_STACK_OF\(([^)]+)\)/) { | ||
42 | push @p12stklst, $1; | ||
43 | } | ||
44 | if (/^DECLARE_LHASH_OF\(([^)]+)\)/) { | ||
45 | push @lhashlst, $1; | ||
46 | } | ||
47 | } | ||
48 | close(IN); | ||
49 | } | ||
50 | |||
51 | |||
52 | |||
53 | my $old_stackfile = ""; | ||
54 | my $new_stackfile = ""; | ||
55 | my $inside_block = 0; | ||
56 | my $type_thing; | ||
57 | |||
58 | open(IN, "< $safestack.h") || die "Can't open input file: $!"; | ||
59 | while(<IN>) { | ||
60 | $old_stackfile .= $_; | ||
61 | |||
62 | if (m|^/\* This block of defines is updated by util/mkstack.pl, please do not touch! \*/|) { | ||
63 | $inside_block = 1; | ||
64 | } | ||
65 | if (m|^/\* End of util/mkstack.pl block, you may now edit :-\) \*/|) { | ||
66 | $inside_block = 0; | ||
67 | } elsif ($inside_block == 0) { | ||
68 | $new_stackfile .= $_; | ||
69 | } | ||
70 | next if($inside_block != 1); | ||
71 | $new_stackfile .= "/* This block of defines is updated by util/mkstack.pl, please do not touch! */"; | ||
72 | |||
73 | foreach $type_thing (sort @stacklst) { | ||
74 | $new_stackfile .= <<EOF; | ||
75 | |||
76 | #define sk_${type_thing}_new(cmp) SKM_sk_new($type_thing, (cmp)) | ||
77 | #define sk_${type_thing}_new_null() SKM_sk_new_null($type_thing) | ||
78 | #define sk_${type_thing}_free(st) SKM_sk_free($type_thing, (st)) | ||
79 | #define sk_${type_thing}_num(st) SKM_sk_num($type_thing, (st)) | ||
80 | #define sk_${type_thing}_value(st, i) SKM_sk_value($type_thing, (st), (i)) | ||
81 | #define sk_${type_thing}_set(st, i, val) SKM_sk_set($type_thing, (st), (i), (val)) | ||
82 | #define sk_${type_thing}_zero(st) SKM_sk_zero($type_thing, (st)) | ||
83 | #define sk_${type_thing}_push(st, val) SKM_sk_push($type_thing, (st), (val)) | ||
84 | #define sk_${type_thing}_unshift(st, val) SKM_sk_unshift($type_thing, (st), (val)) | ||
85 | #define sk_${type_thing}_find(st, val) SKM_sk_find($type_thing, (st), (val)) | ||
86 | #define sk_${type_thing}_find_ex(st, val) SKM_sk_find_ex($type_thing, (st), (val)) | ||
87 | #define sk_${type_thing}_delete(st, i) SKM_sk_delete($type_thing, (st), (i)) | ||
88 | #define sk_${type_thing}_delete_ptr(st, ptr) SKM_sk_delete_ptr($type_thing, (st), (ptr)) | ||
89 | #define sk_${type_thing}_insert(st, val, i) SKM_sk_insert($type_thing, (st), (val), (i)) | ||
90 | #define sk_${type_thing}_set_cmp_func(st, cmp) SKM_sk_set_cmp_func($type_thing, (st), (cmp)) | ||
91 | #define sk_${type_thing}_dup(st) SKM_sk_dup($type_thing, st) | ||
92 | #define sk_${type_thing}_pop_free(st, free_func) SKM_sk_pop_free($type_thing, (st), (free_func)) | ||
93 | #define sk_${type_thing}_shift(st) SKM_sk_shift($type_thing, (st)) | ||
94 | #define sk_${type_thing}_pop(st) SKM_sk_pop($type_thing, (st)) | ||
95 | #define sk_${type_thing}_sort(st) SKM_sk_sort($type_thing, (st)) | ||
96 | #define sk_${type_thing}_is_sorted(st) SKM_sk_is_sorted($type_thing, (st)) | ||
97 | EOF | ||
98 | } | ||
99 | |||
100 | foreach $type_thing (sort @sstacklst) { | ||
101 | my $t1 = $type_thing->[0]; | ||
102 | my $t2 = $type_thing->[1]; | ||
103 | $new_stackfile .= <<EOF; | ||
104 | |||
105 | #define sk_${t1}_new(cmp) ((STACK_OF($t1) *)sk_new(CHECKED_SK_CMP_FUNC($t2, cmp))) | ||
106 | #define sk_${t1}_new_null() ((STACK_OF($t1) *)sk_new_null()) | ||
107 | #define sk_${t1}_push(st, val) sk_push(CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, val)) | ||
108 | #define sk_${t1}_find(st, val) sk_find(CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, val)) | ||
109 | #define sk_${t1}_value(st, i) (($t1)sk_value(CHECKED_PTR_OF(STACK_OF($t1), st), i)) | ||
110 | #define sk_${t1}_num(st) SKM_sk_num($t1, st) | ||
111 | #define sk_${t1}_pop_free(st, free_func) sk_pop_free(CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_SK_FREE_FUNC2($t1, free_func)) | ||
112 | #define sk_${t1}_insert(st, val, i) sk_insert(CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, val), i) | ||
113 | #define sk_${t1}_free(st) SKM_sk_free(${t1}, st) | ||
114 | #define sk_${t1}_set(st, i, val) sk_set((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st), i, CHECKED_PTR_OF($t2, val)) | ||
115 | #define sk_${t1}_zero(st) SKM_sk_zero($t1, (st)) | ||
116 | #define sk_${t1}_unshift(st, val) sk_unshift((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, val)) | ||
117 | #define sk_${t1}_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF($t1), st), CHECKED_CONST_PTR_OF($t2, val)) | ||
118 | #define sk_${t1}_delete(st, i) SKM_sk_delete($t1, (st), (i)) | ||
119 | #define sk_${t1}_delete_ptr(st, ptr) ($t1 *)sk_delete_ptr((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, ptr)) | ||
120 | #define sk_${t1}_set_cmp_func(st, cmp) \\ | ||
121 | ((int (*)(const $t2 * const *,const $t2 * const *)) \\ | ||
122 | sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_SK_CMP_FUNC($t2, cmp))) | ||
123 | #define sk_${t1}_dup(st) SKM_sk_dup($t1, st) | ||
124 | #define sk_${t1}_shift(st) SKM_sk_shift($t1, (st)) | ||
125 | #define sk_${t1}_pop(st) ($t2 *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st)) | ||
126 | #define sk_${t1}_sort(st) SKM_sk_sort($t1, (st)) | ||
127 | #define sk_${t1}_is_sorted(st) SKM_sk_is_sorted($t1, (st)) | ||
128 | |||
129 | EOF | ||
130 | } | ||
131 | |||
132 | foreach $type_thing (sort @asn1setlst) { | ||
133 | $new_stackfile .= <<EOF; | ||
134 | |||
135 | #define d2i_ASN1_SET_OF_${type_thing}(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\ | ||
136 | SKM_ASN1_SET_OF_d2i($type_thing, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) | ||
137 | #define i2d_ASN1_SET_OF_${type_thing}(st, pp, i2d_func, ex_tag, ex_class, is_set) \\ | ||
138 | SKM_ASN1_SET_OF_i2d($type_thing, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) | ||
139 | #define ASN1_seq_pack_${type_thing}(st, i2d_func, buf, len) \\ | ||
140 | SKM_ASN1_seq_pack($type_thing, (st), (i2d_func), (buf), (len)) | ||
141 | #define ASN1_seq_unpack_${type_thing}(buf, len, d2i_func, free_func) \\ | ||
142 | SKM_ASN1_seq_unpack($type_thing, (buf), (len), (d2i_func), (free_func)) | ||
143 | EOF | ||
144 | } | ||
145 | foreach $type_thing (sort @p12stklst) { | ||
146 | $new_stackfile .= <<EOF; | ||
147 | |||
148 | #define PKCS12_decrypt_d2i_${type_thing}(algor, d2i_func, free_func, pass, passlen, oct, seq) \\ | ||
149 | SKM_PKCS12_decrypt_d2i($type_thing, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) | ||
150 | EOF | ||
151 | } | ||
152 | |||
153 | foreach $type_thing (sort @lhashlst) { | ||
154 | my $lc_tt = lc $type_thing; | ||
155 | $new_stackfile .= <<EOF; | ||
156 | |||
157 | #define lh_${type_thing}_new() LHM_lh_new(${type_thing},${lc_tt}) | ||
158 | #define lh_${type_thing}_insert(lh,inst) LHM_lh_insert(${type_thing},lh,inst) | ||
159 | #define lh_${type_thing}_retrieve(lh,inst) LHM_lh_retrieve(${type_thing},lh,inst) | ||
160 | #define lh_${type_thing}_delete(lh,inst) LHM_lh_delete(${type_thing},lh,inst) | ||
161 | #define lh_${type_thing}_doall(lh,fn) LHM_lh_doall(${type_thing},lh,fn) | ||
162 | #define lh_${type_thing}_doall_arg(lh,fn,arg_type,arg) \\ | ||
163 | LHM_lh_doall_arg(${type_thing},lh,fn,arg_type,arg) | ||
164 | #define lh_${type_thing}_error(lh) LHM_lh_error(${type_thing},lh) | ||
165 | #define lh_${type_thing}_num_items(lh) LHM_lh_num_items(${type_thing},lh) | ||
166 | #define lh_${type_thing}_down_load(lh) LHM_lh_down_load(${type_thing},lh) | ||
167 | #define lh_${type_thing}_node_stats_bio(lh,out) \\ | ||
168 | LHM_lh_node_stats_bio(${type_thing},lh,out) | ||
169 | #define lh_${type_thing}_node_usage_stats_bio(lh,out) \\ | ||
170 | LHM_lh_node_usage_stats_bio(${type_thing},lh,out) | ||
171 | #define lh_${type_thing}_stats_bio(lh,out) \\ | ||
172 | LHM_lh_stats_bio(${type_thing},lh,out) | ||
173 | #define lh_${type_thing}_free(lh) LHM_lh_free(${type_thing},lh) | ||
174 | EOF | ||
175 | } | ||
176 | |||
177 | $new_stackfile .= "/* End of util/mkstack.pl block, you may now edit :-) */\n"; | ||
178 | $inside_block = 2; | ||
179 | } | ||
180 | |||
181 | |||
182 | if ($new_stackfile eq $old_stackfile) { | ||
183 | print "No changes to $safestack.h.\n"; | ||
184 | exit 0; # avoid unnecessary rebuild | ||
185 | } | ||
186 | |||
187 | if ($do_write) { | ||
188 | print "Writing new $safestack.h.\n"; | ||
189 | open OUT, ">$safestack.h" || die "Can't open output file"; | ||
190 | print OUT $new_stackfile; | ||
191 | close OUT; | ||
192 | } | ||
diff --git a/src/lib/libcrypto/util/pl/BC-16.pl b/src/lib/libcrypto/util/pl/BC-16.pl deleted file mode 100644 index 8030653daa..0000000000 --- a/src/lib/libcrypto/util/pl/BC-16.pl +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # VCw16lib.pl - the file for Visual C++ 1.52b for windows, static libraries | ||
3 | # | ||
4 | |||
5 | $o='\\'; | ||
6 | $cp='copy'; | ||
7 | $rm='del'; | ||
8 | |||
9 | # C compiler stuff | ||
10 | $cc='bcc'; | ||
11 | |||
12 | if ($debug) | ||
13 | { $op="-v "; } | ||
14 | else { $op="-O "; } | ||
15 | |||
16 | $cflags="-d -ml $op -DL_ENDIAN"; | ||
17 | # I add the stack opt | ||
18 | $base_lflags="/c /C"; | ||
19 | $lflags="$base_lflags"; | ||
20 | |||
21 | if ($win16) | ||
22 | { | ||
23 | $shlib=1; | ||
24 | $cflags.=" -DOPENSSL_SYSNAME_WIN16"; | ||
25 | $app_cflag="-W"; | ||
26 | $lib_cflag="-WD"; | ||
27 | $lflags.="/Twe"; | ||
28 | } | ||
29 | else | ||
30 | { | ||
31 | $cflags.=" -DOENSSL_SYSNAME_MSDOS"; | ||
32 | $lflags.=" /Tde"; | ||
33 | } | ||
34 | |||
35 | if ($shlib) | ||
36 | { | ||
37 | $mlflags=" /Twd $base_lflags"; # stack if defined in .def file | ||
38 | $libs="libw ldllcew"; | ||
39 | $no_asm=1; | ||
40 | } | ||
41 | else | ||
42 | { $mlflags=''; } | ||
43 | |||
44 | $obj='.obj'; | ||
45 | $ofile="-o"; | ||
46 | |||
47 | # EXE linking stuff | ||
48 | $link="tlink"; | ||
49 | $efile=""; | ||
50 | $exep='.exe'; | ||
51 | $ex_libs="CL"; | ||
52 | $ex_libs.=$no_sock?"":" winsock.lib"; | ||
53 | |||
54 | $app_ex_obj="C0L.obj "; | ||
55 | $shlib_ex_obj="" if ($shlib); | ||
56 | |||
57 | # static library stuff | ||
58 | $mklib='tlib'; | ||
59 | $ranlib='echo no ranlib'; | ||
60 | $plib=""; | ||
61 | $libp=".lib"; | ||
62 | $shlibp=($shlib)?".dll":".lib"; | ||
63 | $lfile=''; | ||
64 | |||
65 | $asm='bcc -c -B -Tml'; | ||
66 | $afile='/o'; | ||
67 | if ($no_asm || $fips) | ||
68 | { | ||
69 | $bn_asm_obj=''; | ||
70 | $bn_asm_src=''; | ||
71 | } | ||
72 | elsif ($asmbits == 32) | ||
73 | { | ||
74 | $bn_asm_obj='crypto\bn\asm\x86w32.obj'; | ||
75 | $bn_asm_src='crypto\bn\asm\x86w32.asm'; | ||
76 | } | ||
77 | else | ||
78 | { | ||
79 | $bn_asm_obj='crypto\bn\asm\x86w16.obj'; | ||
80 | $bn_asm_src='crypto\bn\asm\x86w16.asm'; | ||
81 | } | ||
82 | |||
83 | sub do_lib_rule | ||
84 | { | ||
85 | local($target,$name,$shlib)=@_; | ||
86 | local($ret,$Name); | ||
87 | |||
88 | $taget =~ s/\//$o/g if $o ne '/'; | ||
89 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
90 | |||
91 | $ret.="$target: \$(${Name}OBJ)\n"; | ||
92 | $ret.="\t\$(RM) \$(O_$Name)\n"; | ||
93 | |||
94 | # Due to a pathetic line length limit, I unwrap the args. | ||
95 | local($lib_names)=""; | ||
96 | local($dll_names)=""; | ||
97 | foreach $_ (sort split(/\s+/,$Vars{"${Name}OBJ"})) | ||
98 | { | ||
99 | $lib_names.=" +$_ &\n"; | ||
100 | $dll_names.=" $_\n"; | ||
101 | } | ||
102 | |||
103 | if (!$shlib) | ||
104 | { | ||
105 | $ret.="\t\$(MKLIB) $target & <<|\n$lib_names\n,\n|\n"; | ||
106 | } | ||
107 | else | ||
108 | { | ||
109 | local($ex)=($Name eq "SSL")?' $(L_CRYPTO) winsock':""; | ||
110 | $ret.="\t\$(LINK) \$(MLFLAGS) @&&|\n"; | ||
111 | $ret.=$dll_names; | ||
112 | $ret.="\n $target\n\n $ex $libs\nms$o${name}16.def;\n|\n"; | ||
113 | ($out_lib=$target) =~ s/O_/L_/; | ||
114 | $ret.="\timplib /nowep $out_lib $target\n\n"; | ||
115 | } | ||
116 | $ret.="\n"; | ||
117 | return($ret); | ||
118 | } | ||
119 | |||
120 | sub do_link_rule | ||
121 | { | ||
122 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; | ||
123 | local($ret,$f,$_,@f); | ||
124 | |||
125 | $file =~ s/\//$o/g if $o ne '/'; | ||
126 | $n=&bname($target); | ||
127 | $ret.="$target: $files $dep_libs\n"; | ||
128 | $ret.=" \$(LINK) @&&|"; | ||
129 | |||
130 | # Due to a pathetic line length limit, I have to unwrap the args. | ||
131 | $ret.=" \$(LFLAGS) "; | ||
132 | if ($files =~ /\(([^)]*)\)$/) | ||
133 | { | ||
134 | $ret.=" \$(APP_EX_OBJ)"; | ||
135 | foreach $_ (sort split(/\s+/,$Vars{$1})) | ||
136 | { $ret.="\n $r $_ +"; } | ||
137 | chop($ret); | ||
138 | $ret.="\n"; | ||
139 | } | ||
140 | else | ||
141 | { $ret.="\n $r \$(APP_EX_OBJ) $files\n"; } | ||
142 | $ret.=" $target\n\n $libs\n\n|\n"; | ||
143 | if (defined $sha1file) | ||
144 | { | ||
145 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
146 | } | ||
147 | $ret.="\n"; | ||
148 | return($ret); | ||
149 | } | ||
150 | |||
151 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/VC-16.pl b/src/lib/libcrypto/util/pl/VC-16.pl deleted file mode 100644 index 564ba3fd08..0000000000 --- a/src/lib/libcrypto/util/pl/VC-16.pl +++ /dev/null | |||
@@ -1,177 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # VCw16lib.pl - the file for Visual C++ 1.52b for windows, static libraries | ||
3 | # | ||
4 | |||
5 | $ssl= "ssleay16"; | ||
6 | $crypto="libeay16"; | ||
7 | |||
8 | $o='\\'; | ||
9 | $cp='copy'; | ||
10 | $rm='del'; | ||
11 | |||
12 | # C compiler stuff | ||
13 | $cc='cl'; | ||
14 | |||
15 | $out_def="out16"; | ||
16 | $tmp_def="tmp16"; | ||
17 | $inc_def="inc16"; | ||
18 | |||
19 | if ($debug) | ||
20 | { | ||
21 | $op="/Od /Zi /Zd"; | ||
22 | $base_lflags="/CO"; | ||
23 | } | ||
24 | else { | ||
25 | $op="/G2 /f- /Ocgnotb2"; | ||
26 | } | ||
27 | $base_lflags.=" /FARCALL /NOLOGO /NOD /SEG:1024 /ONERROR:NOEXE /NOE /PACKC:60000"; | ||
28 | if ($win16) { $base_lflags.=" /PACKD:60000"; } | ||
29 | |||
30 | $cflags="/ALw /Gx- /Gt256 /Gf $op /W3 /WX -DL_ENDIAN /nologo"; | ||
31 | # I add the stack opt | ||
32 | $lflags="$base_lflags /STACK:20000"; | ||
33 | |||
34 | if ($win16) | ||
35 | { | ||
36 | $cflags.=" -DOPENSSL_SYSNAME_WIN16"; | ||
37 | $app_cflag="/Gw /FPi87"; | ||
38 | $lib_cflag="/Gw"; | ||
39 | $lib_cflag.=" -D_WINDLL -D_DLL" if $shlib; | ||
40 | $lib_cflag.=" -DWIN16TTY" if !$shlib; | ||
41 | $lflags.=" /ALIGN:256"; | ||
42 | $ex_libs.="oldnames llibcewq libw"; | ||
43 | } | ||
44 | else | ||
45 | { | ||
46 | $no_sock=1; | ||
47 | $cflags.=" -DMSDOS"; | ||
48 | $lflags.=" /EXEPACK"; | ||
49 | $ex_libs.="oldnames.lib llibce.lib"; | ||
50 | } | ||
51 | |||
52 | if ($shlib) | ||
53 | { | ||
54 | $mlflags="$base_lflags"; | ||
55 | $libs="oldnames ldllcew libw"; | ||
56 | $shlib_ex_obj=""; | ||
57 | # $no_asm=1; | ||
58 | $out_def="out16dll"; | ||
59 | $tmp_def="tmp16dll"; | ||
60 | } | ||
61 | else | ||
62 | { $mlflags=''; } | ||
63 | |||
64 | $app_ex_obj=""; | ||
65 | |||
66 | $obj='.obj'; | ||
67 | $ofile="/Fo"; | ||
68 | |||
69 | # EXE linking stuff | ||
70 | $link="link"; | ||
71 | $efile=""; | ||
72 | $exep='.exe'; | ||
73 | $ex_libs.=$no_sock?"":" winsock"; | ||
74 | |||
75 | # static library stuff | ||
76 | $mklib='lib /PAGESIZE:1024'; | ||
77 | $ranlib=''; | ||
78 | $plib=""; | ||
79 | $libp=".lib"; | ||
80 | $shlibp=($shlib)?".dll":".lib"; | ||
81 | $lfile=''; | ||
82 | |||
83 | $asm='ml /Cp /c /Cx'; | ||
84 | $afile='/Fo'; | ||
85 | |||
86 | $bn_asm_obj=''; | ||
87 | $bn_asm_src=''; | ||
88 | $des_enc_obj=''; | ||
89 | $des_enc_src=''; | ||
90 | $bf_enc_obj=''; | ||
91 | $bf_enc_src=''; | ||
92 | |||
93 | if (!$no_asm && !$fips) | ||
94 | { | ||
95 | if ($asmbits == 32) | ||
96 | { | ||
97 | $bn_asm_obj='crypto\bn\asm\x86w32.obj'; | ||
98 | $bn_asm_src='crypto\bn\asm\x86w32.asm'; | ||
99 | } | ||
100 | else | ||
101 | { | ||
102 | $bn_asm_obj='crypto\bn\asm\x86w16.obj'; | ||
103 | $bn_asm_src='crypto\bn\asm\x86w16.asm'; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | sub do_lib_rule | ||
108 | { | ||
109 | local($objs,$target,$name,$shlib)=@_; | ||
110 | local($ret,$Name); | ||
111 | |||
112 | $taget =~ s/\//$o/g if $o ne '/'; | ||
113 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
114 | |||
115 | # $target="\$(LIB_D)$o$target"; | ||
116 | $ret.="$target: $objs\n"; | ||
117 | # $ret.="\t\$(RM) \$(O_$Name)\n"; | ||
118 | |||
119 | # Due to a pathetic line length limit, I unwrap the args. | ||
120 | local($lib_names)=""; | ||
121 | local($dll_names)=" \$(SHLIB_EX_OBJ) +\n"; | ||
122 | ($obj)= ($objs =~ /\((.*)\)/); | ||
123 | foreach $_ (sort split(/\s+/,$Vars{$obj})) | ||
124 | { | ||
125 | $lib_names.="+$_ &\n"; | ||
126 | $dll_names.=" $_ +\n"; | ||
127 | } | ||
128 | |||
129 | if (!$shlib) | ||
130 | { | ||
131 | $ret.="\tdel $target\n"; | ||
132 | $ret.="\t\$(MKLIB) @<<\n$target\ny\n$lib_names\n\n<<\n"; | ||
133 | } | ||
134 | else | ||
135 | { | ||
136 | local($ex)=($target =~ /O_SSL/)?'$(L_CRYPTO)':""; | ||
137 | $ex.=' winsock'; | ||
138 | $ret.="\t\$(LINK) \$(MLFLAGS) @<<\n"; | ||
139 | $ret.=$dll_names; | ||
140 | $ret.="\n $target\n\n $ex $libs\nms$o${name}.def;\n<<\n"; | ||
141 | ($out_lib=$target) =~ s/O_/L_/; | ||
142 | $ret.="\timplib /noignorecase /nowep $out_lib $target\n"; | ||
143 | } | ||
144 | $ret.="\n"; | ||
145 | return($ret); | ||
146 | } | ||
147 | |||
148 | sub do_link_rule | ||
149 | { | ||
150 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; | ||
151 | local($ret,$f,$_,@f); | ||
152 | |||
153 | $file =~ s/\//$o/g if $o ne '/'; | ||
154 | $n=&bname($targer); | ||
155 | $ret.="$target: $files $dep_libs\n"; | ||
156 | $ret.=" \$(LINK) \$(LFLAGS) @<<\n"; | ||
157 | |||
158 | # Due to a pathetic line length limit, I have to unwrap the args. | ||
159 | if ($files =~ /\(([^)]*)\)$/) | ||
160 | { | ||
161 | @a=('$(APP_EX_OBJ)'); | ||
162 | push(@a,sort split(/\s+/,$Vars{$1})); | ||
163 | for $_ (@a) | ||
164 | { $ret.=" $_ +\n"; } | ||
165 | } | ||
166 | else | ||
167 | { $ret.=" \$(APP_EX_OBJ) $files"; } | ||
168 | $ret.="\n $target\n\n $libs\n\n<<\n"; | ||
169 | if (defined $sha1file) | ||
170 | { | ||
171 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
172 | } | ||
173 | $ret.="\n"; | ||
174 | return($ret); | ||
175 | } | ||
176 | |||
177 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl b/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl deleted file mode 100644 index b5bbcac6c2..0000000000 --- a/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl +++ /dev/null | |||
@@ -1,222 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # VCw32lib.pl - the file for Visual C++ 4.[01] for windows NT, static libraries | ||
3 | # | ||
4 | |||
5 | |||
6 | if ($fips && !$shlib) | ||
7 | { | ||
8 | $crypto="libeayfips32"; | ||
9 | $crypto_compat = "libeaycompat32.lib"; | ||
10 | } | ||
11 | else | ||
12 | { | ||
13 | $crypto="libeay32"; | ||
14 | } | ||
15 | $ssl= "ssleay32"; | ||
16 | |||
17 | $o='/'; | ||
18 | #$cp='copy nul+'; # Timestamps get stuffed otherwise | ||
19 | #$rm='del'; | ||
20 | |||
21 | $cp='cp'; | ||
22 | $rm='rm'; | ||
23 | |||
24 | $zlib_lib="zlib1.lib"; | ||
25 | |||
26 | # C compiler stuff | ||
27 | $cc='cl'; | ||
28 | $cflags=' -MD -W3 -WX -Ox -O2 -Ob2 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32'; | ||
29 | $cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8 | ||
30 | $cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8 | ||
31 | $lflags="-nologo -subsystem:console -machine:I386 -opt:ref"; | ||
32 | $mlflags=''; | ||
33 | |||
34 | $out_def="gmout32"; | ||
35 | $tmp_def="gmtmp32"; | ||
36 | $inc_def="gminc32"; | ||
37 | |||
38 | if ($debug) | ||
39 | { | ||
40 | $cflags=" -MDd -W3 -WX -Zi -Yd -Od -nologo -DOPENSSL_SYSNAME_WIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG -DDSO_WIN32"; | ||
41 | $lflags.=" -debug"; | ||
42 | $mlflags.=' -debug'; | ||
43 | } | ||
44 | $cflags .= " -DOPENSSL_SYSNAME_WINNT" if $NT == 1; | ||
45 | |||
46 | $obj='.obj'; | ||
47 | $ofile="-Fo"; | ||
48 | |||
49 | # EXE linking stuff | ||
50 | $link="link"; | ||
51 | $efile="-out:"; | ||
52 | $exep='.exe'; | ||
53 | if ($no_sock) | ||
54 | { $ex_libs=""; } | ||
55 | else { $ex_libs="wsock32.lib user32.lib gdi32.lib"; } | ||
56 | |||
57 | # static library stuff | ||
58 | $mklib='lib'; | ||
59 | $ranlib=''; | ||
60 | $plib=""; | ||
61 | $libp=".lib"; | ||
62 | $shlibp=($shlib)?".dll":".lib"; | ||
63 | $lfile='-out:'; | ||
64 | |||
65 | $shlib_ex_obj=""; | ||
66 | $app_ex_obj="setargv.obj"; | ||
67 | if ($nasm) { | ||
68 | $asm='nasmw -f win32'; | ||
69 | $afile='-o '; | ||
70 | } else { | ||
71 | $asm='ml -Cp -coff -c -Cx'; | ||
72 | $asm.=" -Zi" if $debug; | ||
73 | $afile='-Fo'; | ||
74 | } | ||
75 | |||
76 | $bn_asm_obj=''; | ||
77 | $bn_asm_src=''; | ||
78 | $des_enc_obj=''; | ||
79 | $des_enc_src=''; | ||
80 | $bf_enc_obj=''; | ||
81 | $bf_enc_src=''; | ||
82 | |||
83 | if (!$no_asm && !$fips) | ||
84 | { | ||
85 | $bn_asm_obj='crypto/bn/asm/bn_win32.obj'; | ||
86 | $bn_asm_src='crypto/bn/asm/bn_win32.asm'; | ||
87 | $des_enc_obj='crypto/des/asm/d_win32.obj crypto/des/asm/y_win32.obj'; | ||
88 | $des_enc_src='crypto/des/asm/d_win32.asm crypto/des/asm/y_win32.asm'; | ||
89 | $bf_enc_obj='crypto/bf/asm/b_win32.obj'; | ||
90 | $bf_enc_src='crypto/bf/asm/b_win32.asm'; | ||
91 | $cast_enc_obj='crypto/cast/asm/c_win32.obj'; | ||
92 | $cast_enc_src='crypto/cast/asm/c_win32.asm'; | ||
93 | $rc4_enc_obj='crypto/rc4/asm/r4_win32.obj'; | ||
94 | $rc4_enc_src='crypto/rc4/asm/r4_win32.asm'; | ||
95 | $rc5_enc_obj='crypto/rc5/asm/r5_win32.obj'; | ||
96 | $rc5_enc_src='crypto/rc5/asm/r5_win32.asm'; | ||
97 | $md5_asm_obj='crypto/md5/asm/m5_win32.obj'; | ||
98 | $md5_asm_src='crypto/md5/asm/m5_win32.asm'; | ||
99 | $sha1_asm_obj='crypto/sha/asm/s1_win32.obj'; | ||
100 | $sha1_asm_src='crypto/sha/asm/s1_win32.asm'; | ||
101 | $rmd160_asm_obj='crypto/ripemd/asm/rm_win32.obj'; | ||
102 | $rmd160_asm_src='crypto/ripemd/asm/rm_win32.asm'; | ||
103 | $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM"; | ||
104 | } | ||
105 | |||
106 | if ($shlib) | ||
107 | { | ||
108 | $mlflags.=" $lflags -dll"; | ||
109 | # $cflags =~ s| -MD| -MT|; | ||
110 | $lib_cflag=" -D_WINDLL"; | ||
111 | $out_def="gmout32dll"; | ||
112 | $tmp_def="gmtmp32dll"; | ||
113 | } | ||
114 | |||
115 | $cflags.=" -Fd$out_def"; | ||
116 | |||
117 | sub do_lib_rule | ||
118 | { | ||
119 | local($objs,$target,$name,$shlib,$ign,$base_addr, $fips_get_sig, $fips_premain_src)=@_; | ||
120 | local($ret,$Name); | ||
121 | |||
122 | $taget =~ s/\//$o/g if $o ne '/'; | ||
123 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
124 | my $base_arg; | ||
125 | if ($base_addr ne "") | ||
126 | { | ||
127 | $base_arg= " -base:$base_addr"; | ||
128 | } | ||
129 | else | ||
130 | { | ||
131 | $base_arg = ""; | ||
132 | } | ||
133 | |||
134 | |||
135 | # $target="\$(LIB_D)$o$target"; | ||
136 | if (!$shlib) | ||
137 | { | ||
138 | # $ret.="\t\$(RM) \$(O_$Name)\n"; | ||
139 | $ret.="$target: $objs\n"; | ||
140 | $ex =' advapi32.lib'; | ||
141 | $ret.="\t\$(MKLIB) $lfile$target $objs $ex\n\n"; | ||
142 | } | ||
143 | else | ||
144 | { | ||
145 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; | ||
146 | $ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib'; | ||
147 | $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/; | ||
148 | if (defined $fips_get_sig) | ||
149 | { | ||
150 | $ret.="$target: \$(O_FIPSCANISTER) $objs $fips_get_sig\n"; | ||
151 | $ret.="\tFIPS_LINK=\$(LINK) "; | ||
152 | $ret.="FIPS_CC=\$(CC) "; | ||
153 | $ret.="FIPS_CC_ARGS=\"-Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\" "; | ||
154 | $ret.="FIPS_PREMAIN_DSO=$fips_get_sig "; | ||
155 | $ret.="FIPS_TARGET=$target "; | ||
156 | $ret.="FIPS_LIBDIR=\$(FIPSLIB_D) "; | ||
157 | $ret.="\$(FIPSLINK) \$(MLFLAGS) $base_arg $efile$target "; | ||
158 | $ret.="-def:ms/${Name}.def \$(SHLIB_EX_OBJ) $objs "; | ||
159 | $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n\n"; | ||
160 | } | ||
161 | else | ||
162 | { | ||
163 | $ret.="$target: $objs\n"; | ||
164 | $ret.="\t\$(LINK) \$(MLFLAGS) $base_arg $efile$target /def:ms/${Name}.def \$(SHLIB_EX_OBJ) $objs $ex\n\n"; | ||
165 | } | ||
166 | } | ||
167 | $ret.="\n"; | ||
168 | return($ret); | ||
169 | } | ||
170 | |||
171 | sub do_link_rule | ||
172 | { | ||
173 | local($target,$files,$dep_libs,$libs,$standalone)=@_; | ||
174 | local($ret,$_); | ||
175 | $file =~ s/\//$o/g if $o ne '/'; | ||
176 | $n=&bname($targer); | ||
177 | if ($standalone) | ||
178 | { | ||
179 | $ret.="$target: $files $dep_libs\n"; | ||
180 | $ret.="\t\$(LINK) \$(LFLAGS) $efile$target "; | ||
181 | $ret.="$files $libs\n\n"; | ||
182 | } | ||
183 | elsif ($fips && !$shlib) | ||
184 | { | ||
185 | $ret.="$target: \$(O_FIPSCANISTER) $files $dep_libs\n"; | ||
186 | $ret.="\tFIPS_LINK=\$(LINK) "; | ||
187 | $ret.="FIPS_CC=\$(CC) "; | ||
188 | $ret.="FIPS_CC_ARGS=\"-Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\" "; | ||
189 | $ret.="FIPS_PREMAIN_DSO= "; | ||
190 | $ret.="FIPS_TARGET=$target "; | ||
191 | $ret.="FIPS_LIBDIR=\$(FIPSLIB_D) "; | ||
192 | $ret.=" \$(FIPSLINK) \$(LFLAGS) $efile$target "; | ||
193 | $ret.="\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n\n"; | ||
194 | } | ||
195 | else | ||
196 | { | ||
197 | $ret.="$target: $files $dep_libs\n"; | ||
198 | $ret.="\t\$(LINK) \$(LFLAGS) $efile$target "; | ||
199 | $ret.="\$(APP_EX_OBJ) $files $libs\n\n"; | ||
200 | } | ||
201 | $ret.="\n"; | ||
202 | return($ret); | ||
203 | } | ||
204 | |||
205 | sub do_rlink_rule | ||
206 | { | ||
207 | local($target,$files,$check_hash, $deps)=@_; | ||
208 | local($ret,$_); | ||
209 | |||
210 | $file =~ s/\//$o/g if $o ne '/'; | ||
211 | $n=&bname($targer); | ||
212 | $ret.="$target: $check_hash $files $deps\n"; | ||
213 | $ret.="\t\$(PERL) util${o}checkhash.pl -chdir fips-1.0 -program_path ..$o$check_hash\n"; | ||
214 | $ret.="\t\$(MKCANISTER) $target $files\n"; | ||
215 | $ret.="\t$check_hash $target > $target.sha1\n"; | ||
216 | $ret.="\t\$(CP) fips-1.0${o}fips_premain.c \$(FIPSLIB_D)\n"; | ||
217 | $ret.="\t$check_hash \$(FIPSLIB_D)${o}fips_premain.c > \$(FIPSLIB_D)${o}fips_premain.c.sha1\n\n"; | ||
218 | return($ret); | ||
219 | } | ||
220 | |||
221 | |||
222 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/VC-32.pl b/src/lib/libcrypto/util/pl/VC-32.pl index 5f25fc41bf..c3e29fda96 100644 --- a/src/lib/libcrypto/util/pl/VC-32.pl +++ b/src/lib/libcrypto/util/pl/VC-32.pl | |||
@@ -138,8 +138,8 @@ else | |||
138 | } | 138 | } |
139 | 139 | ||
140 | # generate symbols.pdb unconditionally | 140 | # generate symbols.pdb unconditionally |
141 | $app_cflag.=" /Zi /Fd\$(TMP_D)/app"; | 141 | $app_cflag.=" /Zi /Fd$tmp_def/app"; |
142 | $lib_cflag.=" /Zi /Fd\$(TMP_D)/lib"; | 142 | $lib_cflag.=" /Zi /Fd$tmp_def/lib"; |
143 | $lflags.=" /debug"; | 143 | $lflags.=" /debug"; |
144 | 144 | ||
145 | $obj='.obj'; | 145 | $obj='.obj'; |
@@ -195,7 +195,7 @@ if ($FLAVOR =~ /WIN64A/) { | |||
195 | my $ver=`nasm -v 2>NUL`; | 195 | my $ver=`nasm -v 2>NUL`; |
196 | my $vew=`nasmw -v 2>NUL`; | 196 | my $vew=`nasmw -v 2>NUL`; |
197 | # pick newest version | 197 | # pick newest version |
198 | $asm=($ver ge $vew?"nasm":"nasmw")." -f win32"; | 198 | $asm=($ver gt $vew?"nasm":"nasmw")." -f win32"; |
199 | $asmtype="win32n"; | 199 | $asmtype="win32n"; |
200 | $afile='-o '; | 200 | $afile='-o '; |
201 | } else { | 201 | } else { |
diff --git a/src/lib/libcrypto/util/pl/VC-CE.pl b/src/lib/libcrypto/util/pl/VC-CE.pl deleted file mode 100644 index 2fd0c4dd32..0000000000 --- a/src/lib/libcrypto/util/pl/VC-CE.pl +++ /dev/null | |||
@@ -1,116 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # VC-CE.pl - the file for eMbedded Visual C++ 3.0 for windows CE, static libraries | ||
3 | # | ||
4 | |||
5 | $ssl= "ssleay32"; | ||
6 | $crypto="libeay32"; | ||
7 | $RSAref="RSAref32"; | ||
8 | |||
9 | $o='\\'; | ||
10 | $cp='copy nul+'; # Timestamps get stuffed otherwise | ||
11 | $rm='del'; | ||
12 | |||
13 | # C compiler stuff | ||
14 | $cc='$(CC)'; | ||
15 | $cflags=' /W3 /WX /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo $(WCETARGETDEFS) -DUNICODE -D_UNICODE -DWIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -I$(WCECOMPAT)/include'; | ||
16 | $lflags='/nologo /subsystem:windowsce,$(WCELDVERSION) /machine:$(WCELDMACHINE) /opt:ref'; | ||
17 | $mlflags=''; | ||
18 | |||
19 | $out_def='out32_$(TARGETCPU)'; | ||
20 | $tmp_def='tmp32_$(TARGETCPU)'; | ||
21 | $inc_def="inc32"; | ||
22 | |||
23 | if ($debug) | ||
24 | { | ||
25 | $cflags=" /MDd /W3 /WX /Zi /Yd /Od /nologo -DWIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG -DDSO_WIN32"; | ||
26 | $lflags.=" /debug"; | ||
27 | $mlflags.=' /debug'; | ||
28 | } | ||
29 | |||
30 | $obj='.obj'; | ||
31 | $ofile="/Fo"; | ||
32 | |||
33 | # EXE linking stuff | ||
34 | $link="link"; | ||
35 | $efile="/out:"; | ||
36 | $exep='.exe'; | ||
37 | if ($no_sock) | ||
38 | { $ex_libs=""; } | ||
39 | else { $ex_libs='winsock.lib $(WCECOMPAT)/lib/wcecompatex.lib $(WCELDFLAGS)'; } | ||
40 | |||
41 | # static library stuff | ||
42 | $mklib='lib'; | ||
43 | $ranlib=''; | ||
44 | $plib=""; | ||
45 | $libp=".lib"; | ||
46 | $shlibp=($shlib)?".dll":".lib"; | ||
47 | $lfile='/out:'; | ||
48 | |||
49 | $shlib_ex_obj=""; | ||
50 | $app_ex_obj=""; | ||
51 | $app_ex_obj=""; | ||
52 | |||
53 | $bn_asm_obj=''; | ||
54 | $bn_asm_src=''; | ||
55 | $des_enc_obj=''; | ||
56 | $des_enc_src=''; | ||
57 | $bf_enc_obj=''; | ||
58 | $bf_enc_src=''; | ||
59 | |||
60 | if ($shlib) | ||
61 | { | ||
62 | $mlflags.=" $lflags /dll"; | ||
63 | # $cflags =~ s| /MD| /MT|; | ||
64 | $lib_cflag=" -D_WINDLL -D_DLL"; | ||
65 | $out_def='out32dll_$(TARGETCPU)'; | ||
66 | $tmp_def='tmp32dll_$(TARGETCPU)'; | ||
67 | } | ||
68 | |||
69 | $cflags.=" /Fd$out_def"; | ||
70 | |||
71 | sub do_lib_rule | ||
72 | { | ||
73 | local($objs,$target,$name,$shlib)=@_; | ||
74 | local($ret,$Name); | ||
75 | |||
76 | $taget =~ s/\//$o/g if $o ne '/'; | ||
77 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
78 | |||
79 | # $target="\$(LIB_D)$o$target"; | ||
80 | $ret.="$target: $objs\n"; | ||
81 | if (!$shlib) | ||
82 | { | ||
83 | # $ret.="\t\$(RM) \$(O_$Name)\n"; | ||
84 | $ex =' '; | ||
85 | $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; | ||
86 | } | ||
87 | else | ||
88 | { | ||
89 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; | ||
90 | # $ex.=' winsock.lib coredll.lib $(WCECOMPAT)/lib/wcecompatex.lib'; | ||
91 | $ex.=' winsock.lib $(WCECOMPAT)/lib/wcecompatex.lib'; | ||
92 | $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; | ||
93 | } | ||
94 | $ret.="\n"; | ||
95 | return($ret); | ||
96 | } | ||
97 | |||
98 | sub do_link_rule | ||
99 | { | ||
100 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; | ||
101 | local($ret,$_); | ||
102 | |||
103 | $file =~ s/\//$o/g if $o ne '/'; | ||
104 | $n=&bname($targer); | ||
105 | $ret.="$target: $files $dep_libs\n"; | ||
106 | $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n"; | ||
107 | $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n"; | ||
108 | if (defined $sha1file) | ||
109 | { | ||
110 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
111 | } | ||
112 | $ret.="\n"; | ||
113 | return($ret); | ||
114 | } | ||
115 | |||
116 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/netware.pl b/src/lib/libcrypto/util/pl/netware.pl new file mode 100644 index 0000000000..c78bcfc874 --- /dev/null +++ b/src/lib/libcrypto/util/pl/netware.pl | |||
@@ -0,0 +1,532 @@ | |||
1 | # Metrowerks Codewarrior or gcc / nlmconv for NetWare | ||
2 | # | ||
3 | |||
4 | $version_header = "crypto/opensslv.h"; | ||
5 | open(IN, "$version_header") or die "Couldn't open $version_header: $!"; | ||
6 | while (<IN>) { | ||
7 | if (/^#define[\s\t]+OPENSSL_VERSION_NUMBER[\s\t]+0x(\d)(\d{2})(\d{2})(\d{2})/) | ||
8 | { | ||
9 | # die "OpenSSL version detected: $1.$2.$3.$4\n"; | ||
10 | #$nlmvernum = "$1,$2,$3"; | ||
11 | $nlmvernum = "$1,".($2*10+$3).",".($4*1); | ||
12 | #$nlmverstr = "$1.".($2*1).".".($3*1).($4?(chr(96+$4)):""); | ||
13 | break; | ||
14 | } | ||
15 | } | ||
16 | close(IN) or die "Couldn't close $version_header: $!"; | ||
17 | |||
18 | $readme_file = "README"; | ||
19 | open(IN, $readme_file) or die "Couldn't open $readme_file: $!"; | ||
20 | while (<IN>) { | ||
21 | if (/^[\s\t]+OpenSSL[\s\t]+(\d)\.(\d{1,2})\.(\d{1,2})([a-z])(.*)/) | ||
22 | { | ||
23 | #$nlmvernum = "$1,$2,$3"; | ||
24 | #$nlmvernum = "$1,".($2*10+$3).",".($4*1); | ||
25 | $nlmverstr = "$1.$2.$3$4$5"; | ||
26 | } | ||
27 | elsif (/^[\s\t]+(Copyright \(c\) \d{4}\-\d{4} The OpenSSL Project)$/) | ||
28 | { | ||
29 | $nlmcpystr = $1; | ||
30 | } | ||
31 | break if ($nlmvernum && $nlmcpystr); | ||
32 | } | ||
33 | close(IN) or die "Couldn't close $readme_file: $!"; | ||
34 | |||
35 | # Define stacksize here | ||
36 | $nlmstack = "32768"; | ||
37 | |||
38 | # some default settings here in case we failed to find them in README | ||
39 | $nlmvernum = "1,0,0" if (!$nlmvernum); | ||
40 | $nlmverstr = "OpenSSL" if (!$nlmverstr); | ||
41 | $nlmcpystr = "Copyright (c) 1998-now The OpenSSL Project" if (!$nlmcpystr); | ||
42 | |||
43 | # die "OpenSSL copyright: $nlmcpystr\nOpenSSL verstring: $nlmverstr\nOpenSSL vernumber: $nlmvernum\n"; | ||
44 | |||
45 | # The import files and other misc imports needed to link | ||
46 | @misc_imports = ("GetProcessSwitchCount", "RunningProcess", | ||
47 | "GetSuperHighResolutionTimer"); | ||
48 | if ($LIBC) | ||
49 | { | ||
50 | @import_files = ("libc.imp"); | ||
51 | @module_files = ("libc"); | ||
52 | $libarch = "LIBC"; | ||
53 | } | ||
54 | else | ||
55 | { | ||
56 | # clib build | ||
57 | @import_files = ("clib.imp"); | ||
58 | push(@import_files, "socklib.imp") if ($BSDSOCK); | ||
59 | @module_files = ("clib"); | ||
60 | # push(@misc_imports, "_rt_modu64%16", "_rt_divu64%16"); | ||
61 | $libarch = "CLIB"; | ||
62 | } | ||
63 | if ($BSDSOCK) | ||
64 | { | ||
65 | $libarch .= "-BSD"; | ||
66 | } | ||
67 | else | ||
68 | { | ||
69 | $libarch .= "-WS2"; | ||
70 | push(@import_files, "ws2nlm.imp"); | ||
71 | } | ||
72 | |||
73 | # The "IMPORTS" environment variable must be set and point to the location | ||
74 | # where import files (*.imp) can be found. | ||
75 | # Example: set IMPORTS=c:\ndk\nwsdk\imports | ||
76 | $import_path = $ENV{"IMPORTS"} || die ("IMPORTS environment variable not set\n"); | ||
77 | |||
78 | |||
79 | # The "PRELUDE" environment variable must be set and point to the location | ||
80 | # and name of the prelude source to link with ( nwpre.obj is recommended ). | ||
81 | # Example: set PRELUDE=c:\codewar\novell support\metrowerks support\libraries\runtime\nwpre.obj | ||
82 | $prelude = $ENV{"PRELUDE"} || die ("PRELUDE environment variable not set\n"); | ||
83 | |||
84 | # The "INCLUDES" environment variable must be set and point to the location | ||
85 | # where import files (*.imp) can be found. | ||
86 | $include_path = $ENV{"INCLUDE"} || die ("INCLUDES environment variable not set\n"); | ||
87 | $include_path =~ s/\\/\//g; | ||
88 | $include_path = join(" -I", split(/;/, $include_path)); | ||
89 | |||
90 | # check for gcc compiler | ||
91 | $gnuc = $ENV{"GNUC"}; | ||
92 | |||
93 | #$ssl= "ssleay32"; | ||
94 | #$crypto="libeay32"; | ||
95 | |||
96 | if ($gnuc) | ||
97 | { | ||
98 | # C compiler | ||
99 | $cc='gcc'; | ||
100 | # Linker | ||
101 | $link='nlmconv'; | ||
102 | # librarian | ||
103 | $mklib='ar'; | ||
104 | $o='/'; | ||
105 | # cp command | ||
106 | $cp='cp -af'; | ||
107 | # rm command | ||
108 | $rm='rm -f'; | ||
109 | # mv command | ||
110 | $mv='mv -f'; | ||
111 | # mkdir command | ||
112 | $mkdir='gmkdir'; | ||
113 | #$ranlib='ranlib'; | ||
114 | } | ||
115 | else | ||
116 | { | ||
117 | # C compiler | ||
118 | $cc='mwccnlm'; | ||
119 | # Linker | ||
120 | $link='mwldnlm'; | ||
121 | # librarian | ||
122 | $mklib='mwldnlm'; | ||
123 | # Path separator | ||
124 | $o='\\'; | ||
125 | # cp command | ||
126 | $cp='copy >nul:'; | ||
127 | # rm command | ||
128 | $rm='del /f /q'; | ||
129 | } | ||
130 | |||
131 | # assembler | ||
132 | if ($nw_nasm) | ||
133 | { | ||
134 | $asm=(`nasm -v 2>NUL` gt `nasmw -v 2>NUL`?"nasm":"nasmw"); | ||
135 | if ($gnuc) | ||
136 | { | ||
137 | $asm.=" -s -f elf"; | ||
138 | } | ||
139 | else | ||
140 | { | ||
141 | $asm.=" -s -f coff -d __coff__"; | ||
142 | } | ||
143 | $afile="-o "; | ||
144 | $asm.=" -g" if $debug; | ||
145 | } | ||
146 | elsif ($nw_mwasm) | ||
147 | { | ||
148 | $asm="mwasmnlm -maxerrors 20"; | ||
149 | $afile="-o "; | ||
150 | $asm.=" -g" if $debug; | ||
151 | } | ||
152 | elsif ($nw_masm) | ||
153 | { | ||
154 | # masm assembly settings - it should be possible to use masm but haven't | ||
155 | # got it working. | ||
156 | # $asm='ml /Cp /coff /c /Cx'; | ||
157 | # $asm.=" /Zi" if $debug; | ||
158 | # $afile='/Fo'; | ||
159 | die("Support for masm assembler not yet functional\n"); | ||
160 | } | ||
161 | else | ||
162 | { | ||
163 | $asm=""; | ||
164 | $afile=""; | ||
165 | } | ||
166 | |||
167 | |||
168 | |||
169 | if ($gnuc) | ||
170 | { | ||
171 | # compile flags for GNUC | ||
172 | # additional flags based upon debug | non-debug | ||
173 | if ($debug) | ||
174 | { | ||
175 | $cflags="-g -DDEBUG"; | ||
176 | } | ||
177 | else | ||
178 | { | ||
179 | $cflags="-O2"; | ||
180 | } | ||
181 | $cflags.=" -nostdinc -I$include_path \\ | ||
182 | -fno-builtin -fpcc-struct-return -fno-strict-aliasing \\ | ||
183 | -funsigned-char -Wall -Wno-unused -Wno-uninitialized"; | ||
184 | |||
185 | # link flags | ||
186 | $lflags="-T"; | ||
187 | } | ||
188 | else | ||
189 | { | ||
190 | # compile flags for CodeWarrior | ||
191 | # additional flags based upon debug | non-debug | ||
192 | if ($debug) | ||
193 | { | ||
194 | $cflags="-opt off -g -sym internal -DDEBUG"; | ||
195 | } | ||
196 | else | ||
197 | { | ||
198 | # CodeWarrior compiler has a problem with optimizations for floating | ||
199 | # points - no optimizations until further investigation | ||
200 | # $cflags="-opt all"; | ||
201 | } | ||
202 | |||
203 | # NOTES: Several c files in the crypto subdirectory include headers from | ||
204 | # their local directories. Metrowerks wouldn't find these h files | ||
205 | # without adding individual include directives as compile flags | ||
206 | # or modifying the c files. Instead of adding individual include | ||
207 | # paths for each subdirectory a recursive include directive | ||
208 | # is used ( -ir crypto ). | ||
209 | # | ||
210 | # A similar issue exists for the engines and apps subdirectories. | ||
211 | # | ||
212 | # Turned off the "possible" warnings ( -w nopossible ). Metrowerks | ||
213 | # complained a lot about various stuff. May want to turn back | ||
214 | # on for further development. | ||
215 | $cflags.=" -nostdinc -ir crypto -ir engines -ir apps -I$include_path \\ | ||
216 | -msgstyle gcc -align 4 -processor pentium -char unsigned \\ | ||
217 | -w on -w nolargeargs -w nopossible -w nounusedarg -w nounusedexpr \\ | ||
218 | -w noimplicitconv -relax_pointers -nosyspath -maxerrors 20"; | ||
219 | |||
220 | # link flags | ||
221 | $lflags="-msgstyle gcc -zerobss -nostdlib -sym internal -commandfile"; | ||
222 | } | ||
223 | |||
224 | # common defines | ||
225 | $cflags.=" -DL_ENDIAN -DOPENSSL_SYSNAME_NETWARE -U_WIN32"; | ||
226 | |||
227 | # If LibC build add in NKS_LIBC define and set the entry/exit | ||
228 | # routines - The default entry/exit routines are for CLib and don't exist | ||
229 | # in LibC | ||
230 | if ($LIBC) | ||
231 | { | ||
232 | $cflags.=" -DNETWARE_LIBC"; | ||
233 | $nlmstart = "_LibCPrelude"; | ||
234 | $nlmexit = "_LibCPostlude"; | ||
235 | @nlm_flags = ("pseudopreemption", "flag_on 64"); | ||
236 | } | ||
237 | else | ||
238 | { | ||
239 | $cflags.=" -DNETWARE_CLIB"; | ||
240 | $nlmstart = "_Prelude"; | ||
241 | $nlmexit = "_Stop"; | ||
242 | } | ||
243 | |||
244 | # If BSD Socket support is requested, set a define for the compiler | ||
245 | if ($BSDSOCK) | ||
246 | { | ||
247 | $cflags.=" -DNETWARE_BSDSOCK"; | ||
248 | if (!$LIBC) | ||
249 | { | ||
250 | $cflags.=" -DNETDB_USE_INTERNET"; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | |||
255 | # linking stuff | ||
256 | # for the output directories use the mk1mf.pl values with "_nw" appended | ||
257 | if ($shlib) | ||
258 | { | ||
259 | if ($LIBC) | ||
260 | { | ||
261 | $out_def.="_nw_libc_nlm"; | ||
262 | $tmp_def.="_nw_libc_nlm"; | ||
263 | $inc_def.="_nw_libc_nlm"; | ||
264 | } | ||
265 | else # NETWARE_CLIB | ||
266 | { | ||
267 | $out_def.="_nw_clib_nlm"; | ||
268 | $tmp_def.="_nw_clib_nlm"; | ||
269 | $inc_def.="_nw_clib_nlm"; | ||
270 | } | ||
271 | } | ||
272 | else | ||
273 | { | ||
274 | if ($gnuc) # GNUC Tools | ||
275 | { | ||
276 | $libp=".a"; | ||
277 | $shlibp=".a"; | ||
278 | $lib_flags="-cr"; | ||
279 | } | ||
280 | else # CodeWarrior | ||
281 | { | ||
282 | $libp=".lib"; | ||
283 | $shlibp=".lib"; | ||
284 | $lib_flags="-nodefaults -type library -o"; | ||
285 | } | ||
286 | if ($LIBC) | ||
287 | { | ||
288 | $out_def.="_nw_libc"; | ||
289 | $tmp_def.="_nw_libc"; | ||
290 | $inc_def.="_nw_libc"; | ||
291 | } | ||
292 | else # NETWARE_CLIB | ||
293 | { | ||
294 | $out_def.="_nw_clib"; | ||
295 | $tmp_def.="_nw_clib"; | ||
296 | $inc_def.="_nw_clib"; | ||
297 | } | ||
298 | } | ||
299 | |||
300 | # used by mk1mf.pl | ||
301 | $obj='.o'; | ||
302 | $ofile='-o '; | ||
303 | $efile=''; | ||
304 | $exep='.nlm'; | ||
305 | $ex_libs=''; | ||
306 | |||
307 | if (!$no_asm) | ||
308 | { | ||
309 | $bn_asm_obj="\$(OBJ_D)${o}bn-nw${obj}"; | ||
310 | $bn_asm_src="crypto${o}bn${o}asm${o}bn-nw.asm"; | ||
311 | $bnco_asm_obj="\$(OBJ_D)${o}co-nw${obj}"; | ||
312 | $bnco_asm_src="crypto${o}bn${o}asm${o}co-nw.asm"; | ||
313 | $aes_asm_obj="\$(OBJ_D)${o}a-nw${obj}"; | ||
314 | $aes_asm_src="crypto${o}aes${o}asm${o}a-nw.asm"; | ||
315 | $des_enc_obj="\$(OBJ_D)${o}d-nw${obj} \$(OBJ_D)${o}y-nw${obj}"; | ||
316 | $des_enc_src="crypto${o}des${o}asm${o}d-nw.asm crypto${o}des${o}asm${o}y-nw.asm"; | ||
317 | $bf_enc_obj="\$(OBJ_D)${o}b-nw${obj}"; | ||
318 | $bf_enc_src="crypto${o}bf${o}asm${o}b-nw.asm"; | ||
319 | $cast_enc_obj="\$(OBJ_D)${o}c-nw${obj}"; | ||
320 | $cast_enc_src="crypto${o}cast${o}asm${o}c-nw.asm"; | ||
321 | $rc4_enc_obj="\$(OBJ_D)${o}r4-nw${obj}"; | ||
322 | $rc4_enc_src="crypto${o}rc4${o}asm${o}r4-nw.asm"; | ||
323 | $rc5_enc_obj="\$(OBJ_D)${o}r5-nw${obj}"; | ||
324 | $rc5_enc_src="crypto${o}rc5${o}asm${o}r5-nw.asm"; | ||
325 | $md5_asm_obj="\$(OBJ_D)${o}m5-nw${obj}"; | ||
326 | $md5_asm_src="crypto${o}md5${o}asm${o}m5-nw.asm"; | ||
327 | $sha1_asm_obj="\$(OBJ_D)${o}s1-nw${obj} \$(OBJ_D)${o}sha256-nw${obj} \$(OBJ_D)${o}sha512-nw${obj}"; | ||
328 | $sha1_asm_src="crypto${o}sha${o}asm${o}s1-nw.asm crypto${o}sha${o}asm${o}sha256-nw.asm crypto${o}sha${o}asm${o}sha512-nw.asm"; | ||
329 | $rmd160_asm_obj="\$(OBJ_D)${o}rm-nw${obj}"; | ||
330 | $rmd160_asm_src="crypto${o}ripemd${o}asm${o}rm-nw.asm"; | ||
331 | $whirlpool_asm_obj="\$(OBJ_D)${o}wp-nw${obj}"; | ||
332 | $whirlpool_asm_src="crypto${o}whrlpool${o}asm${o}wp-nw.asm"; | ||
333 | $cpuid_asm_obj="\$(OBJ_D)${o}x86cpuid-nw${obj}"; | ||
334 | $cpuid_asm_src="crypto${o}x86cpuid-nw.asm"; | ||
335 | $cflags.=" -DOPENSSL_CPUID_OBJ -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DMD5_ASM -DWHIRLPOOL_ASM"; | ||
336 | $cflags.=" -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM"; | ||
337 | $cflags.=" -DAES_ASM -DRMD160_ASM"; | ||
338 | } | ||
339 | else | ||
340 | { | ||
341 | $bn_asm_obj=''; | ||
342 | $bn_asm_src=''; | ||
343 | $bnco_asm_obj=''; | ||
344 | $bnco_asm_src=''; | ||
345 | $aes_asm_obj=''; | ||
346 | $aes_asm_src=''; | ||
347 | $des_enc_obj=''; | ||
348 | $des_enc_src=''; | ||
349 | $bf_enc_obj=''; | ||
350 | $bf_enc_src=''; | ||
351 | $cast_enc_obj=''; | ||
352 | $cast_enc_src=''; | ||
353 | $rc4_enc_obj=''; | ||
354 | $rc4_enc_src=''; | ||
355 | $rc5_enc_obj=''; | ||
356 | $rc5_enc_src=''; | ||
357 | $md5_asm_obj=''; | ||
358 | $md5_asm_src=''; | ||
359 | $sha1_asm_obj=''; | ||
360 | $sha1_asm_src=''; | ||
361 | $rmd160_asm_obj=''; | ||
362 | $rmd160_asm_src=''; | ||
363 | $whirlpool_asm_obj=''; | ||
364 | $whirlpool_asm_src=''; | ||
365 | $cpuid_asm_obj=''; | ||
366 | $cpuid_asm_src=''; | ||
367 | } | ||
368 | |||
369 | # create the *.def linker command files in \openssl\netware\ directory | ||
370 | sub do_def_file | ||
371 | { | ||
372 | # strip off the leading path | ||
373 | my($target) = bname(shift); | ||
374 | my($i); | ||
375 | |||
376 | if ($target =~ /(.*).nlm/) | ||
377 | { | ||
378 | $target = $1; | ||
379 | } | ||
380 | |||
381 | # special case for openssl - the mk1mf.pl defines E_EXE = openssl | ||
382 | if ($target =~ /E_EXE/) | ||
383 | { | ||
384 | $target =~ s/\$\(E_EXE\)/openssl/; | ||
385 | } | ||
386 | |||
387 | # Note: originally tried to use full path ( \openssl\netware\$target.def ) | ||
388 | # Metrowerks linker choked on this with an assertion failure. bug??? | ||
389 | # | ||
390 | my($def_file) = "netware${o}$target.def"; | ||
391 | |||
392 | open(DEF_OUT, ">$def_file") || die("unable to open file $def_file\n"); | ||
393 | |||
394 | print( DEF_OUT "# command file generated by netware.pl for NLM target.\n" ); | ||
395 | print( DEF_OUT "# do not edit this file - all your changes will be lost!!\n" ); | ||
396 | print( DEF_OUT "#\n"); | ||
397 | print( DEF_OUT "DESCRIPTION \"$target ($libarch) - OpenSSL $nlmverstr\"\n"); | ||
398 | print( DEF_OUT "COPYRIGHT \"$nlmcpystr\"\n"); | ||
399 | print( DEF_OUT "VERSION $nlmvernum\n"); | ||
400 | print( DEF_OUT "STACK $nlmstack\n"); | ||
401 | print( DEF_OUT "START $nlmstart\n"); | ||
402 | print( DEF_OUT "EXIT $nlmexit\n"); | ||
403 | |||
404 | # special case for openssl | ||
405 | if ($target eq "openssl") | ||
406 | { | ||
407 | print( DEF_OUT "SCREENNAME \"OpenSSL $nlmverstr\"\n"); | ||
408 | } | ||
409 | else | ||
410 | { | ||
411 | print( DEF_OUT "SCREENNAME \"DEFAULT\"\n"); | ||
412 | } | ||
413 | |||
414 | foreach $i (@misc_imports) | ||
415 | { | ||
416 | print( DEF_OUT "IMPORT $i\n"); | ||
417 | } | ||
418 | |||
419 | foreach $i (@import_files) | ||
420 | { | ||
421 | print( DEF_OUT "IMPORT \@$import_path${o}$i\n"); | ||
422 | } | ||
423 | |||
424 | foreach $i (@module_files) | ||
425 | { | ||
426 | print( DEF_OUT "MODULE $i\n"); | ||
427 | } | ||
428 | |||
429 | foreach $i (@nlm_flags) | ||
430 | { | ||
431 | print( DEF_OUT "$i\n"); | ||
432 | } | ||
433 | |||
434 | if ($gnuc) | ||
435 | { | ||
436 | if ($target =~ /openssl/) | ||
437 | { | ||
438 | print( DEF_OUT "INPUT ${tmp_def}${o}openssl${obj}\n"); | ||
439 | print( DEF_OUT "INPUT ${tmp_def}${o}openssl${libp}\n"); | ||
440 | } | ||
441 | else | ||
442 | { | ||
443 | print( DEF_OUT "INPUT ${tmp_def}${o}${target}${obj}\n"); | ||
444 | } | ||
445 | print( DEF_OUT "INPUT $prelude\n"); | ||
446 | print( DEF_OUT "INPUT ${out_def}${o}${ssl}${libp} ${out_def}${o}${crypto}${libp}\n"); | ||
447 | print( DEF_OUT "OUTPUT $target.nlm\n"); | ||
448 | } | ||
449 | |||
450 | close(DEF_OUT); | ||
451 | return($def_file); | ||
452 | } | ||
453 | |||
454 | sub do_lib_rule | ||
455 | { | ||
456 | my($objs,$target,$name,$shlib)=@_; | ||
457 | my($ret); | ||
458 | |||
459 | $ret.="$target: $objs\n"; | ||
460 | if (!$shlib) | ||
461 | { | ||
462 | $ret.="\t\@echo Building Lib: $name\n"; | ||
463 | $ret.="\t\$(MKLIB) $lib_flags $target $objs\n"; | ||
464 | $ret.="\t\@echo .\n" | ||
465 | } | ||
466 | else | ||
467 | { | ||
468 | die( "Building as NLM not currently supported!" ); | ||
469 | } | ||
470 | |||
471 | $ret.="\n"; | ||
472 | return($ret); | ||
473 | } | ||
474 | |||
475 | sub do_link_rule | ||
476 | { | ||
477 | my($target,$files,$dep_libs,$libs)=@_; | ||
478 | my($ret); | ||
479 | my($def_file) = do_def_file($target); | ||
480 | |||
481 | $ret.="$target: $files $dep_libs\n"; | ||
482 | |||
483 | # NOTE: When building the test nlms no screen name is given | ||
484 | # which causes the console screen to be used. By using the console | ||
485 | # screen there is no "<press any key to continue>" message which | ||
486 | # requires user interaction. The test script ( do_tests.pl ) needs | ||
487 | # to be able to run the tests without requiring user interaction. | ||
488 | # | ||
489 | # However, the sample program "openssl.nlm" is used by the tests and is | ||
490 | # a interactive sample so a screen is desired when not be run by the | ||
491 | # tests. To solve the problem, two versions of the program are built: | ||
492 | # openssl2 - no screen used by tests | ||
493 | # openssl - default screen - use for normal interactive modes | ||
494 | # | ||
495 | |||
496 | # special case for openssl - the mk1mf.pl defines E_EXE = openssl | ||
497 | if ($target =~ /E_EXE/) | ||
498 | { | ||
499 | my($target2) = $target; | ||
500 | |||
501 | $target2 =~ s/\(E_EXE\)/\(E_EXE\)2/; | ||
502 | |||
503 | # openssl2 | ||
504 | my($def_file2) = do_def_file($target2); | ||
505 | |||
506 | if ($gnuc) | ||
507 | { | ||
508 | $ret.="\t\$(MKLIB) $lib_flags \$(TMP_D)${o}\$(E_EXE).a \$(filter-out \$(TMP_D)${o}\$(E_EXE)${obj},$files)\n"; | ||
509 | $ret.="\t\$(LINK) \$(LFLAGS) $def_file2\n"; | ||
510 | $ret.="\t\@$mv \$(E_EXE)2.nlm \$(TEST_D)\n"; | ||
511 | } | ||
512 | else | ||
513 | { | ||
514 | $ret.="\t\$(LINK) \$(LFLAGS) $def_file2 $files \"$prelude\" $libs -o $target2\n"; | ||
515 | } | ||
516 | } | ||
517 | if ($gnuc) | ||
518 | { | ||
519 | $ret.="\t\$(LINK) \$(LFLAGS) $def_file\n"; | ||
520 | $ret.="\t\@$mv \$(\@F) \$(TEST_D)\n"; | ||
521 | } | ||
522 | else | ||
523 | { | ||
524 | $ret.="\t\$(LINK) \$(LFLAGS) $def_file $files \"$prelude\" $libs -o $target\n"; | ||
525 | } | ||
526 | |||
527 | $ret.="\n"; | ||
528 | return($ret); | ||
529 | |||
530 | } | ||
531 | |||
532 | 1; | ||