mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
revert dash#4683: remove the ability to opt-out from building openssl
This reverts commit b26eaf6954
.
This commit is contained in:
parent
43152b2b35
commit
c7c42fff3d
27
configure.ac
27
configure.ac
@ -246,13 +246,6 @@ AC_ARG_WITH([system-univalue],
|
|||||||
[system_univalue=$withval],
|
[system_univalue=$withval],
|
||||||
[system_univalue=no]
|
[system_univalue=no]
|
||||||
)
|
)
|
||||||
|
|
||||||
AC_ARG_WITH([openssl],
|
|
||||||
[AS_HELP_STRING([--with-openssl],
|
|
||||||
[enable openssl (default is yes if OpenSSL is found)])],
|
|
||||||
[use_openssl=$withval],
|
|
||||||
[use_openssl=yes])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([zmq],
|
AC_ARG_ENABLE([zmq],
|
||||||
[AS_HELP_STRING([--disable-zmq],
|
[AS_HELP_STRING([--disable-zmq],
|
||||||
[disable ZMQ notifications])],
|
[disable ZMQ notifications])],
|
||||||
@ -689,15 +682,13 @@ case $host in
|
|||||||
dnl It's safe to add these paths even if the functionality is disabled by
|
dnl It's safe to add these paths even if the functionality is disabled by
|
||||||
dnl the user (--without-wallet or --without-gui for example).
|
dnl the user (--without-wallet or --without-gui for example).
|
||||||
|
|
||||||
|
openssl_prefix=`$BREW --prefix openssl 2>/dev/null`
|
||||||
bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null`
|
bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null`
|
||||||
qt5_prefix=`$BREW --prefix qt5 2>/dev/null`
|
qt5_prefix=`$BREW --prefix qt5 2>/dev/null`
|
||||||
if test x$use_openssl != xno; then
|
|
||||||
openssl_prefix=`$BREW --prefix openssl 2>/dev/null`
|
|
||||||
if test x$openssl_prefix != x; then
|
if test x$openssl_prefix != x; then
|
||||||
PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
|
PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||||
export PKG_CONFIG_PATH
|
export PKG_CONFIG_PATH
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
if test x$bdb_prefix != x; then
|
if test x$bdb_prefix != x; then
|
||||||
CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include"
|
CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include"
|
||||||
LIBS="$LIBS -L$bdb_prefix/lib"
|
LIBS="$LIBS -L$bdb_prefix/lib"
|
||||||
@ -1227,7 +1218,6 @@ if test "x$enable_fuzz" = "xyes"; then
|
|||||||
bitcoin_enable_qt_dbus=no
|
bitcoin_enable_qt_dbus=no
|
||||||
enable_wallet=no
|
enable_wallet=no
|
||||||
use_bench=no
|
use_bench=no
|
||||||
use_openssl=no
|
|
||||||
use_upnp=no
|
use_upnp=no
|
||||||
use_natpmp=no
|
use_natpmp=no
|
||||||
use_zmq=no
|
use_zmq=no
|
||||||
@ -1439,9 +1429,7 @@ if test x$use_pkgconfig = xyes; then
|
|||||||
m4_ifdef(
|
m4_ifdef(
|
||||||
[PKG_CHECK_MODULES],
|
[PKG_CHECK_MODULES],
|
||||||
[
|
[
|
||||||
if test x$use_openssl != xno; then
|
PKG_CHECK_MODULES([CRYPTO], [libcrypto],,[AC_MSG_ERROR(libcrypto not found.)])
|
||||||
PKG_CHECK_MODULES([CRYPTO], [libcrypto],, [use_openssl=no])
|
|
||||||
fi
|
|
||||||
if test x$use_qr != xno; then
|
if test x$use_qr != xno; then
|
||||||
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])])
|
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])])
|
||||||
fi
|
fi
|
||||||
@ -1464,10 +1452,8 @@ if test x$use_pkgconfig = xyes; then
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
if test x$use_openssl != xno; then
|
AC_CHECK_HEADER([openssl/crypto.h],,AC_MSG_ERROR(libcrypto headers missing))
|
||||||
AC_CHECK_HEADER([openssl/crypto.h],,[use_openssl=no])
|
AC_CHECK_LIB([crypto], [main],CRYPTO_LIBS=-lcrypto, AC_MSG_ERROR(libcrypto missing))
|
||||||
AC_CHECK_LIB([crypto], [main],CRYPTO_LIBS=-lcrypto, [use_openssl=no])
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests != xnononono; then
|
if test x$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests != xnononono; then
|
||||||
AC_CHECK_HEADER([event2/event.h],, AC_MSG_ERROR(libevent headers missing),)
|
AC_CHECK_HEADER([event2/event.h],, AC_MSG_ERROR(libevent headers missing),)
|
||||||
@ -1711,10 +1697,6 @@ if test x$bitcoin_enable_qt != xno; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x$use_openssl = xyes; then
|
|
||||||
AC_DEFINE([USE_OPENSSL],[1],[Define to 1 to use OpenSSL])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"])
|
AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"])
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build test_dash])
|
AC_MSG_CHECKING([whether to build test_dash])
|
||||||
@ -1896,7 +1878,6 @@ echo " with gui / qt = $bitcoin_enable_qt"
|
|||||||
if test x$bitcoin_enable_qt != xno; then
|
if test x$bitcoin_enable_qt != xno; then
|
||||||
echo " with qr = $use_qr"
|
echo " with qr = $use_qr"
|
||||||
fi
|
fi
|
||||||
echo " with openssl = $use_openssl"
|
|
||||||
echo " with zmq = $use_zmq"
|
echo " with zmq = $use_zmq"
|
||||||
echo " with test = $use_tests"
|
echo " with test = $use_tests"
|
||||||
echo " with bench = $use_bench"
|
echo " with bench = $use_bench"
|
||||||
|
@ -33,7 +33,6 @@ WORK_PATH = $(BASEDIR)/work
|
|||||||
BASE_CACHE ?= $(BASEDIR)/built
|
BASE_CACHE ?= $(BASEDIR)/built
|
||||||
SDK_PATH ?= $(BASEDIR)/SDKs
|
SDK_PATH ?= $(BASEDIR)/SDKs
|
||||||
NO_QT ?=
|
NO_QT ?=
|
||||||
NO_OPENSSL ?=
|
|
||||||
NO_WALLET ?=
|
NO_WALLET ?=
|
||||||
NO_ZMQ ?=
|
NO_ZMQ ?=
|
||||||
NO_UPNP ?=
|
NO_UPNP ?=
|
||||||
@ -137,15 +136,10 @@ upnp_packages_$(NO_UPNP) = $(upnp_packages)
|
|||||||
natpmp_packages_$(NO_NATPMP) = $(natpmp_packages)
|
natpmp_packages_$(NO_NATPMP) = $(natpmp_packages)
|
||||||
|
|
||||||
zmq_packages_$(NO_ZMQ) = $(zmq_packages)
|
zmq_packages_$(NO_ZMQ) = $(zmq_packages)
|
||||||
openssl_packages_$(NO_OPENSSL) = $(openssl_packages)
|
|
||||||
|
|
||||||
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_) $(natpmp_packages_)
|
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_) $(natpmp_packages_)
|
||||||
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
|
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
|
||||||
|
|
||||||
ifneq ($(openssl_packages_),)
|
|
||||||
packages += $(openssl_packages)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(zmq_packages_),)
|
ifneq ($(zmq_packages_),)
|
||||||
packages += $(zmq_packages)
|
packages += $(zmq_packages)
|
||||||
endif
|
endif
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
packages:=boost libevent gmp bls-dash backtrace cmake immer
|
packages:=boost openssl libevent gmp bls-dash backtrace cmake immer
|
||||||
|
|
||||||
openssl_packages = openssl
|
|
||||||
|
|
||||||
qt_packages = qrencode zlib
|
qt_packages = qrencode zlib
|
||||||
|
|
||||||
|
@ -25,9 +25,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#if USE_OPENSSL
|
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(QT_STATICPLUGIN)
|
#if defined(QT_STATICPLUGIN)
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
@ -44,10 +44,8 @@
|
|||||||
#include <cpuid.h>
|
#include <cpuid.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_OPENSSL
|
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
#include <openssl/conf.h>
|
#include <openssl/conf.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
[[noreturn]] static void RandFailure()
|
[[noreturn]] static void RandFailure()
|
||||||
{
|
{
|
||||||
@ -402,9 +400,7 @@ void GetOSRand(unsigned char *ent32)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_OPENSSL
|
|
||||||
void LockingCallbackOpenSSL(int mode, int i, const char* file, int line);
|
void LockingCallbackOpenSSL(int mode, int i, const char* file, int line);
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -428,7 +424,6 @@ public:
|
|||||||
{
|
{
|
||||||
InitHardwareRand();
|
InitHardwareRand();
|
||||||
|
|
||||||
#if USE_OPENSSL
|
|
||||||
// Init OpenSSL library multithreading support
|
// Init OpenSSL library multithreading support
|
||||||
m_mutex_openssl.reset(new Mutex[CRYPTO_num_locks()]);
|
m_mutex_openssl.reset(new Mutex[CRYPTO_num_locks()]);
|
||||||
CRYPTO_set_locking_callback(LockingCallbackOpenSSL);
|
CRYPTO_set_locking_callback(LockingCallbackOpenSSL);
|
||||||
@ -439,17 +434,14 @@ public:
|
|||||||
// or corrupt. Explicitly tell OpenSSL not to try to load the file. The result for our libs will be
|
// or corrupt. Explicitly tell OpenSSL not to try to load the file. The result for our libs will be
|
||||||
// that the config appears to have been loaded and there are no modules/engines available.
|
// that the config appears to have been loaded and there are no modules/engines available.
|
||||||
OPENSSL_no_config();
|
OPENSSL_no_config();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~RNGState()
|
~RNGState()
|
||||||
{
|
{
|
||||||
#if USE_OPENSSL
|
|
||||||
// Securely erase the memory used by the OpenSSL PRNG
|
// Securely erase the memory used by the OpenSSL PRNG
|
||||||
RAND_cleanup();
|
RAND_cleanup();
|
||||||
// Shutdown OpenSSL library multithreading support
|
// Shutdown OpenSSL library multithreading support
|
||||||
CRYPTO_set_locking_callback(nullptr);
|
CRYPTO_set_locking_callback(nullptr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Extract up to 32 bytes of entropy from the RNG state, mixing in new entropy from hasher.
|
/** Extract up to 32 bytes of entropy from the RNG state, mixing in new entropy from hasher.
|
||||||
@ -486,9 +478,7 @@ public:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_OPENSSL
|
|
||||||
Mutex& GetOpenSSLMutex(int i) { return m_mutex_openssl[i]; }
|
Mutex& GetOpenSSLMutex(int i) { return m_mutex_openssl[i]; }
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
RNGState& GetRNGState() noexcept
|
RNGState& GetRNGState() noexcept
|
||||||
@ -500,7 +490,6 @@ RNGState& GetRNGState() noexcept
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_OPENSSL
|
|
||||||
void LockingCallbackOpenSSL(int mode, int i, const char* file, int line) NO_THREAD_SAFETY_ANALYSIS
|
void LockingCallbackOpenSSL(int mode, int i, const char* file, int line) NO_THREAD_SAFETY_ANALYSIS
|
||||||
{
|
{
|
||||||
RNGState& rng = GetRNGState();
|
RNGState& rng = GetRNGState();
|
||||||
@ -511,7 +500,6 @@ void LockingCallbackOpenSSL(int mode, int i, const char* file, int line) NO_THRE
|
|||||||
rng.GetOpenSSLMutex(i).unlock();
|
rng.GetOpenSSLMutex(i).unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* A note on the use of noexcept in the seeding functions below:
|
/* A note on the use of noexcept in the seeding functions below:
|
||||||
*
|
*
|
||||||
@ -550,11 +538,9 @@ static void SeedSlow(CSHA512& hasher) noexcept
|
|||||||
GetOSRand(buffer);
|
GetOSRand(buffer);
|
||||||
hasher.Write(buffer, sizeof(buffer));
|
hasher.Write(buffer, sizeof(buffer));
|
||||||
|
|
||||||
#if USE_OPENSSL
|
|
||||||
// OpenSSL RNG (for now)
|
// OpenSSL RNG (for now)
|
||||||
RAND_bytes(buffer, sizeof(buffer));
|
RAND_bytes(buffer, sizeof(buffer));
|
||||||
hasher.Write(buffer, sizeof(buffer));
|
hasher.Write(buffer, sizeof(buffer));
|
||||||
#endif
|
|
||||||
|
|
||||||
// High-precision timestamp.
|
// High-precision timestamp.
|
||||||
//
|
//
|
||||||
@ -649,7 +635,6 @@ static void ProcRand(unsigned char* out, int num, RNGLevel level)
|
|||||||
rng.MixExtract(out, num, std::move(startup_hasher), true);
|
rng.MixExtract(out, num, std::move(startup_hasher), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_OPENSSL
|
|
||||||
// For anything but the 'fast' level, feed the resulting RNG output (after an additional hashing step) back into OpenSSL.
|
// For anything but the 'fast' level, feed the resulting RNG output (after an additional hashing step) back into OpenSSL.
|
||||||
if (level != RNGLevel::FAST) {
|
if (level != RNGLevel::FAST) {
|
||||||
unsigned char buf[64];
|
unsigned char buf[64];
|
||||||
@ -657,7 +642,6 @@ static void ProcRand(unsigned char* out, int num, RNGLevel level)
|
|||||||
RAND_add(buf, sizeof(buf), num);
|
RAND_add(buf, sizeof(buf), num);
|
||||||
memory_cleanse(buf, 64);
|
memory_cleanse(buf, 64);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::chrono::microseconds GetRandMicros(std::chrono::microseconds duration_max) noexcept
|
std::chrono::microseconds GetRandMicros(std::chrono::microseconds duration_max) noexcept
|
||||||
|
Loading…
Reference in New Issue
Block a user