Link fips utils against fipscanister.lib only except for dso builds.
Add --with-fipslibdir option to Configure.
This commit is contained in:
		
							
								
								
									
										7
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								CHANGES
									
									
									
									
									
								
							@@ -4,6 +4,13 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 Changes between 0.9.8e and 0.9.8f-fips  [xx XXX xxxx]
 | 
					 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
 | 
					  *) Add SSE2 instruction support to WIN32 build. These will be compiled
 | 
				
			||||||
     by default and used if an appopriate CPU is detected. Some older versions
 | 
					     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. 
 | 
					     of NASM or MASM which don't support SSE2 will need to be updated. 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -792,6 +792,14 @@ PROCESS_ARGS:
 | 
				
			|||||||
				{
 | 
									{
 | 
				
			||||||
				$withargs{"zlib-include"}="-I$1";
 | 
									$withargs{"zlib-include"}="-I$1";
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
								elsif (/^--with-fipslibdir=(.*)$/)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									$fipslibdir="$1/";
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								elsif (/^--with-baseaddr=(.*)$/)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									$baseaddr="$1";
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				print STDERR $usage;
 | 
									print STDERR $usage;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -354,7 +354,11 @@ for (;;)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ($key eq "FIPSLIBDIR")
 | 
						if ($key eq "FIPSLIBDIR")
 | 
				
			||||||
		{ $fipslibdir=$val;}
 | 
							{
 | 
				
			||||||
 | 
							$fipslibdir=$val;
 | 
				
			||||||
 | 
							$fipslibdir =~ s/\/$//;
 | 
				
			||||||
 | 
							$fipslibdir =~ s/\//$o/g;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ($key eq "BASEADDR")
 | 
						if ($key eq "BASEADDR")
 | 
				
			||||||
		{ $baseaddr=$val;}
 | 
							{ $baseaddr=$val;}
 | 
				
			||||||
@@ -403,14 +407,14 @@ if ($fips)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if ($fipscanisterbuild)
 | 
					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";
 | 
						$fips_premain_c_path = "\$(LIB_D)${o}fips_premain.c";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	if ($fips_canister_path eq "")
 | 
						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 "")
 | 
						if ($fips_premain_c_path eq "")
 | 
				
			||||||
@@ -463,7 +467,7 @@ if ($fips)
 | 
				
			|||||||
			close IN;
 | 
								close IN;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		fips_check_files($fipslibdir,
 | 
							fips_check_files($fipslibdir,
 | 
				
			||||||
				"fipscanister.o", "fipscanister.o.sha1",
 | 
									"fipscanister.lib", "fipscanister.lib.sha1",
 | 
				
			||||||
				"fips_premain.c", "fips_premain.c.sha1");
 | 
									"fips_premain.c", "fips_premain.c.sha1");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -876,17 +880,32 @@ foreach (split(/\s+/,$test))
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
	my $t_libs;
 | 
						my $t_libs;
 | 
				
			||||||
	$t=&bname($_);
 | 
						$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
 | 
						else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		$t_libs = "\$(L_LIBS)";
 | 
							$t_libs = "\$(L_LIBS)";
 | 
				
			||||||
 | 
							$ltype = 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
	$tt="\$(OBJ_D)${o}$t${obj}";
 | 
						$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);
 | 
					$defs.=&do_defs("E_SHLIB",$engines,"\$(ENG_D)",$shlibp);
 | 
				
			||||||
@@ -940,13 +959,29 @@ if ($fips)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
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("\$(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;
 | 
					print $defs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,8 +5,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
$ssl=	"ssleay32";
 | 
					$ssl=	"ssleay32";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
my $mwex =" \$(FIPSLIB_D)${o}_chkstk.o \$(FIPSLIB_D)${o}_udivdi3.o \$(FIPSLIB_D)${o}_umoddi3.o";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if ($fips && !$shlib)
 | 
					if ($fips && !$shlib)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	$crypto="libeayfips32";
 | 
						$crypto="libeayfips32";
 | 
				
			||||||
@@ -291,7 +289,6 @@ sub do_lib_rule
 | 
				
			|||||||
#		$ret.="\t\$(RM) \$(O_$Name)\n";
 | 
					#		$ret.="\t\$(RM) \$(O_$Name)\n";
 | 
				
			||||||
		$ex =' ';
 | 
							$ex =' ';
 | 
				
			||||||
		$ret.="$target: $objs\n";
 | 
							$ret.="$target: $objs\n";
 | 
				
			||||||
		$ex.= $mwex if $fips && !$fipscanisterbuild && $target =~ /O_CRYPTO/;
 | 
					 | 
				
			||||||
		$ret.="\t\$(MKLIB) $lfile$target @<<\n  $objs $ex\n<<\n";
 | 
							$ret.="\t\$(MKLIB) $lfile$target @<<\n  $objs $ex\n<<\n";
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
@@ -374,13 +371,13 @@ sub do_link_rule
 | 
				
			|||||||
	$file =~ s/\//$o/g if $o ne '/';
 | 
						$file =~ s/\//$o/g if $o ne '/';
 | 
				
			||||||
	$n=&bname($targer);
 | 
						$n=&bname($targer);
 | 
				
			||||||
	$ret.="$target: $files $dep_libs\n";
 | 
						$ret.="$target: $files $dep_libs\n";
 | 
				
			||||||
	if ($standalone)
 | 
						if ($standalone == 1)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		$ret.="  \$(LINK) \$(LFLAGS) $efile$target @<<\n\t";
 | 
							$ret.="  \$(LINK) \$(LFLAGS) $efile$target @<<\n\t";
 | 
				
			||||||
		$ret.= "$mwex advapi32.lib " if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild);
 | 
							$ret.= "$mwex advapi32.lib " if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild);
 | 
				
			||||||
		$ret.="$files $libs\n<<\n";
 | 
							$ret.="$files $libs\n<<\n";
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	elsif ($fips && !$shlib)
 | 
						elsif ($standalone == 2)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		$ret.="\tSET FIPS_LINK=\$(LINK)\n";
 | 
							$ret.="\tSET FIPS_LINK=\$(LINK)\n";
 | 
				
			||||||
		$ret.="\tSET FIPS_CC=\$(CC)\n";
 | 
							$ret.="\tSET FIPS_CC=\$(CC)\n";
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user