diff options
Diffstat (limited to 'src/lib/libcrypto/util/mk1mf.pl')
-rw-r--r-- | src/lib/libcrypto/util/mk1mf.pl | 590 |
1 files changed, 267 insertions, 323 deletions
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl index 05a6086164..1ac5fd3a50 100644 --- a/src/lib/libcrypto/util/mk1mf.pl +++ b/src/lib/libcrypto/util/mk1mf.pl | |||
@@ -10,19 +10,11 @@ $OPTIONS=""; | |||
10 | $ssl_version=""; | 10 | $ssl_version=""; |
11 | $banner="\t\@echo Building OpenSSL"; | 11 | $banner="\t\@echo Building OpenSSL"; |
12 | 12 | ||
13 | my $no_static_engine = 0; | ||
14 | my $engines = ""; | ||
13 | local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic | 15 | local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic |
14 | local $zlib_lib = ""; | 16 | local $zlib_lib = ""; |
15 | 17 | ||
16 | my $fips_canister_path = ""; | ||
17 | my $fips_premain_dso_exe_path = ""; | ||
18 | my $fips_premain_c_path = ""; | ||
19 | my $fips_sha1_exe_path = ""; | ||
20 | |||
21 | my $fipslibdir = ""; | ||
22 | my $baseaddr = ""; | ||
23 | |||
24 | my $ex_l_libs = ""; | ||
25 | |||
26 | 18 | ||
27 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; | 19 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; |
28 | while(<IN>) { | 20 | while(<IN>) { |
@@ -38,22 +30,21 @@ $infile="MINFO"; | |||
38 | 30 | ||
39 | %ops=( | 31 | %ops=( |
40 | "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", | 32 | "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", |
41 | "VC-WIN32-GMAKE", "Microsoft Visual C++ [4-6] - Windows NT or 9X, GNU make", | 33 | "VC-WIN64I", "Microsoft C/C++ - Win64/IA-64", |
34 | "VC-WIN64A", "Microsoft C/C++ - Win64/x64", | ||
42 | "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", | 35 | "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", |
43 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", | 36 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", |
44 | "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", | ||
45 | "VC-WIN16", "Alias for VC-W31-32", | ||
46 | "VC-W31-32", "Microsoft Visual C++ 1.52 - Windows 3.1 - 386+", | ||
47 | "VC-MSDOS","Microsoft Visual C++ 1.52 - MSDOS", | ||
48 | "Mingw32", "GNU C++ - Windows NT or 9x", | 37 | "Mingw32", "GNU C++ - Windows NT or 9x", |
49 | "Mingw32-files", "Create files with DOS copy ...", | 38 | "Mingw32-files", "Create files with DOS copy ...", |
50 | "BC-NT", "Borland C++ 4.5 - Windows NT", | 39 | "BC-NT", "Borland C++ 4.5 - Windows NT", |
51 | "BC-W31", "Borland C++ 4.5 - Windows 3.1 - PROBABLY NOT WORKING", | ||
52 | "BC-MSDOS","Borland C++ 4.5 - MSDOS", | ||
53 | "linux-elf","Linux elf", | 40 | "linux-elf","Linux elf", |
54 | "ultrix-mips","DEC mips ultrix", | 41 | "ultrix-mips","DEC mips ultrix", |
55 | "FreeBSD","FreeBSD distribution", | 42 | "FreeBSD","FreeBSD distribution", |
56 | "OS2-EMX", "EMX GCC OS/2", | 43 | "OS2-EMX", "EMX GCC OS/2", |
44 | "netware-clib", "CodeWarrior for NetWare - CLib - with WinSock Sockets", | ||
45 | "netware-clib-bsdsock", "CodeWarrior for NetWare - CLib - with BSD Sockets", | ||
46 | "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets", | ||
47 | "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets", | ||
57 | "default","cc under unix", | 48 | "default","cc under unix", |
58 | ); | 49 | ); |
59 | 50 | ||
@@ -73,16 +64,20 @@ and [options] can be one of | |||
73 | no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest | 64 | no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest |
74 | no-ripemd | 65 | no-ripemd |
75 | no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher | 66 | no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher |
76 | no-bf no-cast no-aes | 67 | no-bf no-cast no-aes no-camellia no-seed |
77 | no-rsa no-dsa no-dh - Skip this public key cipher | 68 | no-rsa no-dsa no-dh - Skip this public key cipher |
78 | no-ssl2 no-ssl3 - Skip this version of SSL | 69 | no-ssl2 no-ssl3 - Skip this version of SSL |
79 | just-ssl - remove all non-ssl keys/digest | 70 | just-ssl - remove all non-ssl keys/digest |
80 | no-asm - No x86 asm | 71 | no-asm - No x86 asm |
81 | no-krb5 - No KRB5 | 72 | no-krb5 - No KRB5 |
82 | no-ec - No EC | 73 | no-ec - No EC |
74 | no-ecdsa - No ECDSA | ||
75 | no-ecdh - No ECDH | ||
83 | no-engine - No engine | 76 | no-engine - No engine |
84 | no-hw - No hw | 77 | no-hw - No hw |
85 | nasm - Use NASM for x86 asm | 78 | nasm - Use NASM for x86 asm |
79 | nw-nasm - Use NASM x86 asm for NetWare | ||
80 | nw-mwasm - Use Metrowerks x86 asm for NetWare | ||
86 | gaswin - Use GNU as with Mingw32 | 81 | gaswin - Use GNU as with Mingw32 |
87 | no-socks - No socket code | 82 | no-socks - No socket code |
88 | no-err - No error strings | 83 | no-err - No error strings |
@@ -107,6 +102,8 @@ foreach (grep(!/^$/, split(/ /, $OPTIONS))) | |||
107 | print STDERR "unknown option - $_\n" if !&read_options; | 102 | print STDERR "unknown option - $_\n" if !&read_options; |
108 | } | 103 | } |
109 | 104 | ||
105 | $no_static_engine = 0 if (!$shlib); | ||
106 | |||
110 | $no_mdc2=1 if ($no_des); | 107 | $no_mdc2=1 if ($no_des); |
111 | 108 | ||
112 | $no_ssl3=1 if ($no_md5 || $no_sha); | 109 | $no_ssl3=1 if ($no_md5 || $no_sha); |
@@ -119,13 +116,10 @@ $out_def="out"; | |||
119 | $inc_def="outinc"; | 116 | $inc_def="outinc"; |
120 | $tmp_def="tmp"; | 117 | $tmp_def="tmp"; |
121 | 118 | ||
122 | $mkdir="-mkdir"; | 119 | $perl="perl" unless defined $perl; |
123 | $mkcanister="ld -r -o"; | 120 | $mkdir="-mkdir" unless defined $mkdir; |
124 | |||
125 | $ex_build_targets = ""; | ||
126 | 121 | ||
127 | ($ssl,$crypto)=("ssl","crypto"); | 122 | ($ssl,$crypto)=("ssl","crypto"); |
128 | $cryptocompat = ""; | ||
129 | $ranlib="echo ranlib"; | 123 | $ranlib="echo ranlib"; |
130 | 124 | ||
131 | $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; | 125 | $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; |
@@ -134,40 +128,16 @@ $bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:''; | |||
134 | 128 | ||
135 | # $bin_dir.=$o causes a core dump on my sparc :-( | 129 | # $bin_dir.=$o causes a core dump on my sparc :-( |
136 | 130 | ||
131 | |||
137 | $NT=0; | 132 | $NT=0; |
138 | 133 | ||
139 | push(@INC,"util/pl","pl"); | 134 | push(@INC,"util/pl","pl"); |
140 | if ($platform eq "VC-MSDOS") | 135 | if (($platform =~ /VC-(.+)/)) |
141 | { | ||
142 | $asmbits=16; | ||
143 | $msdos=1; | ||
144 | require 'VC-16.pl'; | ||
145 | } | ||
146 | elsif ($platform eq "VC-W31-16") | ||
147 | { | 136 | { |
148 | $asmbits=16; | 137 | $FLAVOR=$1; |
149 | $msdos=1; $win16=1; | 138 | $NT = 1 if $1 eq "NT"; |
150 | require 'VC-16.pl'; | ||
151 | } | ||
152 | elsif (($platform eq "VC-W31-32") || ($platform eq "VC-WIN16")) | ||
153 | { | ||
154 | $asmbits=32; | ||
155 | $msdos=1; $win16=1; | ||
156 | require 'VC-16.pl'; | ||
157 | } | ||
158 | elsif (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) | ||
159 | { | ||
160 | $NT = 1 if $platform eq "VC-NT"; | ||
161 | require 'VC-32.pl'; | 139 | require 'VC-32.pl'; |
162 | } | 140 | } |
163 | elsif ($platform eq "VC-WIN32-GMAKE") | ||
164 | { | ||
165 | require 'VC-32-GMAKE.pl'; | ||
166 | } | ||
167 | elsif ($platform eq "VC-CE") | ||
168 | { | ||
169 | require 'VC-CE.pl'; | ||
170 | } | ||
171 | elsif ($platform eq "Mingw32") | 141 | elsif ($platform eq "Mingw32") |
172 | { | 142 | { |
173 | require 'Mingw32.pl'; | 143 | require 'Mingw32.pl'; |
@@ -181,23 +151,6 @@ elsif ($platform eq "BC-NT") | |||
181 | $bc=1; | 151 | $bc=1; |
182 | require 'BC-32.pl'; | 152 | require 'BC-32.pl'; |
183 | } | 153 | } |
184 | elsif ($platform eq "BC-W31") | ||
185 | { | ||
186 | $bc=1; | ||
187 | $msdos=1; $w16=1; | ||
188 | require 'BC-16.pl'; | ||
189 | } | ||
190 | elsif ($platform eq "BC-Q16") | ||
191 | { | ||
192 | $msdos=1; $w16=1; $shlib=0; $qw=1; | ||
193 | require 'BC-16.pl'; | ||
194 | } | ||
195 | elsif ($platform eq "BC-MSDOS") | ||
196 | { | ||
197 | $asmbits=16; | ||
198 | $msdos=1; | ||
199 | require 'BC-16.pl'; | ||
200 | } | ||
201 | elsif ($platform eq "FreeBSD") | 154 | elsif ($platform eq "FreeBSD") |
202 | { | 155 | { |
203 | require 'unix.pl'; | 156 | require 'unix.pl'; |
@@ -220,6 +173,13 @@ elsif ($platform eq "OS2-EMX") | |||
220 | $wc=1; | 173 | $wc=1; |
221 | require 'OS2-EMX.pl'; | 174 | require 'OS2-EMX.pl'; |
222 | } | 175 | } |
176 | elsif (($platform eq "netware-clib") || ($platform eq "netware-libc") || | ||
177 | ($platform eq "netware-clib-bsdsock") || ($platform eq "netware-libc-bsdsock")) | ||
178 | { | ||
179 | $LIBC=1 if $platform eq "netware-libc" || $platform eq "netware-libc-bsdsock"; | ||
180 | $BSDSOCK=1 if ($platform eq "netware-libc-bsdsock") || ($platform eq "netware-clib-bsdsock"); | ||
181 | require 'netware.pl'; | ||
182 | } | ||
223 | else | 183 | else |
224 | { | 184 | { |
225 | require "unix.pl"; | 185 | require "unix.pl"; |
@@ -238,6 +198,8 @@ $cflags= "$xcflags$cflags" if $xcflags ne ""; | |||
238 | 198 | ||
239 | $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; | 199 | $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; |
240 | $cflags.=" -DOPENSSL_NO_AES" if $no_aes; | 200 | $cflags.=" -DOPENSSL_NO_AES" if $no_aes; |
201 | $cflags.=" -DOPENSSL_NO_CAMELLIA" if $no_camellia; | ||
202 | $cflags.=" -DOPENSSL_NO_SEED" if $no_seed; | ||
241 | $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; | 203 | $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; |
242 | $cflags.=" -DOPENSSL_NO_RC4" if $no_rc4; | 204 | $cflags.=" -DOPENSSL_NO_RC4" if $no_rc4; |
243 | $cflags.=" -DOPENSSL_NO_RC5" if $no_rc5; | 205 | $cflags.=" -DOPENSSL_NO_RC5" if $no_rc5; |
@@ -248,7 +210,7 @@ $cflags.=" -DOPENSSL_NO_SHA" if $no_sha; | |||
248 | $cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; | 210 | $cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; |
249 | $cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd; | 211 | $cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd; |
250 | $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; | 212 | $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; |
251 | $cflags.=" -DOPENSSL_NO_BF" if $no_bf; | 213 | $cflags.=" -DOPENSSL_NO_BF" if $no_bf; |
252 | $cflags.=" -DOPENSSL_NO_CAST" if $no_cast; | 214 | $cflags.=" -DOPENSSL_NO_CAST" if $no_cast; |
253 | $cflags.=" -DOPENSSL_NO_DES" if $no_des; | 215 | $cflags.=" -DOPENSSL_NO_DES" if $no_des; |
254 | $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; | 216 | $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; |
@@ -257,17 +219,30 @@ $cflags.=" -DOPENSSL_NO_DH" if $no_dh; | |||
257 | $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock; | 219 | $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock; |
258 | $cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2; | 220 | $cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2; |
259 | $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; | 221 | $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; |
222 | $cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext; | ||
223 | $cflags.=" -DOPENSSL_NO_CMS" if $no_cms; | ||
260 | $cflags.=" -DOPENSSL_NO_ERR" if $no_err; | 224 | $cflags.=" -DOPENSSL_NO_ERR" if $no_err; |
261 | $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; | 225 | $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; |
262 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; | 226 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; |
227 | $cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa; | ||
228 | $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; | ||
263 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; | 229 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; |
264 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; | 230 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; |
265 | $cflags.=" -DOPENSSL_FIPS" if $fips; | ||
266 | #$cflags.=" -DRSAref" if $rsaref ne ""; | ||
267 | 231 | ||
268 | $cflags.= " -DZLIB" if $zlib_opt; | 232 | $cflags.= " -DZLIB" if $zlib_opt; |
269 | $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; | 233 | $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; |
270 | 234 | ||
235 | if ($no_static_engine) | ||
236 | { | ||
237 | $cflags .= " -DOPENSSL_NO_STATIC_ENGINE"; | ||
238 | } | ||
239 | else | ||
240 | { | ||
241 | $cflags .= " -DOPENSSL_NO_DYNAMIC_ENGINE"; | ||
242 | } | ||
243 | |||
244 | #$cflags.=" -DRSAref" if $rsaref ne ""; | ||
245 | |||
271 | ## if ($unix) | 246 | ## if ($unix) |
272 | ## { $cflags="$c_flags" if ($c_flags ne ""); } | 247 | ## { $cflags="$c_flags" if ($c_flags ne ""); } |
273 | ##else | 248 | ##else |
@@ -305,21 +280,11 @@ for (;;) | |||
305 | { | 280 | { |
306 | if ($lib ne "") | 281 | if ($lib ne "") |
307 | { | 282 | { |
308 | if ($fips && $dir =~ /^fips/) | 283 | $uc=$lib; |
309 | { | 284 | $uc =~ s/^lib(.*)\.a/$1/; |
310 | $uc = "FIPS"; | 285 | $uc =~ tr/a-z/A-Z/; |
311 | } | 286 | $lib_nam{$uc}=$uc; |
312 | else | 287 | $lib_obj{$uc}.=$libobj." "; |
313 | { | ||
314 | $uc=$lib; | ||
315 | $uc =~ s/^lib(.*)\.a/$1/; | ||
316 | $uc =~ tr/a-z/A-Z/; | ||
317 | } | ||
318 | if (($uc ne "FIPS") || $fips_canister_build) | ||
319 | { | ||
320 | $lib_nam{$uc}=$uc; | ||
321 | $lib_obj{$uc}.=$libobj." "; | ||
322 | } | ||
323 | } | 288 | } |
324 | last if ($val eq "FINISHED"); | 289 | last if ($val eq "FINISHED"); |
325 | $lib=""; | 290 | $lib=""; |
@@ -340,10 +305,10 @@ for (;;) | |||
340 | { $ex_libs .= " $val" if $val ne "";} | 305 | { $ex_libs .= " $val" if $val ne "";} |
341 | 306 | ||
342 | if ($key eq "TEST") | 307 | if ($key eq "TEST") |
343 | { $test.=&var_add($dir,$val); } | 308 | { $test.=&var_add($dir,$val, 0); } |
344 | 309 | ||
345 | if (($key eq "PROGS") || ($key eq "E_OBJ")) | 310 | if (($key eq "PROGS") || ($key eq "E_OBJ")) |
346 | { $e_exe.=&var_add($dir,$val); } | 311 | { $e_exe.=&var_add($dir,$val, 0); } |
347 | 312 | ||
348 | if ($key eq "LIB") | 313 | if ($key eq "LIB") |
349 | { | 314 | { |
@@ -352,74 +317,45 @@ for (;;) | |||
352 | } | 317 | } |
353 | 318 | ||
354 | if ($key eq "EXHEADER") | 319 | if ($key eq "EXHEADER") |
355 | { $exheader.=&var_add($dir,$val); } | 320 | { $exheader.=&var_add($dir,$val, 1); } |
356 | 321 | ||
357 | if ($key eq "HEADER") | 322 | if ($key eq "HEADER") |
358 | { $header.=&var_add($dir,$val); } | 323 | { $header.=&var_add($dir,$val, 1); } |
359 | |||
360 | if ($key eq "LIBOBJ") | ||
361 | { $libobj=&var_add($dir,$val); } | ||
362 | 324 | ||
363 | if ($key eq "FIPSLIBDIR") | 325 | if ($key eq "LIBOBJ" && ($dir ne "engines" || !$no_static_engine)) |
364 | { $fipslibdir=$val;} | 326 | { $libobj=&var_add($dir,$val, 0); } |
365 | 327 | if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine) | |
366 | if ($key eq "BASEADDR") | 328 | { $engines.=$val } |
367 | { $baseaddr=$val;} | ||
368 | 329 | ||
369 | if (!($_=<IN>)) | 330 | if (!($_=<IN>)) |
370 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } | 331 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } |
371 | } | 332 | } |
372 | close(IN); | 333 | close(IN); |
373 | 334 | ||
374 | if ($fips_canister_path eq "") | 335 | if ($shlib) |
375 | { | ||
376 | $fips_canister_path = "\$(FIPSLIB_D)${o}fipscanister.o"; | ||
377 | } | ||
378 | |||
379 | if ($fips_premain_c_path eq "") | ||
380 | { | 336 | { |
381 | $fips_premain_c_path = "\$(FIPSLIB_D)${o}fips_premain.c"; | 337 | $extra_install= <<"EOF"; |
382 | } | 338 | \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}bin\" |
383 | 339 | \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}bin\" | |
384 | if ($fips) | 340 | \$(CP) \"\$(L_SSL)\" \"\$(INSTALLTOP)${o}lib\" |
385 | { | 341 | \$(CP) \"\$(L_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" |
386 | if ($fips_sha1_exe_path eq "") | 342 | EOF |
343 | if ($no_static_engine) | ||
387 | { | 344 | { |
388 | $fips_sha1_exe_path = | 345 | $extra_install .= <<"EOF" |
389 | "\$(BIN_D)${o}fips_standalone_sha1$exep"; | 346 | \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\" |
347 | \$(CP) \"\$(E_SHLIB)\" \"\$(INSTALLTOP)${o}lib${o}engines\" | ||
348 | EOF | ||
390 | } | 349 | } |
391 | } | 350 | } |
392 | else | 351 | else |
393 | { | ||
394 | $fips_sha1_exe_path = ""; | ||
395 | } | ||
396 | |||
397 | if ($fips_premain_dso_exe_path eq "") | ||
398 | { | ||
399 | $fips_premain_dso_exe_path = "\$(BIN_D)${o}fips_premain_dso$exep"; | ||
400 | } | ||
401 | |||
402 | # $ex_build_targets .= "\$(BIN_D)${o}\$(E_PREMAIN_DSO)$exep" if ($fips); | ||
403 | |||
404 | if ($fips) | ||
405 | { | 352 | { |
406 | if (!$shlib) | 353 | $extra_install= <<"EOF"; |
407 | { | 354 | \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}lib\" |
408 | $ex_build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)"; | 355 | \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" |
409 | $ex_l_libs .= " \$(O_FIPSCANISTER)"; | 356 | EOF |
410 | } | 357 | $ex_libs .= " $zlib_lib" if $zlib_opt == 1; |
411 | if ($fipslibdir eq "") | ||
412 | { | ||
413 | open (IN, "util/fipslib_path.txt") || fipslib_error(); | ||
414 | $fipslibdir = <IN>; | ||
415 | chomp $fipslibdir; | ||
416 | close IN; | ||
417 | } | ||
418 | fips_check_files($fipslibdir, | ||
419 | "fipscanister.o", "fipscanister.o.sha1", | ||
420 | "fips_premain.c", "fips_premain.c.sha1"); | ||
421 | } | 358 | } |
422 | |||
423 | 359 | ||
424 | $defs= <<"EOF"; | 360 | $defs= <<"EOF"; |
425 | # This makefile has been automatically generated from the OpenSSL distribution. | 361 | # This makefile has been automatically generated from the OpenSSL distribution. |
@@ -439,15 +375,6 @@ EOF | |||
439 | 375 | ||
440 | $defs .= $preamble if defined $preamble; | 376 | $defs .= $preamble if defined $preamble; |
441 | 377 | ||
442 | if ($platform eq "VC-CE") | ||
443 | { | ||
444 | $defs.= <<"EOF"; | ||
445 | !INCLUDE <\$(WCECOMPAT)/wcedefs.mak> | ||
446 | |||
447 | EOF | ||
448 | $ex_libs .= " $zlib_lib" if $zlib_opt == 1; | ||
449 | } | ||
450 | |||
451 | $defs.= <<"EOF"; | 378 | $defs.= <<"EOF"; |
452 | INSTALLTOP=$INSTALLTOP | 379 | INSTALLTOP=$INSTALLTOP |
453 | 380 | ||
@@ -468,10 +395,11 @@ EX_LIBS=$ex_libs | |||
468 | SRC_D=$src_dir | 395 | SRC_D=$src_dir |
469 | 396 | ||
470 | LINK=$link | 397 | LINK=$link |
471 | PERL=perl | ||
472 | FIPSLINK=\$(PERL) util${o}fipslink.pl | ||
473 | LFLAGS=$lflags | 398 | LFLAGS=$lflags |
399 | RSC=$rsc | ||
474 | 400 | ||
401 | AES_ASM_OBJ=$aes_asm_obj | ||
402 | AES_ASM_SRC=$aes_asm_src | ||
475 | BN_ASM_OBJ=$bn_asm_obj | 403 | BN_ASM_OBJ=$bn_asm_obj |
476 | BN_ASM_SRC=$bn_asm_src | 404 | BN_ASM_SRC=$bn_asm_src |
477 | BNCO_ASM_OBJ=$bnco_asm_obj | 405 | BNCO_ASM_OBJ=$bnco_asm_obj |
@@ -492,6 +420,8 @@ SHA1_ASM_OBJ=$sha1_asm_obj | |||
492 | SHA1_ASM_SRC=$sha1_asm_src | 420 | SHA1_ASM_SRC=$sha1_asm_src |
493 | RMD160_ASM_OBJ=$rmd160_asm_obj | 421 | RMD160_ASM_OBJ=$rmd160_asm_obj |
494 | RMD160_ASM_SRC=$rmd160_asm_src | 422 | RMD160_ASM_SRC=$rmd160_asm_src |
423 | CPUID_ASM_OBJ=$cpuid_asm_obj | ||
424 | CPUID_ASM_SRC=$cpuid_asm_src | ||
495 | 425 | ||
496 | # The output directory for everything intersting | 426 | # The output directory for everything intersting |
497 | OUT_D=$out_dir | 427 | OUT_D=$out_dir |
@@ -501,9 +431,7 @@ TMP_D=$tmp_dir | |||
501 | INC_D=$inc_dir | 431 | INC_D=$inc_dir |
502 | INCO_D=$inc_dir${o}openssl | 432 | INCO_D=$inc_dir${o}openssl |
503 | 433 | ||
504 | # Directory containing FIPS module | 434 | PERL=$perl |
505 | |||
506 | |||
507 | CP=$cp | 435 | CP=$cp |
508 | RM=$rm | 436 | RM=$rm |
509 | RANLIB=$ranlib | 437 | RANLIB=$ranlib |
@@ -511,18 +439,6 @@ MKDIR=$mkdir | |||
511 | MKLIB=$bin_dir$mklib | 439 | MKLIB=$bin_dir$mklib |
512 | MLFLAGS=$mlflags | 440 | MLFLAGS=$mlflags |
513 | ASM=$bin_dir$asm | 441 | ASM=$bin_dir$asm |
514 | MKCANISTER=$mkcanister | ||
515 | |||
516 | # FIPS validated module and support file locations | ||
517 | |||
518 | E_PREMAIN_DSO=fips_premain_dso | ||
519 | |||
520 | FIPSLIB_D=$fipslibdir | ||
521 | BASEADDR=$baseaddr | ||
522 | FIPS_PREMAIN_SRC=$fips_premain_c_path | ||
523 | O_FIPSCANISTER=$fips_canister_path | ||
524 | FIPS_SHA1_EXE=$fips_sha1_exe_path | ||
525 | PREMAIN_DSO_EXE=$fips_premain_dso_exe_path | ||
526 | 442 | ||
527 | ###################################################### | 443 | ###################################################### |
528 | # You should not need to touch anything below this point | 444 | # You should not need to touch anything below this point |
@@ -535,12 +451,14 @@ CRYPTO=$crypto | |||
535 | # BIN_D - Binary output directory | 451 | # BIN_D - Binary output directory |
536 | # TEST_D - Binary test file output directory | 452 | # TEST_D - Binary test file output directory |
537 | # LIB_D - library output directory | 453 | # LIB_D - library output directory |
454 | # ENG_D - dynamic engine output directory | ||
538 | # Note: if you change these point to different directories then uncomment out | 455 | # Note: if you change these point to different directories then uncomment out |
539 | # the lines around the 'NB' comment below. | 456 | # the lines around the 'NB' comment below. |
540 | # | 457 | # |
541 | BIN_D=\$(OUT_D) | 458 | BIN_D=\$(OUT_D) |
542 | TEST_D=\$(OUT_D) | 459 | TEST_D=\$(OUT_D) |
543 | LIB_D=\$(OUT_D) | 460 | LIB_D=\$(OUT_D) |
461 | ENG_D=\$(OUT_D) | ||
544 | 462 | ||
545 | # INCL_D - local library directory | 463 | # INCL_D - local library directory |
546 | # OBJ_D - temp object file directory | 464 | # OBJ_D - temp object file directory |
@@ -554,7 +472,7 @@ SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp | |||
554 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp | 472 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp |
555 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp | 473 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp |
556 | 474 | ||
557 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs | 475 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) |
558 | 476 | ||
559 | ###################################################### | 477 | ###################################################### |
560 | # Don't touch anything below this point | 478 | # Don't touch anything below this point |
@@ -564,19 +482,19 @@ INC=-I\$(INC_D) -I\$(INCL_D) | |||
564 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) | 482 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) |
565 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) | 483 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) |
566 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) | 484 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) |
567 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) $ex_libs_dep | 485 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) |
568 | 486 | ||
569 | ############################################# | 487 | ############################################# |
570 | EOF | 488 | EOF |
571 | 489 | ||
572 | $rules=<<"EOF"; | 490 | $rules=<<"EOF"; |
573 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers \$(FIPS_SHA1_EXE) lib exe $ex_build_targets | 491 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe |
574 | 492 | ||
575 | banner: | 493 | banner: |
576 | $banner | 494 | $banner |
577 | 495 | ||
578 | \$(TMP_D): | 496 | \$(TMP_D): |
579 | \$(MKDIR) \$(TMP_D) | 497 | \$(MKDIR) \"\$(TMP_D)\" |
580 | # NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different | 498 | # NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different |
581 | #\$(BIN_D): | 499 | #\$(BIN_D): |
582 | # \$(MKDIR) \$(BIN_D) | 500 | # \$(MKDIR) \$(BIN_D) |
@@ -585,31 +503,36 @@ $banner | |||
585 | # \$(MKDIR) \$(TEST_D) | 503 | # \$(MKDIR) \$(TEST_D) |
586 | 504 | ||
587 | \$(LIB_D): | 505 | \$(LIB_D): |
588 | \$(MKDIR) \$(LIB_D) | 506 | \$(MKDIR) \"\$(LIB_D)\" |
589 | 507 | ||
590 | \$(INCO_D): \$(INC_D) | 508 | \$(INCO_D): \$(INC_D) |
591 | \$(MKDIR) \$(INCO_D) | 509 | \$(MKDIR) \"\$(INCO_D)\" |
592 | 510 | ||
593 | \$(INC_D): | 511 | \$(INC_D): |
594 | \$(MKDIR) \$(INC_D) | 512 | \$(MKDIR) \"\$(INC_D)\" |
595 | 513 | ||
596 | headers: \$(HEADER) \$(EXHEADER) | 514 | headers: \$(HEADER) \$(EXHEADER) |
597 | @ | 515 | @ |
598 | 516 | ||
599 | lib: \$(LIBS_DEP) | 517 | lib: \$(LIBS_DEP) \$(E_SHLIB) |
600 | 518 | ||
601 | exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep | 519 | exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep |
602 | 520 | ||
603 | install: | 521 | install: all |
604 | \$(MKDIR) \$(INSTALLTOP) | 522 | \$(MKDIR) \"\$(INSTALLTOP)\" |
605 | \$(MKDIR) \$(INSTALLTOP)${o}bin | 523 | \$(MKDIR) \"\$(INSTALLTOP)${o}bin\" |
606 | \$(MKDIR) \$(INSTALLTOP)${o}include | 524 | \$(MKDIR) \"\$(INSTALLTOP)${o}include\" |
607 | \$(MKDIR) \$(INSTALLTOP)${o}include${o}openssl | 525 | \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\" |
608 | \$(MKDIR) \$(INSTALLTOP)${o}lib | 526 | \$(MKDIR) \"\$(INSTALLTOP)${o}lib\" |
609 | \$(CP) \$(INCO_D)${o}*.\[ch\] \$(INSTALLTOP)${o}include${o}openssl | 527 | \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\" |
610 | \$(CP) \$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin | 528 | \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep\" \"\$(INSTALLTOP)${o}bin\" |
611 | \$(CP) \$(O_SSL) \$(INSTALLTOP)${o}lib | 529 | \$(CP) \"apps${o}openssl.cnf\" \"\$(INSTALLTOP)\" |
612 | \$(CP) \$(O_CRYPTO) \$(INSTALLTOP)${o}lib | 530 | $extra_install |
531 | |||
532 | |||
533 | test: \$(T_EXE) | ||
534 | cd \$(BIN_D) | ||
535 | ..${o}ms${o}test | ||
613 | 536 | ||
614 | clean: | 537 | clean: |
615 | \$(RM) \$(TMP_D)$o*.* | 538 | \$(RM) \$(TMP_D)$o*.* |
@@ -668,11 +591,11 @@ foreach (split(/\s+/,$exheader)){ $h{$_}=1; } | |||
668 | foreach (split(/\s+/,$header)) { $h.=$_." " unless $h{$_}; } | 591 | foreach (split(/\s+/,$header)) { $h.=$_." " unless $h{$_}; } |
669 | chop($h); $header=$h; | 592 | chop($h); $header=$h; |
670 | 593 | ||
671 | $defs.=&do_defs("HEADER",$header,"\$(INCL_D)",".h"); | 594 | $defs.=&do_defs("HEADER",$header,"\$(INCL_D)",""); |
672 | $rules.=&do_copy_rule("\$(INCL_D)",$header,".h"); | 595 | $rules.=&do_copy_rule("\$(INCL_D)",$header,""); |
673 | 596 | ||
674 | $defs.=&do_defs("EXHEADER",$exheader,"\$(INCO_D)",".h"); | 597 | $defs.=&do_defs("EXHEADER",$exheader,"\$(INCO_D)",""); |
675 | $rules.=&do_copy_rule("\$(INCO_D)",$exheader,".h"); | 598 | $rules.=&do_copy_rule("\$(INCO_D)",$exheader,""); |
676 | 599 | ||
677 | $defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj); | 600 | $defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj); |
678 | $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); | 601 | $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); |
@@ -680,29 +603,6 @@ $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); | |||
680 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); | 603 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); |
681 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); | 604 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); |
682 | 605 | ||
683 | # Special case rules for fips_start and fips_end fips_premain_dso | ||
684 | |||
685 | if ($fips) | ||
686 | { | ||
687 | if ($fips_canister_build) | ||
688 | { | ||
689 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_start$obj", | ||
690 | "fips-1.0${o}fips_canister.c", | ||
691 | "-DFIPS_START \$(SHLIB_CFLAGS)"); | ||
692 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_end$obj", | ||
693 | "fips-1.0${o}fips_canister.c", "\$(SHLIB_CFLAGS)"); | ||
694 | } | ||
695 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_standalone_sha1$obj", | ||
696 | "fips-1.0${o}sha${o}fips_standalone_sha1.c", | ||
697 | "\$(SHLIB_CFLAGS)"); | ||
698 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_sha1dgst$obj", | ||
699 | "fips-1.0${o}sha${o}fips_sha1dgst.c", | ||
700 | "\$(SHLIB_CFLAGS)") unless $fips_canister_build; | ||
701 | $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj", | ||
702 | "fips-1.0${o}fips_premain.c", | ||
703 | "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)"); | ||
704 | } | ||
705 | |||
706 | foreach (values %lib_nam) | 606 | foreach (values %lib_nam) |
707 | { | 607 | { |
708 | $lib_obj=$lib_obj{$_}; | 608 | $lib_obj=$lib_obj{$_}; |
@@ -713,7 +613,12 @@ foreach (values %lib_nam) | |||
713 | $rules.="\$(O_SSL):\n\n"; | 613 | $rules.="\$(O_SSL):\n\n"; |
714 | next; | 614 | next; |
715 | } | 615 | } |
716 | 616 | if (($aes_asm_obj ne "") && ($_ eq "CRYPTO")) | |
617 | { | ||
618 | $lib_obj =~ s/\s(\S*\/aes_core\S*)/ \$(AES_ASM_OBJ)/; | ||
619 | $lib_obj =~ s/\s\S*\/aes_cbc\S*//; | ||
620 | $rules.=&do_asm_rule($aes_asm_obj,$aes_asm_src); | ||
621 | } | ||
717 | if (($bn_asm_obj ne "") && ($_ eq "CRYPTO")) | 622 | if (($bn_asm_obj ne "") && ($_ eq "CRYPTO")) |
718 | { | 623 | { |
719 | $lib_obj =~ s/\s\S*\/bn_asm\S*/ \$(BN_ASM_OBJ)/; | 624 | $lib_obj =~ s/\s\S*\/bn_asm\S*/ \$(BN_ASM_OBJ)/; |
@@ -765,11 +670,28 @@ foreach (values %lib_nam) | |||
765 | $lib_obj =~ s/\s(\S*\/rmd_dgst\S*)/ $1 \$(RMD160_ASM_OBJ)/; | 670 | $lib_obj =~ s/\s(\S*\/rmd_dgst\S*)/ $1 \$(RMD160_ASM_OBJ)/; |
766 | $rules.=&do_asm_rule($rmd160_asm_obj,$rmd160_asm_src); | 671 | $rules.=&do_asm_rule($rmd160_asm_obj,$rmd160_asm_src); |
767 | } | 672 | } |
673 | if (($cpuid_asm_obj ne "") && ($_ eq "CRYPTO")) | ||
674 | { | ||
675 | $lib_obj =~ s/\s(\S*\/cversion\S*)/ $1 \$(CPUID_ASM_OBJ)/; | ||
676 | $rules.=&do_asm_rule($cpuid_asm_obj,$cpuid_asm_src); | ||
677 | } | ||
768 | $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj); | 678 | $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj); |
769 | $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)"; | 679 | $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)"; |
770 | $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib); | 680 | $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib); |
771 | } | 681 | } |
772 | 682 | ||
683 | # hack to add version info on MSVC | ||
684 | if (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) { | ||
685 | $rules.= <<"EOF"; | ||
686 | \$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc | ||
687 | \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc | ||
688 | |||
689 | \$(OBJ_D)\\\$(SSL).res: ms\\version32.rc | ||
690 | \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc | ||
691 | |||
692 | EOF | ||
693 | } | ||
694 | |||
773 | $defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep); | 695 | $defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep); |
774 | foreach (split(/\s+/,$test)) | 696 | foreach (split(/\s+/,$test)) |
775 | { | 697 | { |
@@ -778,42 +700,20 @@ foreach (split(/\s+/,$test)) | |||
778 | $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | 700 | $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); |
779 | } | 701 | } |
780 | 702 | ||
781 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); | 703 | $defs.=&do_defs("E_SHLIB",$engines,"\$(ENG_D)",$shlibp); |
782 | |||
783 | 704 | ||
784 | if ($fips) | 705 | foreach (split(/\s+/,$engines)) |
785 | { | ||
786 | if ($shlib) | ||
787 | { | ||
788 | $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)", | ||
789 | "\$(O_CRYPTO)", | ||
790 | "$crypto", | ||
791 | $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)"); | ||
792 | } | ||
793 | else | ||
794 | { | ||
795 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)", | ||
796 | "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", ""); | ||
797 | $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)", | ||
798 | "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", ""); | ||
799 | } | ||
800 | } | ||
801 | else | ||
802 | { | 706 | { |
803 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib, | 707 | $rules.=&do_compile_rule("\$(OBJ_D)","engines${o}e_$_",$lib); |
804 | "\$(SO_CRYPTO)"); | 708 | $rules.= &do_lib_rule("\$(OBJ_D)${o}e_${_}.obj","\$(ENG_D)$o$_$shlibp","",$shlib,""); |
805 | } | 709 | } |
806 | 710 | ||
807 | 711 | ||
808 | if ($fips) | ||
809 | { | ||
810 | $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)", "\$(OBJ_D)${o}fips_start$obj \$(FIPSOBJ) \$(OBJ_D)${o}fips_end$obj", "\$(FIPSLIB_D)${o}fips_standalone_sha1$exep", "") if $fips_canister_build; | ||
811 | $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1); | ||
812 | |||
813 | $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)","\$(OBJ_D)${o}fips_standalone_sha1$obj \$(OBJ_D)${o}fips_sha1dgst$obj","","", 1); | ||
814 | } | ||
815 | 712 | ||
816 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)",0); | 713 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); |
714 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); | ||
715 | |||
716 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | ||
817 | 717 | ||
818 | print $defs; | 718 | print $defs; |
819 | 719 | ||
@@ -833,13 +733,15 @@ print $rules; | |||
833 | # directories | 733 | # directories |
834 | sub var_add | 734 | sub var_add |
835 | { | 735 | { |
836 | local($dir,$val)=@_; | 736 | local($dir,$val,$keepext)=@_; |
837 | local(@a,$_,$ret); | 737 | local(@a,$_,$ret); |
838 | 738 | ||
839 | return("") if $no_engine && $dir =~ /\/engine/; | 739 | return("") if $no_engine && $dir =~ /\/engine/; |
840 | return("") if $no_hw && $dir =~ /\/hw/; | 740 | return("") if $no_hw && $dir =~ /\/hw/; |
841 | return("") if $no_idea && $dir =~ /\/idea/; | 741 | return("") if $no_idea && $dir =~ /\/idea/; |
842 | return("") if $no_aes && $dir =~ /\/aes/; | 742 | return("") if $no_aes && $dir =~ /\/aes/; |
743 | return("") if $no_camellia && $dir =~ /\/camellia/; | ||
744 | return("") if $no_seed && $dir =~ /\/seed/; | ||
843 | return("") if $no_rc2 && $dir =~ /\/rc2/; | 745 | return("") if $no_rc2 && $dir =~ /\/rc2/; |
844 | return("") if $no_rc4 && $dir =~ /\/rc4/; | 746 | return("") if $no_rc4 && $dir =~ /\/rc4/; |
845 | return("") if $no_rc5 && $dir =~ /\/rc5/; | 747 | return("") if $no_rc5 && $dir =~ /\/rc5/; |
@@ -848,6 +750,7 @@ sub var_add | |||
848 | return("") if $no_dsa && $dir =~ /\/dsa/; | 750 | return("") if $no_dsa && $dir =~ /\/dsa/; |
849 | return("") if $no_dh && $dir =~ /\/dh/; | 751 | return("") if $no_dh && $dir =~ /\/dh/; |
850 | return("") if $no_ec && $dir =~ /\/ec/; | 752 | return("") if $no_ec && $dir =~ /\/ec/; |
753 | return("") if $no_cms && $dir =~ /\/cms/; | ||
851 | if ($no_des && $dir =~ /\/des/) | 754 | if ($no_des && $dir =~ /\/des/) |
852 | { | 755 | { |
853 | if ($val =~ /read_pwd/) | 756 | if ($val =~ /read_pwd/) |
@@ -862,7 +765,7 @@ sub var_add | |||
862 | 765 | ||
863 | $val =~ s/^\s*(.*)\s*$/$1/; | 766 | $val =~ s/^\s*(.*)\s*$/$1/; |
864 | @a=split(/\s+/,$val); | 767 | @a=split(/\s+/,$val); |
865 | grep(s/\.[och]$//,@a); | 768 | grep(s/\.[och]$//,@a) unless $keepext; |
866 | 769 | ||
867 | @a=grep(!/^e_.*_3d$/,@a) if $no_des; | 770 | @a=grep(!/^e_.*_3d$/,@a) if $no_des; |
868 | @a=grep(!/^e_.*_d$/,@a) if $no_des; | 771 | @a=grep(!/^e_.*_d$/,@a) if $no_des; |
@@ -873,6 +776,8 @@ sub var_add | |||
873 | @a=grep(!/^e_.*_bf$/,@a) if $no_bf; | 776 | @a=grep(!/^e_.*_bf$/,@a) if $no_bf; |
874 | @a=grep(!/^e_.*_c$/,@a) if $no_cast; | 777 | @a=grep(!/^e_.*_c$/,@a) if $no_cast; |
875 | @a=grep(!/^e_rc4$/,@a) if $no_rc4; | 778 | @a=grep(!/^e_rc4$/,@a) if $no_rc4; |
779 | @a=grep(!/^e_camellia$/,@a) if $no_camellia; | ||
780 | @a=grep(!/^e_seed$/,@a) if $no_seed; | ||
876 | 781 | ||
877 | @a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2; | 782 | @a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2; |
878 | @a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3; | 783 | @a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3; |
@@ -956,13 +861,23 @@ sub do_defs | |||
956 | elsif ($_ =~ /RC5_ENC/) { $t="$_ "; } | 861 | elsif ($_ =~ /RC5_ENC/) { $t="$_ "; } |
957 | elsif ($_ =~ /MD5_ASM/) { $t="$_ "; } | 862 | elsif ($_ =~ /MD5_ASM/) { $t="$_ "; } |
958 | elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; } | 863 | elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; } |
864 | elsif ($_ =~ /AES_ASM/){ $t="$_ "; } | ||
959 | elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; } | 865 | elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; } |
866 | elsif ($_ =~ /CPUID_ASM/){ $t="$_ "; } | ||
960 | else { $t="$location${o}$_$pf "; } | 867 | else { $t="$location${o}$_$pf "; } |
961 | 868 | ||
962 | $Vars{$var}.="$t "; | 869 | $Vars{$var}.="$t "; |
963 | $ret.=$t; | 870 | $ret.=$t; |
964 | } | 871 | } |
965 | chop($ret); | 872 | # hack to add version info on MSVC |
873 | if ($shlib && (($platform eq "VC-WIN32") || ($platform eq "VC-NT"))) | ||
874 | { | ||
875 | if ($var eq "CRYPTOOBJ") | ||
876 | { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; } | ||
877 | elsif ($var eq "SSLOBJ") | ||
878 | { $ret.="\$(OBJ_D)\\\$(SSL).res "; } | ||
879 | } | ||
880 | chomp($ret); | ||
966 | $ret.="\n\n"; | 881 | $ret.="\n\n"; |
967 | return($ret); | 882 | return($ret); |
968 | } | 883 | } |
@@ -1057,61 +972,118 @@ sub do_copy_rule | |||
1057 | if ($n =~ /bss_file/) | 972 | if ($n =~ /bss_file/) |
1058 | { $pp=".c"; } | 973 | { $pp=".c"; } |
1059 | else { $pp=$p; } | 974 | else { $pp=$p; } |
1060 | $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \$(SRC_D)$o$_$pp $to${o}$n$pp\n\n"; | 975 | $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \"\$(SRC_D)$o$_$pp\" \"$to${o}$n$pp\"\n\n"; |
1061 | } | 976 | } |
1062 | return($ret); | 977 | return($ret); |
1063 | } | 978 | } |
1064 | 979 | ||
1065 | sub read_options | 980 | sub read_options |
1066 | { | 981 | { |
1067 | if (/^no-rc2$/) { $no_rc2=1; } | 982 | # Many options are handled in a similar way. In particular |
1068 | elsif (/^no-rc4$/) { $no_rc4=1; } | 983 | # no-xxx sets zero or more scalars to 1. |
1069 | elsif (/^no-rc5$/) { $no_rc5=1; } | 984 | # Process these using a hash containing the option name and |
1070 | elsif (/^no-idea$/) { $no_idea=1; } | 985 | # reference to the scalars to set. |
1071 | elsif (/^no-aes$/) { $no_aes=1; } | 986 | |
1072 | elsif (/^no-des$/) { $no_des=1; } | 987 | my %valid_options = ( |
1073 | elsif (/^no-bf$/) { $no_bf=1; } | 988 | "no-rc2" => \$no_rc2, |
1074 | elsif (/^no-cast$/) { $no_cast=1; } | 989 | "no-rc4" => \$no_rc4, |
1075 | elsif (/^no-md2$/) { $no_md2=1; } | 990 | "no-rc5" => \$no_rc5, |
1076 | elsif (/^no-md4$/) { $no_md4=1; } | 991 | "no-idea" => \$no_idea, |
1077 | elsif (/^no-md5$/) { $no_md5=1; } | 992 | "no-aes" => \$no_aes, |
1078 | elsif (/^no-sha$/) { $no_sha=1; } | 993 | "no-camellia" => \$no_camellia, |
1079 | elsif (/^no-sha1$/) { $no_sha1=1; } | 994 | "no-seed" => \$no_seed, |
1080 | elsif (/^no-ripemd$/) { $no_ripemd=1; } | 995 | "no-des" => \$no_des, |
1081 | elsif (/^no-mdc2$/) { $no_mdc2=1; } | 996 | "no-bf" => \$no_bf, |
1082 | elsif (/^no-patents$/) { $no_rc2=$no_rc4=$no_rc5=$no_idea=$no_rsa=1; } | 997 | "no-cast" => \$no_cast, |
1083 | elsif (/^no-rsa$/) { $no_rsa=1; } | 998 | "no-md2" => \$no_md2, |
1084 | elsif (/^no-dsa$/) { $no_dsa=1; } | 999 | "no-md4" => \$no_md4, |
1085 | elsif (/^no-dh$/) { $no_dh=1; } | 1000 | "no-md5" => \$no_md5, |
1086 | elsif (/^no-hmac$/) { $no_hmac=1; } | 1001 | "no-sha" => \$no_sha, |
1087 | elsif (/^no-aes$/) { $no_aes=1; } | 1002 | "no-sha1" => \$no_sha1, |
1088 | elsif (/^no-asm$/) { $no_asm=1; } | 1003 | "no-ripemd" => \$no_ripemd, |
1089 | elsif (/^nasm$/) { $nasm=1; } | 1004 | "no-mdc2" => \$no_mdc2, |
1090 | elsif (/^gaswin$/) { $gaswin=1; } | 1005 | "no-patents" => |
1091 | elsif (/^no-ssl2$/) { $no_ssl2=1; } | 1006 | [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa], |
1092 | elsif (/^no-ssl3$/) { $no_ssl3=1; } | 1007 | "no-rsa" => \$no_rsa, |
1093 | elsif (/^no-err$/) { $no_err=1; } | 1008 | "no-dsa" => \$no_dsa, |
1094 | elsif (/^no-sock$/) { $no_sock=1; } | 1009 | "no-dh" => \$no_dh, |
1095 | elsif (/^no-krb5$/) { $no_krb5=1; } | 1010 | "no-hmac" => \$no_hmac, |
1096 | elsif (/^no-ec$/) { $no_ec=1; } | 1011 | "no-asm" => \$no_asm, |
1097 | elsif (/^no-engine$/) { $no_engine=1; } | 1012 | "nasm" => \$nasm, |
1098 | elsif (/^no-hw$/) { $no_hw=1; } | 1013 | "nw-nasm" => \$nw_nasm, |
1099 | 1014 | "nw-mwasm" => \$nw_mwasm, | |
1100 | elsif (/^just-ssl$/) { $no_rc2=$no_idea=$no_des=$no_bf=$no_cast=1; | 1015 | "gaswin" => \$gaswin, |
1101 | $no_md2=$no_sha=$no_mdc2=$no_dsa=$no_dh=1; | 1016 | "no-ssl2" => \$no_ssl2, |
1102 | $no_ssl2=$no_err=$no_ripemd=$no_rc5=1; | 1017 | "no-ssl3" => \$no_ssl3, |
1103 | $no_aes=1; } | 1018 | "no-tlsext" => \$no_tlsext, |
1104 | 1019 | "no-cms" => \$no_cms, | |
1105 | elsif (/^rsaref$/) { } | 1020 | "no-err" => \$no_err, |
1106 | elsif (/^fips$/) { $fips=1; } | 1021 | "no-sock" => \$no_sock, |
1107 | elsif (/^gcc$/) { $gcc=1; } | 1022 | "no-krb5" => \$no_krb5, |
1108 | elsif (/^debug$/) { $debug=1; } | 1023 | "no-ec" => \$no_ec, |
1109 | elsif (/^profile$/) { $profile=1; } | 1024 | "no-ecdsa" => \$no_ecdsa, |
1110 | elsif (/^shlib$/) { $shlib=1; } | 1025 | "no-ecdh" => \$no_ecdh, |
1111 | elsif (/^dll$/) { $shlib=1; } | 1026 | "no-engine" => \$no_engine, |
1112 | elsif (/^shared$/) { } # We just need to ignore it for now... | 1027 | "no-hw" => \$no_hw, |
1113 | elsif (/^zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 } | 1028 | "just-ssl" => |
1114 | elsif (/^zlib-dynamic$/){ $zlib_opt = 2; } | 1029 | [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast, |
1030 | \$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh, | ||
1031 | \$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5, | ||
1032 | \$no_aes, \$no_camellia, \$no_seed], | ||
1033 | "rsaref" => 0, | ||
1034 | "gcc" => \$gcc, | ||
1035 | "debug" => \$debug, | ||
1036 | "profile" => \$profile, | ||
1037 | "shlib" => \$shlib, | ||
1038 | "dll" => \$shlib, | ||
1039 | "shared" => 0, | ||
1040 | "no-gmp" => 0, | ||
1041 | "no-rfc3779" => 0, | ||
1042 | "no-montasm" => 0, | ||
1043 | "no-shared" => 0, | ||
1044 | "no-zlib" => 0, | ||
1045 | "no-zlib-dynamic" => 0, | ||
1046 | ); | ||
1047 | |||
1048 | if (exists $valid_options{$_}) | ||
1049 | { | ||
1050 | my $r = $valid_options{$_}; | ||
1051 | if ( ref $r eq "SCALAR") | ||
1052 | { $$r = 1;} | ||
1053 | elsif ( ref $r eq "ARRAY") | ||
1054 | { | ||
1055 | my $r2; | ||
1056 | foreach $r2 (@$r) | ||
1057 | { | ||
1058 | $$r2 = 1; | ||
1059 | } | ||
1060 | } | ||
1061 | } | ||
1062 | elsif (/^no-comp$/) { $xcflags = "-DOPENSSL_NO_COMP $xcflags"; } | ||
1063 | elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 } | ||
1064 | elsif (/^enable-zlib-dynamic$/) | ||
1065 | { | ||
1066 | $zlib_opt = 2; | ||
1067 | } | ||
1068 | elsif (/^no-static-engine/) | ||
1069 | { | ||
1070 | $no_static_engine = 1; | ||
1071 | } | ||
1072 | elsif (/^enable-static-engine/) | ||
1073 | { | ||
1074 | $no_static_engine = 0; | ||
1075 | } | ||
1076 | # There are also enable-xxx options which correspond to | ||
1077 | # the no-xxx. Since the scalars are enabled by default | ||
1078 | # these can be ignored. | ||
1079 | elsif (/^enable-/) | ||
1080 | { | ||
1081 | my $t = $_; | ||
1082 | $t =~ s/^enable/no/; | ||
1083 | if (exists $valid_options{$t}) | ||
1084 | {return 1;} | ||
1085 | return 0; | ||
1086 | } | ||
1115 | elsif (/^--with-krb5-flavor=(.*)$/) | 1087 | elsif (/^--with-krb5-flavor=(.*)$/) |
1116 | { | 1088 | { |
1117 | my $krb5_flavor = $1; | 1089 | my $krb5_flavor = $1; |
@@ -1135,31 +1107,3 @@ sub read_options | |||
1135 | else { return(0); } | 1107 | else { return(0); } |
1136 | return(1); | 1108 | return(1); |
1137 | } | 1109 | } |
1138 | |||
1139 | sub fipslib_error | ||
1140 | { | ||
1141 | print STDERR "***FIPS module directory sanity check failed***\n"; | ||
1142 | print STDERR "FIPS module build failed, or was deleted\n"; | ||
1143 | print STDERR "Please rebuild FIPS module.\n"; | ||
1144 | exit 1; | ||
1145 | } | ||
1146 | |||
1147 | sub fips_check_files | ||
1148 | { | ||
1149 | my $dir = shift @_; | ||
1150 | my $ret = 1; | ||
1151 | if (!-d $dir) | ||
1152 | { | ||
1153 | print STDERR "FIPS module directory $dir does not exist\n"; | ||
1154 | fipslib_error(); | ||
1155 | } | ||
1156 | foreach (@_) | ||
1157 | { | ||
1158 | if (!-f "$dir${o}$_") | ||
1159 | { | ||
1160 | print STDERR "FIPS module file $_ does not exist!\n"; | ||
1161 | $ret = 0; | ||
1162 | } | ||
1163 | } | ||
1164 | fipslib_error() if ($ret == 0); | ||
1165 | } | ||