Auto merge of #1429 - str4d:867-update-dependencies, r=str4d
Update all dependencies Also re-enables disabled compiler warnings. Closes #867, #944, #1241, #1255, #1348.
This commit is contained in:
commit
4cfbe798bf
|
@ -1,11 +1,11 @@
|
|||
AC_DEFUN([BITCOIN_FIND_BDB48],[
|
||||
AC_DEFUN([BITCOIN_FIND_BDB53],[
|
||||
AC_MSG_CHECKING([for Berkeley DB C++ headers])
|
||||
BDB_CPPFLAGS=
|
||||
BDB_LIBS=
|
||||
bdbpath=X
|
||||
bdb48path=X
|
||||
bdb53path=X
|
||||
bdbdirlist=
|
||||
for _vn in 4.8 48 4 5 ''; do
|
||||
for _vn in 5.3 53 5 ''; do
|
||||
for _pfx in b lib ''; do
|
||||
bdbdirlist="$bdbdirlist ${_pfx}db${_vn}"
|
||||
done
|
||||
|
@ -15,8 +15,8 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
|
|||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <${searchpath}db_cxx.h>
|
||||
]],[[
|
||||
#if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4)
|
||||
#error "failed to find bdb 4.8+"
|
||||
#if !((DB_VERSION_MAJOR == 5 && DB_VERSION_MINOR >= 3) || DB_VERSION_MAJOR > 5)
|
||||
#error "failed to find bdb 5.3+"
|
||||
#endif
|
||||
]])],[
|
||||
if test "x$bdbpath" = "xX"; then
|
||||
|
@ -28,32 +28,32 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
|
|||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <${searchpath}db_cxx.h>
|
||||
]],[[
|
||||
#if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8)
|
||||
#error "failed to find bdb 4.8"
|
||||
#if !(DB_VERSION_MAJOR == 5 && DB_VERSION_MINOR == 3)
|
||||
#error "failed to find bdb 5.3"
|
||||
#endif
|
||||
]])],[
|
||||
bdb48path="${searchpath}"
|
||||
bdb53path="${searchpath}"
|
||||
break
|
||||
],[])
|
||||
done
|
||||
if test "x$bdbpath" = "xX"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([libdb_cxx headers missing, Bitcoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
|
||||
elif test "x$bdb48path" = "xX"; then
|
||||
elif test "x$bdb53path" = "xX"; then
|
||||
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx)
|
||||
AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[
|
||||
AC_MSG_WARN([Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!])
|
||||
AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 5.3])],[
|
||||
AC_MSG_WARN([Found Berkeley DB other than 5.3; wallets opened by this build will not be portable!])
|
||||
],[
|
||||
AC_MSG_ERROR([Found Berkeley DB other than 4.8, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)])
|
||||
AC_MSG_ERROR([Found Berkeley DB other than 5.3, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)])
|
||||
])
|
||||
else
|
||||
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx)
|
||||
bdbpath="${bdb48path}"
|
||||
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb53path}],db_cxx)
|
||||
bdbpath="${bdb53path}"
|
||||
fi
|
||||
AC_SUBST(BDB_CPPFLAGS)
|
||||
|
||||
# TODO: Ideally this could find the library version and make sure it matches the headers being used
|
||||
for searchlib in db_cxx-4.8 db_cxx; do
|
||||
for searchlib in db_cxx-5.3 db_cxx; do
|
||||
AC_CHECK_LIB([$searchlib],[main],[
|
||||
BDB_LIBS="-l${searchlib}"
|
||||
break
|
||||
|
|
37
configure.ac
37
configure.ac
|
@ -263,9 +263,9 @@ case $host in
|
|||
dnl add default macports paths
|
||||
CPPFLAGS="$CPPFLAGS -isystem /opt/local/include"
|
||||
LIBS="$LIBS -L/opt/local/lib"
|
||||
if test -d /opt/local/include/db48; then
|
||||
CPPFLAGS="$CPPFLAGS -I/opt/local/include/db48"
|
||||
LIBS="$LIBS -L/opt/local/lib/db48"
|
||||
if test -d /opt/local/include/db53; then
|
||||
CPPFLAGS="$CPPFLAGS -I/opt/local/include/db53"
|
||||
LIBS="$LIBS -L/opt/local/lib/db53"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -512,7 +512,7 @@ AC_SUBST(LIBMEMENV)
|
|||
|
||||
if test x$enable_wallet != xno; then
|
||||
dnl Check for libdb_cxx only if wallet enabled
|
||||
BITCOIN_FIND_BDB48
|
||||
BITCOIN_FIND_BDB53
|
||||
fi
|
||||
|
||||
dnl Check for libminiupnpc (optional)
|
||||
|
@ -722,35 +722,12 @@ AC_CHECK_LIB([snark],[main],LIBSNARK_LIBS=-lsnark, [AC_MSG_ERROR(libsnark missin
|
|||
|
||||
LIBZCASH_LIBS="-lsnark -lgmp -lgmpxx -lboost_system-mt -lcrypto -lsodium -fopenmp"
|
||||
|
||||
AC_CHECK_LIB([crypto],[RAND_egd],[],[
|
||||
AC_ARG_WITH([libressl],
|
||||
[AS_HELP_STRING([--with-libressl],[Build with system LibreSSL (default is no; DANGEROUS; NOT SUPPORTED)])],
|
||||
[AC_MSG_WARN([Detected LibreSSL: This is NOT supported, and may break consensus compatibility!])],
|
||||
[AC_MSG_ERROR([Detected LibreSSL: This is NOT supported, and may break consensus compatibility!])]
|
||||
)
|
||||
])
|
||||
|
||||
CFLAGS_TEMP="$CFLAGS"
|
||||
CXXFLAGS_TEMP="$CXXFLAGS"
|
||||
LIBS_TEMP="$LIBS"
|
||||
CFLAGS="$CFLAGS $SSL_CFLAGS $CRYPTO_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $SSL_CFLAGS $CRYPTO_CFLAGS"
|
||||
LIBS="$LIBS $SSL_LIBS $CRYPTO_LIBS $GMP_LIBS $GMPXX_LIBS"
|
||||
AC_CHECK_HEADER([openssl/ec.h],, AC_MSG_ERROR(OpenSSL ec header missing),)
|
||||
|
||||
AC_MSG_CHECKING(for a supported OpenSSL version)
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <openssl/rand.h>
|
||||
]],
|
||||
[[RAND_egd(NULL);]])],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[
|
||||
AC_ARG_WITH([libressl],
|
||||
[AS_HELP_STRING([--with-libressl],[Build with system LibreSSL (default is no; DANGEROUS; NOT SUPPORTED)])],
|
||||
[AC_MSG_WARN([Detected LibreSSL: This is NOT supported, and may break consensus compatibility!])],
|
||||
[AC_MSG_ERROR([Detected LibreSSL: This is NOT supported, and may break consensus compatibility!])]
|
||||
)]
|
||||
)
|
||||
|
||||
CFLAGS="$CFLAGS_TEMP"
|
||||
CXXFLAGS="$CXXFLAGS_TEMP"
|
||||
LIBS="$LIBS_TEMP"
|
||||
|
||||
BITCOIN_QT_PATH_PROGS([PROTOC], [protoc],$protoc_bin_path)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package=bdb
|
||||
$(package)_version=4.8.30
|
||||
$(package)_version=5.3.28
|
||||
$(package)_download_path=http://download.oracle.com/berkeley-db
|
||||
$(package)_file_name=db-$($(package)_version).NC.tar.gz
|
||||
$(package)_sha256_hash=12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef
|
||||
$(package)_file_name=db-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=e0a992d740709892e81f9d93f06daf305cf73fb81b545afe72478043172c3628
|
||||
$(package)_build_subdir=build_unix
|
||||
|
||||
define $(package)_set_vars
|
||||
|
@ -11,16 +11,12 @@ $(package)_config_opts_mingw32=--enable-mingw
|
|||
$(package)_config_opts_linux=--with-pic
|
||||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
sed -i.old 's/__atomic_compare_exchange/__atomic_compare_exchange_db/' dbinc/atomic.h
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
../dist/$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE) libdb_cxx-4.8.a libdb-4.8.a
|
||||
$(MAKE) libdb_cxx-5.3.a libdb-5.3.a
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package=boost
|
||||
$(package)_version=1_57_0
|
||||
$(package)_download_path=http://sourceforge.net/projects/boost/files/boost/1.57.0
|
||||
$(package)_version=1_62_0
|
||||
$(package)_download_path=http://sourceforge.net/projects/boost/files/boost/1.62.0
|
||||
$(package)_file_name=$(package)_$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=910c8c022a33ccec7f088bd65d4f14b466588dda94ba2124e78b8c57db264967
|
||||
$(package)_sha256_hash=36c96b0f6155c98404091d8ceb48319a28279ca0333fba1ad8611eb90afb2ca0
|
||||
$(package)_patches=deprecated_auto_ptr.patch
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts_release=variant=release
|
||||
|
@ -25,7 +26,8 @@ $(package)_cxxflags_linux=-fPIC
|
|||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : <cxxflags>\"$($(package)_cxxflags) $($(package)_cppflags)\" <linkflags>\"$($(package)_ldflags)\" <archiver>\"$(boost_archiver_$(host_os))\" <striper>\"$(host_STRIP)\" <ranlib>\"$(host_RANLIB)\" <rc>\"$(host_WINDRES)\" : ;" > user-config.jam
|
||||
echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : <cxxflags>\"$($(package)_cxxflags) $($(package)_cppflags)\" <linkflags>\"$($(package)_ldflags)\" <archiver>\"$(boost_archiver_$(host_os))\" <striper>\"$(host_STRIP)\" <ranlib>\"$(host_RANLIB)\" <rc>\"$(host_WINDRES)\" : ;" > user-config.jam && \
|
||||
patch -p1 < $($(package)_patch_dir)/deprecated_auto_ptr.patch
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package=libgmp
|
||||
$(package)_version=6.0.0a
|
||||
$(package)_version=6.1.1
|
||||
$(package)_download_path=https://gmplib.org/download/gmp/
|
||||
$(package)_file_name=gmp-6.0.0a.tar.bz2
|
||||
$(package)_sha256_hash=7f8e9a804b9c6d07164cf754207be838ece1219425d64e28cfa3e70d5c759aaf
|
||||
$(package)_file_name=gmp-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6
|
||||
$(package)_dependencies=
|
||||
$(package)_config_opts=--enable-cxx --disable-shared
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package=miniupnpc
|
||||
$(package)_version=1.9.20151008
|
||||
$(package)_version=2.0
|
||||
$(package)_download_path=http://miniupnp.free.fr/files
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=e444ac3b587ce82709c4d0cfca1fe71f44f9fc433e9f946b12b9e1bfe667a633
|
||||
$(package)_sha256_hash=d434ceb8986efbe199c5ca53f90ed53eab290b1e6d0530b717eb6fa49d61f93b
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_build_opts=CC="$($(package)_cc)"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package=native_ccache
|
||||
$(package)_version=3.1.9
|
||||
$(package)_download_path=http://samba.org/ftp/ccache
|
||||
$(package)_version=3.3.1
|
||||
$(package)_download_path=https://www.samba.org/ftp/ccache
|
||||
$(package)_file_name=ccache-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=04d3e2e438ac8d4cc4b110b68cdd61bd59226c6588739a4a386869467f5ced7c
|
||||
$(package)_sha256_hash=cb6e4bafbb19ba0a2ec43386b123a5f92a20e1e3384c071d5d13e0cb3c84bf73
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=
|
||||
|
|
|
@ -1,14 +1,81 @@
|
|||
package=openssl
|
||||
$(package)_version=1.0.1k
|
||||
$(package)_version=1.1.0b
|
||||
$(package)_download_path=https://www.openssl.org/source
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=8f9faeaebad088e772f4ef5e38252d472be4d878c6b3a2718c10a4fcebe7a41c
|
||||
$(package)_sha256_hash=a45de072bf9be4dea437230aaf036000f0e68c6a665931c57e76b5b036cef6f7
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"
|
||||
$(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl no-zlib no-shared no-dso
|
||||
$(package)_config_opts+=no-krb5 no-camellia no-capieng no-cast no-cms no-dtls1 no-gost no-gmp no-heartbeats no-idea no-jpake no-md2
|
||||
$(package)_config_opts+=no-mdc2 no-rc5 no-rdrand no-rfc3779 no-rsax no-sctp no-seed no-sha0 no-static_engine no-whirlpool no-rc2 no-rc4 no-ssl2 no-ssl3
|
||||
$(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl
|
||||
$(package)_config_opts+=no-afalgeng
|
||||
$(package)_config_opts+=no-asm
|
||||
$(package)_config_opts+=no-async
|
||||
$(package)_config_opts+=no-bf
|
||||
$(package)_config_opts+=no-blake2
|
||||
$(package)_config_opts+=no-camellia
|
||||
$(package)_config_opts+=no-capieng
|
||||
$(package)_config_opts+=no-cast
|
||||
$(package)_config_opts+=no-chacha
|
||||
$(package)_config_opts+=no-cmac
|
||||
$(package)_config_opts+=no-cms
|
||||
$(package)_config_opts+=no-comp
|
||||
$(package)_config_opts+=no-crypto-mdebug
|
||||
$(package)_config_opts+=no-crypto-mdebug-backtrace
|
||||
$(package)_config_opts+=no-ct
|
||||
$(package)_config_opts+=no-des
|
||||
$(package)_config_opts+=no-dgram
|
||||
$(package)_config_opts+=no-dsa
|
||||
$(package)_config_opts+=no-dso
|
||||
$(package)_config_opts+=no-dtls
|
||||
$(package)_config_opts+=no-dtls1
|
||||
$(package)_config_opts+=no-dtls1-method
|
||||
$(package)_config_opts+=no-dynamic-engine
|
||||
$(package)_config_opts+=no-ec2m
|
||||
$(package)_config_opts+=no-ec_nistp_64_gcc_128
|
||||
$(package)_config_opts+=no-egd
|
||||
$(package)_config_opts+=no-engine
|
||||
$(package)_config_opts+=no-err
|
||||
$(package)_config_opts+=no-gost
|
||||
$(package)_config_opts+=no-heartbeats
|
||||
$(package)_config_opts+=no-idea
|
||||
$(package)_config_opts+=no-md2
|
||||
$(package)_config_opts+=no-md4
|
||||
$(package)_config_opts+=no-mdc2
|
||||
$(package)_config_opts+=no-multiblock
|
||||
$(package)_config_opts+=no-nextprotoneg
|
||||
$(package)_config_opts+=no-ocb
|
||||
$(package)_config_opts+=no-ocsp
|
||||
$(package)_config_opts+=no-poly1305
|
||||
$(package)_config_opts+=no-posix-io
|
||||
$(package)_config_opts+=no-psk
|
||||
$(package)_config_opts+=no-rc2
|
||||
$(package)_config_opts+=no-rc4
|
||||
$(package)_config_opts+=no-rc5
|
||||
$(package)_config_opts+=no-rdrand
|
||||
$(package)_config_opts+=no-rfc3779
|
||||
$(package)_config_opts+=no-rmd160
|
||||
$(package)_config_opts+=no-scrypt
|
||||
$(package)_config_opts+=no-sctp
|
||||
$(package)_config_opts+=no-seed
|
||||
$(package)_config_opts+=no-shared
|
||||
$(package)_config_opts+=no-sock
|
||||
$(package)_config_opts+=no-srp
|
||||
$(package)_config_opts+=no-srtp
|
||||
$(package)_config_opts+=no-ssl
|
||||
$(package)_config_opts+=no-ssl3
|
||||
$(package)_config_opts+=no-ssl3-method
|
||||
$(package)_config_opts+=no-ssl-trace
|
||||
$(package)_config_opts+=no-stdio
|
||||
$(package)_config_opts+=no-tls
|
||||
$(package)_config_opts+=no-tls1
|
||||
$(package)_config_opts+=no-tls1-method
|
||||
$(package)_config_opts+=no-ts
|
||||
$(package)_config_opts+=no-ui
|
||||
$(package)_config_opts+=no-unit-test
|
||||
$(package)_config_opts+=no-weak-ssl-ciphers
|
||||
$(package)_config_opts+=no-whirlpool
|
||||
$(package)_config_opts+=no-zlib
|
||||
$(package)_config_opts+=no-zlib-dynamic
|
||||
$(package)_config_opts+=$($(package)_cflags) $($(package)_cppflags)
|
||||
$(package)_config_opts+=-DPURIFY
|
||||
$(package)_config_opts_linux=-fPIC -Wa,--noexecstack
|
||||
|
@ -25,7 +92,7 @@ endef
|
|||
|
||||
define $(package)_preprocess_cmds
|
||||
sed -i.old "/define DATE/d" util/mkbuildinf.pl && \
|
||||
sed -i.old "s|engines apps test|engines|" Makefile.org
|
||||
sed -i.old "s|\"engines\", \"apps\", \"test\"|\"engines\"|" Configure
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
|
@ -37,7 +104,7 @@ define $(package)_build_cmds
|
|||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) INSTALL_PREFIX=$($(package)_staging_dir) -j1 install_sw
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) -j1 install_sw
|
||||
endef
|
||||
|
||||
define $(package)_postprocess_cmds
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
--- boost_1_62_0-orig/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp 2016-09-29 14:03:47.317997658 +1300
|
||||
+++ boost_1_62_0/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp 2016-09-29 14:07:41.308726372 +1300
|
||||
@@ -13,10 +13,16 @@
|
||||
|
||||
#if !defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE)
|
||||
#include <boost/spirit/home/classic/core/non_terminal/impl/object_with_id.ipp>
|
||||
+#include <boost/smart_ptr/detail/sp_disable_deprecated.hpp>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <memory> // for std::auto_ptr
|
||||
#include <boost/weak_ptr.hpp>
|
||||
+
|
||||
+#if defined( BOOST_SP_DISABLE_DEPRECATED )
|
||||
+#pragma GCC diagnostic push
|
||||
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_SPIRIT_THREADSAFE
|
||||
@@ -370,4 +376,10 @@
|
||||
|
||||
}} // namespace boost::spirit
|
||||
|
||||
+#if !defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE)
|
||||
+#if defined( BOOST_SP_DISABLE_DEPRECATED )
|
||||
+#pragma GCC diagnostic pop
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
#endif
|
|
@ -2,6 +2,20 @@ Release Process
|
|||
====================
|
||||
Meta: There should always be a single release engineer to disambiguate responsibility.
|
||||
|
||||
## Pre-release
|
||||
|
||||
Check all of the following:
|
||||
|
||||
- All dependencies have been updated as appropriate:
|
||||
- BDB
|
||||
- Boost
|
||||
- ccache
|
||||
- libgmp
|
||||
- libsnark (upstream of our fork)
|
||||
- libsodium
|
||||
- miniupnpc
|
||||
- OpenSSL
|
||||
|
||||
## A. Define the release version as:
|
||||
|
||||
$ ZCASH_RELEASE=MAJOR.MINOR.REVISION(-BUILD_STRING)
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "uint256.h"
|
||||
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <openssl/obj_mac.h>
|
||||
|
||||
namespace {
|
||||
|
@ -62,6 +61,9 @@ int ECDSA_SIG_recover_key_GFp(EC_KEY *eckey, ECDSA_SIG *ecsig, const unsigned ch
|
|||
int n = 0;
|
||||
int i = recid / 2;
|
||||
|
||||
const BIGNUM *sig_r, *sig_s;
|
||||
ECDSA_SIG_get0(ecsig, &sig_r, &sig_s);
|
||||
|
||||
const EC_GROUP *group = EC_KEY_get0_group(eckey);
|
||||
if ((ctx = BN_CTX_new()) == NULL) { ret = -1; goto err; }
|
||||
BN_CTX_start(ctx);
|
||||
|
@ -70,7 +72,7 @@ int ECDSA_SIG_recover_key_GFp(EC_KEY *eckey, ECDSA_SIG *ecsig, const unsigned ch
|
|||
x = BN_CTX_get(ctx);
|
||||
if (!BN_copy(x, order)) { ret=-1; goto err; }
|
||||
if (!BN_mul_word(x, i)) { ret=-1; goto err; }
|
||||
if (!BN_add(x, x, ecsig->r)) { ret=-1; goto err; }
|
||||
if (!BN_add(x, x, sig_r)) { ret=-1; goto err; }
|
||||
field = BN_CTX_get(ctx);
|
||||
if (!EC_GROUP_get_curve_GFp(group, field, NULL, NULL, ctx)) { ret=-2; goto err; }
|
||||
if (BN_cmp(x, field) >= 0) { ret=0; goto err; }
|
||||
|
@ -91,9 +93,9 @@ int ECDSA_SIG_recover_key_GFp(EC_KEY *eckey, ECDSA_SIG *ecsig, const unsigned ch
|
|||
if (!BN_zero(zero)) { ret=-1; goto err; }
|
||||
if (!BN_mod_sub(e, zero, e, order, ctx)) { ret=-1; goto err; }
|
||||
rr = BN_CTX_get(ctx);
|
||||
if (!BN_mod_inverse(rr, ecsig->r, order, ctx)) { ret=-1; goto err; }
|
||||
if (!BN_mod_inverse(rr, sig_r, order, ctx)) { ret=-1; goto err; }
|
||||
sor = BN_CTX_get(ctx);
|
||||
if (!BN_mod_mul(sor, ecsig->s, rr, order, ctx)) { ret=-1; goto err; }
|
||||
if (!BN_mod_mul(sor, sig_s, rr, order, ctx)) { ret=-1; goto err; }
|
||||
eor = BN_CTX_get(ctx);
|
||||
if (!BN_mod_mul(eor, e, rr, order, ctx)) { ret=-1; goto err; }
|
||||
if (!EC_POINT_mul(group, Q, eor, R, sor, ctx)) { ret=-2; goto err; }
|
||||
|
@ -177,9 +179,12 @@ bool CECKey::Recover(const uint256 &hash, const unsigned char *p64, int rec)
|
|||
if (rec<0 || rec>=3)
|
||||
return false;
|
||||
ECDSA_SIG *sig = ECDSA_SIG_new();
|
||||
BN_bin2bn(&p64[0], 32, sig->r);
|
||||
BN_bin2bn(&p64[32], 32, sig->s);
|
||||
bool ret = ECDSA_SIG_recover_key_GFp(pkey, sig, (unsigned char*)&hash, sizeof(hash), rec, 0) == 1;
|
||||
BIGNUM *sig_r = BN_bin2bn(&p64[0], 32, nullptr);
|
||||
BIGNUM *sig_s = BN_bin2bn(&p64[32], 32, nullptr);
|
||||
assert(sig && sig_r && sig_s);
|
||||
bool ret = ECDSA_SIG_set0(sig, sig_r, sig_s);
|
||||
assert(ret);
|
||||
ret = ECDSA_SIG_recover_key_GFp(pkey, sig, (unsigned char*)&hash, sizeof(hash), rec, 0) == 1;
|
||||
ECDSA_SIG_free(sig);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||
{
|
||||
const CChainParams& chainparams = Params();
|
||||
// Create new block
|
||||
auto_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate());
|
||||
unique_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate());
|
||||
if(!pblocktemplate.get())
|
||||
return NULL;
|
||||
CBlock *pblock = &pblocktemplate->block; // pointer for convenience
|
||||
|
@ -485,7 +485,7 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||
unsigned int nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
|
||||
CBlockIndex* pindexPrev = chainActive.Tip();
|
||||
|
||||
auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey));
|
||||
unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey));
|
||||
if (!pblocktemplate.get())
|
||||
{
|
||||
LogPrintf("Error in ZcashMiner: Keypool ran out, please call keypoolrefill before restarting the mining thread\n");
|
||||
|
|
|
@ -154,7 +154,7 @@ Value generate(const Array& params, bool fHelp)
|
|||
unsigned int k = Params().EquihashK();
|
||||
while (nHeight < nHeightEnd)
|
||||
{
|
||||
auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey));
|
||||
unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey));
|
||||
if (!pblocktemplate.get())
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Wallet keypool empty");
|
||||
CBlock *pblock = &pblocktemplate->block;
|
||||
|
|
|
@ -70,7 +70,7 @@ noinst_PROGRAMS += tests
|
|||
tests_SOURCES = src/tests.c
|
||||
tests_CPPFLAGS = -DVERIFY $(SECP_INCLUDES) $(SECP_TEST_INCLUDES)
|
||||
tests_LDADD = $(SECP_LIBS) $(SECP_TEST_LIBS)
|
||||
tests_LDFLAGS = -static
|
||||
tests_LDFLAGS = -static -pthread
|
||||
TESTS = tests
|
||||
endif
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define BITCOIN_TEST_BIGNUM_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
#include <stdint.h>
|
||||
|
@ -23,48 +24,52 @@ public:
|
|||
|
||||
|
||||
/** C++ wrapper for BIGNUM (OpenSSL bignum) */
|
||||
class CBigNum : public BIGNUM
|
||||
class CBigNum
|
||||
{
|
||||
BIGNUM* bn;
|
||||
public:
|
||||
CBigNum()
|
||||
{
|
||||
BN_init(this);
|
||||
bn = BN_new();
|
||||
assert(bn);
|
||||
}
|
||||
|
||||
CBigNum(const CBigNum& b)
|
||||
{
|
||||
BN_init(this);
|
||||
if (!BN_copy(this, &b))
|
||||
bn = BN_new();
|
||||
assert(bn);
|
||||
if (!BN_copy(bn, b.bn))
|
||||
{
|
||||
BN_clear_free(this);
|
||||
BN_clear_free(bn);
|
||||
throw bignum_error("CBigNum::CBigNum(const CBigNum&): BN_copy failed");
|
||||
}
|
||||
}
|
||||
|
||||
CBigNum& operator=(const CBigNum& b)
|
||||
{
|
||||
if (!BN_copy(this, &b))
|
||||
if (!BN_copy(bn, b.bn))
|
||||
throw bignum_error("CBigNum::operator=: BN_copy failed");
|
||||
return (*this);
|
||||
}
|
||||
|
||||
~CBigNum()
|
||||
{
|
||||
BN_clear_free(this);
|
||||
BN_clear_free(bn);
|
||||
}
|
||||
|
||||
CBigNum(long long n) { BN_init(this); setint64(n); }
|
||||
CBigNum(long long n) { bn = BN_new(); assert(bn); setint64(n); }
|
||||
|
||||
explicit CBigNum(const std::vector<unsigned char>& vch)
|
||||
{
|
||||
BN_init(this);
|
||||
bn = BN_new();
|
||||
assert(bn);
|
||||
setvch(vch);
|
||||
}
|
||||
|
||||
int getint() const
|
||||
{
|
||||
BN_ULONG n = BN_get_word(this);
|
||||
if (!BN_is_negative(this))
|
||||
BN_ULONG n = BN_get_word(bn);
|
||||
if (!BN_is_negative(bn))
|
||||
return (n > (BN_ULONG)std::numeric_limits<int>::max() ? std::numeric_limits<int>::max() : n);
|
||||
else
|
||||
return (n > (BN_ULONG)std::numeric_limits<int>::max() ? std::numeric_limits<int>::min() : -(int)n);
|
||||
|
@ -112,7 +117,7 @@ public:
|
|||
pch[1] = (nSize >> 16) & 0xff;
|
||||
pch[2] = (nSize >> 8) & 0xff;
|
||||
pch[3] = (nSize) & 0xff;
|
||||
BN_mpi2bn(pch, p - pch, this);
|
||||
BN_mpi2bn(pch, p - pch, bn);
|
||||
}
|
||||
|
||||
void setvch(const std::vector<unsigned char>& vch)
|
||||
|
@ -127,22 +132,30 @@ public:
|
|||
vch2[3] = (nSize >> 0) & 0xff;
|
||||
// swap data to big endian
|
||||
reverse_copy(vch.begin(), vch.end(), vch2.begin() + 4);
|
||||
BN_mpi2bn(&vch2[0], vch2.size(), this);
|
||||
BN_mpi2bn(&vch2[0], vch2.size(), bn);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> getvch() const
|
||||
{
|
||||
unsigned int nSize = BN_bn2mpi(this, NULL);
|
||||
unsigned int nSize = BN_bn2mpi(bn, NULL);
|
||||
if (nSize <= 4)
|
||||
return std::vector<unsigned char>();
|
||||
std::vector<unsigned char> vch(nSize);
|
||||
BN_bn2mpi(this, &vch[0]);
|
||||
BN_bn2mpi(bn, &vch[0]);
|
||||
vch.erase(vch.begin(), vch.begin() + 4);
|
||||
reverse(vch.begin(), vch.end());
|
||||
return vch;
|
||||
}
|
||||
|
||||
friend inline const CBigNum operator+(const CBigNum& a, const CBigNum& b);
|
||||
friend inline const CBigNum operator-(const CBigNum& a, const CBigNum& b);
|
||||
friend inline const CBigNum operator-(const CBigNum& a);
|
||||
friend inline bool operator==(const CBigNum& a, const CBigNum& b);
|
||||
friend inline bool operator!=(const CBigNum& a, const CBigNum& b);
|
||||
friend inline bool operator<=(const CBigNum& a, const CBigNum& b);
|
||||
friend inline bool operator>=(const CBigNum& a, const CBigNum& b);
|
||||
friend inline bool operator<(const CBigNum& a, const CBigNum& b);
|
||||
friend inline bool operator>(const CBigNum& a, const CBigNum& b);
|
||||
};
|
||||
|
||||
|
||||
|
@ -150,7 +163,7 @@ public:
|
|||
inline const CBigNum operator+(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CBigNum r;
|
||||
if (!BN_add(&r, &a, &b))
|
||||
if (!BN_add(r.bn, a.bn, b.bn))
|
||||
throw bignum_error("CBigNum::operator+: BN_add failed");
|
||||
return r;
|
||||
}
|
||||
|
@ -158,7 +171,7 @@ inline const CBigNum operator+(const CBigNum& a, const CBigNum& b)
|
|||
inline const CBigNum operator-(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CBigNum r;
|
||||
if (!BN_sub(&r, &a, &b))
|
||||
if (!BN_sub(r.bn, a.bn, b.bn))
|
||||
throw bignum_error("CBigNum::operator-: BN_sub failed");
|
||||
return r;
|
||||
}
|
||||
|
@ -166,15 +179,15 @@ inline const CBigNum operator-(const CBigNum& a, const CBigNum& b)
|
|||
inline const CBigNum operator-(const CBigNum& a)
|
||||
{
|
||||
CBigNum r(a);
|
||||
BN_set_negative(&r, !BN_is_negative(&r));
|
||||
BN_set_negative(r.bn, !BN_is_negative(r.bn));
|
||||
return r;
|
||||
}
|
||||
|
||||
inline bool operator==(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) == 0); }
|
||||
inline bool operator!=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) != 0); }
|
||||
inline bool operator<=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) <= 0); }
|
||||
inline bool operator>=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) >= 0); }
|
||||
inline bool operator<(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) < 0); }
|
||||
inline bool operator>(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) > 0); }
|
||||
inline bool operator==(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.bn, b.bn) == 0); }
|
||||
inline bool operator!=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.bn, b.bn) != 0); }
|
||||
inline bool operator<=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.bn, b.bn) <= 0); }
|
||||
inline bool operator>=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.bn, b.bn) >= 0); }
|
||||
inline bool operator<(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.bn, b.bn) < 0); }
|
||||
inline bool operator>(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.bn, b.bn) > 0); }
|
||||
|
||||
#endif // BITCOIN_TEST_BIGNUM_H
|
||||
|
|
|
@ -59,15 +59,14 @@ bool CCrypter::Encrypt(const CKeyingMaterial& vchPlaintext, std::vector<unsigned
|
|||
int nCLen = nLen + AES_BLOCK_SIZE, nFLen = 0;
|
||||
vchCiphertext = std::vector<unsigned char> (nCLen);
|
||||
|
||||
EVP_CIPHER_CTX ctx;
|
||||
|
||||
bool fOk = true;
|
||||
|
||||
EVP_CIPHER_CTX_init(&ctx);
|
||||
if (fOk) fOk = EVP_EncryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, chKey, chIV) != 0;
|
||||
if (fOk) fOk = EVP_EncryptUpdate(&ctx, &vchCiphertext[0], &nCLen, &vchPlaintext[0], nLen) != 0;
|
||||
if (fOk) fOk = EVP_EncryptFinal_ex(&ctx, (&vchCiphertext[0]) + nCLen, &nFLen) != 0;
|
||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||
EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();
|
||||
assert(ctx);
|
||||
if (fOk) fOk = EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, chKey, chIV) != 0;
|
||||
if (fOk) fOk = EVP_EncryptUpdate(ctx, &vchCiphertext[0], &nCLen, &vchPlaintext[0], nLen) != 0;
|
||||
if (fOk) fOk = EVP_EncryptFinal_ex(ctx, (&vchCiphertext[0]) + nCLen, &nFLen) != 0;
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
|
||||
if (!fOk) return false;
|
||||
|
||||
|
@ -86,15 +85,14 @@ bool CCrypter::Decrypt(const std::vector<unsigned char>& vchCiphertext, CKeyingM
|
|||
|
||||
vchPlaintext = CKeyingMaterial(nPLen);
|
||||
|
||||
EVP_CIPHER_CTX ctx;
|
||||
|
||||
bool fOk = true;
|
||||
|
||||
EVP_CIPHER_CTX_init(&ctx);
|
||||
if (fOk) fOk = EVP_DecryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, chKey, chIV) != 0;
|
||||
if (fOk) fOk = EVP_DecryptUpdate(&ctx, &vchPlaintext[0], &nPLen, &vchCiphertext[0], nLen) != 0;
|
||||
if (fOk) fOk = EVP_DecryptFinal_ex(&ctx, (&vchPlaintext[0]) + nPLen, &nFLen) != 0;
|
||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||
EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();
|
||||
assert(ctx);
|
||||
if (fOk) fOk = EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, chKey, chIV) != 0;
|
||||
if (fOk) fOk = EVP_DecryptUpdate(ctx, &vchPlaintext[0], &nPLen, &vchCiphertext[0], nLen) != 0;
|
||||
if (fOk) fOk = EVP_DecryptFinal_ex(ctx, (&vchPlaintext[0]) + nPLen, &nFLen) != 0;
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
|
||||
if (!fOk) return false;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void CDBEnv::EnvShutdown()
|
|||
if (ret != 0)
|
||||
LogPrintf("CDBEnv::EnvShutdown: Error %d shutting down database environment: %s\n", ret, DbEnv::strerror(ret));
|
||||
if (!fMockDb)
|
||||
DbEnv(0).remove(strPath.c_str(), 0);
|
||||
DbEnv(u_int32_t{0}).remove(strPath.c_str(), 0);
|
||||
}
|
||||
|
||||
void CDBEnv::Reset()
|
||||
|
|
|
@ -37,5 +37,5 @@ PREFIX="$(pwd)/depends/x86_64-unknown-linux-gnu/"
|
|||
|
||||
make "$@" -C ./depends/ V=1 NO_QT=1
|
||||
./autogen.sh
|
||||
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" CXXFLAGS='-fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Wno-placement-new -Wno-terminate -Werror -g'
|
||||
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" CXXFLAGS='-fwrapv -fno-strict-aliasing -Werror -g'
|
||||
make "$@" V=1
|
||||
|
|
Loading…
Reference in New Issue