Forward FIPS DLL implementations from libcrypto DLL under Win32.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 22 Mar 2007 18:31:35 +0000 (18:31 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 22 Mar 2007 18:31:35 +0000 (18:31 +0000)
CHANGES
Configure
util/mk1mf.pl
util/mksdef.pl
util/pl/VC-32.pl

diff --git a/CHANGES b/CHANGES
index a10b4b526cbf1adb177160e6718beb5177324754..d67252d68e25bb62c426d6f2beeb6417e4b6e190 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,10 @@
 
  Changes between 0.9.8e and 0.9.8f-fips  [xx XXX xxxx]
 
+  *) Modify WIN32 build system to forward references to functions implemented
+     in FIPS DLL. 
+     [Steve Henson]
+
   *) Move error library so that all lhash dependencies are in a separate
      file. Include a simplified ERR_get_state() function for stand alone
      FIPS applications. Include a initialization function OPENSSL_init()
index e0a49e69a4b2b1ccb39ceedd52be6da0d498e35d..293e5e53801943f712fd3f13779a4fd16708ef2b 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -1746,7 +1746,7 @@ OpenSSL FIPS Object Module as identified by the CMVP
 (http://csrc.nist.gov/cryptval/) in any application requiring the use of FIPS
 140-2 validated software. 
 
-This is a OpenSSL 0.9.8-fips test version.
+This is an OpenSSL 0.9.8-fips test version.
 
 See the file README.FIPS for details of how to build a test library.
 
index 5293b97720128afb696631ccb8ca3c52bcfbab05..6ab1c644bdd180578610fedf621a79f7a0b658ca 100755 (executable)
@@ -433,7 +433,7 @@ if ($fips_premain_dso_exe_path eq "")
 
 #      $ex_build_targets .= "\$(BIN_D)${o}\$(E_PREMAIN_DSO)$exep" if ($fips);
 
-$ex_l_libs .= " \$(L_FIPS)" if $fipsdso;
+#$ex_l_libs .= " \$(L_FIPS)" if $fipsdso;
 
 if ($fips)
        {
@@ -587,7 +587,7 @@ PREMAIN_DSO_EXE=$fips_premain_dso_exe_path
 E_EXE=openssl
 SSL=$ssl
 CRYPTO=$crypto
-LIBFIPS=libfips
+LIBFIPS=libosslfips
 
 # BIN_D  - Binary output directory
 # TEST_D - Binary test file output directory
@@ -884,7 +884,7 @@ if ($fips)
                                        $shlib, "", "");
                        $rules.= &do_lib_rule(
                                "\$(O_FIPSCANISTER)",
-                               "\$(O_FIPS)", "libfips",
+                               "\$(O_FIPS)", "\$(LIBFIPS)",
                                $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)");
                        $rules.= &do_sdef_rule();
                        }
index 18fdef5b2d19a6cbde671f5b71e84a18e52eeea7..065dc675f1e252daec9651f14980810afad7a077 100644 (file)
@@ -24,7 +24,7 @@ foreach (@deferr)
                }
        }
 
-open (IN, "ms/libeay32.def") || die "Can't Open DEF file for splittling";
+open (IN, "ms/libeay32.def") || die "Can't Open DEF file for spliting";
 
 my $started = 0;
 
@@ -34,7 +34,7 @@ my $started = 0;
 
 foreach (<IN>)
        {
-       if (/^\s*(\S+)\s*\@/)
+       if (/^\s*(\S+)\s*(\@\S+)\s*$/)
                {
                $started = 1;
                if (exists $nosym{$1})
@@ -43,6 +43,9 @@ foreach (<IN>)
                        }
                else
                        {
+                       my $imptmp = sprintf "     %-39s %s\n",
+                                       "$1=libosslfips.$1", $2;
+                       push @fipsrest, $imptmp;
                        push @fipsdll, "\t$1\n";
                        }
                }
@@ -59,8 +62,8 @@ push @fipsdll, "\tOPENSSL_cpuid_setup\n";
 
 # Write out DEF files for each array
 
