Index: Configure
--- ../tmp/openssl-0.9.8b/Configure	2006-04-03 02:15:40.000000000 -0700
+++ ./Configure	2006-06-27 02:39:02.000000000 -0700
@@ -132,7 +132,7 @@
 # seems to be sufficient?
 my $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
 
-#config-string	$cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags
+#config-string	$cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags : $ar : $nm
 
 my %table=(
 # File 'TABLE' (created by 'make TABLE') contains the data from this list,
@@ -468,6 +468,9 @@
 # Borland C++ 4.5
 "BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32",
 
+# MinGW32
+"mingw32", "mingw32-gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a:mingw32-ranlib::mingw32-ar:mingw32-nm",
+
 # MinGW
 "mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a",
 
@@ -558,6 +561,8 @@
 my $idx_shared_extension = $idx++;
 my $idx_ranlib = $idx++;
 my $idx_arflags = $idx++;
+my $idx_ar= $idx++;
+my $idx_nm= $idx++;
 
 my $prefix="";
 my $openssldir="";
@@ -920,7 +925,7 @@
 
 $IsMK1MF=1 if ($target eq "mingw" && $^O ne "cygwin");
 
-$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw");
+$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw" || $target eq "mingw32");
 $exe_ext=".pm"  if ($target =~ /vos/);
 $openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
 $prefix=$openssldir if $prefix eq "";
@@ -964,6 +969,8 @@
 my $shared_extension = $fields[$idx_shared_extension];
 my $ranlib = $fields[$idx_ranlib];
 my $arflags = $fields[$idx_arflags];
+my $ar = $fields[$idx_ar];
+my $nm = $fields[$idx_nm];
 
 my $no_shared_warn=0;
 my $no_user_cflags=0;
@@ -1172,6 +1179,18 @@
 	{
 	$ranlib = $default_ranlib;
 	}
+if ($arflags eq "")
+	{
+	$arflags = "r";
+	}
+if ($ar eq "")
+	{
+	$ar = "ar";
+	}
+if ($nm eq "")
+	{
+	$nm = "nm";
+	}
 
 #my ($bn1)=split(/\s+/,$bn_obj);
 #$bn1 = "" unless defined $bn1;
@@ -1307,6 +1326,8 @@
 	s/^PROCESSOR=.*/PROCESSOR= $processor/;
 	s/^RANLIB=.*/RANLIB= $ranlib/;
 	s/^ARFLAGS=.*/ARFLAGS= $arflags/;
+	s/^AR=.*/AR= $ar/;
+	s/^NM=.*/NM= $nm/;
 	s/^PERL=.*/PERL= $perl/;
 	s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
 	s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
@@ -1358,6 +1379,8 @@
 print "PROCESSOR     =$processor\n";
 print "RANLIB        =$ranlib\n";
 print "ARFLAGS       =$arflags\n";
+print "AR            =$ar\n";
+print "NM            =$nm\n";
 print "PERL          =$perl\n";
 print "KRB5_INCLUDES =",$withargs{"krb5-include"},"\n"
 	if $withargs{"krb5-include"} ne "";
@@ -1737,7 +1760,7 @@
 	my $bn_ops,my $cpuid_obj,my $bn_obj,my $des_obj,my $aes_obj, my $bf_obj,
 	my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj,
 	my $rc5_obj,my $dso_scheme,my $shared_target,my $shared_cflag,
-	my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags)=
+	my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags, my $ar, my $nm)=
 	split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
 			
 	print <<EOF
@@ -1768,6 +1791,8 @@
 \$shared_extension = $shared_extension
 \$ranlib       = $ranlib
 \$arflags      = $arflags
+\$ar           = $ar
+\$nm           = $nm
 EOF
 	}
 
Index: crypto/comp/Makefile
--- ../tmp/openssl-0.9.8b/crypto/comp/Makefile	2006-02-03 17:48:54.000000000 -0800
+++ ./crypto/comp/Makefile	2006-06-27 01:45:24.000000000 -0700
@@ -5,7 +5,7 @@
 DIR=	comp
 TOP=	../..
 CC=	cc
-INCLUDES= -I.. -I$(TOP) -I../../include
+INCLUDES= -I.. -I$(TOP) -I../../include $(ZLIB_INCLUDE)
 CFLAG=-g
 MAKEFILE=	Makefile
 AR=		ar r
