diff options
Diffstat (limited to 'src/lib/libcrypto/util/mk1mf.pl')
-rw-r--r-- | src/lib/libcrypto/util/mk1mf.pl | 561 |
1 files changed, 140 insertions, 421 deletions
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl index 4c16f1dc9e..780029a03f 100644 --- a/src/lib/libcrypto/util/mk1mf.pl +++ b/src/lib/libcrypto/util/mk1mf.pl | |||
@@ -6,36 +6,56 @@ | |||
6 | # | 6 | # |
7 | 7 | ||
8 | $INSTALLTOP="/usr/local/ssl"; | 8 | $INSTALLTOP="/usr/local/ssl"; |
9 | $OPENSSLDIR="/usr/local/ssl"; | ||
9 | $OPTIONS=""; | 10 | $OPTIONS=""; |
10 | $ssl_version=""; | 11 | $ssl_version=""; |
11 | $banner="\t\@echo Building OpenSSL"; | 12 | $banner="\t\@echo Building OpenSSL"; |
12 | 13 | ||
13 | my $no_static_engine = 0; | 14 | my $no_static_engine = 1; |
14 | my $engines = ""; | 15 | my $engines = ""; |
15 | local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic | 16 | local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic |
16 | local $zlib_lib = ""; | 17 | local $zlib_lib = ""; |
18 | local $perl_asm = 0; # 1 to autobuild asm files from perl scripts | ||
19 | |||
20 | # Options to import from top level Makefile | ||
21 | |||
22 | my %mf_import = ( | ||
23 | VERSION => \$ssl_version, | ||
24 | OPTIONS => \$OPTIONS, | ||
25 | INSTALLTOP => \$INSTALLTOP, | ||
26 | OPENSSLDIR => \$OPENSSLDIR, | ||
27 | PLATFORM => \$mf_platform, | ||
28 | CFLAG => \$mf_cflag, | ||
29 | DEPFLAG => \$mf_depflag, | ||
30 | CPUID_OBJ => \$mf_cpuid_asm, | ||
31 | BN_ASM => \$mf_bn_asm, | ||
32 | DES_ENC => \$mf_des_asm, | ||
33 | AES_ENC => \$mf_aes_asm, | ||
34 | BF_ENC => \$mf_bf_asm, | ||
35 | CAST_ENC => \$mf_cast_asm, | ||
36 | RC4_ENC => \$mf_rc4_asm, | ||
37 | RC5_ENC => \$mf_rc5_asm, | ||
38 | MD5_ASM_OBJ => \$mf_md5_asm, | ||
39 | SHA1_ASM_OBJ => \$mf_sha_asm, | ||
40 | RMD160_ASM_OBJ => \$mf_rmd_asm, | ||
41 | WP_ASM_OBJ => \$mf_wp_asm, | ||
42 | CMLL_ENC => \$mf_cm_asm | ||
43 | ); | ||
17 | 44 | ||
18 | local $fips_canister_path = ""; | ||
19 | my $fips_premain_dso_exe_path = ""; | ||
20 | my $fips_premain_c_path = ""; | ||
21 | my $fips_sha1_exe_path = ""; | ||
22 | |||
23 | local $fipscanisterbuild = 0; | ||
24 | local $fipsdso = 0; | ||
25 | |||
26 | my $fipslibdir = ""; | ||
27 | my $baseaddr = ""; | ||
28 | |||
29 | my $ex_l_libs = ""; | ||
30 | 45 | ||
31 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; | 46 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; |
32 | while(<IN>) { | 47 | while(<IN>) { |
33 | $ssl_version=$1 if (/^VERSION=(.*)$/); | 48 | my ($mf_opt, $mf_ref); |
34 | $OPTIONS=$1 if (/^OPTIONS=(.*)$/); | 49 | while (($mf_opt, $mf_ref) = each %mf_import) { |
35 | $INSTALLTOP=$1 if (/^INSTALLTOP=(.*$)/); | 50 | if (/^$mf_opt\s*=\s*(.*)$/) { |
51 | $$mf_ref = $1; | ||
52 | } | ||
53 | } | ||
36 | } | 54 | } |
37 | close(IN); | 55 | close(IN); |
38 | 56 | ||
57 | $debug = 1 if $mf_platform =~ /^debug-/; | ||
58 | |||
39 | die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq ""; | 59 | die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq ""; |
40 | 60 | ||
41 | $infile="MINFO"; | 61 | $infile="MINFO"; |
@@ -58,6 +78,7 @@ $infile="MINFO"; | |||
58 | "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets", | 78 | "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets", |
59 | "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets", | 79 | "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets", |
60 | "default","cc under unix", | 80 | "default","cc under unix", |
81 | "auto", "auto detect from top level Makefile" | ||
61 | ); | 82 | ); |
62 | 83 | ||
63 | $platform=""; | 84 | $platform=""; |
@@ -144,6 +165,12 @@ $bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:''; | |||
144 | $NT=0; | 165 | $NT=0; |
145 | 166 | ||
146 | push(@INC,"util/pl","pl"); | 167 | push(@INC,"util/pl","pl"); |
168 | |||
169 | if ($platform eq "auto") { | ||
170 | $platform = $mf_platform; | ||
171 | print STDERR "Imported platform $mf_platform\n"; | ||
172 | } | ||
173 | |||
147 | if (($platform =~ /VC-(.+)/)) | 174 | if (($platform =~ /VC-(.+)/)) |
148 | { | 175 | { |
149 | $FLAVOR=$1; | 176 | $FLAVOR=$1; |
@@ -228,13 +255,12 @@ $cflags.=" -DOPENSSL_NO_DES" if $no_des; | |||
228 | $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; | 255 | $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; |
229 | $cflags.=" -DOPENSSL_NO_DSA" if $no_dsa; | 256 | $cflags.=" -DOPENSSL_NO_DSA" if $no_dsa; |
230 | $cflags.=" -DOPENSSL_NO_DH" if $no_dh; | 257 | $cflags.=" -DOPENSSL_NO_DH" if $no_dh; |
258 | $cflags.=" -DOPENSSL_NO_WHIRLPOOL" if $no_whirlpool; | ||
231 | $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock; | 259 | $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock; |
232 | $cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2; | 260 | $cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2; |
233 | $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; | 261 | $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; |
234 | $cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext; | 262 | $cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext; |
235 | $cflags.=" -DOPENSSL_NO_CMS" if $no_cms; | 263 | $cflags.=" -DOPENSSL_NO_CMS" if $no_cms; |
236 | $cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; | ||
237 | $cflags.=" -DOPENSSL_NO_CAPIENG" if $no_capieng; | ||
238 | $cflags.=" -DOPENSSL_NO_ERR" if $no_err; | 264 | $cflags.=" -DOPENSSL_NO_ERR" if $no_err; |
239 | $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; | 265 | $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; |
240 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; | 266 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; |
@@ -242,7 +268,7 @@ $cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa; | |||
242 | $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; | 268 | $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; |
243 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; | 269 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; |
244 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; | 270 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; |
245 | $cflags.=" -DOPENSSL_FIPS" if $fips; | 271 | $cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; |
246 | $cflags.= " -DZLIB" if $zlib_opt; | 272 | $cflags.= " -DZLIB" if $zlib_opt; |
247 | $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; | 273 | $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; |
248 | 274 | ||
@@ -264,9 +290,9 @@ else | |||
264 | 290 | ||
265 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); | 291 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); |
266 | 292 | ||
293 | |||
267 | %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", | 294 | %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", |
268 | "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO", | 295 | "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); |
269 | "FIPS" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); | ||
270 | 296 | ||
271 | if ($msdos) | 297 | if ($msdos) |
272 | { | 298 | { |
@@ -280,6 +306,7 @@ if ($msdos) | |||
280 | $link="$bin_dir$link" if ($link !~ /^\$/); | 306 | $link="$bin_dir$link" if ($link !~ /^\$/); |
281 | 307 | ||
282 | $INSTALLTOP =~ s|/|$o|g; | 308 | $INSTALLTOP =~ s|/|$o|g; |
309 | $OPENSSLDIR =~ s|/|$o|g; | ||
283 | 310 | ||
284 | ############################################# | 311 | ############################################# |
285 | # We parse in input file and 'store' info for later printing. | 312 | # We parse in input file and 'store' info for later printing. |
@@ -294,21 +321,11 @@ for (;;) | |||
294 | { | 321 | { |
295 | if ($lib ne "") | 322 | if ($lib ne "") |
296 | { | 323 | { |
297 | if ($fips && $dir =~ /^fips/) | 324 | $uc=$lib; |
298 | { | 325 | $uc =~ s/^lib(.*)\.a/$1/; |
299 | $uc = "FIPS"; | 326 | $uc =~ tr/a-z/A-Z/; |
300 | } | 327 | $lib_nam{$uc}=$uc; |
301 | else | 328 | $lib_obj{$uc}.=$libobj." "; |
302 | { | ||
303 | $uc=$lib; | ||
304 | $uc =~ s/^lib(.*)\.a/$1/; | ||
305 | $uc =~ tr/a-z/A-Z/; | ||
306 | } | ||
307 | if (($uc ne "FIPS") || $fipscanisterbuild) | ||
308 | { | ||
309 | $lib_nam{$uc}=$uc; | ||
310 | $lib_obj{$uc}.=$libobj." "; | ||
311 | } | ||
312 | } | 329 | } |
313 | last if ($val eq "FINISHED"); | 330 | last if ($val eq "FINISHED"); |
314 | $lib=""; | 331 | $lib=""; |
@@ -351,130 +368,11 @@ for (;;) | |||
351 | if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine) | 368 | if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine) |
352 | { $engines.=$val } | 369 | { $engines.=$val } |
353 | 370 | ||
354 | if ($key eq "FIPS_EX_OBJ") | ||
355 | { | ||
356 | $fips_ex_obj=&var_add("crypto",$val,0); | ||
357 | } | ||
358 | |||
359 | if ($key eq "FIPSLIBDIR") | ||
360 | { | ||
361 | $fipslibdir=$val; | ||
362 | $fipslibdir =~ s/\/$//; | ||
363 | $fipslibdir =~ s/\//$o/g; | ||
364 | } | ||
365 | |||
366 | if ($key eq "BASEADDR") | ||
367 | { $baseaddr=$val;} | ||
368 | |||
369 | if (!($_=<IN>)) | 371 | if (!($_=<IN>)) |
370 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } | 372 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } |
371 | } | 373 | } |
372 | close(IN); | 374 | close(IN); |
373 | 375 | ||
374 | if ($fips) | ||
375 | { | ||
376 | |||
377 | foreach (split " ", $fips_ex_obj) | ||
378 | { | ||
379 | $fips_exclude_obj{$1} = 1 if (/\/([^\/]*)$/); | ||
380 | } | ||
381 | |||
382 | $fips_exclude_obj{"cpu_win32"} = 1; | ||
383 | $fips_exclude_obj{"bn_asm"} = 1; | ||
384 | $fips_exclude_obj{"des_enc"} = 1; | ||
385 | $fips_exclude_obj{"fcrypt_b"} = 1; | ||
386 | $fips_exclude_obj{"aes_core"} = 1; | ||
387 | $fips_exclude_obj{"aes_cbc"} = 1; | ||
388 | |||
389 | my @ltmp = split " ", $lib_obj{"CRYPTO"}; | ||
390 | |||
391 | |||
392 | $lib_obj{"CRYPTO"} = ""; | ||
393 | |||
394 | foreach(@ltmp) | ||
395 | { | ||
396 | if (/\/([^\/]*)$/ && exists $fips_exclude_obj{$1}) | ||
397 | { | ||
398 | if ($fipscanisterbuild) | ||
399 | { | ||
400 | $lib_obj{"FIPS"} .= "$_ "; | ||
401 | } | ||
402 | } | ||
403 | else | ||
404 | { | ||
405 | $lib_obj{"CRYPTO"} .= "$_ "; | ||
406 | } | ||
407 | } | ||
408 | |||
409 | } | ||
410 | |||
411 | if ($fipscanisterbuild) | ||
412 | { | ||
413 | $fips_canister_path = "\$(LIB_D)${o}fipscanister.lib" if $fips_canister_path eq ""; | ||
414 | $fips_premain_c_path = "\$(LIB_D)${o}fips_premain.c"; | ||
415 | } | ||
416 | else | ||
417 | { | ||
418 | if ($fips_canister_path eq "") | ||
419 | { | ||
420 | $fips_canister_path = "\$(FIPSLIB_D)${o}fipscanister.lib"; | ||
421 | } | ||
422 | |||
423 | if ($fips_premain_c_path eq "") | ||
424 | { | ||
425 | $fips_premain_c_path = "\$(FIPSLIB_D)${o}fips_premain.c"; | ||
426 | } | ||
427 | } | ||
428 | |||
429 | if ($fips) | ||
430 | { | ||
431 | if ($fips_sha1_exe_path eq "") | ||
432 | { | ||
433 | $fips_sha1_exe_path = | ||
434 | "\$(BIN_D)${o}fips_standalone_sha1$exep"; | ||
435 | } | ||
436 | } | ||
437 | else | ||
438 | { | ||
439 | $fips_sha1_exe_path = ""; | ||
440 | } | ||
441 | |||
442 | if ($fips_premain_dso_exe_path eq "") | ||
443 | { | ||
444 | $fips_premain_dso_exe_path = "\$(BIN_D)${o}fips_premain_dso$exep"; | ||
445 | } | ||
446 | |||
447 | # $ex_build_targets .= "\$(BIN_D)${o}\$(E_PREMAIN_DSO)$exep" if ($fips); | ||
448 | |||
449 | #$ex_l_libs .= " \$(L_FIPS)" if $fipsdso; | ||
450 | |||
451 | if ($fips) | ||
452 | { | ||
453 | if (!$shlib) | ||
454 | { | ||
455 | $ex_build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)"; | ||
456 | $ex_l_libs .= " \$(O_FIPSCANISTER)"; | ||
457 | $ex_libs_dep .= " \$(O_FIPSCANISTER)" if $fipscanisterbuild; | ||
458 | } | ||
459 | if ($fipscanisterbuild) | ||
460 | { | ||
461 | $fipslibdir = "\$(LIB_D)"; | ||
462 | } | ||
463 | else | ||
464 | { | ||
465 | if ($fipslibdir eq "") | ||
466 | { | ||
467 | open (IN, "util/fipslib_path.txt") || fipslib_error(); | ||
468 | $fipslibdir = <IN>; | ||
469 | chomp $fipslibdir; | ||
470 | close IN; | ||
471 | } | ||
472 | fips_check_files($fipslibdir, | ||
473 | "fipscanister.lib", "fipscanister.lib.sha1", | ||
474 | "fips_premain.c", "fips_premain.c.sha1"); | ||
475 | } | ||
476 | } | ||
477 | |||
478 | if ($shlib) | 376 | if ($shlib) |
479 | { | 377 | { |
480 | $extra_install= <<"EOF"; | 378 | $extra_install= <<"EOF"; |
@@ -520,6 +418,7 @@ $defs .= $preamble if defined $preamble; | |||
520 | 418 | ||
521 | $defs.= <<"EOF"; | 419 | $defs.= <<"EOF"; |
522 | INSTALLTOP=$INSTALLTOP | 420 | INSTALLTOP=$INSTALLTOP |
421 | OPENSSLDIR=$OPENSSLDIR | ||
523 | 422 | ||
524 | # Set your compiler options | 423 | # Set your compiler options |
525 | PLATFORM=$platform | 424 | PLATFORM=$platform |
@@ -540,32 +439,6 @@ SRC_D=$src_dir | |||
540 | LINK=$link | 439 | LINK=$link |
541 | LFLAGS=$lflags | 440 | LFLAGS=$lflags |
542 | RSC=$rsc | 441 | RSC=$rsc |
543 | FIPSLINK=\$(PERL) util${o}fipslink.pl | ||
544 | |||
545 | AES_ASM_OBJ=$aes_asm_obj | ||
546 | AES_ASM_SRC=$aes_asm_src | ||
547 | BN_ASM_OBJ=$bn_asm_obj | ||
548 | BN_ASM_SRC=$bn_asm_src | ||
549 | BNCO_ASM_OBJ=$bnco_asm_obj | ||
550 | BNCO_ASM_SRC=$bnco_asm_src | ||
551 | DES_ENC_OBJ=$des_enc_obj | ||
552 | DES_ENC_SRC=$des_enc_src | ||
553 | BF_ENC_OBJ=$bf_enc_obj | ||
554 | BF_ENC_SRC=$bf_enc_src | ||
555 | CAST_ENC_OBJ=$cast_enc_obj | ||
556 | CAST_ENC_SRC=$cast_enc_src | ||
557 | RC4_ENC_OBJ=$rc4_enc_obj | ||
558 | RC4_ENC_SRC=$rc4_enc_src | ||
559 | RC5_ENC_OBJ=$rc5_enc_obj | ||
560 | RC5_ENC_SRC=$rc5_enc_src | ||
561 | MD5_ASM_OBJ=$md5_asm_obj | ||
562 | MD5_ASM_SRC=$md5_asm_src | ||
563 | SHA1_ASM_OBJ=$sha1_asm_obj | ||
564 | SHA1_ASM_SRC=$sha1_asm_src | ||
565 | RMD160_ASM_OBJ=$rmd160_asm_obj | ||
566 | RMD160_ASM_SRC=$rmd160_asm_src | ||
567 | CPUID_ASM_OBJ=$cpuid_asm_obj | ||
568 | CPUID_ASM_SRC=$cpuid_asm_src | ||
569 | 442 | ||
570 | # The output directory for everything intersting | 443 | # The output directory for everything intersting |
571 | OUT_D=$out_dir | 444 | OUT_D=$out_dir |
@@ -584,17 +457,6 @@ MKLIB=$bin_dir$mklib | |||
584 | MLFLAGS=$mlflags | 457 | MLFLAGS=$mlflags |
585 | ASM=$bin_dir$asm | 458 | ASM=$bin_dir$asm |
586 | 459 | ||
587 | # FIPS validated module and support file locations | ||
588 | |||
589 | E_PREMAIN_DSO=fips_premain_dso | ||
590 | |||
591 | FIPSLIB_D=$fipslibdir | ||
592 | BASEADDR=$baseaddr | ||
593 | FIPS_PREMAIN_SRC=$fips_premain_c_path | ||
594 | O_FIPSCANISTER=$fips_canister_path | ||
595 | FIPS_SHA1_EXE=$fips_sha1_exe_path | ||
596 | PREMAIN_DSO_EXE=$fips_premain_dso_exe_path | ||
597 | |||
598 | ###################################################### | 460 | ###################################################### |
599 | # You should not need to touch anything below this point | 461 | # You should not need to touch anything below this point |
600 | ###################################################### | 462 | ###################################################### |
@@ -602,7 +464,6 @@ PREMAIN_DSO_EXE=$fips_premain_dso_exe_path | |||
602 | E_EXE=openssl | 464 | E_EXE=openssl |
603 | SSL=$ssl | 465 | SSL=$ssl |
604 | CRYPTO=$crypto | 466 | CRYPTO=$crypto |
605 | LIBFIPS=libosslfips | ||
606 | 467 | ||
607 | # BIN_D - Binary output directory | 468 | # BIN_D - Binary output directory |
608 | # TEST_D - Binary test file output directory | 469 | # TEST_D - Binary test file output directory |
@@ -623,14 +484,12 @@ INCL_D=\$(TMP_D) | |||
623 | 484 | ||
624 | O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp | 485 | O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp |
625 | O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp | 486 | O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp |
626 | O_FIPS= \$(LIB_D)$o$plib\$(LIBFIPS)$shlibp | ||
627 | SO_SSL= $plib\$(SSL)$so_shlibp | 487 | SO_SSL= $plib\$(SSL)$so_shlibp |
628 | SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp | 488 | SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp |
629 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp | 489 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp |
630 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp | 490 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp |
631 | L_FIPS= \$(LIB_D)$o$plib\$(LIBFIPS)$libp | ||
632 | 491 | ||
633 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs | 492 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) |
634 | 493 | ||
635 | ###################################################### | 494 | ###################################################### |
636 | # Don't touch anything below this point | 495 | # Don't touch anything below this point |
@@ -640,13 +499,13 @@ INC=-I\$(INC_D) -I\$(INCL_D) | |||
640 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) | 499 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) |
641 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) | 500 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) |
642 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) | 501 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) |
643 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) $ex_libs_dep | 502 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) |
644 | 503 | ||
645 | ############################################# | 504 | ############################################# |
646 | EOF | 505 | EOF |
647 | 506 | ||
648 | $rules=<<"EOF"; | 507 | $rules=<<"EOF"; |
649 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers \$(FIPS_SHA1_EXE) lib exe $ex_build_targets | 508 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe |
650 | 509 | ||
651 | banner: | 510 | banner: |
652 | $banner | 511 | $banner |
@@ -683,8 +542,9 @@ install: all | |||
683 | \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\" | 542 | \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\" |
684 | \$(MKDIR) \"\$(INSTALLTOP)${o}lib\" | 543 | \$(MKDIR) \"\$(INSTALLTOP)${o}lib\" |
685 | \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\" | 544 | \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\" |
686 | \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep\" \"\$(INSTALLTOP)${o}bin\" | 545 | \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\" |
687 | \$(CP) \"apps${o}openssl.cnf\" \"\$(INSTALLTOP)\" | 546 | \$(MKDIR) \"\$(OPENSSLDIR)\" |
547 | \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\" | ||
688 | $extra_install | 548 | $extra_install |
689 | 549 | ||
690 | 550 | ||
@@ -761,26 +621,6 @@ $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); | |||
761 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); | 621 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); |
762 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); | 622 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); |
763 | 623 | ||
764 | # Special case rules for fips_start and fips_end fips_premain_dso | ||
765 | |||
766 | if ($fips) | ||
767 | { | ||
768 | if ($fipscanisterbuild) | ||
769 | { | ||
770 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_start$obj", | ||
771 | "fips${o}fips_canister.c", | ||
772 | "-DFIPS_START \$(SHLIB_CFLAGS)"); | ||
773 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_end$obj", | ||
774 | "fips${o}fips_canister.c", "\$(SHLIB_CFLAGS)"); | ||
775 | } | ||
776 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_standalone_sha1$obj", | ||
777 | "fips${o}sha${o}fips_standalone_sha1.c", | ||
778 | "\$(SHLIB_CFLAGS)"); | ||
779 | $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj", | ||
780 | "fips${o}fips_premain.c", | ||
781 | "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)"); | ||
782 | } | ||
783 | |||
784 | foreach (values %lib_nam) | 624 | foreach (values %lib_nam) |
785 | { | 625 | { |
786 | $lib_obj=$lib_obj{$_}; | 626 | $lib_obj=$lib_obj{$_}; |
@@ -792,78 +632,14 @@ foreach (values %lib_nam) | |||
792 | next; | 632 | next; |
793 | } | 633 | } |
794 | 634 | ||
795 | if ((!$fips && ($_ eq "CRYPTO")) || ($fips && ($_ eq "FIPS"))) | ||
796 | { | ||
797 | if ($cpuid_asm_obj ne "") | ||
798 | { | ||
799 | $lib_obj =~ s/(\S*\/cryptlib\S*)/$1 \$(CPUID_ASM_OBJ)/; | ||
800 | $rules.=&do_asm_rule($cpuid_asm_obj,$cpuid_asm_src); | ||
801 | } | ||
802 | if ($aes_asm_obj ne "") | ||
803 | { | ||
804 | $lib_obj =~ s/\s(\S*\/aes_core\S*)/ \$(AES_ASM_OBJ)/; | ||
805 | $lib_obj =~ s/\s\S*\/aes_cbc\S*//; | ||
806 | $rules.=&do_asm_rule($aes_asm_obj,$aes_asm_src); | ||
807 | } | ||
808 | if ($sha1_asm_obj ne "") | ||
809 | { | ||
810 | $lib_obj =~ s/\s(\S*\/sha1dgst\S*)/ $1 \$(SHA1_ASM_OBJ)/; | ||
811 | $rules.=&do_asm_rule($sha1_asm_obj,$sha1_asm_src); | ||
812 | } | ||
813 | if ($bn_asm_obj ne "") | ||
814 | { | ||
815 | $lib_obj =~ s/\s\S*\/bn_asm\S*/ \$(BN_ASM_OBJ)/; | ||
816 | $rules.=&do_asm_rule($bn_asm_obj,$bn_asm_src); | ||
817 | } | ||
818 | if ($bnco_asm_obj ne "") | ||
819 | { | ||
820 | $lib_obj .= "\$(BNCO_ASM_OBJ)"; | ||
821 | $rules.=&do_asm_rule($bnco_asm_obj,$bnco_asm_src); | ||
822 | } | ||
823 | if ($des_enc_obj ne "") | ||
824 | { | ||
825 | $lib_obj =~ s/\s\S*des_enc\S*/ \$(DES_ENC_OBJ)/; | ||
826 | $lib_obj =~ s/\s\S*\/fcrypt_b\S*\s*/ /; | ||
827 | $rules.=&do_asm_rule($des_enc_obj,$des_enc_src); | ||
828 | } | ||
829 | } | ||
830 | if (($bf_enc_obj ne "") && ($_ eq "CRYPTO")) | ||
831 | { | ||
832 | $lib_obj =~ s/\s\S*\/bf_enc\S*/ \$(BF_ENC_OBJ)/; | ||
833 | $rules.=&do_asm_rule($bf_enc_obj,$bf_enc_src); | ||
834 | } | ||
835 | if (($cast_enc_obj ne "") && ($_ eq "CRYPTO")) | ||
836 | { | ||
837 | $lib_obj =~ s/(\s\S*\/c_enc\S*)/ \$(CAST_ENC_OBJ)/; | ||
838 | $rules.=&do_asm_rule($cast_enc_obj,$cast_enc_src); | ||
839 | } | ||
840 | if (($rc4_enc_obj ne "") && ($_ eq "CRYPTO")) | ||
841 | { | ||
842 | $lib_obj =~ s/\s\S*\/rc4_enc\S*/ \$(RC4_ENC_OBJ)/; | ||
843 | $rules.=&do_asm_rule($rc4_enc_obj,$rc4_enc_src); | ||
844 | } | ||
845 | if (($rc5_enc_obj ne "") && ($_ eq "CRYPTO")) | ||
846 | { | ||
847 | $lib_obj =~ s/\s\S*\/rc5_enc\S*/ \$(RC5_ENC_OBJ)/; | ||
848 | $rules.=&do_asm_rule($rc5_enc_obj,$rc5_enc_src); | ||
849 | } | ||
850 | if (($md5_asm_obj ne "") && ($_ eq "CRYPTO")) | ||
851 | { | ||
852 | $lib_obj =~ s/\s(\S*\/md5_dgst\S*)/ $1 \$(MD5_ASM_OBJ)/; | ||
853 | $rules.=&do_asm_rule($md5_asm_obj,$md5_asm_src); | ||
854 | } | ||
855 | if (($rmd160_asm_obj ne "") && ($_ eq "CRYPTO")) | ||
856 | { | ||
857 | $lib_obj =~ s/\s(\S*\/rmd_dgst\S*)/ $1 \$(RMD160_ASM_OBJ)/; | ||
858 | $rules.=&do_asm_rule($rmd160_asm_obj,$rmd160_asm_src); | ||
859 | } | ||
860 | $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj); | 635 | $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj); |
861 | $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)"; | 636 | $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)"; |
862 | $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib); | 637 | $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib); |
863 | } | 638 | } |
864 | 639 | ||
865 | # hack to add version info on MSVC | 640 | # hack to add version info on MSVC |
866 | if (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) { | 641 | if (($platform eq "VC-WIN32") || ($platform eq "VC-WIN64A") |
642 | || ($platform eq "VC-WIN64I") || ($platform eq "VC-NT")) { | ||
867 | $rules.= <<"EOF"; | 643 | $rules.= <<"EOF"; |
868 | \$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc | 644 | \$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc |
869 | \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc | 645 | \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc |
@@ -871,43 +647,15 @@ if (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) { | |||
871 | \$(OBJ_D)\\\$(SSL).res: ms\\version32.rc | 647 | \$(OBJ_D)\\\$(SSL).res: ms\\version32.rc |
872 | \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc | 648 | \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc |
873 | 649 | ||
874 | \$(OBJ_D)\\\$(LIBFIPS).res: ms\\version32.rc | ||
875 | \$(RSC) /fo"\$(OBJ_D)\\\$(LIBFIPS).res" /d FIPS ms\\version32.rc | ||
876 | |||
877 | EOF | 650 | EOF |
878 | } | 651 | } |
879 | 652 | ||
880 | $defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep); | 653 | $defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep); |
881 | foreach (split(/\s+/,$test)) | 654 | foreach (split(/\s+/,$test)) |
882 | { | 655 | { |
883 | my $t_libs; | ||
884 | $t=&bname($_); | 656 | $t=&bname($_); |
885 | my $ltype; | ||
886 | # Check to see if test program is FIPS | ||
887 | if ($fips && /fips/) | ||
888 | { | ||
889 | # If fipsdso link to libosslfips.dll | ||
890 | # otherwise perform static link to | ||
891 | # $(O_FIPSCANISTER) | ||
892 | if ($fipsdso) | ||
893 | { | ||
894 | $t_libs = "\$(L_FIPS)"; | ||
895 | $ltype = 0; | ||
896 | } | ||
897 | else | ||
898 | { | ||
899 | $t_libs = "\$(O_FIPSCANISTER)"; | ||
900 | $ltype = 2; | ||
901 | } | ||
902 | } | ||
903 | else | ||
904 | { | ||
905 | $t_libs = "\$(L_LIBS)"; | ||
906 | $ltype = 0; | ||
907 | } | ||
908 | |||
909 | $tt="\$(OBJ_D)${o}$t${obj}"; | 657 | $tt="\$(OBJ_D)${o}$t${obj}"; |
910 | $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","$t_libs \$(EX_LIBS)", $ltype); | 658 | $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); |
911 | } | 659 | } |
912 | 660 | ||
913 | $defs.=&do_defs("E_SHLIB",$engines,"\$(ENG_D)",$shlibp); | 661 | $defs.=&do_defs("E_SHLIB",$engines,"\$(ENG_D)",$shlibp); |
@@ -921,69 +669,9 @@ foreach (split(/\s+/,$engines)) | |||
921 | 669 | ||
922 | 670 | ||
923 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); | 671 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); |
672 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); | ||
924 | 673 | ||
925 | if ($fips) | 674 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); |
926 | { | ||
927 | if ($shlib) | ||
928 | { | ||
929 | if ($fipsdso) | ||
930 | { | ||
931 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)", | ||
932 | "\$(O_CRYPTO)", "$crypto", | ||
933 | $shlib, "", ""); | ||
934 | $rules.= &do_lib_rule( | ||
935 | "\$(O_FIPSCANISTER)", | ||
936 | "\$(O_FIPS)", "\$(LIBFIPS)", | ||
937 | $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)"); | ||
938 | $rules.= &do_sdef_rule(); | ||
939 | } | ||
940 | else | ||
941 | { | ||
942 | $rules.= &do_lib_rule( | ||
943 | "\$(CRYPTOOBJ) \$(O_FIPSCANISTER)", | ||
944 | "\$(O_CRYPTO)", "$crypto", | ||
945 | $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)"); | ||
946 | } | ||
947 | } | ||
948 | else | ||
949 | { | ||
950 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)", | ||
951 | "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", ""); | ||
952 | $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(FIPSOBJ)", | ||
953 | "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", ""); | ||
954 | } | ||
955 | } | ||
956 | else | ||
957 | { | ||
958 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib, | ||
959 | "\$(SO_CRYPTO)"); | ||
960 | } | ||
961 | |||
962 | if ($fips) | ||
963 | { | ||
964 | if ($fipscanisterbuild) | ||
965 | { | ||
966 | $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)", | ||
967 | "\$(OBJ_D)${o}fips_start$obj", | ||
968 | "\$(FIPSOBJ)", | ||
969 | "\$(OBJ_D)${o}fips_end$obj", | ||
970 | "\$(FIPS_SHA1_EXE)", ""); | ||
971 | $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)", | ||
972 | "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(OBJ_D)${o}sha1dgst$obj \$(SHA1_ASM_OBJ)", | ||
973 | "","\$(EX_LIBS)", 1); | ||
974 | } | ||
975 | else | ||
976 | { | ||
977 | $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)", | ||
978 | "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(O_FIPSCANISTER)", | ||
979 | "","", 1); | ||
980 | |||
981 | } | ||
982 | $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1); | ||
983 | |||
984 | } | ||
985 | |||
986 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0); | ||
987 | 675 | ||
988 | print $defs; | 676 | print $defs; |
989 | 677 | ||
@@ -1022,7 +710,6 @@ sub var_add | |||
1022 | return("") if $no_ec && $dir =~ /\/ec/; | 710 | return("") if $no_ec && $dir =~ /\/ec/; |
1023 | return("") if $no_cms && $dir =~ /\/cms/; | 711 | return("") if $no_cms && $dir =~ /\/cms/; |
1024 | return("") if $no_jpake && $dir =~ /\/jpake/; | 712 | return("") if $no_jpake && $dir =~ /\/jpake/; |
1025 | return("") if !$fips && $dir =~ /^fips/; | ||
1026 | if ($no_des && $dir =~ /\/des/) | 713 | if ($no_des && $dir =~ /\/des/) |
1027 | { | 714 | { |
1028 | if ($val =~ /read_pwd/) | 715 | if ($val =~ /read_pwd/) |
@@ -1034,6 +721,7 @@ sub var_add | |||
1034 | return("") if $no_sock && $dir =~ /\/proxy/; | 721 | return("") if $no_sock && $dir =~ /\/proxy/; |
1035 | return("") if $no_bf && $dir =~ /\/bf/; | 722 | return("") if $no_bf && $dir =~ /\/bf/; |
1036 | return("") if $no_cast && $dir =~ /\/cast/; | 723 | return("") if $no_cast && $dir =~ /\/cast/; |
724 | return("") if $no_whirlpool && $dir =~ /\/whrlpool/; | ||
1037 | 725 | ||
1038 | $val =~ s/^\s*(.*)\s*$/$1/; | 726 | $val =~ s/^\s*(.*)\s*$/$1/; |
1039 | @a=split(/\s+/,$val); | 727 | @a=split(/\s+/,$val); |
@@ -1051,8 +739,8 @@ sub var_add | |||
1051 | @a=grep(!/^e_camellia$/,@a) if $no_camellia; | 739 | @a=grep(!/^e_camellia$/,@a) if $no_camellia; |
1052 | @a=grep(!/^e_seed$/,@a) if $no_seed; | 740 | @a=grep(!/^e_seed$/,@a) if $no_seed; |
1053 | 741 | ||
1054 | @a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2; | 742 | #@a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2; |
1055 | @a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3; | 743 | #@a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3; |
1056 | 744 | ||
1057 | @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock; | 745 | @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock; |
1058 | 746 | ||
@@ -1126,6 +814,7 @@ sub do_defs | |||
1126 | else { $pf=$postfix; } | 814 | else { $pf=$postfix; } |
1127 | if ($_ =~ /BN_ASM/) { $t="$_ "; } | 815 | if ($_ =~ /BN_ASM/) { $t="$_ "; } |
1128 | elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; } | 816 | elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; } |
817 | elsif ($_ =~ /AES_ASM/){ $t="$_ "; } | ||
1129 | elsif ($_ =~ /DES_ENC/) { $t="$_ "; } | 818 | elsif ($_ =~ /DES_ENC/) { $t="$_ "; } |
1130 | elsif ($_ =~ /BF_ENC/) { $t="$_ "; } | 819 | elsif ($_ =~ /BF_ENC/) { $t="$_ "; } |
1131 | elsif ($_ =~ /CAST_ENC/){ $t="$_ "; } | 820 | elsif ($_ =~ /CAST_ENC/){ $t="$_ "; } |
@@ -1133,8 +822,8 @@ sub do_defs | |||
1133 | elsif ($_ =~ /RC5_ENC/) { $t="$_ "; } | 822 | elsif ($_ =~ /RC5_ENC/) { $t="$_ "; } |
1134 | elsif ($_ =~ /MD5_ASM/) { $t="$_ "; } | 823 | elsif ($_ =~ /MD5_ASM/) { $t="$_ "; } |
1135 | elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; } | 824 | elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; } |
1136 | elsif ($_ =~ /AES_ASM/){ $t="$_ "; } | ||
1137 | elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; } | 825 | elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; } |
826 | elsif ($_ =~ /WHIRLPOOL_ASM/){ $t="$_ "; } | ||
1138 | elsif ($_ =~ /CPUID_ASM/){ $t="$_ "; } | 827 | elsif ($_ =~ /CPUID_ASM/){ $t="$_ "; } |
1139 | else { $t="$location${o}$_$pf "; } | 828 | else { $t="$location${o}$_$pf "; } |
1140 | 829 | ||
@@ -1142,7 +831,7 @@ sub do_defs | |||
1142 | $ret.=$t; | 831 | $ret.=$t; |
1143 | } | 832 | } |
1144 | # hack to add version info on MSVC | 833 | # hack to add version info on MSVC |
1145 | if ($shlib && (($platform eq "VC-WIN32") || ($platform eq "VC-NT"))) | 834 | if ($shlib && (($platform eq "VC-WIN32") || ($platfrom eq "VC-WIN64I") || ($platform eq "VC-WIN64A") || ($platform eq "VC-NT"))) |
1146 | { | 835 | { |
1147 | if ($var eq "CRYPTOOBJ") | 836 | if ($var eq "CRYPTOOBJ") |
1148 | { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; } | 837 | { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; } |
@@ -1162,6 +851,13 @@ sub bname | |||
1162 | return($ret); | 851 | return($ret); |
1163 | } | 852 | } |
1164 | 853 | ||
854 | # return the leading path | ||
855 | sub dname | ||
856 | { | ||
857 | my $ret=shift; | ||
858 | $ret =~ s/(^.*)[\\\/][^\\\/]+$/$1/; | ||
859 | return($ret); | ||
860 | } | ||
1165 | 861 | ||
1166 | ############################################################## | 862 | ############################################################## |
1167 | # do a rule for each file that says 'compile' to new direcory | 863 | # do a rule for each file that says 'compile' to new direcory |
@@ -1169,19 +865,61 @@ sub bname | |||
1169 | sub do_compile_rule | 865 | sub do_compile_rule |
1170 | { | 866 | { |
1171 | local($to,$files,$ex)=@_; | 867 | local($to,$files,$ex)=@_; |
1172 | local($ret,$_,$n); | 868 | local($ret,$_,$n,$d,$s); |
1173 | 869 | ||
1174 | $files =~ s/\//$o/g if $o ne '/'; | 870 | $files =~ s/\//$o/g if $o ne '/'; |
1175 | foreach (split(/\s+/,$files)) | 871 | foreach (split(/\s+/,$files)) |
1176 | { | 872 | { |
1177 | $n=&bname($_); | 873 | $n=&bname($_); |
1178 | $ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex) | 874 | $d=&dname($_); |
875 | if (-f "${_}.c") | ||
876 | { | ||
877 | $ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex) | ||
878 | } | ||
879 | elsif (-f ($s="${d}${o}asm${o}${n}.pl") or | ||
880 | ($s=~s/sha256/sha512/ and -f $s) or | ||
881 | -f ($s="${d}${o}${n}.pl")) | ||
882 | { | ||
883 | $ret.=&perlasm_compile_target("$to${o}$n$obj",$s,$n); | ||
884 | } | ||
885 | elsif (-f ($s="${d}${o}asm${o}${n}.S") or | ||
886 | -f ($s="${d}${o}${n}.S")) | ||
887 | { | ||
888 | $ret.=&Sasm_compile_target("$to${o}$n$obj",$s,$n); | ||
889 | } | ||
890 | else { die "no rule for $_"; } | ||
1179 | } | 891 | } |
1180 | return($ret); | 892 | return($ret); |
1181 | } | 893 | } |
1182 | 894 | ||
1183 | ############################################################## | 895 | ############################################################## |
1184 | # do a rule for each file that says 'compile' to new direcory | 896 | # do a rule for each file that says 'compile' to new direcory |
897 | sub perlasm_compile_target | ||
898 | { | ||
899 | my($target,$source,$bname)=@_; | ||
900 | my($ret); | ||
901 | |||
902 | $bname =~ s/(.*)\.[^\.]$/$1/; | ||
903 | $ret ="\$(TMP_D)$o$bname.asm: $source\n"; | ||
904 | $ret.="\t\$(PERL) $source $asmtype \$(CFLAG) >\$\@\n\n"; | ||
905 | $ret.="$target: \$(TMP_D)$o$bname.asm\n"; | ||
906 | $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n"; | ||
907 | return($ret); | ||
908 | } | ||
909 | |||
910 | sub Sasm_compile_target | ||
911 | { | ||
912 | my($target,$source,$bname)=@_; | ||
913 | my($ret); | ||
914 | |||
915 | $bname =~ s/(.*)\.[^\.]$/$1/; | ||
916 | $ret ="\$(TMP_D)$o$bname.asm: $source\n"; | ||
917 | $ret.="\t\$(CC) -E \$(CFLAG) $source >\$\@\n\n"; | ||
918 | $ret.="$target: \$(TMP_D)$o$bname.asm\n"; | ||
919 | $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n"; | ||
920 | return($ret); | ||
921 | } | ||
922 | |||
1185 | sub cc_compile_target | 923 | sub cc_compile_target |
1186 | { | 924 | { |
1187 | local($target,$source,$ex_flags)=@_; | 925 | local($target,$source,$ex_flags)=@_; |
@@ -1204,13 +942,25 @@ sub do_asm_rule | |||
1204 | $target =~ s/\//$o/g if $o ne "/"; | 942 | $target =~ s/\//$o/g if $o ne "/"; |
1205 | $src =~ s/\//$o/g if $o ne "/"; | 943 | $src =~ s/\//$o/g if $o ne "/"; |
1206 | 944 | ||
1207 | @s=split(/\s+/,$src); | ||
1208 | @t=split(/\s+/,$target); | 945 | @t=split(/\s+/,$target); |
946 | @s=split(/\s+/,$src); | ||
947 | |||
1209 | 948 | ||
1210 | for ($i=0; $i<=$#s; $i++) | 949 | for ($i=0; $i<=$#s; $i++) |
1211 | { | 950 | { |
1212 | $ret.="$t[$i]: $s[$i]\n"; | 951 | my $objfile = $t[$i]; |
1213 | $ret.="\t\$(ASM) $afile$t[$i] \$(SRC_D)$o$s[$i]\n\n"; | 952 | my $srcfile = $s[$i]; |
953 | |||
954 | if ($perl_asm == 1) | ||
955 | { | ||
956 | my $plasm = $objfile; | ||
957 | $plasm =~ s/${obj}/.pl/; | ||
958 | $ret.="$srcfile: $plasm\n"; | ||
959 | $ret.="\t\$(PERL) $plasm $asmtype \$(CFLAG) >$srcfile\n\n"; | ||
960 | } | ||
961 | |||
962 | $ret.="$objfile: $srcfile\n"; | ||
963 | $ret.="\t\$(ASM) $afile$objfile \$(SRC_D)$o$srcfile\n\n"; | ||
1214 | } | 964 | } |
1215 | return($ret); | 965 | return($ret); |
1216 | } | 966 | } |
@@ -1274,6 +1024,7 @@ sub read_options | |||
1274 | "no-sha1" => \$no_sha1, | 1024 | "no-sha1" => \$no_sha1, |
1275 | "no-ripemd" => \$no_ripemd, | 1025 | "no-ripemd" => \$no_ripemd, |
1276 | "no-mdc2" => \$no_mdc2, | 1026 | "no-mdc2" => \$no_mdc2, |
1027 | "no-whirlpool" => \$no_whirlpool, | ||
1277 | "no-patents" => | 1028 | "no-patents" => |
1278 | [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa], | 1029 | [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa], |
1279 | "no-rsa" => \$no_rsa, | 1030 | "no-rsa" => \$no_rsa, |
@@ -1282,7 +1033,6 @@ sub read_options | |||
1282 | "no-hmac" => \$no_hmac, | 1033 | "no-hmac" => \$no_hmac, |
1283 | "no-asm" => \$no_asm, | 1034 | "no-asm" => \$no_asm, |
1284 | "nasm" => \$nasm, | 1035 | "nasm" => \$nasm, |
1285 | "ml64" => \$ml64, | ||
1286 | "nw-nasm" => \$nw_nasm, | 1036 | "nw-nasm" => \$nw_nasm, |
1287 | "nw-mwasm" => \$nw_mwasm, | 1037 | "nw-mwasm" => \$nw_mwasm, |
1288 | "gaswin" => \$gaswin, | 1038 | "gaswin" => \$gaswin, |
@@ -1291,7 +1041,6 @@ sub read_options | |||
1291 | "no-tlsext" => \$no_tlsext, | 1041 | "no-tlsext" => \$no_tlsext, |
1292 | "no-cms" => \$no_cms, | 1042 | "no-cms" => \$no_cms, |
1293 | "no-jpake" => \$no_jpake, | 1043 | "no-jpake" => \$no_jpake, |
1294 | "no-capieng" => \$no_capieng, | ||
1295 | "no-err" => \$no_err, | 1044 | "no-err" => \$no_err, |
1296 | "no-sock" => \$no_sock, | 1045 | "no-sock" => \$no_sock, |
1297 | "no-krb5" => \$no_krb5, | 1046 | "no-krb5" => \$no_krb5, |
@@ -1316,11 +1065,9 @@ sub read_options | |||
1316 | "no-rfc3779" => 0, | 1065 | "no-rfc3779" => 0, |
1317 | "no-montasm" => 0, | 1066 | "no-montasm" => 0, |
1318 | "no-shared" => 0, | 1067 | "no-shared" => 0, |
1068 | "no-store" => 0, | ||
1319 | "no-zlib" => 0, | 1069 | "no-zlib" => 0, |
1320 | "no-zlib-dynamic" => 0, | 1070 | "no-zlib-dynamic" => 0, |
1321 | "fips" => \$fips, | ||
1322 | "fipscanisterbuild" => [\$fips, \$fipscanisterbuild], | ||
1323 | "fipsdso" => [\$fips, \$fipscanisterbuild, \$fipsdso], | ||
1324 | ); | 1071 | ); |
1325 | 1072 | ||
1326 | if (exists $valid_options{$_}) | 1073 | if (exists $valid_options{$_}) |
@@ -1397,31 +1144,3 @@ sub read_options | |||
1397 | else { return(0); } | 1144 | else { return(0); } |
1398 | return(1); | 1145 | return(1); |
1399 | } | 1146 | } |
1400 | |||
1401 | sub fipslib_error | ||
1402 | { | ||
1403 | print STDERR "***FIPS module directory sanity check failed***\n"; | ||
1404 | print STDERR "FIPS module build failed, or was deleted\n"; | ||
1405 | print STDERR "Please rebuild FIPS module.\n"; | ||
1406 | exit 1; | ||
1407 | } | ||
1408 | |||
1409 | sub fips_check_files | ||
1410 | { | ||
1411 | my $dir = shift @_; | ||
1412 | my $ret = 1; | ||
1413 | if (!-d $dir) | ||
1414 | { | ||
1415 | print STDERR "FIPS module directory $dir does not exist\n"; | ||
1416 | fipslib_error(); | ||
1417 | } | ||
1418 | foreach (@_) | ||
1419 | { | ||
1420 | if (!-f "$dir${o}$_") | ||
1421 | { | ||
1422 | print STDERR "FIPS module file $_ does not exist!\n"; | ||
1423 | $ret = 0; | ||
1424 | } | ||
1425 | } | ||
1426 | fipslib_error() if ($ret == 0); | ||
1427 | } | ||