Browse Source

Merge pull request #1042 from gavinandresen/use_ssl_cleanup

Remove USE_SSL #define
0.8
Gavin Andresen 13 years ago
parent
commit
895c12943b
  1. 6
      bitcoin-qt.pro
  2. 2
      contrib/debian/rules
  3. 4
      contrib/gitian-descriptors/gitian-win32.yml
  4. 4
      contrib/gitian-descriptors/gitian.yml
  5. 2
      doc/release-process.txt
  6. 28
      src/bitcoinrpc.cpp
  7. 2
      src/init.cpp
  8. 2
      src/makefile.linux-mingw
  9. 2
      src/makefile.mingw
  10. 2
      src/makefile.osx
  11. 4
      src/makefile.unix
  12. 9
      src/rpcdump.cpp

6
bitcoin-qt.pro

@ -62,12 +62,6 @@ contains(USE_DBUS, 1) {
QT += dbus QT += dbus
} }
# use: qmake "USE_SSL=1"
contains(USE_SSL, 1) {
message(Building with SSL support for RPC)
DEFINES += USE_SSL
}
# use: qmake "FIRST_CLASS_MESSAGING=1" # use: qmake "FIRST_CLASS_MESSAGING=1"
contains(FIRST_CLASS_MESSAGING, 1) { contains(FIRST_CLASS_MESSAGING, 1) {
message(Building with first-class messaging) message(Building with first-class messaging)

2
contrib/debian/rules vendored

@ -20,7 +20,7 @@ override_dh_auto_clean:
cd src; $(MAKE) -f makefile.unix clean cd src; $(MAKE) -f makefile.unix clean
override_dh_auto_configure: override_dh_auto_configure:
qmake bitcoin-qt.pro USE_SSL=1 USE_QRCODE=1 qmake bitcoin-qt.pro USE_QRCODE=1
override_dh_auto_test: override_dh_auto_test:
cd src; $(MAKE) -f makefile.unix test_bitcoin cd src; $(MAKE) -f makefile.unix test_bitcoin

4
contrib/gitian-descriptors/gitian-win32.yml

@ -52,7 +52,7 @@ script: |
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
export FAKETIME=$REFERENCE_DATETIME export FAKETIME=$REFERENCE_DATETIME
export TZ=UTC export TZ=UTC
$HOME/qt/src/bin/qmake -spec unsupported/win32-g++-cross USE_SSL=1 MINIUPNPC_LIB_PATH=$HOME/build/miniupnpc MINIUPNPC_INCLUDE_PATH=$HOME/build/ BDB_LIB_PATH=$HOME/build/db-4.8.30.NC/build_unix BDB_INCLUDE_PATH=$HOME/build/db-4.8.30.NC/build_unix BOOST_LIB_PATH=$HOME/build/boost_1_47_0/stage/lib BOOST_INCLUDE_PATH=$HOME/build/boost_1_47_0 BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$HOME/build/openssl-1.0.0e OPENSSL_INCLUDE_PATH=$HOME/build/openssl-1.0.0e/include QRENCODE_LIB_PATH=$HOME/build/qrencode-3.2.0/.libs QRENCODE_INCLUDE_PATH=$HOME/build/qrencode-3.2.0 USE_QRCODE=1 INCLUDEPATH=$HOME/build DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_LRELEASE=lrelease QMAKE_CXXFLAGS=-frandom-seed=bitcoin QMAKE_LFLAGS=-frandom-seed=bitcoin $HOME/qt/src/bin/qmake -spec unsupported/win32-g++-cross MINIUPNPC_LIB_PATH=$HOME/build/miniupnpc MINIUPNPC_INCLUDE_PATH=$HOME/build/ BDB_LIB_PATH=$HOME/build/db-4.8.30.NC/build_unix BDB_INCLUDE_PATH=$HOME/build/db-4.8.30.NC/build_unix BOOST_LIB_PATH=$HOME/build/boost_1_47_0/stage/lib BOOST_INCLUDE_PATH=$HOME/build/boost_1_47_0 BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$HOME/build/openssl-1.0.0e OPENSSL_INCLUDE_PATH=$HOME/build/openssl-1.0.0e/include QRENCODE_LIB_PATH=$HOME/build/qrencode-3.2.0/.libs QRENCODE_INCLUDE_PATH=$HOME/build/qrencode-3.2.0 USE_QRCODE=1 INCLUDEPATH=$HOME/build DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_LRELEASE=lrelease QMAKE_CXXFLAGS=-frandom-seed=bitcoin QMAKE_LFLAGS=-frandom-seed=bitcoin
make $MAKEOPTS make $MAKEOPTS
cp release/bitcoin-qt.exe $OUTDIR/ cp release/bitcoin-qt.exe $OUTDIR/
# #
@ -61,7 +61,7 @@ script: |
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
export FAKETIME=$REFERENCE_DATETIME export FAKETIME=$REFERENCE_DATETIME
export TZ=UTC export TZ=UTC
make -f makefile.linux-mingw $MAKEOPTS DEPSDIR=$HOME/build bitcoind.exe USE_SSL=1 USE_UPNP=0 make -f makefile.linux-mingw $MAKEOPTS DEPSDIR=$HOME/build bitcoind.exe USE_UPNP=0
i586-mingw32msvc-strip bitcoind.exe i586-mingw32msvc-strip bitcoind.exe
makensis ../share/setup.nsi makensis ../share/setup.nsi
cp ../share/bitcoin-*-win32-setup.exe $OUTDIR/ cp ../share/bitcoin-*-win32-setup.exe $OUTDIR/

4
contrib/gitian-descriptors/gitian.yml

@ -48,10 +48,10 @@ script: |
cp $OUTDIR/src/COPYING $OUTDIR cp $OUTDIR/src/COPYING $OUTDIR
cd src cd src
sed 's/$(DEBUGFLAGS)//' -i makefile.unix sed 's/$(DEBUGFLAGS)//' -i makefile.unix
make -f makefile.unix STATIC=1 OPENSSL_INCLUDE_PATH="$INSTDIR/include" OPENSSL_LIB_PATH="$INSTDIR/lib" $MAKEOPTS bitcoind USE_UPNP=0 USE_SSL=1 make -f makefile.unix STATIC=1 OPENSSL_INCLUDE_PATH="$INSTDIR/include" OPENSSL_LIB_PATH="$INSTDIR/lib" $MAKEOPTS bitcoind USE_UPNP=0
mkdir -p $OUTDIR/bin/$GBUILD_BITS mkdir -p $OUTDIR/bin/$GBUILD_BITS
install -s bitcoind $OUTDIR/bin/$GBUILD_BITS install -s bitcoind $OUTDIR/bin/$GBUILD_BITS
cd .. cd ..
qmake INCLUDEPATH="$INSTDIR/include" LIBS="-L$INSTDIR/lib" RELEASE=1 USE_SSL=1 USE_QRCODE=1 qmake INCLUDEPATH="$INSTDIR/include" LIBS="-L$INSTDIR/lib" RELEASE=1 USE_QRCODE=1
make $MAKEOPTS make $MAKEOPTS
install bitcoin-qt $OUTDIR/bin/$GBUILD_BITS install bitcoin-qt $OUTDIR/bin/$GBUILD_BITS

2
doc/release-process.txt

@ -79,7 +79,7 @@
Gavin also had trouble with the macports py27-appscript package; he Gavin also had trouble with the macports py27-appscript package; he
ended up installing a version that worked with: /usr/bin/easy_install-2.7 appscript ended up installing a version that worked with: /usr/bin/easy_install-2.7 appscript
qmake RELEASE=1 USE_SSL=1 USE_UPNP=1 USE_QRCODE=1 bitcoin-qt.pro qmake RELEASE=1 USE_UPNP=1 USE_QRCODE=1 bitcoin-qt.pro
make make
export QTDIR=/opt/local/share/qt4 # needed to find translations/qt_*.qm files export QTDIR=/opt/local/share/qt4 # needed to find translations/qt_*.qm files
T=$(contrib/qt_translations.py $QTDIR/translations src/qt/locale) T=$(contrib/qt_translations.py $QTDIR/translations src/qt/locale)

28
src/bitcoinrpc.cpp

@ -14,12 +14,11 @@
#include <boost/iostreams/stream.hpp> #include <boost/iostreams/stream.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#ifdef USE_SSL
#include <boost/asio/ssl.hpp> #include <boost/asio/ssl.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SSLStream; typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SSLStream;
#endif
#include "json/json_spirit_reader_template.h" #include "json/json_spirit_reader_template.h"
#include "json/json_spirit_writer_template.h" #include "json/json_spirit_writer_template.h"
#include "json/json_spirit_utils.h" #include "json/json_spirit_utils.h"
@ -2273,7 +2272,6 @@ bool ClientAllowed(const string& strAddress)
return false; return false;
} }
#ifdef USE_SSL
// //
// IOStream device that speaks SSL but can also speak non-SSL // IOStream device that speaks SSL but can also speak non-SSL
// //
@ -2325,7 +2323,6 @@ private:
bool fUseSSL; bool fUseSSL;
SSLStream& stream; SSLStream& stream;
}; };
#endif
void ThreadRPCServer(void* parg) void ThreadRPCServer(void* parg)
{ {
@ -2384,7 +2381,6 @@ void ThreadRPCServer2(void* parg)
acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
#ifdef USE_SSL
ssl::context context(io_service, ssl::context::sslv23); ssl::context context(io_service, ssl::context::sslv23);
if (fUseSSL) if (fUseSSL)
{ {
@ -2402,29 +2398,17 @@ void ThreadRPCServer2(void* parg)
"TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH"); "TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH");
SSL_CTX_set_cipher_list(context.impl(), ciphers.c_str()); SSL_CTX_set_cipher_list(context.impl(), ciphers.c_str());
} }
#else
if (fUseSSL)
throw runtime_error("-rpcssl=1, but bitcoin compiled without full openssl libraries.");
#endif
loop loop
{ {
// Accept connection // Accept connection
#ifdef USE_SSL
SSLStream sslStream(io_service, context); SSLStream sslStream(io_service, context);
SSLIOStreamDevice d(sslStream, fUseSSL); SSLIOStreamDevice d(sslStream, fUseSSL);
iostreams::stream<SSLIOStreamDevice> stream(d); iostreams::stream<SSLIOStreamDevice> stream(d);
#else
ip::tcp::iostream stream;
#endif
ip::tcp::endpoint peer; ip::tcp::endpoint peer;
vnThreadsRunning[THREAD_RPCSERVER]--; vnThreadsRunning[THREAD_RPCSERVER]--;
#ifdef USE_SSL
acceptor.accept(sslStream.lowest_layer(), peer); acceptor.accept(sslStream.lowest_layer(), peer);
#else
acceptor.accept(*stream.rdbuf(), peer);
#endif
vnThreadsRunning[4]++; vnThreadsRunning[4]++;
if (fShutdown) if (fShutdown)
return; return;
@ -2551,7 +2535,6 @@ Object CallRPC(const string& strMethod, const Array& params)
// Connect to localhost // Connect to localhost
bool fUseSSL = GetBoolArg("-rpcssl"); bool fUseSSL = GetBoolArg("-rpcssl");
#ifdef USE_SSL
asio::io_service io_service; asio::io_service io_service;
ssl::context context(io_service, ssl::context::sslv23); ssl::context context(io_service, ssl::context::sslv23);
context.set_options(ssl::context::no_sslv2); context.set_options(ssl::context::no_sslv2);
@ -2560,15 +2543,6 @@ Object CallRPC(const string& strMethod, const Array& params)
iostreams::stream<SSLIOStreamDevice> stream(d); iostreams::stream<SSLIOStreamDevice> stream(d);
if (!d.connect(GetArg("-rpcconnect", "127.0.0.1"), GetArg("-rpcport", "8332"))) if (!d.connect(GetArg("-rpcconnect", "127.0.0.1"), GetArg("-rpcport", "8332")))
throw runtime_error("couldn't connect to server"); throw runtime_error("couldn't connect to server");
#else
if (fUseSSL)
throw runtime_error("-rpcssl=1, but bitcoin compiled without full openssl libraries.");
ip::tcp::iostream stream(GetArg("-rpcconnect", "127.0.0.1"), GetArg("-rpcport", "8332"));
if (stream.fail())
throw runtime_error("couldn't connect to server");
#endif
// HTTP basic authentication // HTTP basic authentication
string strUserPass64 = EncodeBase64(mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"]); string strUserPass64 = EncodeBase64(mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"]);

2
src/init.cpp

@ -221,14 +221,12 @@ bool AppInit2(int argc, char* argv[])
" -checkblocks=<n> \t\t " + _("How many blocks to check at startup (default: 2500, 0 = all)") + "\n" + " -checkblocks=<n> \t\t " + _("How many blocks to check at startup (default: 2500, 0 = all)") + "\n" +
" -checklevel=<n> \t\t " + _("How thorough the block verification is (0-6, default: 1)") + "\n"; " -checklevel=<n> \t\t " + _("How thorough the block verification is (0-6, default: 1)") + "\n";
#ifdef USE_SSL
strUsage += string() + strUsage += string() +
_("\nSSL options: (see the Bitcoin Wiki for SSL setup instructions)") + "\n" + _("\nSSL options: (see the Bitcoin Wiki for SSL setup instructions)") + "\n" +
" -rpcssl \t " + _("Use OpenSSL (https) for JSON-RPC connections") + "\n" + " -rpcssl \t " + _("Use OpenSSL (https) for JSON-RPC connections") + "\n" +
" -rpcsslcertificatechainfile=<file.cert>\t " + _("Server certificate file (default: server.cert)") + "\n" + " -rpcsslcertificatechainfile=<file.cert>\t " + _("Server certificate file (default: server.cert)") + "\n" +
" -rpcsslprivatekeyfile=<file.pem> \t " + _("Server private key (default: server.pem)") + "\n" + " -rpcsslprivatekeyfile=<file.pem> \t " + _("Server private key (default: server.pem)") + "\n" +
" -rpcsslciphers=<ciphers> \t " + _("Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)") + "\n"; " -rpcsslciphers=<ciphers> \t " + _("Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)") + "\n";
#endif
strUsage += string() + strUsage += string() +
" -? \t\t " + _("This help message") + "\n"; " -? \t\t " + _("This help message") + "\n";

2
src/makefile.linux-mingw

@ -26,7 +26,7 @@ LIBS= \
-l ssl \ -l ssl \
-l crypto -l crypto
DEFS=-D_MT -DWIN32 -D_WINDOWS -DNOPCH -DUSE_SSL -DBOOST_THREAD_USE_LIB DEFS=-D_MT -DWIN32 -D_WINDOWS -DNOPCH -DBOOST_THREAD_USE_LIB
DEBUGFLAGS=-g DEBUGFLAGS=-g
CFLAGS=-O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) CFLAGS=-O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)