Index: crypto/Makefile
--- ../tmp/openssl-0.9.8b/crypto/Makefile	2006-02-03 17:48:41.000000000 -0800
+++ ./crypto/Makefile	2006-06-27 01:53:25.000000000 -0700
@@ -7,7 +7,7 @@
 CC=		cc
 INCLUDE=	-I. -I$(TOP) -I../include
 # INCLUDES targets sudbirs!
-INCLUDES=	-I.. -I../.. -I../../include
+INCLUDES=	-I.. -I../.. -I../../include $(ZLIB_INCLUDE)
 CFLAG=		-g
 MAKEDEPPROG=	makedepend
 MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
Index: engines/Makefile
--- ../tmp/openssl-0.9.8b/engines/Makefile	2006-02-03 17:49:34.000000000 -0800
+++ ./engines/Makefile	2006-06-27 01:21:53.000000000 -0700
@@ -91,19 +91,23 @@
 		set -e; \
 		for l in $(LIBNAMES); do \
 			( echo installing $$l; \
-			  if [ "$(PLATFORM)" != "Cygwin" ]; then \
-				case "$(CFLAGS)" in \
-				*DSO_DLFCN*)	sfx="so";;	\
-				*DSO_DL*)	sfx="sl";;	\
-				*)		sfx="bad";;	\
-				esac; \
-				cp lib$$l.$$sfx $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
+			  if [ "$(PLATFORM)" = "mingw32" ]; then \
+				cp $${l}eay32.dll $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/$${l}eay32.dll; \
 			  else \
-			  	sfx="so"; \
-				cp cyg$$l.dll $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
-			  fi; \
-			  chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
-			  mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx ); \
+				if [ "$(PLATFORM)" = "Cygwin" ]; then \
+					sfx="so"; \
+					cp cyg$$l.dll $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
+				else \
+					case "$(CFLAGS)" in \
+					*DSO_DLFCN*)	sfx="so";;	\
+					*DSO_DL*)	sfx="sl";;	\
+					*)		sfx="bad";;	\
+					esac; \
+					cp lib$$l.$$sfx $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
+				fi; \
+				chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
+				mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx; \
+			fi ); \
 		done; \
 	fi
 
Index: Makefile.org
--- ../tmp/openssl-0.9.8b/Makefile.org	2006-02-10 00:52:56.000000000 -0800
+++ ./Makefile.org	2006-06-27 02:14:13.000000000 -0700
@@ -65,6 +65,7 @@
 EXE_EXT= 
 ARFLAGS=
 AR=ar $(ARFLAGS) r
+NM=nm
 RANLIB= ranlib
 PERL= perl
 TAR= tar
@@ -171,7 +172,9 @@
 BUILDENV=	PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
 		CC='${CC}' CFLAG='${CFLAG}' 			\
 		AS='${CC}' ASFLAG='${CFLAG} -c'			\
-		AR='${AR}' PERL='${PERL}' RANLIB='${RANLIB}'	\
+		AR='${AR} ${ARFLAGS}' PERL='${PERL}'		\
+		NM='${NM}' RANLIB='${RANLIB}'			\
+		ZLIB_INCLUDE='${ZLIB_INCLUDE}' LIBZLIB='${LIBZLIB}' \
 		SDIRS='${SDIRS}' LIBRPATH='${INSTALLTOP}/lib'	\
 		INSTALL_PREFIX='${INSTALL_PREFIX}'		\
 		INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}'	\
@@ -290,6 +293,12 @@
 		if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \
 			libs="$(LIBKRB5) $$libs"; \
 		fi; \
