diff options
Diffstat (limited to 'src/lib/libcrypto/util/mk1mf.pl')
-rw-r--r-- | src/lib/libcrypto/util/mk1mf.pl | 337 |
1 files changed, 279 insertions, 58 deletions
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl index 957264c6b5..05a6086164 100644 --- a/src/lib/libcrypto/util/mk1mf.pl +++ b/src/lib/libcrypto/util/mk1mf.pl | |||
@@ -10,6 +10,20 @@ $OPTIONS=""; | |||
10 | $ssl_version=""; | 10 | $ssl_version=""; |
11 | $banner="\t\@echo Building OpenSSL"; | 11 | $banner="\t\@echo Building OpenSSL"; |
12 | 12 | ||
13 | local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic | ||
14 | local $zlib_lib = ""; | ||
15 | |||
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 | |||
13 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; | 27 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; |
14 | while(<IN>) { | 28 | while(<IN>) { |
15 | $ssl_version=$1 if (/^VERSION=(.*)$/); | 29 | $ssl_version=$1 if (/^VERSION=(.*)$/); |
@@ -24,6 +38,7 @@ $infile="MINFO"; | |||
24 | 38 | ||
25 | %ops=( | 39 | %ops=( |
26 | "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", | 40 | "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", | ||
27 | "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", | 42 | "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", |
28 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", | 43 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", |
29 | "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", | 44 | "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", |
@@ -43,6 +58,7 @@ $infile="MINFO"; | |||
43 | ); | 58 | ); |
44 | 59 | ||
45 | $platform=""; | 60 | $platform=""; |
61 | my $xcflags=""; | ||
46 | foreach (@ARGV) | 62 | foreach (@ARGV) |
47 | { | 63 | { |
48 | if (!&read_options && !defined($ops{$_})) | 64 | if (!&read_options && !defined($ops{$_})) |
@@ -104,8 +120,12 @@ $inc_def="outinc"; | |||
104 | $tmp_def="tmp"; | 120 | $tmp_def="tmp"; |
105 | 121 | ||
106 | $mkdir="-mkdir"; | 122 | $mkdir="-mkdir"; |
123 | $mkcanister="ld -r -o"; | ||
124 | |||
125 | $ex_build_targets = ""; | ||
107 | 126 | ||
108 | ($ssl,$crypto)=("ssl","crypto"); | 127 | ($ssl,$crypto)=("ssl","crypto"); |
128 | $cryptocompat = ""; | ||
109 | $ranlib="echo ranlib"; | 129 | $ranlib="echo ranlib"; |
110 | 130 | ||
111 | $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; | 131 | $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; |
@@ -140,6 +160,10 @@ elsif (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) | |||
140 | $NT = 1 if $platform eq "VC-NT"; | 160 | $NT = 1 if $platform eq "VC-NT"; |
141 | require 'VC-32.pl'; | 161 | require 'VC-32.pl'; |
142 | } | 162 | } |
163 | elsif ($platform eq "VC-WIN32-GMAKE") | ||
164 | { | ||
165 | require 'VC-32-GMAKE.pl'; | ||
166 | } | ||
143 | elsif ($platform eq "VC-CE") | 167 | elsif ($platform eq "VC-CE") |
144 | { | 168 | { |
145 | require 'VC-CE.pl'; | 169 | require 'VC-CE.pl'; |
@@ -210,6 +234,8 @@ $inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def; | |||
210 | 234 | ||
211 | $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); | 235 | $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); |
212 | 236 | ||
237 | $cflags= "$xcflags$cflags" if $xcflags ne ""; | ||
238 | |||
213 | $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; | 239 | $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; |
214 | $cflags.=" -DOPENSSL_NO_AES" if $no_aes; | 240 | $cflags.=" -DOPENSSL_NO_AES" if $no_aes; |
215 | $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; | 241 | $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; |
@@ -239,6 +265,9 @@ $cflags.=" -DOPENSSL_NO_HW" if $no_hw; | |||
239 | $cflags.=" -DOPENSSL_FIPS" if $fips; | 265 | $cflags.=" -DOPENSSL_FIPS" if $fips; |
240 | #$cflags.=" -DRSAref" if $rsaref ne ""; | 266 | #$cflags.=" -DRSAref" if $rsaref ne ""; |
241 | 267 | ||
268 | $cflags.= " -DZLIB" if $zlib_opt; | ||
269 | $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; | ||
270 | |||
242 | ## if ($unix) | 271 | ## if ($unix) |
243 | ## { $cflags="$c_flags" if ($c_flags ne ""); } | 272 | ## { $cflags="$c_flags" if ($c_flags ne ""); } |
244 | ##else | 273 | ##else |
@@ -246,6 +275,7 @@ $cflags.=" -DOPENSSL_FIPS" if $fips; | |||
246 | 275 | ||
247 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); | 276 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); |
248 | 277 | ||
278 | |||
249 | %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", | 279 | %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", |
250 | "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); | 280 | "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); |
251 | 281 | ||
@@ -262,6 +292,135 @@ $link="$bin_dir$link" if ($link !~ /^\$/); | |||
262 | 292 | ||
263 | $INSTALLTOP =~ s|/|$o|g; | 293 | $INSTALLTOP =~ s|/|$o|g; |
264 | 294 | ||
295 | ############################################# | ||
296 | # We parse in input file and 'store' info for later printing. | ||
297 | open(IN,"<$infile") || die "unable to open $infile:$!\n"; | ||
298 | $_=<IN>; | ||
299 | for (;;) | ||
300 | { | ||
301 | chop; | ||
302 | |||
303 | ($key,$val)=/^([^=]+)=(.*)/; | ||
304 | if ($key eq "RELATIVE_DIRECTORY") | ||
305 | { | ||
306 | if ($lib ne "") | ||
307 | { | ||
308 | if ($fips && $dir =~ /^fips/) | ||
309 | { | ||
310 | $uc = "FIPS"; | ||
311 | } | ||
312 | else | ||
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 | } | ||
324 | last if ($val eq "FINISHED"); | ||
325 | $lib=""; | ||
326 | $libobj=""; | ||
327 | $dir=$val; | ||
328 | } | ||
329 | |||
330 | if ($key eq "KRB5_INCLUDES") | ||
331 | { $cflags .= " $val";} | ||
332 | |||
333 | if ($key eq "ZLIB_INCLUDE") | ||
334 | { $cflags .= " $val" if $val ne "";} | ||
335 | |||
336 | if ($key eq "LIBZLIB") | ||
337 | { $zlib_lib = "$val" if $val ne "";} | ||
338 | |||
339 | if ($key eq "LIBKRB5") | ||
340 | { $ex_libs .= " $val" if $val ne "";} | ||
341 | |||
342 | if ($key eq "TEST") | ||
343 | { $test.=&var_add($dir,$val); } | ||
344 | |||
345 | if (($key eq "PROGS") || ($key eq "E_OBJ")) | ||
346 | { $e_exe.=&var_add($dir,$val); } | ||
347 | |||
348 | if ($key eq "LIB") | ||
349 | { | ||
350 | $lib=$val; | ||
351 | $lib =~ s/^.*\/([^\/]+)$/$1/; | ||
352 | } | ||
353 | |||
354 | if ($key eq "EXHEADER") | ||
355 | { $exheader.=&var_add($dir,$val); } | ||
356 | |||
357 | if ($key eq "HEADER") | ||
358 | { $header.=&var_add($dir,$val); } | ||
359 | |||
360 | if ($key eq "LIBOBJ") | ||
361 | { $libobj=&var_add($dir,$val); } | ||
362 | |||
363 | if ($key eq "FIPSLIBDIR") | ||
364 | { $fipslibdir=$val;} | ||
365 | |||
366 | if ($key eq "BASEADDR") | ||
367 | { $baseaddr=$val;} | ||
368 | |||
369 | if (!($_=<IN>)) | ||
370 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } | ||
371 | } | ||
372 | close(IN); | ||
373 | |||
374 | if ($fips_canister_path eq "") | ||
375 | { | ||
376 | $fips_canister_path = "\$(FIPSLIB_D)${o}fipscanister.o"; | ||
377 | } | ||
378 | |||
379 | if ($fips_premain_c_path eq "") | ||
380 | { | ||
381 | $fips_premain_c_path = "\$(FIPSLIB_D)${o}fips_premain.c"; | ||
382 | } | ||
383 | |||
384 | if ($fips) | ||
385 | { | ||
386 | if ($fips_sha1_exe_path eq "") | ||
387 | { | ||
388 | $fips_sha1_exe_path = | ||
389 | "\$(BIN_D)${o}fips_standalone_sha1$exep"; | ||
390 | } | ||
391 | } | ||
392 | 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 | { | ||
406 | if (!$shlib) | ||
407 | { | ||
408 | $ex_build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)"; | ||
409 | $ex_l_libs .= " \$(O_FIPSCANISTER)"; | ||
410 | } | ||
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 | } | ||
422 | |||
423 | |||
265 | $defs= <<"EOF"; | 424 | $defs= <<"EOF"; |
266 | # This makefile has been automatically generated from the OpenSSL distribution. | 425 | # This makefile has been automatically generated from the OpenSSL distribution. |
267 | # This single makefile will build the complete OpenSSL distribution and | 426 | # This single makefile will build the complete OpenSSL distribution and |
@@ -286,6 +445,7 @@ if ($platform eq "VC-CE") | |||
286 | !INCLUDE <\$(WCECOMPAT)/wcedefs.mak> | 445 | !INCLUDE <\$(WCECOMPAT)/wcedefs.mak> |
287 | 446 | ||
288 | EOF | 447 | EOF |
448 | $ex_libs .= " $zlib_lib" if $zlib_opt == 1; | ||
289 | } | 449 | } |
290 | 450 | ||
291 | $defs.= <<"EOF"; | 451 | $defs.= <<"EOF"; |
@@ -308,6 +468,8 @@ EX_LIBS=$ex_libs | |||
308 | SRC_D=$src_dir | 468 | SRC_D=$src_dir |
309 | 469 | ||
310 | LINK=$link | 470 | LINK=$link |
471 | PERL=perl | ||
472 | FIPSLINK=\$(PERL) util${o}fipslink.pl | ||
311 | LFLAGS=$lflags | 473 | LFLAGS=$lflags |
312 | 474 | ||
313 | BN_ASM_OBJ=$bn_asm_obj | 475 | BN_ASM_OBJ=$bn_asm_obj |
@@ -339,6 +501,9 @@ TMP_D=$tmp_dir | |||
339 | INC_D=$inc_dir | 501 | INC_D=$inc_dir |
340 | INCO_D=$inc_dir${o}openssl | 502 | INCO_D=$inc_dir${o}openssl |
341 | 503 | ||
504 | # Directory containing FIPS module | ||
505 | |||
506 | |||
342 | CP=$cp | 507 | CP=$cp |
343 | RM=$rm | 508 | RM=$rm |
344 | RANLIB=$ranlib | 509 | RANLIB=$ranlib |
@@ -346,6 +511,18 @@ MKDIR=$mkdir | |||
346 | MKLIB=$bin_dir$mklib | 511 | MKLIB=$bin_dir$mklib |
347 | MLFLAGS=$mlflags | 512 | MLFLAGS=$mlflags |
348 | ASM=$bin_dir$asm | 513 | 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 | ||
349 | 526 | ||
350 | ###################################################### | 527 | ###################################################### |
351 | # You should not need to touch anything below this point | 528 | # You should not need to touch anything below this point |
@@ -377,7 +554,7 @@ SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp | |||
377 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp | 554 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp |
378 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp | 555 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp |
379 | 556 | ||
380 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) | 557 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs |
381 | 558 | ||
382 | ###################################################### | 559 | ###################################################### |
383 | # Don't touch anything below this point | 560 | # Don't touch anything below this point |
@@ -387,13 +564,13 @@ INC=-I\$(INC_D) -I\$(INCL_D) | |||
387 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) | 564 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) |
388 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) | 565 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) |
389 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) | 566 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) |
390 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) | 567 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) $ex_libs_dep |
391 | 568 | ||
392 | ############################################# | 569 | ############################################# |
393 | EOF | 570 | EOF |
394 | 571 | ||
395 | $rules=<<"EOF"; | 572 | $rules=<<"EOF"; |
396 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe | 573 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers \$(FIPS_SHA1_EXE) lib exe $ex_build_targets |
397 | 574 | ||
398 | banner: | 575 | banner: |
399 | $banner | 576 | $banner |
@@ -479,57 +656,6 @@ printf OUT " #define DATE \"%s\"\n", scalar gmtime(); | |||
479 | printf OUT "#endif\n"; | 656 | printf OUT "#endif\n"; |
480 | close(OUT); | 657 | close(OUT); |
481 | 658 | ||
482 | ############################################# | ||
483 | # We parse in input file and 'store' info for later printing. | ||
484 | open(IN,"<$infile") || die "unable to open $infile:$!\n"; | ||
485 | $_=<IN>; | ||
486 | for (;;) | ||
487 | { | ||
488 | chop; | ||
489 | |||
490 | ($key,$val)=/^([^=]+)=(.*)/; | ||
491 | if ($key eq "RELATIVE_DIRECTORY") | ||
492 | { | ||
493 | if ($lib ne "") | ||
494 | { | ||
495 | $uc=$lib; | ||
496 | $uc =~ s/^lib(.*)\.a/$1/; | ||
497 | $uc =~ tr/a-z/A-Z/; | ||
498 | $lib_nam{$uc}=$uc; | ||
499 | $lib_obj{$uc}.=$libobj." "; | ||
500 | } | ||
501 | last if ($val eq "FINISHED"); | ||
502 | $lib=""; | ||
503 | $libobj=""; | ||
504 | $dir=$val; | ||
505 | } | ||
506 | |||
507 | if ($key eq "TEST") | ||
508 | { $test.=&var_add($dir,$val); } | ||
509 | |||
510 | if (($key eq "PROGS") || ($key eq "E_OBJ")) | ||
511 | { $e_exe.=&var_add($dir,$val); } | ||
512 | |||
513 | if ($key eq "LIB") | ||
514 | { | ||
515 | $lib=$val; | ||
516 | $lib =~ s/^.*\/([^\/]+)$/$1/; | ||
517 | } | ||
518 | |||
519 | if ($key eq "EXHEADER") | ||
520 | { $exheader.=&var_add($dir,$val); } | ||
521 | |||
522 | if ($key eq "HEADER") | ||
523 | { $header.=&var_add($dir,$val); } | ||
524 | |||
525 | if ($key eq "LIBOBJ") | ||
526 | { $libobj=&var_add($dir,$val); } | ||
527 | |||
528 | if (!($_=<IN>)) | ||
529 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } | ||
530 | } | ||
531 | close(IN); | ||
532 | |||
533 | # Strip of trailing ' ' | 659 | # Strip of trailing ' ' |
534 | foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); } | 660 | foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); } |
535 | $test=&clean_up_ws($test); | 661 | $test=&clean_up_ws($test); |
@@ -554,6 +680,29 @@ $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); | |||
554 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); | 680 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); |
555 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); | 681 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); |
556 | 682 | ||
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 | |||
557 | foreach (values %lib_nam) | 706 | foreach (values %lib_nam) |
558 | { | 707 | { |
559 | $lib_obj=$lib_obj{$_}; | 708 | $lib_obj=$lib_obj{$_}; |
@@ -630,16 +779,42 @@ foreach (split(/\s+/,$test)) | |||
630 | } | 779 | } |
631 | 780 | ||
632 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); | 781 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); |
633 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); | 782 | |
634 | 783 | ||
635 | if ($fips) | 784 | if ($fips) |
636 | { | 785 | { |
637 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)","\$(BIN_D)$o.sha1","\$(BIN_D)$o\$(E_EXE)$exep"); | 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 | } | ||
638 | } | 800 | } |
639 | else | 801 | else |
640 | { | 802 | { |
641 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | 803 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib, |
804 | "\$(SO_CRYPTO)"); | ||
642 | } | 805 | } |
806 | |||
807 | |||
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 | |||
816 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)",0); | ||
817 | |||
643 | print $defs; | 818 | print $defs; |
644 | 819 | ||
645 | if ($platform eq "linux-elf") { | 820 | if ($platform eq "linux-elf") { |
@@ -935,6 +1110,24 @@ sub read_options | |||
935 | elsif (/^shlib$/) { $shlib=1; } | 1110 | elsif (/^shlib$/) { $shlib=1; } |
936 | elsif (/^dll$/) { $shlib=1; } | 1111 | elsif (/^dll$/) { $shlib=1; } |
937 | elsif (/^shared$/) { } # We just need to ignore it for now... | 1112 | elsif (/^shared$/) { } # We just need to ignore it for now... |
1113 | elsif (/^zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 } | ||
1114 | elsif (/^zlib-dynamic$/){ $zlib_opt = 2; } | ||
1115 | elsif (/^--with-krb5-flavor=(.*)$/) | ||
1116 | { | ||
1117 | my $krb5_flavor = $1; | ||
1118 | if ($krb5_flavor =~ /^force-[Hh]eimdal$/) | ||
1119 | { | ||
1120 | $xcflags="-DKRB5_HEIMDAL $xcflags"; | ||
1121 | } | ||
1122 | elsif ($krb5_flavor =~ /^MIT/i) | ||
1123 | { | ||
1124 | $xcflags="-DKRB5_MIT $xcflags"; | ||
1125 | if ($krb5_flavor =~ /^MIT[._-]*1[._-]*[01]/i) | ||
1126 | { | ||
1127 | $xcflags="-DKRB5_MIT_OLD11 $xcflags" | ||
1128 | } | ||
1129 | } | ||
1130 | } | ||
938 | elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } | 1131 | elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } |
939 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } | 1132 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } |
940 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) | 1133 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) |
@@ -942,3 +1135,31 @@ sub read_options | |||
942 | else { return(0); } | 1135 | else { return(0); } |
943 | return(1); | 1136 | return(1); |
944 | } | 1137 | } |
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 | } | ||