-write_def("ms/libfips.def", "LIBFIPS", $preamble, \@fipsdll);
-write_def("ms/libcryptofips.def", "LIBCRYPTOFIPS", $preamble, \@fipsrest);
+write_def("ms/libosslfips.def", "LIBOSSLFIPS", $preamble, \@fipsdll);
+write_def("ms/libeayfips.def", "", $preamble, \@fipsrest);
 
 
 sub write_def
@@ -68,9 +71,11 @@ sub write_def
        my ($fnam, $defname, $preamble, $rdefs) = @_;
        open (OUT, ">$fnam") || die "Can't Open DEF file $fnam for Writing\n";
 
-       $preamble =~ s/LIBEAY32/$defname/g;
-       $preamble =~ s/LIBEAY/$defname/g;
-
+       if ($defname ne "")
+               {
+               $preamble =~ s/LIBEAY32/$defname/g;
+               $preamble =~ s/LIBEAY/$defname/g;
+               }
        print OUT $preamble;
        foreach (@$rdefs)
                {
index 8997ac507b57993b634853f53582d0f2a0f820a6..9f897aa4bbb5fdb5f72a6f245929f76671461e13 100644 (file)
@@ -14,20 +14,13 @@ if ($fips && !$shlib)
        }
 else
        {
-       if ($fipsdso) 
-               {
-               $crypto="libcryptofips";
-               }
-       else
-               {
-               $crypto="libeay32";
-               }
+       $crypto="libeay32";
        }
 
 $o='\\';
 $cp='$(PERL) util/copy.pl';
 $mkdir='$(PERL) util/mkdir-p.pl';
-$rm='del';
+$rm='del /Q';
 
 $zlib_lib="zlib1.lib";
 
@@ -269,7 +262,11 @@ sub do_lib_rule
                {
                $base_arg = "";
                }
-       if ($name ne "")
+       if ($target =~ /O_CRYPTO/ && $fipsdso)
+               {
+               $name = "/def:ms/libeayfips.def";
+               }
+       elsif ($name ne "")
                {
                $name =~ tr/a-z/A-Z/;
                $name = "/def:ms/${name}.def";
@@ -291,7 +288,7 @@ sub do_lib_rule
                if ($target =~ /O_SSL/)
                        {
                        $ex .= " \$(L_CRYPTO)";
-                       $ex .= " \$(L_FIPS)" if $fipsdso;
+                       #$ex .= " \$(L_FIPS)" if $fipsdso;
                        }
                my $fipstarget;
                if ($fipsdso)
@@ -324,7 +321,7 @@ sub do_lib_rule
                        {
                        $ex.= $mwex unless $fipscanisterbuild;
                        $ret.="$target: $objs \$(PREMAIN_DSO_EXE)";
-                       $ret.=" ms/libfips.def" if $fipsdso;
+                       $ret.=" ms/\$(LIBFIPS).def" if $fipsdso;
                        $ret.="\n\tSET FIPS_LINK=\$(LINK)\n";
                        $ret.="\tSET FIPS_CC=\$(CC)\n";
                        $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n";
@@ -347,7 +344,7 @@ sub do_lib_rule
                        $ret.="\n\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n  \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
                        }
 
-        $ret.="\tIF EXIST \$@.manifest mt -manifest \$@.manifest -outputresource:\$@;2\n\n";
+        $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n";
                }
        $ret.="\n";
        return($ret);
@@ -383,7 +380,7 @@ sub do_link_rule
                $ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n";
                $ret.="\t\$(APP_EX_OBJ) $files $libs\n<<\n";
                }
-       $ret.="\tIF EXIST \$@.manifest mt -manifest \$@.manifest -outputresource:\$@;1\n\n";
+       $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n";
        return($ret);
        }
 
@@ -406,7 +403,7 @@ sub do_rlink_rule
 
 sub do_sdef_rule
        {
-       my $ret = "ms/libfips.def: \$(O_FIPSCANISTER)\n";
+       my $ret = "ms/\$(LIBFIPS).def: \$(O_FIPSCANISTER)\n";
        $ret.="\t\$(PERL) util/mksdef.pl \$(MLFLAGS) /out:dummy.dll /def:ms/libeay32.def @<<\n  \$(O_FIPSCANISTER)\n<<\n";
        $ret.="\n";
        return $ret;