2
src/makefile.mingw

@ -23,7 +23,7 @@ LIBS= \
-l ssl \ -l ssl \
-l crypto -l crypto
DEFS=-DWIN32 -D_WINDOWS -DNOPCH -DUSE_SSL -DBOOST_THREAD_USE_LIB DEFS=-DWIN32 -D_WINDOWS -DNOPCH -DBOOST_THREAD_USE_LIB
DEBUGFLAGS=-g DEBUGFLAGS=-g
CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)

2
src/makefile.osx vendored

@ -49,7 +49,7 @@ LIBS += \
TESTDEFS += -DBOOST_TEST_DYN_LINK TESTDEFS += -DBOOST_TEST_DYN_LINK
endif endif
DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DUSE_SSL DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0
ifdef RELEASE ifdef RELEASE
# Compile for maximum compatibility and smallest size. # Compile for maximum compatibility and smallest size.

4
src/makefile.unix

@ -39,10 +39,6 @@ ifneq (${USE_UPNP}, -)
DEFS += -DUSE_UPNP=$(USE_UPNP) DEFS += -DUSE_UPNP=$(USE_UPNP)
endif endif
ifneq (${USE_SSL}, 0)
DEFS += -DUSE_SSL
endif
LIBS+= \ LIBS+= \
-Wl,-B$(LMODE2) \ -Wl,-B$(LMODE2) \
-l z \ -l z \

9
src/rpcdump.cpp

@ -6,15 +6,8 @@
#include "init.h" // for pwalletMain #include "init.h" // for pwalletMain
#include "bitcoinrpc.h" #include "bitcoinrpc.h"
// #include <boost/asio.hpp>
// #include <boost/iostreams/concepts.hpp>
// #include <boost/iostreams/stream.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
// #ifdef USE_SSL
// #include <boost/asio/ssl.hpp>
// typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SSLStream;
// #endif
// #include <boost/xpressive/xpressive_dynamic.hpp>
#include "json/json_spirit_reader_template.h" #include "json/json_spirit_reader_template.h"
#include "json/json_spirit_writer_template.h" #include "json/json_spirit_writer_template.h"
#include "json/json_spirit_utils.h" #include "json/json_spirit_utils.h"

Loading…
Cancel
Save