Link fips utils against fipscanister.lib only except for dso builds.
authorDr. Stephen Henson <steve@openssl.org>
Fri, 20 Jul 2007 22:23:11 +0000 (22:23 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 20 Jul 2007 22:23:11 +0000 (22:23 +0000)
Add --with-fipslibdir option to Configure.

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

diff --git a/CHANGES b/CHANGES
index 98a2c4ecc9b7dad791b303fa20103f77408861e4..7b7c9ac8768681ee0c8c76a2766e4b6d5d1b7338 100644 (file)
--- 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. 
index aca0995563c0141f6f7fcb009bbd845e9ce4d9d6..b64ed1448166b8b86ecad13510218de90859a7f6 100755 (executable)
--- 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;
index 3b46cb2dafc3531f0f1c5eab32ff2d63b193c91d..b774e19d0d98370dd4095a12be53edd37c073a86 100755 (executable)
@@ -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;
 
index 7682a591ce4cdc2bd77fa3a82885297f591adf46..cb01bb7480a039603a29a13f55e501b24b079364 100644 (file)
@@ -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";