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 "OS2-EMX", "EMX GCC OS/2",
112 "netware-clib", "CodeWarrior for NetWare - CLib - with WinSock Sockets",
113 "netware-clib-bsdsock", "CodeWarrior for NetWare - CLib - with BSD Sockets",
114 "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets",
115 "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets",
116 "default","cc under unix",
117 "auto", "auto detect from top level Makefile",
118 "copy", "copy from top level Makefile"
125 if (!&read_options && !defined($ops{$_}))
127 print STDERR "unknown option - $_\n";
128 print STDERR "usage: perl mk1mf.pl [options] [system]\n";
129 print STDERR "\nwhere [system] can be one of the following\n";
130 foreach $i (sort keys %ops)
131 { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; }
132 print STDERR <<"EOF";
133 and [options] can be one of
134 no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest
136 no-blake2 - No blake2
137 no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher
138 no-bf no-cast no-aes no-camellia no-seed
139 no-rsa no-dsa no-dh - Skip this public key cipher
140 no-ssl3 - Skip this version of SSL
141 just-ssl - remove all non-ssl keys/digest
145 no-engine - No engine
148 no-async - No Async (use NULL)
149 no-autoalginit - Don't auto load algorithms in libcrypto
150 no-autoerrinit - Don't auto load error strings for libcrypto or libssl
151 nasm - Use NASM for x86 asm
152 nw-nasm - Use NASM x86 asm for NetWare
153 nw-mwasm - Use Metrowerks x86 asm for NetWare
154 gaswin - Use GNU as with Mingw32
155 no-socks - No socket code
156 no-err - No error strings
157 dll/shlib - Build shared libraries (MS)
159 profile - Profiling build
162 Values that can be set
163 TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler
165 -L<ex_lib_path> -l<ex_lib> - extra library flags (unix)
166 -<ex_cc_flags> - extra 'cc' flags,
167 added (MS), or replace (unix)
173 foreach (grep(!/^$/, split(/ /, $OPTIONS)))
175 print STDERR "unknown option - $_\n" if !&read_options;
178 $no_mdc2=1 if ($no_des);
180 $no_ssl3=1 if ($no_md5);
181 $no_ssl3=1 if ($no_rsa && $no_dh);
187 $perl="perl" unless defined $perl;
188 $mkdir="-mkdir" unless defined $mkdir;
189 $mv="mv" unless defined $mv;
191 ($ssl,$crypto)=("ssl","crypto");
192 $ranlib="echo ranlib";
194 $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc';
195 $src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}: $platform eq 'copy' ? getcwd() : '.';
196 $bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:'';
198 # $bin_dir.=$o causes a core dump on my sparc :-(
203 push(@INC,"util/pl","pl");
205 if ($platform eq "auto" || $platform eq 'copy') {
206 $orig_platform = $platform;
207 $platform = $mf_platform;
208 print STDERR "Imported platform $mf_platform\n";
211 if (($platform =~ /VC-(.+)/))
214 $NT = 1 if $1 eq "NT";
217 elsif ($platform eq "Mingw32")
219 require 'Mingw32.pl';
221 elsif ($platform eq "Mingw32-files")
223 require 'Mingw32f.pl';
225 elsif ($platform eq "FreeBSD")
228 $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer';
230 elsif ($platform eq "linux-elf")
236 elsif ($platform eq "OS2-EMX")
239 require 'OS2-EMX.pl';
241 elsif (($platform eq "netware-clib") || ($platform eq "netware-libc") ||
242 ($platform eq "netware-clib-bsdsock") || ($platform eq "netware-libc-bsdsock"))
244 $LIBC=1 if $platform eq "netware-libc" || $platform eq "netware-libc-bsdsock";
245 $BSDSOCK=1 if ($platform eq "netware-libc-bsdsock") || ($platform eq "netware-clib-bsdsock");
246 require 'netware.pl';
253 $cflags.=' -DTERMIO';
256 $out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":"");
257 $tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":"");
258 $inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def;
260 $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq ''));
262 $cflags= "$xcflags$cflags" if $xcflags ne "";
264 $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea;
265 $cflags.=" -DOPENSSL_NO_AES" if $no_aes;
266 $cflags.=" -DOPENSSL_NO_CAMELLIA" if $no_camellia;
267 $cflags.=" -DOPENSSL_NO_SEED" if $no_seed;
268 $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2;
269 $cflags.=" -DOPENSSL_NO_RC4" if $no_rc4;
270 $cflags.=" -DOPENSSL_NO_RC5" if $no_rc5;
271 $cflags.=" -DOPENSSL_NO_MD2" if $no_md2;
272 $cflags.=" -DOPENSSL_NO_MD4" if $no_md4;
273 $cflags.=" -DOPENSSL_NO_MD5" if $no_md5;
274 $cflags.=" -DOPENSSL_NO_RMD160" if $no_ripemd;
275 $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2;
276 $cflags.=" -DOPENSSL_NO_BF" if $no_bf;
277 $cflags.=" -DOPENSSL_NO_CAST" if $no_cast;
278 $cflags.=" -DOPENSSL_NO_DES" if $no_des;
279 $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa;
280 $cflags.=" -DOPENSSL_NO_DSA" if $no_dsa;
281 $cflags.=" -DOPENSSL_NO_DH" if $no_dh;
282 $cflags.=" -DOPENSSL_NO_WHIRLPOOL" if $no_whirlpool;
283 $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock;
284 $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3;
285 $cflags.=" -DOPENSSL_NO_SRP" if $no_srp;
286 $cflags.=" -DOPENSSL_NO_CMS" if $no_cms;
287 $cflags.=" -DOPENSSL_NO_ERR" if $no_err;
288 $cflags.=" -DOPENSSL_NO_EC" if $no_ec;
289 $cflags.=" -DOPENSSL_NO_GOST" if $no_gost;
290 $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine;
291 $cflags.=" -DOPENSSL_NO_HW" if $no_hw;
292 $cflags.=" -DOPENSSL_NO_ASYNC" if $no_async;
293 $cflags.=" -DOPENSSL_NO_AUTOALGINIT" if $no_autoalginit;
294 $cflags.=" -DOPENSSL_NO_AUTOERRINIT" if $no_autoerrinit;
295 $cflags.=" -DOPENSSL_FIPS" if $fips;
296 $cflags.=" -DOPENSSL_NO_EC2M" if $no_ec2m;
297 $cflags.= " -DZLIB" if $zlib_opt;
298 $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2;
299 $cflags.=" -DOPENSSL_PIC";
301 if ($no_static_engine)
303 $cflags .= " -DOPENSSL_NO_STATIC_ENGINE";
307 $cflags .= " -DOPENSSL_NO_DYNAMIC_ENGINE";
310 #$cflags.=" -DRSAref" if $rsaref ne "";
313 ## { $cflags="$c_flags" if ($c_flags ne ""); }
315 { $cflags="$c_flags$cflags" if ($c_flags ne ""); }
317 if ($orig_platform eq 'copy') {
318 $cflags = "$mf_cflag $mf_shared_cflag";
322 $ex_libs="$l_flags$ex_libs" if ($l_flags ne "");
325 %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL",
326 "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO");
330 $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n";
331 $banner.="\t\@echo top level directory, if you don't have perl, you will\n";
332 $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n";
333 $banner.="\t\@echo documentation for details.\n";
336 # have to do this to allow $(CC) under unix
337 $link="$bin_dir$link" if ($link !~ /^\$/);
339 $INSTALLTOP =~ s|/|$o|g;
340 $OPENSSLDIR =~ s|/|$o|g;
342 #############################################
343 # We parse in input file and 'store' info for later printing.
344 open(IN,"<$infile") || die "unable to open $infile:$!\n";
348 s/\s*$//; # was chop, didn't work in mixture of perls for Windows...
350 ($key,$val)=/^([^=]+)=(.*)/;
351 if ($key eq "RELATIVE_DIRECTORY")
355 if ($fips && $dir =~ /^fips/)
362 $uc =~ s/^lib(.*)\.a/$1/;
365 if (($uc ne "FIPS") || $fipscanisterbuild)
368 $lib_obj{$uc}.=$libobj." ";
371 last if ($val eq "FINISHED");
377 if ($key eq "ZLIB_INCLUDE")
378 { $cflags .= " $val" if $val ne "";}
380 if ($key eq "LIBZLIB")
381 { $zlib_lib = "$val" if $val ne "";}
383 if ($key eq "EX_LIBS")
384 { $ex_libs .= " $val" if $val ne "";}
386 # There was a condition here before:
387 # !$fipscanisteronly || $dir =~ /^fips/
388 # It currently fills no function and needs to be rewritten anyway, so
390 if ($dir eq "test" && $key eq "EXE")
392 foreach my $t (split /\s+/, $val) {
393 $test.=&var_add($dir,$t, 0) if $t; }
396 if ($key eq "EXE_OBJ")
397 { $e_exe.=&var_add($dir,$val, 0); }
402 $lib =~ s/^.*\/([^\/]+)$/$1/;
404 if ($key eq "LIBNAME" && $no_static_engine)
407 $lib =~ s/^.*\/([^\/]+)$/$1/;
408 $otherlibs .= " $lib";
411 if ($key eq "HEADER")
412 { $header.=&var_add($dir,$val, 1); }
414 if ($key eq "LIBOBJ")
416 if ($dir ne "engines" || !$no_static_engine)
417 { $libobj=&var_add($dir,$val, 0); }
419 { push(@engines_obj,split(/\s+/,&var_add($dir,$val,0))); }
421 if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine)
424 if ($key eq "FIPS_EX_OBJ")
426 $fips_ex_obj=&var_add("crypto",$val,0);
429 if ($key eq "FIPSLIBDIR")
432 $fipslibdir =~ s/\/$//;
433 $fipslibdir =~ s/\//$o/g;
436 if ($key eq "BASEADDR")
440 { $_="RELATIVE_DIRECTORY=FINISHED\n"; }
444 if ($orig_platform eq 'copy')
446 # Remove opensslconf.h so it doesn't get updated if we configure a
448 $header =~ s/[^ ]+\/opensslconf.h//;
454 foreach (split " ", $fips_ex_obj)
456 $fips_exclude_obj{$1} = 1 if (/\/([^\/]*)$/);
459 "$mf_cpuid_asm $mf_aes_asm $mf_sha_asm $mf_bn_asm " .
460 "$mf_des_asm $mf_modes_asm")
463 $fips_exclude_obj{$_} = 1;
465 my @ltmp = split " ", $lib_obj{"CRYPTO"};
468 $lib_obj{"CRYPTO"} = "";
472 if (/\/([^\/]*)$/ && exists $fips_exclude_obj{$1})
474 if ($fipscanisterbuild)
476 $lib_obj{"FIPS"} .= "$_ ";
479 elsif (!$fipscanisteronly)
481 $lib_obj{"CRYPTO"} .= "$_ ";
487 if ($fipscanisterbuild)
489 $fips_canister_path = "\$(LIB_D)${o}fipscanister.lib" if $fips_canister_path eq "";
490 $fips_premain_c_path = "\$(LIB_D)${o}fips_premain.c";
494 if ($fips_canister_path eq "")
496 $fips_canister_path = "\$(FIPSLIB_D)${o}fipscanister.lib";
499 if ($fips_premain_c_path eq "")
501 $fips_premain_c_path = "\$(FIPSLIB_D)${o}fips_premain.c";
507 if ($fips_sha1_exe_path eq "")
509 $fips_sha1_exe_path =
510 "\$(BIN_D)${o}fips_standalone_sha1$exep";
515 $fips_sha1_exe_path = "";
518 if ($fips_premain_dso_exe_path eq "")
520 $fips_premain_dso_exe_path = "\$(BIN_D)${o}fips_premain_dso$exep";
523 # $ex_build_targets .= "\$(BIN_D)${o}\$(E_PREMAIN_DSO)$exep" if ($fips);
529 $build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)";
530 $ex_l_libs .= " \$(O_FIPSCANISTER)";
531 $ex_libs_dep .= " \$(O_FIPSCANISTER)" if $fipscanisterbuild;
533 if ($fipscanisterbuild)
535 $fipslibdir = "\$(LIB_D)";
539 if ($fipslibdir eq "")
541 open (IN, "util/fipslib_path.txt") || fipslib_error();
544 $fipslibdir = "" unless defined($fipslibdir);
545 $fipslibdir =~ s{\R$}{};
546 fipslib_error() if ($fipslibdir eq "");
548 fips_check_files($fipslibdir,
549 "fipscanister.lib", "fipscanister.lib.sha1",
550 "fips_premain.c", "fips_premain.c.sha1");
554 if ($fipscanisteronly)
556 $build_targets = "\$(O_FIPSCANISTER) \$(T_EXE)";
560 $cp2 = $cp unless defined $cp2;
562 $extra_install= <<"EOF";
563 \$(CP) \"include${o}openssl${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\"
564 \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\"
565 \$(MKDIR) \"\$(OPENSSLDIR)\"
566 \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\"
569 if ($fipscanisteronly)
571 $extra_install = <<"EOF";
572 \$(CP) \"\$(O_FIPSCANISTER)\" \"\$(INSTALLTOP)${o}lib\"
573 \$(CP) \"\$(O_FIPSCANISTER).sha1\" \"\$(INSTALLTOP)${o}lib\"
574 \$(CP2) \"fips${o}fips_premain.c\" \"\$(INSTALLTOP)${o}lib\"
575 \$(CP) \"fips${o}fips_premain.c.sha1\" \"\$(INSTALLTOP)${o}lib\"
576 \$(CP) \"include${o}openssl${o}fips.h\" \"\$(INSTALLTOP)${o}include${o}openssl\"
577 \$(CP) \"include${o}openssl${o}fips_rand.h\" \"\$(INSTALLTOP)${o}include${o}openssl\"
578 \$(CP) "\$(BIN_D)${o}fips_standalone_sha1$exep" \"\$(INSTALLTOP)${o}bin\"
579 \$(CP) \"util${o}fipslink.pl\" \"\$(INSTALLTOP)${o}bin\"
584 $extra_install .= <<"EOF";
585 \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}bin\"
586 \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}bin\"
587 \$(CP) \"\$(L_SSL)\" \"\$(INSTALLTOP)${o}lib\"
588 \$(CP) \"\$(L_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\"
590 if ($no_static_engine)
592 $extra_install .= <<"EOF"
593 \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\"
594 \$(CP) \"\$(E_SHLIB)\" \"\$(INSTALLTOP)${o}lib${o}engines\"
600 $extra_install .= <<"EOF";
601 \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}lib\"
602 \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\"
604 $ex_libs .= " $zlib_lib" if $zlib_opt == 1;
607 my $asm_def = $orig_platform eq 'copy' ? "" : "ASM=$bin_dir$asm";
609 $cflags =~ s/\((ENGINESDIR|OPENSSLDIR)\)/\(${1}_QQ\)/g;
610 (my $cflags_q = $cflags) =~ s/([\\"])/\\$1/g;
611 (my $INSTALLTOP_Q = $INSTALLTOP) =~ s/([\\"])/\\$1/g;
612 (my $INSTALLTOP_QQ = $INSTALLTOP_Q) =~ s/\\/\\\\/g;
613 (my $OPENSSLDIR_Q = $OPENSSLDIR) =~ s/([\\"])/\\$1/g;
614 (my $OPENSSLDIR_QQ = $OPENSSLDIR_Q) =~ s/\\/\\\\/g;
615 (my $ENGINESDIR_Q = $ENGINESDIR) =~ s/([\\"])/\\$1/g;
616 (my $ENGINESDIR_QQ = $ENGINESDIR_Q) =~ s/\\/\\\\/g;
619 # N.B. You MUST use -j on FreeBSD.
620 # This makefile has been automatically generated from the OpenSSL distribution.
621 # This single makefile will build the complete OpenSSL distribution and
622 # by default leave the 'interesting' output files in .${o}out and the stuff
623 # that needs deleting in .${o}tmp.
624 # The file was generated by running 'make makefile.one', which
625 # does a 'make files', which writes all the environment variables from all
626 # the makefiles to the file call MINFO. This file is used by
627 # util${o}mk1mf.pl to generate makefile.one.
628 # The 'makefile per directory' system suites me when developing this
629 # library and also so I can 'distribute' indervidual library sections.
630 # The one monster makefile better suits building in non-unix
635 $defs .= $preamble if defined $preamble;
638 INSTALLTOP=$INSTALLTOP
639 INSTALLTOP_QQ=$INSTALLTOP_QQ
640 OPENSSLDIR=$OPENSSLDIR
641 OPENSSLDIR_QQ=$OPENSSLDIR_QQ
642 ENGINESDIR=$ENGINESDIR
643 ENGINESDIR_QQ=$ENGINESDIR_QQ
645 # Set your compiler options
652 SHLIB_CFLAG=$shl_cflag
653 APP_EX_OBJ=$app_ex_obj
654 SHLIB_EX_OBJ=$shlib_ex_obj
655 # add extra libraries to this define, for solaris -lsocket -lnsl would
659 # The OpenSSL directory
665 FIPSLINK=\$(PERL) util${o}fipslink.pl
667 # The output directory for everything interesting
669 # The output directory for all the temporary muck
673 PERLASM_SCHEME=$mf_perlasm_scheme
684 # FIPS validated module and support file locations
686 E_PREMAIN_DSO=fips_premain_dso
688 FIPSLIB_D=$fipslibdir
690 FIPS_PREMAIN_SRC=$fips_premain_c_path
691 O_FIPSCANISTER=$fips_canister_path
692 FIPS_SHA1_EXE=$fips_sha1_exe_path
693 PREMAIN_DSO_EXE=$fips_premain_dso_exe_path
695 ######################################################
696 # You should not need to touch anything below this point
697 ######################################################
703 # BIN_D - Binary output directory
704 # TEST_D - Binary test file output directory
705 # LIB_D - library output directory
706 # ENG_D - dynamic engine output directory
707 # Note: if you change these point to different directories then uncomment out
708 # the lines around the 'NB' comment below.
715 # INCL_D - local library directory
716 # OBJ_D - temp object file directory
720 O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp
721 O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp
722 SO_SSL= $plib\$(SSL)$so_shlibp
723 SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp
724 L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp
725 L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp
727 L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs
729 ######################################################
730 # Don't touch anything below this point
731 ######################################################
733 INC=-I\$(SRC_D)${o}include -I\$(INCL_D) -I\$(SRC_D)${o}crypto${o}include
734 APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG)
735 LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG)
736 SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG)
739 #############################################
743 all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) headers \$(FIPS_SHA1_EXE) $build_targets
749 \$(MKDIR) \"\$(TMP_D)\"
750 # NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different
752 # \$(MKDIR) \$(BIN_D)
755 # \$(MKDIR) \$(TEST_D)
758 \$(MKDIR) \"\$(LIB_D)\"
760 # This needs to be invoked once, when the makefile is first constructed, or
762 init: \$(TMP_D) \$(LIB_D) \$(BIN_D) \$(TEST_D) headers
766 lib: \$(LIBS_DEP) \$(E_SHLIB)
768 exe: apps tools testapps
769 apps: \$(BIN_D)$o\$(E_EXE)$exep \$(BIN_D)${o}CA.pl
771 tools: \$(BIN_D)${o}c_rehash
774 \$(MKDIR) \"\$(INSTALLTOP)\"
775 \$(MKDIR) \"\$(INSTALLTOP)${o}bin\"
776 \$(MKDIR) \"\$(INSTALLTOP)${o}include\"
777 \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\"
778 \$(MKDIR) \"\$(INSTALLTOP)${o}lib\"
779 \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\"
783 \$(RM) \$(TMP_D)$o*.*
786 \$(RM) \$(TMP_D)$o*.*
787 \$(RM) \$(OUT_D)$o*.*
792 \$(RM) -rf \$(TEST_D)
797 $rules .= &do_rehash_rule("rehash.time", "apps tools");
798 $rules .= &do_test_rule("test", "rehash.time", "run_tests.pl");
801 crypto${o}buildinf.h : MINFO
802 \$(PERL) util${o}mkbuildinf.pl "\$(CC) \$(CFLAG_Q)" "\$(PLATFORM)" > crypto${o}buildinf.h
803 $(OBJ_D)${o}cversion${obj} : crypto${o}buildinf.h
806 # Strip off trailing ' '
807 foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); }
808 $test=&clean_up_ws($test);
809 $e_exe=&clean_up_ws($e_exe);
810 $header=&clean_up_ws($header);
812 $defs.=&do_defs("HEADER",$header,"\$(INCL_D)","");
813 $rules.=&do_copy_rule("\$(INCL_D)",$header,"");
815 $defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj);
816 $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)");
818 $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj);
819 $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)');
821 # Special case rules for fips_start and fips_end fips_premain_dso
825 if ($fipscanisterbuild)
827 $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_start$obj",
828 "fips${o}fips_canister.c",
829 "-DFIPS_START \$(SHLIB_CFLAGS)");
830 $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_end$obj",
831 "fips${o}fips_canister.c", "\$(SHLIB_CFLAGS)");
833 $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_standalone_sha1$obj",
834 "fips${o}sha${o}fips_standalone_sha1.c",
836 $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj",
837 "fips${o}fips_premain.c",
838 "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(APP_CFLAGS)");
846 $asm =~ s/\s+/ $dir\//g;
853 if ($orig_platform eq 'copy') {
854 $lib_obj{CRYPTO} .= fix_asm($mf_md5_asm, 'crypto/md5');
855 $lib_obj{CRYPTO} .= fix_asm($mf_bn_asm, 'crypto/bn');
856 # cpuid is included by the crypto dir
857 #$lib_obj{CRYPTO} .= fix_asm($mf_cpuid_asm, 'crypto');
858 # AES asm files end up included by the aes dir itself
859 #$lib_obj{CRYPTO} .= fix_asm($mf_aes_asm, 'crypto/aes');
860 $lib_obj{CRYPTO} .= fix_asm($mf_sha_asm, 'crypto/sha');
861 $lib_obj{CRYPTO} .= fix_asm($mf_engines_asm, 'engines');
862 $lib_obj{CRYPTO} .= fix_asm($mf_rc4_asm, 'crypto/rc4');
863 $lib_obj{CRYPTO} .= fix_asm($mf_modes_asm, 'crypto/modes');
864 $lib_obj{CRYPTO} .= fix_asm($mf_ec_asm, 'crypto/ec');
867 foreach (values %lib_nam)
869 $lib_obj=$lib_obj{$_};
872 $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj);
873 $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)";
874 $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib);
877 # hack to add version info on MSVC
878 if (($platform eq "VC-WIN32") || ($platform eq "VC-WIN64A")
879 || ($platform eq "VC-WIN64I") || ($platform eq "VC-NT")) {
881 \$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc
882 \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc
884 \$(OBJ_D)\\\$(SSL).res: ms\\version32.rc
885 \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc
890 $defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep);
891 foreach (split(/\s+/,$test))
896 # Check to see if test program is FIPS
899 # If fips perform static link to
901 $t_libs = "\$(O_FIPSCANISTER)";
906 $t_libs = "\$(L_LIBS)";
910 $tt="\$(OBJ_D)${o}$t${obj}";
911 $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","$t_libs \$(EX_LIBS)", $ltype);
914 $defs.=&do_defs("E_SHLIB",$engines . $otherlibs,"\$(ENG_D)",$shlibp);
916 foreach (split(/\s+/,$engines))
919 my @objs = grep {/e_$engine/} @engines_obj;
920 $rules.=&do_compile_rule("\$(OBJ_D)",join(" ",@objs),$lib);
921 map {$_=~s/.*\/([^\/]+)$/\$(OBJ_D)${o}$1$obj/} @objs;
922 $rules.= &do_lib_rule(join(" ",@objs),"\$(ENG_D)$o$engine$shlibp","",$shlib,"");
927 $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)");
928 #$rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)");
930 foreach (split(" ",$otherlibs))
934 $rules.= &do_lib_rule("\$(${uc}OBJ)","\$(ENG_D)$o$_$shlibp", "", $shlib, "");
942 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
943 "\$(O_CRYPTO)", "$crypto",
944 $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)");
948 $rules.= &do_lib_rule("\$(CRYPTOOBJ)",
949 "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", "");
950 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
951 "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", "");
956 $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,
962 if ($fipscanisterbuild)
964 $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)",
965 "\$(OBJ_D)${o}fips_start$obj",
967 "\$(OBJ_D)${o}fips_end$obj",
968 "\$(FIPS_SHA1_EXE)", "");
970 $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)",
971 "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(OBJ_D)${o}sha1dgst$obj $sha1_asm_obj",
972 "","\$(EX_LIBS)", 1);
976 $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)",
977 "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(O_FIPSCANISTER)",
981 $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1);
985 $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0);
987 $rules.=&do_dofile_rule("\$(BIN_D)","c_rehash","tools/c_rehash.in");
988 $rules.=&do_dofile_rule("\$(BIN_D)","CA.pl","apps/CA.pl.in");
992 if ($platform eq "linux-elf") {
994 # Generate perlasm output files
996 (cd \$(\@D)/..; PERL=perl make -f Makefile asm/\$(\@F))
999 print "###################################################################\n";
1002 ###############################################
1003 # strip off any trailing .[och] and append the relative directory
1004 # also remembering to do nothing if we are in one of the dropped
1008 local($dir,$val,$keepext)=@_;
1011 return("") if $no_engine && $dir =~ /\/engine/;
1012 return("") if $no_hw && $dir =~ /\/hw/;
1013 return("") if $no_idea && $dir =~ /\/idea/;
1014 return("") if $no_aes && $dir =~ /\/aes/;
1015 return("") if $no_camellia && $dir =~ /\/camellia/;
1016 return("") if $no_seed && $dir =~ /\/seed/;
1017 return("") if $no_rc2 && $dir =~ /\/rc2/;
1018 return("") if $no_rc4 && $dir =~ /\/rc4/;
1019 return("") if $no_rc5 && $dir =~ /\/rc5/;
1020 return("") if $no_rsa && $dir =~ /\/rsa/;
1021 return("") if $no_rsa && $dir =~ /^rsaref/;
1022 return("") if $no_dsa && $dir =~ /\/dsa/;
1023 return("") if $no_dh && $dir =~ /\/dh/;
1024 return("") if $no_ec && $dir =~ /\/ec/;
1025 return("") if $no_cms && $dir =~ /\/cms/;
1026 return("") if !$fips && $dir =~ /^fips/;
1027 if ($no_des && $dir =~ /\/des/)
1029 if ($val =~ /read_pwd/)
1030 { return("$dir/read_pwd "); }
1034 return("") if $no_mdc2 && $dir =~ /\/mdc2/;
1035 return("") if $no_sock && $dir =~ /\/proxy/;
1036 return("") if $no_bf && $dir =~ /\/bf/;
1037 return("") if $no_cast && $dir =~ /\/cast/;
1038 return("") if $no_whirlpool && $dir =~ /\/whrlpool/;
1040 $val =~ s/^\s*(.*)\s*$/$1/;
1041 @a=split(/\s+/,$val);
1042 grep(s/\.[och]$//,@a) unless $keepext;
1044 @a=grep(!/^e_.*_3d$/,@a) if $no_des;
1045 @a=grep(!/^e_.*_d$/,@a) if $no_des;
1046 @a=grep(!/^e_.*_ae$/,@a) if $no_idea;
1047 @a=grep(!/^e_.*_i$/,@a) if $no_aes;
1048 @a=grep(!/^e_.*_r2$/,@a) if $no_rc2;
1049 @a=grep(!/^e_.*_r5$/,@a) if $no_rc5;
1050 @a=grep(!/^e_.*_bf$/,@a) if $no_bf;
1051 @a=grep(!/^e_.*_c$/,@a) if $no_cast;
1052 @a=grep(!/^e_rc4$/,@a) if $no_rc4;
1053 @a=grep(!/^e_camellia$/,@a) if $no_camellia;
1054 @a=grep(!/^e_seed$/,@a) if $no_seed;
1056 #@a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3;
1058 @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock;
1060 @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2;
1061 @a=grep(!/(^md4)|(_md4$)/,@a) if $no_md4;
1062 @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5;
1063 @a=grep(!/(rmd)|(ripemd)/,@a) if $no_ripemd;
1064 @a=grep(!/(^blake)/,@a) if $no_blake2;
1066 @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa;
1067 @a=grep(!/(^p_open$)/,@a) if $no_rsa;
1069 @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa;
1070 @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa;
1072 @a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4;
1074 @a=grep(!/_dhp$/,@a) if $no_dh;
1076 @a=grep(!/_mdc2$/,@a) if $no_mdc2;
1078 @a=grep(!/(srp)/,@a) if $no_srp;
1080 @a=grep(!/^engine$/,@a) if $no_engine;
1081 @a=grep(!/^hw$/,@a) if $no_hw;
1082 @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa;
1083 @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa;
1084 @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh;
1086 grep($_="$dir/$_",@a);
1087 @a=grep(!/(^|\/)s_/,@a) if $no_sock;
1088 @a=grep(!/(^|\/)bio_sock/,@a) if $no_sock;
1089 $ret=join(' ',@a)." ";
1093 # change things so that each 'token' is only separated by one space
1098 $w =~ s/^\s*(.*)\s*$/$1/;
1105 local($var,$files,$location,$postfix)=@_;
1107 local(*OUT,$tmp,$t);
1109 $files =~ s/\//$o/g if $o ne '/';
1113 foreach (split(/ /,$files))
1116 $_=&bname($_) unless /^\$/;
1122 if (($_ =~ /bss_file/) && ($postfix eq ".h"))
1124 else { $pf=$postfix; }
1125 if ($_ =~ /BN_ASM/) { $t="$_ "; }
1126 elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; }
1127 elsif ($_ =~ /AES_ASM/){ $t="$_ "; }
1128 elsif ($_ =~ /DES_ENC/) { $t="$_ "; }
1129 elsif ($_ =~ /BF_ENC/) { $t="$_ "; }
1130 elsif ($_ =~ /CAST_ENC/){ $t="$_ "; }
1131 elsif ($_ =~ /RC4_ENC/) { $t="$_ "; }
1132 elsif ($_ =~ /RC5_ENC/) { $t="$_ "; }
1133 elsif ($_ =~ /MD5_ASM/) { $t="$_ "; }
1134 elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; }
1135 elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; }
1136 elsif ($_ =~ /WHIRLPOOL_ASM/){ $t="$_ "; }
1137 elsif ($_ =~ /CPUID_ASM/){ $t="$_ "; }
1138 else { $t="$location${o}$_$pf "; }
1143 # hack to add version info on MSVC
1144 if ($shlib && (($platform eq "VC-WIN32") || ($platfrom eq "VC-WIN64I") || ($platform eq "VC-WIN64A") || ($platform eq "VC-NT")))
1146 if ($var eq "CRYPTOOBJ")
1147 { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; }
1148 elsif ($var eq "SSLOBJ")
1149 { $ret.="\$(OBJ_D)\\\$(SSL).res "; }
1151 chomp($ret); # Does this actually do something? /RL
1156 # return the name with the leading path removed
1160 $ret =~ s/^.*[\\\/]([^\\\/]+)$/$1/;
1164 # return the leading path
1168 $ret =~ s/(^.*)[\\\/][^\\\/]+$/$1/;
1172 ##############################################################
1173 # do a rule for each file that says 'compile' to new direcory
1174 # compile the files in '$files' into $to
1177 local($to,$files,$ex)=@_;
1178 local($ret,$_,$n,$d,$s);
1180 $files =~ s/\//$o/g if $o ne '/';
1181 foreach (split(/\s+/,$files))
1187 $ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex)
1189 elsif (-f ($s="${d}${o}asm${o}${n}.pl") or
1190 ($s=~s/sha256/sha512/ and -f $s) or
1191 -f ($s="${d}${o}${n}.pl"))
1193 $ret.=&perlasm_compile_target("$to${o}$n$obj",$s,$n);
1195 elsif (-f ($s="${d}${o}asm${o}${n}.S") or
1196 -f ($s="${d}${o}${n}.S"))
1198 $ret.=&Sasm_compile_target("$to${o}$n$obj",$s,$n);
1200 elsif (defined &special_compile_target and
1201 ($s=special_compile_target($_)))
1205 else { die "no rule for $_"; }
1210 ##############################################################
1211 # do a rule for each file that says 'compile' to new direcory
1212 sub perlasm_compile_target
1214 my($target,$source,$bname)=@_;
1216 return platform_perlasm_compile_target($target, $source, $bname)
1217 if defined &platform_perlasm_compile_target;
1220 $bname =~ s/(.*)\.[^\.]$/$1/;
1221 $ret ="\$(TMP_D)$o$bname$asm_suffix: $source\n";
1222 $ret.="\t\$(PERL) $source $asmtype \$(CFLAG) \$\@\n";
1223 if ($fipscanisteronly)
1225 $ret .= "\t\$(PERL) util$o.pl . \$@ norunasm \$(CFLAG)\n";
1228 $ret.="$target: \$(TMP_D)$o$bname$asm_suffix\n";
1229 $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname$asm_suffix\n\n";
1233 sub Sasm_compile_target
1235 my($target,$source,$bname)=@_;
1238 $bname =~ s/(.*)\.[^\.]$/$1/;
1239 $ret ="\$(TMP_D)$o$bname.asm: $source\n";
1240 $ret.="\t\$(CC) -E \$(CFLAG) $source >\$\@\n";
1241 $ret.="\t\$(PERL) util\\fipsas.pl . \$@ norunasm \$(CFLAG)\n" if $fipscanisteronly;
1243 $ret.="$target: \$(TMP_D)$o$bname.asm\n";
1244 $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n";
1248 sub cc_compile_target
1250 local($target,$source,$ex_flags)=@_;
1253 $target =~ s/\//$o/g if $o ne "/";
1254 $source =~ s/\//$o/g if $o ne "/";
1255 $ret ="$target: \$(SRC_D)$o$source\n\t";
1257 $ret.= " -MMD" if $orig_platform eq "copy";
1258 $ret.= " ${ofile}$target $ex_flags -c \$(SRC_D)$o$source\n\n";
1259 $target =~ s/\.o$/.d/;
1260 $ret.=".sinclude \"$target\"\n\n" if $orig_platform eq "copy";
1264 ##############################################################
1267 local($target,$src)=@_;
1268 local($ret,@s,@t,$i);
1270 $target =~ s/\//$o/g if $o ne "/";
1271 $src =~ s/\//$o/g if $o ne "/";
1273 @t=split(/\s+/,$target);
1274 @s=split(/\s+/,$src);
1277 for ($i=0; $i<=$#s; $i++)
1279 my $objfile = $t[$i];
1280 my $srcfile = $s[$i];
1284 my $plasm = $objfile;
1285 $plasm =~ s/${obj}/.pl/;
1286 $ret.="$srcfile: $plasm\n";
1287 $ret.="\t\$(PERL) $plasm $asmtype \$(CFLAG) $srcfile\n\n";
1290 $ret.="$objfile: $srcfile\n";
1291 $ret.="\t\$(ASM) $afile$objfile \$(SRC_D)$o$srcfile\n\n";
1302 ($nn=$n) =~ tr/a-z/A-Z/;
1303 $ret.="$n.dll: \$(${nn}OBJ)\n";
1306 $ret.="\t\$(MKSHLIB) $efile$n.dll $def @<<\n \$(${nn}OBJ_F)\n<<\n";
1312 # do a rule for each file that says 'copy' to new direcory on change
1315 local($to,$files,$p)=@_;
1316 local($ret,$_,$n,$pp);
1319 $files =~ s/\//$o/g if $o ne '/';
1320 foreach (split(/\s+/,$files))
1323 if ($n =~ /bss_file/)
1326 $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";
1333 (my $to, my $file, my $tmpl) = @_;
1335 $file =~ s|/|$o|g if $o ne '/';
1338 \$(PERL) "-I." "-Mconfigdata" util/dofile.pl "$tmpl" > "$to${o}$file.new"
1339 \$(MV) "$to${o}$file.new" "$to${o}$file"
1343 # Options picked up from the OPTIONS line in the top level Makefile
1344 # generated by Configure.
1348 # Many options are handled in a similar way. In particular
1349 # no-xxx sets zero or more scalars to 1.
1350 # Process these using the %valid_options hash containing the option
1351 # name and reference to the scalars to set. In some cases the option
1352 # needs no special handling and can be ignored: this is done by
1353 # setting the value to 0.
1355 my %valid_options = (
1356 "no-rc2" => \$no_rc2,
1357 "no-rc4" => \$no_rc4,
1358 "no-rc5" => \$no_rc5,
1359 "no-idea" => \$no_idea,
1360 "no-aes" => \$no_aes,
1361 "no-camellia" => \$no_camellia,
1362 "no-seed" => \$no_seed,
1363 "no-des" => \$no_des,
1365 "no-cast" => \$no_cast,
1366 "no-md2" => \$no_md2,
1367 "no-md4" => \$no_md4,
1368 "no-md5" => \$no_md5,
1369 "no-rmd160" => \$no_ripemd,
1370 "no-blake2" => \$no_blake2,
1371 "no-mdc2" => \$no_mdc2,
1372 "no-whirlpool" => \$no_whirlpool,
1374 [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa],
1375 "no-rsa" => \$no_rsa,
1376 "no-dsa" => \$no_dsa,
1378 "no-asm" => \$no_asm,
1380 "nw-nasm" => \$nw_nasm,
1381 "nw-mwasm" => \$nw_mwasm,
1382 "gaswin" => \$gaswin,
1383 "no-ssl3" => \$no_ssl3,
1384 "no-ssl3-method" => 0,
1385 "no-weak-ssl-ciphers" => 0,
1386 "no-srp" => \$no_srp,
1387 "no-cms" => \$no_cms,
1388 "no-ec2m" => \$no_ec2m,
1389 "no-ec_nistp_64_gcc_128" => 0,
1390 "no-err" => \$no_err,
1391 "no-sock" => \$no_sock,
1393 "no-gost" => \$no_gost,
1394 "no-engine" => \$no_engine,
1396 "no-heartbeats" => 0,
1398 "no-async" => \$no_async,
1399 "no-autoalginit" => \$no_autoalginit,
1400 "no-autoerrinit" => \$no_autoerrinit,
1402 [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast,
1403 \$no_md2, \$no_mdc2, \$no_dsa, \$no_dh,
1404 \$no_err, \$no_ripemd, \$no_rc5,
1405 \$no_aes, \$no_camellia, \$no_seed, \$no_srp],
1409 "--debug" => \$debug,
1411 "profile" => \$profile,
1423 "no-zlib-dynamic" => 0,
1424 "no-ssl-trace" => 0,
1425 "no-unit-test" => 0,
1426 "no-deprecated" => 0,
1428 "no-crypto-mdebug" => 0,
1429 "no-crypto-mdebug-backtrace" => 0,
1431 "fipscanisterbuild" => [\$fips, \$fipscanisterbuild],
1432 "fipscanisteronly" => [\$fips, \$fipscanisterbuild, \$fipscanisteronly],
1433 "fipscheck" => [\$fips, \$fipscanisterbuild, \$fipscanisteronly],
1436 if (exists $valid_options{$_})
1438 my $r = $valid_options{$_};
1439 if ( ref $r eq "SCALAR")
1441 elsif ( ref $r eq "ARRAY")
1450 elsif (/^no-comp$/) { $xcflags = "-DOPENSSL_NO_COMP $xcflags"; }
1451 elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 }
1452 elsif (/^enable-zlib-dynamic$/)
1456 elsif (/^no-static-engine/ or /^enable-dynamic-engine/)
1458 $no_static_engine = 1;
1460 elsif (/^no-dynamic-engine/ or /^enable-static-engine/)
1462 $no_static_engine = 0;
1464 # There are also enable-xxx options which correspond to
1465 # the no-xxx. Since the scalars are enabled by default
1466 # these can be ignored.
1470 $t =~ s/^enable/no/;
1471 if (exists $valid_options{$t})
1475 elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; }
1476 elsif (/^-[lL].*$/) { $l_flags.="$_ "; }
1477 elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/)
1478 { $c_flags.="$_ "; }
1485 print STDERR "***FIPS module directory sanity check failed***\n";
1486 print STDERR "FIPS module build failed, or was deleted\n";
1487 print STDERR "Please rebuild FIPS module.\n";
1491 sub fips_check_files
1497 print STDERR "FIPS module directory $dir does not exist\n";
1502 if (!-f "$dir${o}$_")
1504 print STDERR "FIPS module file $_ does not exist!\n";
1508 fipslib_error() if ($ret == 0);