2 # A bit of an evil hack but it post processes the file ../MINFO which
3 # is generated by `make files` in the top directory.
4 # This script outputs one mega makefile that has no shell stuff or any
5 # funny stuff (if the target is not "copy").
6 # If the target is "copy", then it tries to create a makefile that can be
7 # safely used with the -j flag and that is compatible with the top-level
8 # Makefile, in the sense that it uses the same options and assembler files etc.
12 $INSTALLTOP="/usr/local";
13 $OPENSSLDIR="/usr/local/ssl";
14 $ENGINESDIR="/usr/local/lib/engines";
17 $banner="\t\@echo Building OpenSSL";
19 my $no_static_engine = 1;
23 local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic
25 local $perl_asm = 0; # 1 to autobuild asm files from perl scripts
27 local $fips_canister_path = "";
28 my $fips_premain_dso_exe_path = "";
29 my $fips_premain_c_path = "";
30 my $fips_sha1_exe_path = "";
32 local $fipscanisterbuild = 0;
34 my $fipscanisteronly = 0;
41 my $build_targets = "lib exe";
42 my $libs_dep = "\$(O_CRYPTO) \$(O_SSL)";
44 # Options to import from top level Makefile
47 VERSION => \$ssl_version,
49 INSTALLTOP => \$INSTALLTOP,
50 OPENSSLDIR => \$OPENSSLDIR,
51 ENGINESDIR => \$ENGINESDIR,
52 PLATFORM => \$mf_platform,
55 CFLAG_Q => \$mf_cflag_q,
56 SHARED_CFLAG => \$mf_shared_cflag,
57 DEPFLAG => \$mf_depflag,
58 CPUID_OBJ => \$mf_cpuid_asm,
59 BN_ASM => \$mf_bn_asm,
60 DES_ENC => \$mf_des_asm,
61 AES_ENC => \$mf_aes_asm,
62 BF_ENC => \$mf_bf_asm,
63 CAST_ENC => \$mf_cast_asm,
64 RC4_ENC => \$mf_rc4_asm,
65 RC5_ENC => \$mf_rc5_asm,
66 MD5_ASM_OBJ => \$mf_md5_asm,
67 SHA1_ASM_OBJ => \$mf_sha_asm,
68 RMD160_ASM_OBJ => \$mf_rmd_asm,
69 WP_ASM_OBJ => \$mf_wp_asm,
70 CMLL_ENC => \$mf_cm_asm,
71 MODES_ASM_OBJ => \$mf_modes_asm,
72 ENGINES_ASM_OBJ=> \$mf_engines_asm,
73 PERLASM_SCHEME => \$mf_perlasm_scheme,
74 FIPSCANISTERONLY => \$mf_fipscanisteronly,
75 FIPSCANISTERINTERNAL => \$mf_fipscanisterinternal,
76 EC_ASM => \$mf_ec_asm,
79 open(IN,"<Makefile") || die "unable to open Makefile!\n";
81 my ($mf_opt, $mf_ref);
82 while (($mf_opt, $mf_ref) = each %mf_import) {
83 if (/^$mf_opt\s*=\s*(.*)$/ && !defined($$mfref)) {
90 if ($mf_fipscanisterinternal eq "y") {
92 $fipscanisterbuild = 1;
93 $fipscanisteronly = 1;
97 die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq "";
102 "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X",
103 "VC-WIN64I", "Microsoft C/C++ - Win64/IA-64",
104 "VC-WIN64A", "Microsoft C/C++ - Win64/x64",
105 "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY",
106 "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY",
107 "Mingw32", "GNU C++ - Windows NT or 9x",
108 "Mingw32-files", "Create files with DOS copy ...",
109 "linux-elf","Linux elf",
110 "FreeBSD","FreeBSD distribution",
111 "default","cc under unix",
112 "auto", "auto detect from top level Makefile",
113 "copy", "copy from top level Makefile"
120 if (!&read_options && !defined($ops{$_}))
122 print STDERR "unknown option - $_\n";
123 print STDERR "usage: perl mk1mf.pl [options] [system]\n";
124 print STDERR "\nwhere [system] can be one of the following\n";
125 foreach $i (sort keys %ops)
126 { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; }
127 print STDERR <<"EOF";
128 and [options] can be one of
129 no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest
131 no-blake2 - No blake2
132 no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher
133 no-bf no-cast no-aes no-camellia no-seed
134 no-rsa no-dsa no-dh - Skip this public key cipher
135 no-ssl3 - Skip this version of SSL
136 just-ssl - remove all non-ssl keys/digest
140 no-engine - No engine
143 no-async - No Async (use NULL)
144 no-autoalginit - Don't auto load algorithms in libcrypto
145 no-autoerrinit - Don't auto load error strings for libcrypto or libssl
146 nasm - Use NASM for x86 asm
147 gaswin - Use GNU as with Mingw32
148 no-socks - No socket code
149 no-err - No error strings
150 dll/shlib - Build shared libraries (MS)
152 profile - Profiling build
155 Values that can be set
156 TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler
158 -L<ex_lib_path> -l<ex_lib> - extra library flags (unix)
159 -<ex_cc_flags> - extra 'cc' flags,
160 added (MS), or replace (unix)
166 foreach (grep(!/^$/, split(/ /, $OPTIONS)))
168 print STDERR "unknown option - $_\n" if !&read_options;
171 $no_mdc2=1 if ($no_des);
173 $no_ssl3=1 if ($no_md5);
174 $no_ssl3=1 if ($no_rsa && $no_dh);
180 $perl="perl" unless defined $perl;
181 $mkdir="-mkdir" unless defined $mkdir;
182 $mv="mv" unless defined $mv;
184 ($ssl,$crypto)=("ssl","crypto");
185 $ranlib="echo ranlib";
187 $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc';
188 $src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}: $platform eq 'copy' ? getcwd() : '.';
189 $bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:'';
191 # $bin_dir.=$o causes a core dump on my sparc :-(
196 push(@INC,"util/pl","pl");
198 if ($platform eq "auto" || $platform eq 'copy') {
199 $orig_platform = $platform;
200 $platform = $mf_platform;
201 print STDERR "Imported platform $mf_platform\n";
204 if (($platform =~ /VC-(.+)/))
207 $NT = 1 if $1 eq "NT";
210 elsif ($platform eq "Mingw32")
212 require 'Mingw32.pl';
214 elsif ($platform eq "Mingw32-files")
216 require 'Mingw32f.pl';
218 elsif ($platform eq "FreeBSD")
221 $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer';
223 elsif ($platform eq "linux-elf")
234 $cflags.=' -DTERMIO';
237 $out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":"");
238 $tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":"");
239 $inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def;
241 $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq ''));
243 $cflags= "$xcflags$cflags" if $xcflags ne "";
245 $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea;
246 $cflags.=" -DOPENSSL_NO_AES" if $no_aes;
247 $cflags.=" -DOPENSSL_NO_CAMELLIA" if $no_camellia;
248 $cflags.=" -DOPENSSL_NO_SEED" if $no_seed;
249 $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2;
250 $cflags.=" -DOPENSSL_NO_RC4" if $no_rc4;
251 $cflags.=" -DOPENSSL_NO_RC5" if $no_rc5;
252 $cflags.=" -DOPENSSL_NO_MD2" if $no_md2;
253 $cflags.=" -DOPENSSL_NO_MD4" if $no_md4;
254 $cflags.=" -DOPENSSL_NO_MD5" if $no_md5;
255 $cflags.=" -DOPENSSL_NO_RMD160" if $no_ripemd;
256 $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2;
257 $cflags.=" -DOPENSSL_NO_BF" if $no_bf;
258 $cflags.=" -DOPENSSL_NO_CAST" if $no_cast;
259 $cflags.=" -DOPENSSL_NO_DES" if $no_des;
260 $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa;
261 $cflags.=" -DOPENSSL_NO_DSA" if $no_dsa;
262 $cflags.=" -DOPENSSL_NO_DH" if $no_dh;
263 $cflags.=" -DOPENSSL_NO_WHIRLPOOL" if $no_whirlpool;
264 $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock;
265 $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3;
266 $cflags.=" -DOPENSSL_NO_SRP" if $no_srp;
267 $cflags.=" -DOPENSSL_NO_CMS" if $no_cms;
268 $cflags.=" -DOPENSSL_NO_ERR" if $no_err;
269 $cflags.=" -DOPENSSL_NO_EC" if $no_ec;
270 $cflags.=" -DOPENSSL_NO_GOST" if $no_gost;
271 $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine;
272 $cflags.=" -DOPENSSL_NO_HW" if $no_hw;
273 $cflags.=" -DOPENSSL_NO_ASYNC" if $no_async;
274 $cflags.=" -DOPENSSL_NO_AUTOALGINIT" if $no_autoalginit;
275 $cflags.=" -DOPENSSL_NO_AUTOERRINIT" if $no_autoerrinit;
276 $cflags.=" -DOPENSSL_FIPS" if $fips;
277 $cflags.=" -DOPENSSL_NO_EC2M" if $no_ec2m;
278 $cflags.=" -DZLIB" if $zlib_opt;
279 $cflags.=" -DZLIB_SHARED" if $zlib_opt == 2;
280 $cflags.=" -DOPENSSL_PIC";
281 $cflags.=" -DOPENSSL_NO_COMP" if $no_comp;
283 if ($no_static_engine)
285 $cflags .= " -DOPENSSL_NO_STATIC_ENGINE";
289 $cflags .= " -DOPENSSL_NO_DYNAMIC_ENGINE";
292 #$cflags.=" -DRSAref" if $rsaref ne "";
295 ## { $cflags="$c_flags" if ($c_flags ne ""); }
297 { $cflags="$c_flags$cflags" if ($c_flags ne ""); }
299 if ($orig_platform eq 'copy') {
300 $cflags = "$mf_cflag $mf_shared_cflag";
304 $ex_libs="$l_flags$ex_libs" if ($l_flags ne "");
307 %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL",
308 "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO");
312 $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n";
313 $banner.="\t\@echo top level directory, if you don't have perl, you will\n";
314 $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n";
315 $banner.="\t\@echo documentation for details.\n";
318 # have to do this to allow $(CC) under unix
319 $link="$bin_dir$link" if ($link !~ /^\$/);
321 $INSTALLTOP =~ s|/|$o|g;
322 $OPENSSLDIR =~ s|/|$o|g;
324 #############################################
325 # We parse in input file and 'store' info for later printing.
326 open(IN,"<$infile") || die "unable to open $infile:$!\n";
330 s/\s*$//; # was chop, didn't work in mixture of perls for Windows...
332 ($key,$val)=/^([^=]+)=(.*)/;
333 if ($key eq "RELATIVE_DIRECTORY")
337 if ($fips && $dir =~ /^fips/)
344 $uc =~ s/^lib(.*)\.a/$1/;
347 if (($uc ne "FIPS") || $fipscanisterbuild)
350 $lib_obj{$uc}.=$libobj." ";
353 last if ($val eq "FINISHED");
359 if ($key eq "ZLIB_INCLUDE")
360 { $cflags .= " $val" if $val ne "";}
362 if ($key eq "LIBZLIB")
363 { $zlib_lib = "$val" if $val ne "";}
365 if ($key eq "EX_LIBS")
366 { $ex_libs .= " $val" if $val ne "";}
368 # There was a condition here before:
369 # !$fipscanisteronly || $dir =~ /^fips/
370 # It currently fills no function and needs to be rewritten anyway, so
372 if ($dir eq "test" && $key eq "EXE")
374 foreach my $t (split /\s+/, $val) {
375 $test.=&var_add($dir,$t, 0) if $t; }
378 if ($key eq "EXE_OBJ")
379 { $e_exe.=&var_add($dir,$val, 0); }
384 $lib =~ s/^.*\/([^\/]+)$/$1/;
386 if ($key eq "LIBNAME" && $no_static_engine)
389 $lib =~ s/^.*\/([^\/]+)$/$1/;
390 $otherlibs .= " $lib";
393 if ($key eq "HEADER")
394 { $header.=&var_add($dir,$val, 1); }
396 if ($key eq "LIBOBJ")
398 if ($dir ne "engines" || !$no_static_engine)
399 { $libobj=&var_add($dir,$val, 0); }
401 { push(@engines_obj,split(/\s+/,&var_add($dir,$val,0))); }
403 if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine)
406 if ($key eq "FIPS_EX_OBJ")
408 $fips_ex_obj=&var_add("crypto",$val,0);
411 if ($key eq "FIPSLIBDIR")
414 $fipslibdir =~ s/\/$//;
415 $fipslibdir =~ s/\//$o/g;
418 if ($key eq "BASEADDR")
422 { $_="RELATIVE_DIRECTORY=FINISHED\n"; }
426 if ($orig_platform eq 'copy')
428 # Remove opensslconf.h so it doesn't get updated if we configure a
430 $header =~ s/[^ ]+\/opensslconf.h//;
436 foreach (split " ", $fips_ex_obj)
438 $fips_exclude_obj{$1} = 1 if (/\/([^\/]*)$/);
441 "$mf_cpuid_asm $mf_aes_asm $mf_sha_asm $mf_bn_asm " .
442 "$mf_des_asm $mf_modes_asm")
445 $fips_exclude_obj{$_} = 1;
447 my @ltmp = split " ", $lib_obj{"CRYPTO"};
450 $lib_obj{"CRYPTO"} = "";
454 if (/\/([^\/]*)$/ && exists $fips_exclude_obj{$1})
456 if ($fipscanisterbuild)
458 $lib_obj{"FIPS"} .= "$_ ";
461 elsif (!$fipscanisteronly)
463 $lib_obj{"CRYPTO"} .= "$_ ";
469 if ($fipscanisterbuild)
471 $fips_canister_path = "\$(LIB_D)${o}fipscanister.lib" if $fips_canister_path eq "";
472 $fips_premain_c_path = "\$(LIB_D)${o}fips_premain.c";
476 if ($fips_canister_path eq "")
478 $fips_canister_path = "\$(FIPSLIB_D)${o}fipscanister.lib";
481 if ($fips_premain_c_path eq "")
483 $fips_premain_c_path = "\$(FIPSLIB_D)${o}fips_premain.c";
489 if ($fips_sha1_exe_path eq "")
491 $fips_sha1_exe_path =
492 "\$(BIN_D)${o}fips_standalone_sha1$exep";
497 $fips_sha1_exe_path = "";
500 if ($fips_premain_dso_exe_path eq "")
502 $fips_premain_dso_exe_path = "\$(BIN_D)${o}fips_premain_dso$exep";
505 # $ex_build_targets .= "\$(BIN_D)${o}\$(E_PREMAIN_DSO)$exep" if ($fips);
511 $build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)";
512 $ex_l_libs .= " \$(O_FIPSCANISTER)";
513 $ex_libs_dep .= " \$(O_FIPSCANISTER)" if $fipscanisterbuild;
515 if ($fipscanisterbuild)
517 $fipslibdir = "\$(LIB_D)";
521 if ($fipslibdir eq "")
523 open (IN, "util/fipslib_path.txt") || fipslib_error();
526 $fipslibdir = "" unless defined($fipslibdir);
527 $fipslibdir =~ s{\R$}{};
528 fipslib_error() if ($fipslibdir eq "");
530 fips_check_files($fipslibdir,
531 "fipscanister.lib", "fipscanister.lib.sha1",
532 "fips_premain.c", "fips_premain.c.sha1");
536 if ($fipscanisteronly)
538 $build_targets = "\$(O_FIPSCANISTER) \$(T_EXE)";
542 $cp2 = $cp unless defined $cp2;
544 $extra_install= <<"EOF";
545 \$(CP) \"include${o}openssl${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\"
546 \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\"
547 \$(MKDIR) \"\$(OPENSSLDIR)\"
548 \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\"
551 if ($fipscanisteronly)
553 $extra_install = <<"EOF";
554 \$(CP) \"\$(O_FIPSCANISTER)\" \"\$(INSTALLTOP)${o}lib\"
555 \$(CP) \"\$(O_FIPSCANISTER).sha1\" \"\$(INSTALLTOP)${o}lib\"
556 \$(CP2) \"fips${o}fips_premain.c\" \"\$(INSTALLTOP)${o}lib\"
557 \$(CP) \"fips${o}fips_premain.c.sha1\" \"\$(INSTALLTOP)${o}lib\"
558 \$(CP) \"include${o}openssl${o}fips.h\" \"\$(INSTALLTOP)${o}include${o}openssl\"
559 \$(CP) \"include${o}openssl${o}fips_rand.h\" \"\$(INSTALLTOP)${o}include${o}openssl\"
560 \$(CP) "\$(BIN_D)${o}fips_standalone_sha1$exep" \"\$(INSTALLTOP)${o}bin\"
561 \$(CP) \"util${o}fipslink.pl\" \"\$(INSTALLTOP)${o}bin\"
566 $extra_install .= <<"EOF";
567 \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}bin\"
568 \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}bin\"
569 \$(CP) \"\$(L_SSL)\" \"\$(INSTALLTOP)${o}lib\"
570 \$(CP) \"\$(L_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\"
572 if ($no_static_engine)
574 $extra_install .= <<"EOF"
575 \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\"
576 \$(CP) \"\$(E_SHLIB)\" \"\$(INSTALLTOP)${o}lib${o}engines\"
582 $extra_install .= <<"EOF";
583 \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}lib\"
584 \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\"
586 $ex_libs .= " $zlib_lib" if $zlib_opt == 1;
589 my $asm_def = $orig_platform eq 'copy' ? "" : "ASM=$bin_dir$asm";
591 $cflags =~ s/\((ENGINESDIR|OPENSSLDIR)\)/\(${1}_QQ\)/g;
592 (my $cflags_q = $cflags) =~ s/([\\"])/\\$1/g;
593 (my $INSTALLTOP_Q = $INSTALLTOP) =~ s/([\\"])/\\$1/g;
594 (my $INSTALLTOP_QQ = $INSTALLTOP_Q) =~ s/\\/\\\\/g;
595 (my $OPENSSLDIR_Q = $OPENSSLDIR) =~ s/([\\"])/\\$1/g;
596 (my $OPENSSLDIR_QQ = $OPENSSLDIR_Q) =~ s/\\/\\\\/g;
597 (my $ENGINESDIR_Q = $ENGINESDIR) =~ s/([\\"])/\\$1/g;
598 (my $ENGINESDIR_QQ = $ENGINESDIR_Q) =~ s/\\/\\\\/g;
601 # N.B. You MUST use -j on FreeBSD.
602 # This makefile has been automatically generated from the OpenSSL distribution.
603 # This single makefile will build the complete OpenSSL distribution and
604 # by default leave the 'interesting' output files in .${o}out and the stuff
605 # that needs deleting in .${o}tmp.
606 # The file was generated by running 'make makefile.one', which
607 # does a 'make files', which writes all the environment variables from all
608 # the makefiles to the file call MINFO. This file is used by
609 # util${o}mk1mf.pl to generate makefile.one.
610 # The 'makefile per directory' system suites me when developing this
611 # library and also so I can 'distribute' indervidual library sections.
612 # The one monster makefile better suits building in non-unix
617 $defs .= $preamble if defined $preamble;
620 INSTALLTOP=$INSTALLTOP
621 INSTALLTOP_QQ=$INSTALLTOP_QQ
622 OPENSSLDIR=$OPENSSLDIR
623 OPENSSLDIR_QQ=$OPENSSLDIR_QQ
624 ENGINESDIR=$ENGINESDIR
625 ENGINESDIR_QQ=$ENGINESDIR_QQ
627 # Set your compiler options
634 SHLIB_CFLAG=$shl_cflag
635 APP_EX_OBJ=$app_ex_obj
636 SHLIB_EX_OBJ=$shlib_ex_obj
637 # add extra libraries to this define, for solaris -lsocket -lnsl would
641 # The OpenSSL directory
647 FIPSLINK=\$(PERL) util${o}fipslink.pl
649 # The output directory for everything interesting
651 # The output directory for all the temporary muck
655 PERLASM_SCHEME=$mf_perlasm_scheme
666 # FIPS validated module and support file locations
668 E_PREMAIN_DSO=fips_premain_dso
670 FIPSLIB_D=$fipslibdir
672 FIPS_PREMAIN_SRC=$fips_premain_c_path
673 O_FIPSCANISTER=$fips_canister_path
674 FIPS_SHA1_EXE=$fips_sha1_exe_path
675 PREMAIN_DSO_EXE=$fips_premain_dso_exe_path
677 ######################################################
678 # You should not need to touch anything below this point
679 ######################################################
685 # BIN_D - Binary output directory
686 # TEST_D - Binary test file output directory
687 # LIB_D - library output directory
688 # ENG_D - dynamic engine output directory
689 # Note: if you change these point to different directories then uncomment out
690 # the lines around the 'NB' comment below.
697 # INCL_D - local library directory
698 # OBJ_D - temp object file directory
702 O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp
703 O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp
704 SO_SSL= $plib\$(SSL)$so_shlibp
705 SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp
706 L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp
707 L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp
709 L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs
711 ######################################################
712 # Don't touch anything below this point
713 ######################################################
715 INC=-I\$(SRC_D)${o}include -I\$(INCL_D) -I\$(SRC_D)${o}crypto${o}include
716 APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG)
717 LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG)
718 SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG)
721 #############################################
725 all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) headers \$(FIPS_SHA1_EXE) $build_targets
731 \$(MKDIR) \"\$(TMP_D)\"
732 # NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different
734 # \$(MKDIR) \$(BIN_D)
737 # \$(MKDIR) \$(TEST_D)
740 \$(MKDIR) \"\$(LIB_D)\"
742 # This needs to be invoked once, when the makefile is first constructed, or
744 init: \$(TMP_D) \$(LIB_D) \$(BIN_D) \$(TEST_D) headers
748 lib: \$(LIBS_DEP) \$(E_SHLIB)
750 exe: apps tools testapps
751 apps: \$(BIN_D)$o\$(E_EXE)$exep \$(BIN_D)${o}CA.pl
753 tools: \$(BIN_D)${o}c_rehash
756 \$(MKDIR) \"\$(INSTALLTOP)\"
757 \$(MKDIR) \"\$(INSTALLTOP)${o}bin\"
758 \$(MKDIR) \"\$(INSTALLTOP)${o}include\"
759 \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\"
760 \$(MKDIR) \"\$(INSTALLTOP)${o}lib\"
761 \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\"
765 \$(RM) \$(TMP_D)$o*.*
768 \$(RM) \$(TMP_D)$o*.*
769 \$(RM) \$(OUT_D)$o*.*
774 \$(RM) -rf \$(TEST_D)
779 $rules .= &do_rehash_rule("rehash.time", "apps tools");
780 $rules .= &do_test_rule("test", "rehash.time", "run_tests.pl");
783 crypto${o}buildinf.h : MINFO
784 \$(PERL) util${o}mkbuildinf.pl "\$(CC) \$(CFLAG_Q)" "\$(PLATFORM)" > crypto${o}buildinf.h
785 $(OBJ_D)${o}cversion${obj} : crypto${o}buildinf.h
788 # Strip off trailing ' '
789 foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); }
790 $test=&clean_up_ws($test);
791 $e_exe=&clean_up_ws($e_exe);
792 $header=&clean_up_ws($header);
794 $defs.=&do_defs("HEADER",$header,"\$(INCL_D)","");
795 $rules.=&do_copy_rule("\$(INCL_D)",$header,"");
797 $defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj);
798 $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)");
800 $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj);
801 $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)');
803 # Special case rules for fips_start and fips_end fips_premain_dso
807 if ($fipscanisterbuild)
809 $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_start$obj",
810 "fips${o}fips_canister.c",
811 "-DFIPS_START \$(SHLIB_CFLAGS)");
812 $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_end$obj",
813 "fips${o}fips_canister.c", "\$(SHLIB_CFLAGS)");
815 $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_standalone_sha1$obj",
816 "fips${o}sha${o}fips_standalone_sha1.c",
818 $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj",
819 "fips${o}fips_premain.c",
820 "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(APP_CFLAGS)");
828 $asm =~ s/\s+/ $dir\//g;
835 if ($orig_platform eq 'copy') {
836 $lib_obj{CRYPTO} .= fix_asm($mf_md5_asm, 'crypto/md5');
837 $lib_obj{CRYPTO} .= fix_asm($mf_bn_asm, 'crypto/bn');
838 # cpuid is included by the crypto dir
839 #$lib_obj{CRYPTO} .= fix_asm($mf_cpuid_asm, 'crypto');
840 # AES asm files end up included by the aes dir itself
841 #$lib_obj{CRYPTO} .= fix_asm($mf_aes_asm, 'crypto/aes');
842 $lib_obj{CRYPTO} .= fix_asm($mf_sha_asm, 'crypto/sha');
843 $lib_obj{CRYPTO} .= fix_asm($mf_engines_asm, 'engines');
844 $lib_obj{CRYPTO} .= fix_asm($mf_rc4_asm, 'crypto/rc4');
845 $lib_obj{CRYPTO} .= fix_asm($mf_modes_asm, 'crypto/modes');
846 $lib_obj{CRYPTO} .= fix_asm($mf_ec_asm, 'crypto/ec');
849 foreach (values %lib_nam)
851 $lib_obj=$lib_obj{$_};
854 $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj);
855 $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)";
856 $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib);
859 # hack to add version info on MSVC
860 if (($platform eq "VC-WIN32") || ($platform eq "VC-WIN64A")
861 || ($platform eq "VC-WIN64I") || ($platform eq "VC-NT")) {
863 \$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc
864 \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc
866 \$(OBJ_D)\\\$(SSL).res: ms\\version32.rc
867 \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc
872 $defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep);
873 foreach (split(/\s+/,$test))
878 # Check to see if test program is FIPS
881 # If fips perform static link to
883 $t_libs = "\$(O_FIPSCANISTER)";
888 $t_libs = "\$(L_LIBS)";
892 $tt="\$(OBJ_D)${o}$t${obj}";
893 $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","$t_libs \$(EX_LIBS)", $ltype);
896 $defs.=&do_defs("E_SHLIB",$engines . $otherlibs,"\$(ENG_D)",$shlibp);
898 foreach (split(/\s+/,$engines))
901 my @objs = grep {/e_$engine/} @engines_obj;
902 $rules.=&do_compile_rule("\$(OBJ_D)",join(" ",@objs),$lib);
903 map {$_=~s/.*\/([^\/]+)$/\$(OBJ_D)${o}$1$obj/} @objs;
904 $rules.= &do_lib_rule(join(" ",@objs),"\$(ENG_D)$o$engine$shlibp","",$shlib,"");
909 $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)");
910 #$rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)");
912 foreach (split(" ",$otherlibs))
916 $rules.= &do_lib_rule("\$(${uc}OBJ)","\$(ENG_D)$o$_$shlibp", "", $shlib, "");
924 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
925 "\$(O_CRYPTO)", "$crypto",
926 $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)");
930 $rules.= &do_lib_rule("\$(CRYPTOOBJ)",
931 "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", "");
932 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
933 "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", "");
938 $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,
944 if ($fipscanisterbuild)
946 $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)",
947 "\$(OBJ_D)${o}fips_start$obj",
949 "\$(OBJ_D)${o}fips_end$obj",
950 "\$(FIPS_SHA1_EXE)", "");
952 $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)",
953 "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(OBJ_D)${o}sha1dgst$obj $sha1_asm_obj",
954 "","\$(EX_LIBS)", 1);
958 $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)",
959 "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(O_FIPSCANISTER)",
963 $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1);
967 $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0);
969 $rules.=&do_dofile_rule("\$(BIN_D)","c_rehash","tools/c_rehash.in");
970 $rules.=&do_dofile_rule("\$(BIN_D)","CA.pl","apps/CA.pl.in");
974 if ($platform eq "linux-elf") {
976 # Generate perlasm output files
978 (cd \$(\@D)/..; PERL=perl make -f Makefile asm/\$(\@F))
981 print "###################################################################\n";
984 ###############################################
985 # strip off any trailing .[och] and append the relative directory
986 # also remembering to do nothing if we are in one of the dropped
990 local($dir,$val,$keepext)=@_;
993 return("") if $no_engine && $dir =~ /\/engine/;
994 return("") if $no_hw && $dir =~ /\/hw/;
995 return("") if $no_idea && $dir =~ /\/idea/;
996 return("") if $no_aes && $dir =~ /\/aes/;
997 return("") if $no_camellia && $dir =~ /\/camellia/;
998 return("") if $no_seed && $dir =~ /\/seed/;
999 return("") if $no_rc2 && $dir =~ /\/rc2/;
1000 return("") if $no_rc4 && $dir =~ /\/rc4/;
1001 return("") if $no_rc5 && $dir =~ /\/rc5/;
1002 return("") if $no_rsa && $dir =~ /\/rsa/;
1003 return("") if $no_rsa && $dir =~ /^rsaref/;
1004 return("") if $no_dsa && $dir =~ /\/dsa/;
1005 return("") if $no_dh && $dir =~ /\/dh/;
1006 return("") if $no_ec && $dir =~ /\/ec/;
1007 return("") if $no_cms && $dir =~ /\/cms/;
1008 return("") if $no_comp && $dir =~ /\/comp/;
1009 return("") if !$fips && $dir =~ /^fips/;
1010 if ($no_des && $dir =~ /\/des/)
1012 if ($val =~ /read_pwd/)
1013 { return("$dir/read_pwd "); }
1017 return("") if $no_mdc2 && $dir =~ /\/mdc2/;
1018 return("") if $no_sock && $dir =~ /\/proxy/;
1019 return("") if $no_bf && $dir =~ /\/bf/;
1020 return("") if $no_cast && $dir =~ /\/cast/;
1021 return("") if $no_whirlpool && $dir =~ /\/whrlpool/;
1023 $val =~ s/^\s*(.*)\s*$/$1/;
1024 @a=split(/\s+/,$val);
1025 grep(s/\.[och]$//,@a) unless $keepext;
1027 @a=grep(!/^e_.*_3d$/,@a) if $no_des;
1028 @a=grep(!/^e_.*_d$/,@a) if $no_des;
1029 @a=grep(!/^e_.*_ae$/,@a) if $no_idea;
1030 @a=grep(!/^e_.*_i$/,@a) if $no_aes;
1031 @a=grep(!/^e_.*_r2$/,@a) if $no_rc2;
1032 @a=grep(!/^e_.*_r5$/,@a) if $no_rc5;
1033 @a=grep(!/^e_.*_bf$/,@a) if $no_bf;
1034 @a=grep(!/^e_.*_c$/,@a) if $no_cast;
1035 @a=grep(!/^e_rc4$/,@a) if $no_rc4;
1036 @a=grep(!/^e_camellia$/,@a) if $no_camellia;
1037 @a=grep(!/^e_seed$/,@a) if $no_seed;
1039 #@a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3;
1041 @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock;
1043 @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2;
1044 @a=grep(!/(^md4)|(_md4$)/,@a) if $no_md4;
1045 @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5;
1046 @a=grep(!/(rmd)|(ripemd)/,@a) if $no_ripemd;
1047 @a=grep(!/(^blake)/,@a) if $no_blake2;
1049 @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa;
1050 @a=grep(!/(^p_open$)/,@a) if $no_rsa;
1052 @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa;
1053 @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa;
1055 @a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4;
1057 @a=grep(!/_dhp$/,@a) if $no_dh;
1059 @a=grep(!/_mdc2$/,@a) if $no_mdc2;
1061 @a=grep(!/(srp)/,@a) if $no_srp;
1063 @a=grep(!/^engine$/,@a) if $no_engine;
1064 @a=grep(!/^hw$/,@a) if $no_hw;
1065 @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa;
1066 @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa;
1067 @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh;
1069 grep($_="$dir/$_",@a);
1070 @a=grep(!/(^|\/)s_/,@a) if $no_sock;
1071 @a=grep(!/(^|\/)bio_sock/,@a) if $no_sock;
1072 $ret=join(' ',@a)." ";
1076 # change things so that each 'token' is only separated by one space
1081 $w =~ s/^\s*(.*)\s*$/$1/;
1088 local($var,$files,$location,$postfix)=@_;
1090 local(*OUT,$tmp,$t);
1092 $files =~ s/\//$o/g if $o ne '/';
1096 foreach (split(/ /,$files))
1099 $_=&bname($_) unless /^\$/;
1105 if (($_ =~ /bss_file/) && ($postfix eq ".h"))
1107 else { $pf=$postfix; }
1108 if ($_ =~ /BN_ASM/) { $t="$_ "; }
1109 elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; }
1110 elsif ($_ =~ /AES_ASM/){ $t="$_ "; }
1111 elsif ($_ =~ /DES_ENC/) { $t="$_ "; }
1112 elsif ($_ =~ /BF_ENC/) { $t="$_ "; }
1113 elsif ($_ =~ /CAST_ENC/){ $t="$_ "; }
1114 elsif ($_ =~ /RC4_ENC/) { $t="$_ "; }
1115 elsif ($_ =~ /RC5_ENC/) { $t="$_ "; }
1116 elsif ($_ =~ /MD5_ASM/) { $t="$_ "; }
1117 elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; }
1118 elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; }
1119 elsif ($_ =~ /WHIRLPOOL_ASM/){ $t="$_ "; }
1120 elsif ($_ =~ /CPUID_ASM/){ $t="$_ "; }
1121 else { $t="$location${o}$_$pf "; }
1126 # hack to add version info on MSVC
1127 if ($shlib && (($platform eq "VC-WIN32") || ($platfrom eq "VC-WIN64I") || ($platform eq "VC-WIN64A") || ($platform eq "VC-NT")))
1129 if ($var eq "CRYPTOOBJ")
1130 { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; }
1131 elsif ($var eq "SSLOBJ")
1132 { $ret.="\$(OBJ_D)\\\$(SSL).res "; }
1134 chomp($ret); # Does this actually do something? /RL
1139 # return the name with the leading path removed
1143 $ret =~ s/^.*[\\\/]([^\\\/]+)$/$1/;
1147 # return the leading path
1151 $ret =~ s/(^.*)[\\\/][^\\\/]+$/$1/;
1155 ##############################################################
1156 # do a rule for each file that says 'compile' to new direcory
1157 # compile the files in '$files' into $to
1160 local($to,$files,$ex)=@_;
1161 local($ret,$_,$n,$d,$s);
1163 $files =~ s/\//$o/g if $o ne '/';
1164 foreach (split(/\s+/,$files))
1170 $ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex)
1172 elsif (-f ($s="${d}${o}asm${o}${n}.pl") or
1173 ($s=~s/sha256/sha512/ and -f $s) or
1174 -f ($s="${d}${o}${n}.pl"))
1176 $ret.=&perlasm_compile_target("$to${o}$n$obj",$s,$n);
1178 elsif (-f ($s="${d}${o}asm${o}${n}.S") or
1179 -f ($s="${d}${o}${n}.S"))
1181 $ret.=&Sasm_compile_target("$to${o}$n$obj",$s,$n);
1183 elsif (defined &special_compile_target and
1184 ($s=special_compile_target($_)))
1188 else { die "no rule for $_"; }
1193 ##############################################################
1194 # do a rule for each file that says 'compile' to new direcory
1195 sub perlasm_compile_target
1197 my($target,$source,$bname)=@_;
1199 return platform_perlasm_compile_target($target, $source, $bname)
1200 if defined &platform_perlasm_compile_target;
1203 $bname =~ s/(.*)\.[^\.]$/$1/;
1204 $ret ="\$(TMP_D)$o$bname$asm_suffix: $source\n";
1205 $ret.="\t\$(PERL) $source $asmtype \$(CFLAG) \$\@\n";
1206 if ($fipscanisteronly)
1208 $ret .= "\t\$(PERL) util$o.pl . \$@ norunasm \$(CFLAG)\n";
1211 $ret.="$target: \$(TMP_D)$o$bname$asm_suffix\n";
1212 $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname$asm_suffix\n\n";
1216 sub Sasm_compile_target
1218 my($target,$source,$bname)=@_;
1221 $bname =~ s/(.*)\.[^\.]$/$1/;
1222 $ret ="\$(TMP_D)$o$bname.asm: $source\n";
1223 $ret.="\t\$(CC) -E \$(CFLAG) $source >\$\@\n";
1224 $ret.="\t\$(PERL) util\\fipsas.pl . \$@ norunasm \$(CFLAG)\n" if $fipscanisteronly;
1226 $ret.="$target: \$(TMP_D)$o$bname.asm\n";
1227 $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n";
1231 sub cc_compile_target
1233 local($target,$source,$ex_flags)=@_;
1236 $target =~ s/\//$o/g if $o ne "/";
1237 $source =~ s/\//$o/g if $o ne "/";
1238 $ret ="$target: \$(SRC_D)$o$source\n\t";
1240 $ret.= " -MMD" if $orig_platform eq "copy";
1241 $ret.= " ${ofile}$target $ex_flags -c \$(SRC_D)$o$source\n\n";
1242 $target =~ s/\.o$/.d/;
1243 $ret.=".sinclude \"$target\"\n\n" if $orig_platform eq "copy";
1247 ##############################################################
1250 local($target,$src)=@_;
1251 local($ret,@s,@t,$i);
1253 $target =~ s/\//$o/g if $o ne "/";
1254 $src =~ s/\//$o/g if $o ne "/";
1256 @t=split(/\s+/,$target);
1257 @s=split(/\s+/,$src);
1260 for ($i=0; $i<=$#s; $i++)
1262 my $objfile = $t[$i];
1263 my $srcfile = $s[$i];
1267 my $plasm = $objfile;
1268 $plasm =~ s/${obj}/.pl/;
1269 $ret.="$srcfile: $plasm\n";
1270 $ret.="\t\$(PERL) $plasm $asmtype \$(CFLAG) $srcfile\n\n";
1273 $ret.="$objfile: $srcfile\n";
1274 $ret.="\t\$(ASM) $afile$objfile \$(SRC_D)$o$srcfile\n\n";
1285 ($nn=$n) =~ tr/a-z/A-Z/;
1286 $ret.="$n.dll: \$(${nn}OBJ)\n";
1289 $ret.="\t\$(MKSHLIB) $efile$n.dll $def @<<\n \$(${nn}OBJ_F)\n<<\n";
1295 # do a rule for each file that says 'copy' to new direcory on change
1298 local($to,$files,$p)=@_;
1299 local($ret,$_,$n,$pp);
1302 $files =~ s/\//$o/g if $o ne '/';
1303 foreach (split(/\s+/,$files))
1306 if ($n =~ /bss_file/)
1309 $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(PERL) \$(SRC_D)${o}util${o}copy-if-different.pl \"\$(SRC_D)$o$_$pp\" \"$to${o}$n$pp\"\n\n";
1316 (my $to, my $file, my $tmpl) = @_;
1318 $file =~ s|/|$o|g if $o ne '/';
1321 \$(PERL) "-I." "-Mconfigdata" util/dofile.pl "$tmpl" > "$to${o}$file.new"
1322 \$(MV) "$to${o}$file.new" "$to${o}$file"
1326 # Options picked up from the OPTIONS line in the top level Makefile
1327 # generated by Configure.
1331 # Many options are handled in a similar way. In particular
1332 # no-xxx sets zero or more scalars to 1.
1333 # Process these using the %valid_options hash containing the option
1334 # name and reference to the scalars to set. In some cases the option
1335 # needs no special handling and can be ignored: this is done by
1336 # setting the value to 0.
1338 my %valid_options = (
1339 "no-rc2" => \$no_rc2,
1340 "no-rc4" => \$no_rc4,
1341 "no-rc5" => \$no_rc5,
1342 "no-idea" => \$no_idea,
1343 "no-aes" => \$no_aes,
1344 "no-camellia" => \$no_camellia,
1345 "no-seed" => \$no_seed,
1346 "no-des" => \$no_des,
1348 "no-cast" => \$no_cast,
1349 "no-md2" => \$no_md2,
1350 "no-md4" => \$no_md4,
1351 "no-md5" => \$no_md5,
1352 "no-rmd160" => \$no_ripemd,
1353 "no-blake2" => \$no_blake2,
1354 "no-mdc2" => \$no_mdc2,
1355 "no-whirlpool" => \$no_whirlpool,
1357 [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa],
1358 "no-rsa" => \$no_rsa,
1359 "no-dsa" => \$no_dsa,
1361 "no-asm" => \$no_asm,
1363 "gaswin" => \$gaswin,
1364 "no-ssl3" => \$no_ssl3,
1365 "no-ssl3-method" => 0,
1366 "no-weak-ssl-ciphers" => 0,
1367 "no-srp" => \$no_srp,
1368 "no-cms" => \$no_cms,
1369 "no-ec2m" => \$no_ec2m,
1370 "no-ec_nistp_64_gcc_128" => 0,
1371 "no-err" => \$no_err,
1372 "no-sock" => \$no_sock,
1374 "no-gost" => \$no_gost,
1375 "no-engine" => \$no_engine,
1377 "no-heartbeats" => 0,
1379 "no-async" => \$no_async,
1380 "no-autoalginit" => \$no_autoalginit,
1381 "no-autoerrinit" => \$no_autoerrinit,
1383 [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast,
1384 \$no_md2, \$no_mdc2, \$no_dsa, \$no_dh,
1385 \$no_err, \$no_ripemd, \$no_rc5,
1386 \$no_aes, \$no_camellia, \$no_seed, \$no_srp],
1390 "--debug" => \$debug,
1392 "profile" => \$profile,
1404 "no-zlib-dynamic" => 0,
1405 "no-ssl-trace" => 0,
1406 "no-unit-test" => 0,
1407 "no-comp" => \$no_comp,
1408 "no-deprecated" => 0,
1410 "no-crypto-mdebug" => 0,
1411 "no-crypto-mdebug-backtrace" => 0,
1413 "fipscanisterbuild" => [\$fips, \$fipscanisterbuild],
1414 "fipscanisteronly" => [\$fips, \$fipscanisterbuild, \$fipscanisteronly],
1415 "fipscheck" => [\$fips, \$fipscanisterbuild, \$fipscanisteronly],
1418 if (exists $valid_options{$_})
1420 my $r = $valid_options{$_};
1421 if ( ref $r eq "SCALAR")
1423 elsif ( ref $r eq "ARRAY")
1432 elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 }
1433 elsif (/^enable-zlib-dynamic$/)
1437 elsif (/^no-static-engine/ or /^enable-dynamic-engine/)
1439 $no_static_engine = 1;
1441 elsif (/^no-dynamic-engine/ or /^enable-static-engine/)
1443 $no_static_engine = 0;
1445 # There are also enable-xxx options which correspond to
1446 # the no-xxx. Since the scalars are enabled by default
1447 # these can be ignored.
1451 $t =~ s/^enable/no/;
1452 if (exists $valid_options{$t})
1456 elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; }
1457 elsif (/^-[lL].*$/) { $l_flags.="$_ "; }
1458 elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/)
1459 { $c_flags.="$_ "; }
1466 print STDERR "***FIPS module directory sanity check failed***\n";
1467 print STDERR "FIPS module build failed, or was deleted\n";
1468 print STDERR "Please rebuild FIPS module.\n";
1472 sub fips_check_files
1478 print STDERR "FIPS module directory $dir does not exist\n";
1483 if (!-f "$dir${o}$_")
1485 print STDERR "FIPS module file $_ does not exist!\n";
1489 fipslib_error() if ($ret == 0);