From 0649b6af90bbe8f3e12f0fae6516ca12125d1dc9 Mon Sep 17 00:00:00 2001
From: Matt Corallo <matt@bluematt.me>
Date: Fri, 27 May 2011 02:53:13 +0200
Subject: [PATCH] Update to openssl-1.0.0d and enable RPC-SSL on Win32

---
 doc/build-msw.txt  | 11 +++--------
 share/setup.nsi    |  2 --
 src/makefile.mingw |  9 +++++----
 3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/doc/build-msw.txt b/doc/build-msw.txt
index e30b4ee72..1911008d1 100644
--- a/doc/build-msw.txt
+++ b/doc/build-msw.txt
@@ -28,7 +28,7 @@ Libraries you need to download separately and build:
 
                 default path               download
 wxWidgets       \wxwidgets-2.9.1-mgw       http://www.wxwidgets.org/downloads/
-OpenSSL         \openssl-1.0.0c-mgw        http://www.openssl.org/source/
+OpenSSL         \openssl-1.0.0d-mgw        http://www.openssl.org/source/
 Berkeley DB     \db-4.7.25.NC-mgw          http://www.oracle.com/technology/software/products/berkeley-db/index.html
 Boost           \boost-1.43.0-mgw          http://www.boost.org/users/download/
 miniupnpc       \upnpc-exe-win32-20110215  http://miniupnp.tuxfamily.org/files/
@@ -42,7 +42,7 @@ miniupnpc      New (3-clause) BSD license
 
 Versions used in this release:
 wxWidgets    2.9.1
-OpenSSL      1.0.0c
+OpenSSL      1.0.0d
 Berkeley DB  4.7.25.NC
 Boost        1.43.0
 miniupnpc    1.5-20110215
@@ -66,15 +66,10 @@ MSYS shell:
 un-tar sources with MSYS 'tar xfz' to avoid issue with symlinks (OpenSSL ticket 2377)
 change 'MAKE' env. variable from 'C:\MinGW32\bin\mingw32-make.exe' to '/c/MinGW32/bin/mingw32-make.exe'
 
-cd /c/openssl-1.0.0c-mgw
+cd /c/openssl-1.0.0d-mgw
 ./config
 make
 
-perl util/mkdef.pl 32 libeay enable-static-engine > libeay32.def
-dllwrap --dllname libeay32.dll --output-lib libeay32.a --def libeay32.def libcrypto.a -lws2_32 -lgdi32
-
-after that openssl libeay is in main source dir (openssl-1.0.0c-mgw)
-
 Berkeley DB
 -----------
 MSYS shell:
diff --git a/share/setup.nsi b/share/setup.nsi
index 4239f5320..d26530253 100644
--- a/share/setup.nsi
+++ b/share/setup.nsi
@@ -60,7 +60,6 @@ Section -Main SEC0000
     SetOutPath $INSTDIR
     SetOverwrite on
     File ../src/bitcoin.exe
-    File ../../openssl-1.0.0d/libeay32.dll
     File /oname=license.txt ../COPYING
     File /oname=readme.txt ../doc/README_windows.txt
     SetOutPath $INSTDIR\daemon
@@ -108,7 +107,6 @@ done${UNSECTION_ID}:
 # Uninstaller sections
 Section /o -un.Main UNSEC0000
     Delete /REBOOTOK $INSTDIR\bitcoin.exe
-    Delete /REBOOTOK $INSTDIR\libeay32.dll
     Delete /REBOOTOK $INSTDIR\license.txt
     Delete /REBOOTOK $INSTDIR\readme.txt
     RMDir /r /REBOOTOK $INSTDIR\daemon
diff --git a/src/makefile.mingw b/src/makefile.mingw
index 57ece3ba2..c3a964e8f 100644
--- a/src/makefile.mingw
+++ b/src/makefile.mingw
@@ -7,14 +7,14 @@ USE_UPNP:=0
 INCLUDEPATHS= \
  -I"C:\boost-1.43.0-mgw" \
  -I"C:\db-4.7.25.NC-mgw\build_unix" \
- -I"C:\openssl-1.0.0c-mgw\include" \
+ -I"C:\openssl-1.0.0d-mgw\include" \
  -I"C:\wxWidgets-2.9.1-mgw\lib\gcc_lib\mswud" \
  -I"C:\wxWidgets-2.9.1-mgw\include"
 
 LIBPATHS= \
  -L"C:\boost-1.43.0-mgw\stage\lib" \
  -L"C:\db-4.7.25.NC-mgw\build_unix" \
- -L"C:\openssl-1.0.0c-mgw" \
+ -L"C:\openssl-1.0.0d-mgw" \
  -L"C:\wxWidgets-2.9.1-mgw\lib\gcc_lib"
 
 WXLIBS= \
@@ -26,9 +26,10 @@ LIBS= \
  -l boost_program_options-mgw45-mt-s-1_43 \
  -l boost_thread-mgw45-mt-s-1_43 \
  -l db_cxx \
- -l eay32
+ -l ssl \
+ -l crypto
 
-DEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH
+DEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH -DUSE_SSL
 DEBUGFLAGS=-g -D__WXDEBUG__
 CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
 HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \