summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/util/mk1mf.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/util/mk1mf.pl')
-rw-r--r--src/lib/libcrypto/util/mk1mf.pl87
1 files changed, 10 insertions, 77 deletions
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl
index 72fa089f6b..1dcef2b8a2 100644
--- a/src/lib/libcrypto/util/mk1mf.pl
+++ b/src/lib/libcrypto/util/mk1mf.pl
@@ -18,8 +18,6 @@ local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic
18local $zlib_lib = ""; 18local $zlib_lib = "";
19local $perl_asm = 0; # 1 to autobuild asm files from perl scripts 19local $perl_asm = 0; # 1 to autobuild asm files from perl scripts
20 20
21my $ex_l_libs = "";
22
23# Options to import from top level Makefile 21# Options to import from top level Makefile
24 22
25my %mf_import = ( 23my %mf_import = (
@@ -42,9 +40,7 @@ my %mf_import = (
42 SHA1_ASM_OBJ => \$mf_sha_asm, 40 SHA1_ASM_OBJ => \$mf_sha_asm,
43 RMD160_ASM_OBJ => \$mf_rmd_asm, 41 RMD160_ASM_OBJ => \$mf_rmd_asm,
44 WP_ASM_OBJ => \$mf_wp_asm, 42 WP_ASM_OBJ => \$mf_wp_asm,
45 CMLL_ENC => \$mf_cm_asm, 43 CMLL_ENC => \$mf_cm_asm
46 BASEADDR => \$baseaddr,
47 FIPSDIR => \$fipsdir,
48); 44);
49 45
50 46
@@ -108,7 +104,6 @@ and [options] can be one of
108 just-ssl - remove all non-ssl keys/digest 104 just-ssl - remove all non-ssl keys/digest
109 no-asm - No x86 asm 105 no-asm - No x86 asm
110 no-krb5 - No KRB5 106 no-krb5 - No KRB5
111 no-srp - No SRP
112 no-ec - No EC 107 no-ec - No EC
113 no-ecdsa - No ECDSA 108 no-ecdsa - No ECDSA
114 no-ecdh - No ECDH 109 no-ecdh - No ECDH
@@ -233,8 +228,6 @@ else
233 $cflags.=' -DTERMIO'; 228 $cflags.=' -DTERMIO';
234 } 229 }
235 230
236$fipsdir =~ s/\//${o}/g;
237
238$out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":""); 231$out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":"");
239$tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":""); 232$tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":"");
240$inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def; 233$inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def;
@@ -268,7 +261,6 @@ $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock;
268$cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2; 261$cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2;
269$cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; 262$cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3;
270$cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext; 263$cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext;
271$cflags.=" -DOPENSSL_NO_SRP" if $no_srp;
272$cflags.=" -DOPENSSL_NO_CMS" if $no_cms; 264$cflags.=" -DOPENSSL_NO_CMS" if $no_cms;
273$cflags.=" -DOPENSSL_NO_ERR" if $no_err; 265$cflags.=" -DOPENSSL_NO_ERR" if $no_err;
274$cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; 266$cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5;
@@ -278,9 +270,7 @@ $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh;
278$cflags.=" -DOPENSSL_NO_GOST" if $no_gost; 270$cflags.=" -DOPENSSL_NO_GOST" if $no_gost;
279$cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; 271$cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine;
280$cflags.=" -DOPENSSL_NO_HW" if $no_hw; 272$cflags.=" -DOPENSSL_NO_HW" if $no_hw;
281$cflags.=" -DOPENSSL_FIPS" if $fips;
282$cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; 273$cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake;
283$cflags.=" -DOPENSSL_NO_EC2M" if $no_ec2m;
284$cflags.= " -DZLIB" if $zlib_opt; 274$cflags.= " -DZLIB" if $zlib_opt;
285$cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; 275$cflags.= " -DZLIB_SHARED" if $zlib_opt == 2;
286 276
@@ -414,11 +404,6 @@ else
414 \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" 404 \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\"
415EOF 405EOF
416 $ex_libs .= " $zlib_lib" if $zlib_opt == 1; 406 $ex_libs .= " $zlib_lib" if $zlib_opt == 1;
417 if ($fips)
418 {
419 $build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)";
420 $ex_l_libs .= " \$(O_FIPSCANISTER)";
421 }
422 } 407 }
423 408
424$defs= <<"EOF"; 409$defs= <<"EOF";
@@ -480,18 +465,6 @@ MKLIB=$bin_dir$mklib
480MLFLAGS=$mlflags 465MLFLAGS=$mlflags
481ASM=$bin_dir$asm 466ASM=$bin_dir$asm
482 467
483# FIPS validated module and support file locations
484
485FIPSDIR=$fipsdir
486BASEADDR=$baseaddr
487FIPSLIB_D=\$(FIPSDIR)${o}lib
488FIPS_PREMAIN_SRC=\$(FIPSLIB_D)${o}fips_premain.c
489O_FIPSCANISTER=\$(FIPSLIB_D)${o}fipscanister.lib
490FIPS_SHA1_EXE=\$(FIPSDIR)${o}bin${o}fips_standalone_sha1${exep}
491E_PREMAIN_DSO=fips_premain_dso
492PREMAIN_DSO_EXE=\$(BIN_D)${o}fips_premain_dso$exep
493FIPSLINK=\$(PERL) \$(FIPSDIR)${o}bin${o}fipslink.pl
494
495###################################################### 468######################################################
496# You should not need to touch anything below this point 469# You should not need to touch anything below this point
497###################################################### 470######################################################
@@ -524,7 +497,7 @@ SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp
524L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp 497L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp
525L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp 498L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp
526 499
527L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs 500L_LIBS= \$(L_SSL) \$(L_CRYPTO)
528 501
529###################################################### 502######################################################
530# Don't touch anything below this point 503# Don't touch anything below this point
@@ -540,7 +513,7 @@ LIBS_DEP=\$(O_CRYPTO) \$(O_SSL)
540EOF 513EOF
541 514
542$rules=<<"EOF"; 515$rules=<<"EOF";
543all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe $build_targets 516all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe
544 517
545banner: 518banner:
546$banner 519$banner
@@ -656,16 +629,6 @@ $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)");
656$defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); 629$defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj);
657$rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); 630$rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)');
658 631
659# Special case rule for fips_premain_dso
660
661if ($fips)
662 {
663 $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj",
664 "\$(FIPS_PREMAIN_SRC)",
665 "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)", "");
666 $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1);
667 }
668
669foreach (values %lib_nam) 632foreach (values %lib_nam)
670 { 633 {
671 $lib_obj=$lib_obj{$_}; 634 $lib_obj=$lib_obj{$_};
@@ -714,28 +677,7 @@ foreach (split(/\s+/,$engines))
714 677
715 678
716$rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); 679$rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)");
717 680$rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)");
718if ($fips)
719 {
720 if ($shlib)
721 {
722 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
723 "\$(O_CRYPTO)", "$crypto",
724 $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)");
725 }
726 else
727 {
728 $rules.= &do_lib_rule("\$(CRYPTOOBJ)",
729 "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", "");
730 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
731 "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", "");
732 }
733 }
734 else
735 {
736 $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,
737 "\$(SO_CRYPTO)");
738 }
739 681
740foreach (split(" ",$otherlibs)) 682foreach (split(" ",$otherlibs))
741 { 683 {
@@ -745,7 +687,7 @@ foreach (split(" ",$otherlibs))
745 687
746 } 688 }
747 689
748$rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0); 690$rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)");
749 691
750print $defs; 692print $defs;
751 693
@@ -839,8 +781,6 @@ sub var_add
839 @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; 781 @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
840 @a=grep(!/_mdc2$/,@a) if $no_mdc2; 782 @a=grep(!/_mdc2$/,@a) if $no_mdc2;
841 783
842 @a=grep(!/(srp)/,@a) if $no_srp;
843
844 @a=grep(!/^engine$/,@a) if $no_engine; 784 @a=grep(!/^engine$/,@a) if $no_engine;
845 @a=grep(!/^hw$/,@a) if $no_hw; 785 @a=grep(!/^hw$/,@a) if $no_hw;
846 @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa; 786 @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa;
@@ -999,15 +939,14 @@ sub Sasm_compile_target
999 939
1000sub cc_compile_target 940sub cc_compile_target
1001 { 941 {
1002 local($target,$source,$ex_flags, $srcd)=@_; 942 local($target,$source,$ex_flags)=@_;
1003 local($ret); 943 local($ret);
1004 944
1005 $ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/); 945 $ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/);
1006 $target =~ s/\//$o/g if $o ne "/"; 946 $target =~ s/\//$o/g if $o ne "/";
1007 $source =~ s/\//$o/g if $o ne "/"; 947 $source =~ s/\//$o/g if $o ne "/";
1008 $srcd = "\$(SRC_D)$o" unless defined $srcd; 948 $ret ="$target: \$(SRC_D)$o$source\n\t";
1009 $ret ="$target: $srcd$source\n\t"; 949 $ret.="\$(CC) ${ofile}$target $ex_flags -c \$(SRC_D)$o$source\n\n";
1010 $ret.="\$(CC) ${ofile}$target $ex_flags -c $srcd$source\n\n";
1011 return($ret); 950 return($ret);
1012 } 951 }
1013 952
@@ -1117,11 +1056,8 @@ sub read_options
1117 "no-ssl2" => \$no_ssl2, 1056 "no-ssl2" => \$no_ssl2,
1118 "no-ssl3" => \$no_ssl3, 1057 "no-ssl3" => \$no_ssl3,
1119 "no-tlsext" => \$no_tlsext, 1058 "no-tlsext" => \$no_tlsext,
1120 "no-srp" => \$no_srp,
1121 "no-cms" => \$no_cms, 1059 "no-cms" => \$no_cms,
1122 "no-ec2m" => \$no_ec2m,
1123 "no-jpake" => \$no_jpake, 1060 "no-jpake" => \$no_jpake,
1124 "no-ec_nistp_64_gcc_128" => 0,
1125 "no-err" => \$no_err, 1061 "no-err" => \$no_err,
1126 "no-sock" => \$no_sock, 1062 "no-sock" => \$no_sock,
1127 "no-krb5" => \$no_krb5, 1063 "no-krb5" => \$no_krb5,
@@ -1131,12 +1067,11 @@ sub read_options
1131 "no-gost" => \$no_gost, 1067 "no-gost" => \$no_gost,
1132 "no-engine" => \$no_engine, 1068 "no-engine" => \$no_engine,
1133 "no-hw" => \$no_hw, 1069 "no-hw" => \$no_hw,
1134 "no-rsax" => 0,
1135 "just-ssl" => 1070 "just-ssl" =>
1136 [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast, 1071 [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast,
1137 \$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh, 1072 \$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh,
1138 \$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5, 1073 \$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5,
1139 \$no_aes, \$no_camellia, \$no_seed, \$no_srp], 1074 \$no_aes, \$no_camellia, \$no_seed],
1140 "rsaref" => 0, 1075 "rsaref" => 0,
1141 "gcc" => \$gcc, 1076 "gcc" => \$gcc,
1142 "debug" => \$debug, 1077 "debug" => \$debug,
@@ -1144,7 +1079,6 @@ sub read_options
1144 "shlib" => \$shlib, 1079 "shlib" => \$shlib,
1145 "dll" => \$shlib, 1080 "dll" => \$shlib,
1146 "shared" => 0, 1081 "shared" => 0,
1147 "no-sctp" => 0,
1148 "no-gmp" => 0, 1082 "no-gmp" => 0,
1149 "no-rfc3779" => 0, 1083 "no-rfc3779" => 0,
1150 "no-montasm" => 0, 1084 "no-montasm" => 0,
@@ -1152,7 +1086,6 @@ sub read_options
1152 "no-store" => 0, 1086 "no-store" => 0,
1153 "no-zlib" => 0, 1087 "no-zlib" => 0,
1154 "no-zlib-dynamic" => 0, 1088 "no-zlib-dynamic" => 0,
1155 "fips" => \$fips
1156 ); 1089 );
1157 1090
1158 if (exists $valid_options{$_}) 1091 if (exists $valid_options{$_})
@@ -1222,7 +1155,7 @@ sub read_options
1222 } 1155 }
1223 } 1156 }
1224 } 1157 }
1225 elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } 1158 elsif (/^([^=]*)=(.*)$/ && !/^-D/){ $VARS{$1}=$2; }
1226 elsif (/^-[lL].*$/) { $l_flags.="$_ "; } 1159 elsif (/^-[lL].*$/) { $l_flags.="$_ "; }
1227 elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) 1160 elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/)
1228 { $c_flags.="$_ "; } 1161 { $c_flags.="$_ "; }