diff -r -u openssl-0.9.8h/Configure openssl-modified/Configure
--- openssl-0.9.8h/Configure	2008-05-02 01:11:30.000000000 +0200
+++ openssl-modified/Configure	2008-06-02 17:15:02.000000000 +0200
@@ -474,6 +474,7 @@
 
 # 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",
+"mingw64", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -Wall -D_WIN32_WINNT=0x333:::MINGW64:-lwsock32 -lgdi32:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a",
 
 # UWIN 
 "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
@@ -947,7 +948,7 @@
 
 $IsMK1MF=1 if ($target eq "mingw" && $^O ne "cygwin" && !is_msys());
 
-$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 "mingw64" );
 $exe_ext=".nlm" if ($target =~ /netware/);
 $exe_ext=".pm"  if ($target =~ /vos/);
 $openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
diff -r -u openssl-0.9.8h/crypto/rand/rand.h openssl-modified/crypto/rand/rand.h
--- openssl-0.9.8h/crypto/rand/rand.h	2004-05-17 17:49:12.000000000 +0200
+++ openssl-modified/crypto/rand/rand.h	2008-06-02 16:33:33.000000000 +0200
@@ -65,6 +65,14 @@
 
 #if defined(OPENSSL_SYS_WINDOWS)
 #include <windows.h>
+
+#ifdef OPENSSL_SYS_WIN32
+/* Under Win32 these are defined in wincrypt.h */
+#undef X509_NAME
+#undef X509_CERT_PAIR
+/* Under Win64 also this might be defined in wincrypt.h */
+#undef X509_EXTENSIONS
+#endif
 #endif
 
 #ifdef  __cplusplus
diff -r -u openssl-0.9.8h/crypto/x509/x509.h openssl-modified/crypto/x509/x509.h
--- openssl-0.9.8h/crypto/x509/x509.h	2008-04-02 13:11:50.000000000 +0200
+++ openssl-modified/crypto/x509/x509.h	2008-06-02 16:16:59.000000000 +0200
@@ -116,6 +116,8 @@
 /* Under Win32 these are defined in wincrypt.h */
 #undef X509_NAME
 #undef X509_CERT_PAIR
+/* Under Win64 also this might be defined in wincrypt.h */
+#undef X509_EXTENSIONS
 #endif
 
 #define X509_FILETYPE_PEM	1
diff -r -u openssl-0.9.8h/e_os2.h openssl-modified/e_os2.h
--- openssl-0.9.8h/e_os2.h	2005-12-18 19:57:07.000000000 +0100
+++ openssl-modified/e_os2.h	2008-06-02 15:38:49.000000000 +0200
@@ -262,7 +262,7 @@
 */
 #ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
 # define OPENSSL_IMPLEMENT_GLOBAL(type,name)			     \
-	extern type _hide_##name;				     \
+	static type _hide_##name;				     \
 	type *_shadow_##name(void) { return &_hide_##name; }	     \
 	static type _hide_##name
 # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
diff -r -u openssl-0.9.8h/e_os.h openssl-modified/e_os.h
--- openssl-0.9.8h/e_os.h	2008-01-03 23:53:01.000000000 +0100
+++ openssl-modified/e_os.h	2008-06-02 16:43:12.000000000 +0200
@@ -334,7 +334,13 @@
 #  else
 #    define DEFAULT_HOME  "C:"
 #  endif
-
+#ifdef OPENSSL_SYS_WIN32
+/* Under Win32 these are defined in wincrypt.h */
+#undef X509_NAME
+#undef X509_CERT_PAIR
+/* Under Win64 also this might be defined in wincrypt.h */
+#undef X509_EXTENSIONS
+#endif
 #else /* The non-microsoft world world */
 
 #  ifdef OPENSSL_SYS_VMS