+		if [ "${SHLIBDIRS}" = "crypto" -a "$(SHLIB_TARGET)" = "cygwin-shared" ]; then \
+			libs="ms/libeay32.def $$libs"; \
+		fi; \
+		if [ "${SHLIBDIRS}" = "ssl" -a "$(SHLIB_TARGET)" = "cygwin-shared" ]; then \
+			libs="ms/ssleay32.def $$libs"; \
+		fi; \
 		$(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
 			LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
 			LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
@@ -506,18 +515,27 @@
 		do \
 			if [ -f "$$i" -o -f "$$i.a" ]; then \
 			(       echo installing $$i; \
-				if [ "$(PLATFORM)" != "Cygwin" ]; then \
+				if [ "$(PLATFORM)" = "Cygwin" ]; then \
+					c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
+					cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
+					chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
+					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
 					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
-					chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
+					chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
-				else \
-					c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
+				elif [ "$(PLATFORM)" = "mingw32" ]; then \
+					c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/\1eay32.dll/'`; \
+					[ "$$i" = "libcrypto.dll.a" ] && c=libeay32.dll; \
 					cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
 					chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
 					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
 					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 					chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
+				else \
+					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
+					chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
+					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
 				fi ); \
 			fi; \
 		done; \
Index: Makefile.shared
--- ../tmp/openssl-0.9.8b/Makefile.shared	2005-12-16 12:52:38.000000000 -0800
+++ ./Makefile.shared	2006-06-27 01:56:39.000000000 -0700
@@ -8,6 +8,7 @@
 # CC contains the current compiler.  This one MUST be defined
 CC=cc
 CFLAGS=$(CFLAG)
+NM=nm
 # LDFLAGS contains flags to be used when temporary object files (when building
 # shared libraries) are created, or when an application is linked.
 # SHARED_LDFLAGS contains flags to be used when the shared library is created.
@@ -101,7 +102,7 @@
     LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
     SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \
     SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
-    nm -Pg $$SHOBJECTS | grep ' [BDT] ' | cut -f1 -d' ' > lib$(LIBNAME).exp; \
+    ${NM} -Pg $$SHOBJECTS | grep ' [BDT] ' | cut -f1 -d' ' > lib$(LIBNAME).exp; \
     LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
     LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
     LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
@@ -112,7 +113,20 @@
   ( $(SET_X); rm -f lib$(LIBNAME).exp )
 
 SYMLINK_SO=	\
-	if [ -n "$$INHIBIT_SYMLINKS" ]; then :; else \
+	if [ -n "$$INHIBIT_SYMLINKS" ]; then \
+		prev=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
+		if [ -n "$$SHLIB_COMPAT" ]; then \
+			for x in $$SHLIB_COMPAT; do \
+				( $(SET_X); rm -f $$SHLIB$$x$$SHLIB_SUFFIX; \
+				  ln -s $$prev $$SHLIB$$x$$SHLIB_SUFFIX ); \
+				prev=$$SHLIB$$x$$SHLIB_SUFFIX; \
+			done; \
+		fi; \
+		if [ -n "$$SHLIB_SOVER" ]; then \
+			( $(SET_X); rm -f $$SHLIB$$SHLIB_SUFFIX; \
+			  cp -p $$prev $$SHLIB$$SHLIB_SUFFIX ); \
+		fi; \
+	else \
 		prev=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
 		if [ -n "$$SHLIB_COMPAT" ]; then \
 			for x in $$SHLIB_COMPAT; do \
@@ -249,6 +263,9 @@
 	INHIBIT_SYMLINKS=yes; \
 	SHLIB=cyg$(LIBNAME); \
 	expr $(PLATFORM) : 'mingw' > /dev/null && SHLIB=$(LIBNAME)eay32; \
+	if [ "$(PLATFORM)" = "mingw32" -a "$(LIBNAME)" = "crypto" ]; then \
+		SHLIB=libeay32; \
+	fi; \
 	SHLIB_SUFFIX=.dll; \
 	SHLIB_SOVER=-$(LIBVERSION); \
 	ALLSYMSFLAGS='-Wl,--whole-archive'; \
@@ -258,8 +275,8 @@
 	[ -f apps/$$SHLIB$$SHLIB_SUFFIX ] && rm apps/$$SHLIB$$SHLIB_SUFFIX; \
 	[ -f test/$$SHLIB$$SHLIB_SUFFIX ] && rm test/$$SHLIB$$SHLIB_SUFFIX; \
 	$(LINK_SO_A) || exit 1; \
-	cp -p $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX apps/; \
-	cp -p $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX test/
+	cp -p $$SHLIB$$SHLIB_SUFFIX apps/; \
+	cp -p $$SHLIB$$SHLIB_SUFFIX test/
 link_app.cygwin:
 	$(LINK_APP)
 
Index: util/mkdef.pl
--- ../tmp/openssl-0.9.8b/util/mkdef.pl	2006-01-02 06:08:22.000000000 -0800
+++ ./util/mkdef.pl	2006-07-26 23:21:46.000000000 -0700
@@ -1204,7 +1204,7 @@
 ; Definition file for the DLL version of the $name library from OpenSSL
 ;
 
-LIBRARY         $libname	$liboptions
+LIBRARY         $libname.DLL	$liboptions
 
 DESCRIPTION     '$description'
 
