Modify VC++ build sytem to use fipscanister.lib instead of fipscanister.o
authorDr. Stephen Henson <steve@openssl.org>
Mon, 26 Mar 2007 12:06:44 +0000 (12:06 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 26 Mar 2007 12:06:44 +0000 (12:06 +0000)
and avoid the need for ld.exe.

CHANGES
util/fipslink.pl
util/mk1mf.pl
util/pl/VC-32.pl

diff --git a/CHANGES b/CHANGES
index d67252d68e25bb62c426d6f2beeb6417e4b6e190..1b5fdc076522dc4f9712e06017a2747edca6db54 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,7 +4,16 @@
 
  Changes between 0.9.8e and 0.9.8f-fips  [xx XXX xxxx]
 
-  *) Modify WIN32 build system to forward references to functions implemented
+  *) Modify VC++ build system to rename .text and .rdata segments in
+     FIPS sources to .fipst${a,b,c}, and $fipsr${a,b,c} and place them
+     in a static library fipscanister.lib. These are then combined by the
+     VC++ linker into a single segment in suffix order but without the
+     suffix (i.e. .fipst and .fipsr). This serves the same purpose as
+     fipscanister.o on other platforms but has the advantage that it can
+     be created using only standard VC++ utilities.
+     [Steve Henson]
+
+  *) Modify WIN32 build system to forward references functions implemented
      in FIPS DLL. 
      [Steve Henson]
 
index a893833c5c7b3976b3f094a7f9a7d16318b66971..3597bc1740ae23d1ad11daaba635f0c824f06006 100644 (file)
@@ -28,7 +28,7 @@ if (exists $ENV{"PREMAIN_DSO_EXE"})
        }
 
 check_hash($sha1_exe, "fips_premain.c");
-check_hash($sha1_exe, "fipscanister.o");
+check_hash($sha1_exe, "fipscanister.lib");
 
 
 print "Integrity check OK\n";
index 0da53cdbb2d10a3b91b79d1d0d0a1db00249b83b..747f8033423e9c96ce9ea1a3a30cc68e4ee9ba17 100755 (executable)
@@ -15,7 +15,7 @@ my $engines = "";
 local $zlib_opt = 0;   # 0 = no zlib, 1 = static, 2 = dynamic
 local $zlib_lib = "";
 
-my $fips_canister_path = "";
+local $fips_canister_path = "";
 my $fips_premain_dso_exe_path = "";
 my $fips_premain_c_path = "";
 my $fips_sha1_exe_path = "";
@@ -397,7 +397,7 @@ if ($fips)
 
 if ($fipscanisterbuild)
        {
-       $fips_canister_path = "\$(LIB_D)${o}fipscanister.o";
+       $fips_canister_path = "\$(LIB_D)${o}fipscanister.o" if $fips_canister_path eq "";
        $fips_premain_c_path = "\$(LIB_D)${o}fips_premain.c";
        }
 else
@@ -904,7 +904,7 @@ if ($fips)
                {
                $rules.= &do_lib_rule("\$(CRYPTOOBJ)",
                        "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", "");
-               $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
+               $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(FIPSOBJ)",
                        "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", "");
                }
        }
@@ -916,7 +916,7 @@ 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;
+       $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)", "\$(OBJ_D)${o}fips_start$obj", "\$(FIPSOBJ)", "\$(OBJ_D)${o}fips_end$obj", "\$(FIPS_SHA1_EXE)", "") if $fipscanisterbuild;
        $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}fips_sha1dgst$obj","","", 1);
index a4e74fa625ddefce31f1e197bfae613b0f505646..e6257ea149f683cf067e723b18d2847ed53223d7 100644 (file)
@@ -17,6 +17,11 @@ else
        $crypto="libeay32";
        }
 
+if ($fipscanisterbuild)
+       {
+       $fips_canister_path = "\$(LIB_D)\\fipscanister.lib";
+       }
+
 $o='\\';
 $cp='$(PERL) util/copy.pl';
 $mkdir='$(PERL) util/mkdir-p.pl';
@@ -391,14 +396,19 @@ sub do_link_rule
 
 sub do_rlink_rule
        {
-       local($target,$files,$dep_libs,$libs)=@_;
+       local($target,$rl_start, $rl_mid, $rl_end,$dep_libs,$libs)=@_;
        local($ret,$_);
+       my $files = "$rl_start $rl_mid $rl_end";
 
        $file =~ s/\//$o/g if $o ne '/';
        $n=&bname($targer);
        $ret.="$target: $files $dep_libs \$(FIPS_SHA1_EXE)\n";
-       $ret.="\t\$(MKCANISTER) $target <<\n";
-       $ret.="INPUT($files)\n<<\n";
+       $ret.="\teditbin /SECTION:.text=.fipst\$\$a /SECTION:.rdata=.fipsr\$\$a $rl_start\n";
+       $ret.="\teditbin /SECTION:.text=.fipst\$\$b /SECTION:.rdata=.fipsr\$\$b @<<\n\t$rl_mid\n<<\n";
+       $ret.="\teditbin /SECTION:.text=.fipst\$\$c /SECTION:.rdata=.fipsr\$\$c $rl_end\n";
+       $ret.="\t\$(MKLIB) $lfile$target @<<\n\t$files\n<<\n";
+       #$ret.="\t\$(MKCANISTER) $target <<\n";
+       #$ret.="INPUT($files)\n<<\n";
        $ret.="\t\$(FIPS_SHA1_EXE) $target > ${target}.sha1\n";
        $ret.="\t\$(PERL) util${o}copy.pl -stripcr fips-1.0${o}fips_premain.c \$(LIB_D)${o}fips_premain.c\n";
        $ret.="\t\$(CP) fips-1.0${o}fips_premain.c.sha1 \$(LIB_D)${o}fips_premain.c.sha1\n";