From: Dr. Stephen Henson Date: Fri, 20 Jul 2007 22:23:11 +0000 (+0000) Subject: Link fips utils against fipscanister.lib only except for dso builds. X-Git-Tag: FIPS_098_TEST_3~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=100868d1cf9f1e6512bf8692b41f21a424053a08;p=thirdparty%2Fopenssl.git Link fips utils against fipscanister.lib only except for dso builds. Add --with-fipslibdir option to Configure. --- diff --git a/CHANGES b/CHANGES index 98a2c4ecc9b..7b7c9ac8768 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,13 @@ Changes between 0.9.8e and 0.9.8f-fips [xx XXX xxxx] + + *) Add option --with-fipslibdir to specify location of fipscanister.lib + and friends. When combined with fips build option fipscanister.lib is + not built but linked from the supplied directory. Always link fips + utilities against fiscanister.lib only except in fipsdso builds. + [Steve Henson] + *) Add SSE2 instruction support to WIN32 build. These will be compiled by default and used if an appopriate CPU is detected. Some older versions of NASM or MASM which don't support SSE2 will need to be updated. diff --git a/Configure b/Configure index aca0995563c..b64ed144816 100755 --- a/Configure +++ b/Configure @@ -792,6 +792,14 @@ PROCESS_ARGS: { $withargs{"zlib-include"}="-I$1"; } + elsif (/^--with-fipslibdir=(.*)$/) + { + $fipslibdir="$1/"; + } + elsif (/^--with-baseaddr=(.*)$/) + { + $baseaddr="$1"; + } else { print STDERR $usage; diff --git a/util/mk1mf.pl b/util/mk1mf.pl index 3b46cb2dafc..b774e19d0d9 100755 --- a/util/mk1mf.pl +++ b/util/mk1mf.pl @@ -354,7 +354,11 @@ for (;;) } if ($key eq "FIPSLIBDIR") - { $fipslibdir=$val;} + { + $fipslibdir=$val; + $fipslibdir =~ s/\/$//; + $fipslibdir =~ s/\//$o/g; + } if ($key eq "BASEADDR") { $baseaddr=$val;} @@ -403,14 +407,14 @@ if ($fips) if ($fipscanisterbuild) { - $fips_canister_path = "\$(LIB_D)${o}fipscanister.o" if $fips_canister_path eq ""; + $fips_canister_path = "\$(LIB_D)${o}fipscanister.lib" if $fips_canister_path eq ""; $fips_premain_c_path = "\$(LIB_D)${o}fips_premain.c"; } else { if ($fips_canister_path eq "") { - $fips_canister_path = "\$(FIPSLIB_D)${o}fipscanister.o"; + $fips_canister_path = "\$(FIPSLIB_D)${o}fipscanister.lib"; } if ($fips_premain_c_path eq "") @@ -463,7 +467,7 @@ if ($fips) close IN; } fips_check_files($fipslibdir, - "fipscanister.o", "fipscanister.o.sha1", + "fipscanister.lib", "fipscanister.lib.sha1", "fips_premain.c", "fips_premain.c.sha1"); } } @@ -876,17 +880,32 @@ foreach (split(/\s+/,$test)) { my $t_libs; $t=&bname($_); - if ($fipsdso && /fips-1.0/) + my $ltype; + # Check to see if test program is FIPS + if (/fips-1.0/) { - $t_libs = "\$(L_FIPS)"; + # If fipsdso link to libosslfips.dll + # otherwise perform static link to + # $(O_FIPSCANISTER) + if ($fipsdso) + { + $t_libs = "\$(L_FIPS)"; + $ltype = 0; + } + else + { + $t_libs = "\$(O_FIPSCANISTER)"; + $ltype = 2; + } } else { $t_libs = "\$(L_LIBS)"; + $ltype = 0; } - + $tt="\$(OBJ_D)${o}$t${obj}"; - $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","$t_libs \$(EX_LIBS)"); + $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","$t_libs \$(EX_LIBS)", $ltype); } $defs.=&do_defs("E_SHLIB",$engines,"\$(ENG_D)",$shlibp); @@ -940,13 +959,29 @@ if ($fips) if ($fips) { - $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)", "\$(OBJ_D)${o}fips_start$obj", "\$(FIPSOBJ)", "\$(OBJ_D)${o}fips_end$obj", "\$(FIPS_SHA1_EXE)", "") if $fipscanisterbuild; + if ($fipscanisterbuild) + { + $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)", + "\$(OBJ_D)${o}fips_start$obj", + "\$(FIPSOBJ)", + "\$(OBJ_D)${o}fips_end$obj", + "\$(FIPS_SHA1_EXE)", ""); + $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)", + "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(OBJ_D)${o}sha1dgst$obj \$(SHA1_ASM_OBJ)", + "","", 1); + } + else + { + $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)", + "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(O_FIPSCANISTER)", + "","", 1); + + } $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1); - $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)","\$(OBJ_D)${o}fips_standalone_sha1$obj \$(OBJ_D)${o}sha1dgst$obj \$(SHA1_ASM_OBJ)","","", 1); } -$rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)",0); +$rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0); print $defs; diff --git a/util/pl/VC-32.pl b/util/pl/VC-32.pl index 7682a591ce4..cb01bb7480a 100644 --- a/util/pl/VC-32.pl +++ b/util/pl/VC-32.pl @@ -5,8 +5,6 @@ $ssl= "ssleay32"; -my $mwex =" \$(FIPSLIB_D)${o}_chkstk.o \$(FIPSLIB_D)${o}_udivdi3.o \$(FIPSLIB_D)${o}_umoddi3.o"; - if ($fips && !$shlib) { $crypto="libeayfips32"; @@ -291,7 +289,6 @@ sub do_lib_rule # $ret.="\t\$(RM) \$(O_$Name)\n"; $ex =' '; $ret.="$target: $objs\n"; - $ex.= $mwex if $fips && !$fipscanisterbuild && $target =~ /O_CRYPTO/; $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; } else @@ -374,13 +371,13 @@ sub do_link_rule $file =~ s/\//$o/g if $o ne '/'; $n=&bname($targer); $ret.="$target: $files $dep_libs\n"; - if ($standalone) + if ($standalone == 1) { $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n\t"; $ret.= "$mwex advapi32.lib " if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild); $ret.="$files $libs\n<<\n"; } - elsif ($fips && !$shlib) + elsif ($standalone == 2) { $ret.="\tSET FIPS_LINK=\$(LINK)\n"; $ret.="\tSET FIPS_CC=\$(CC)\n";