Commit 79336445 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Modify VC++ build sytem to use fipscanister.lib instead of fipscanister.o

and avoid the need for ld.exe.
parent 6b053504
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -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]

+1 −1
Original line number Diff line number Diff line
@@ -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";
+4 −4
Original line number Diff line number Diff line
@@ -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);
+13 −3
Original line number Diff line number Diff line
@@ -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";