Skip to content

Commit

Permalink
Merge branch 'master' of ghostlander/Phoenixcoin-v0.7 into Phoenixcoi…
Browse files Browse the repository at this point in the history
…n-v0.7

Sync with the base
  • Loading branch information
sats0k committed Dec 28, 2021
2 parents aba816b + a2759e7 commit 69d6d78
Show file tree
Hide file tree
Showing 109 changed files with 1,585 additions and 1,570 deletions.
31 changes: 10 additions & 21 deletions phoenixcoin-qt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ greaterThan(QT_MAJOR_VERSION, 4): {
# Dependency library locations can be customized with:
# BOOST_INCLUDE_PATH, BOOST_LIB_PATH, BDB_INCLUDE_PATH,
# BDB_LIB_PATH, OPENSSL_INCLUDE_PATH and OPENSSL_LIB_PATH respectively
win32:BOOST_LIB_SUFFIX=-mgw49-mt-x64-1_70
win32:BOOST_INCLUDE_PATH="/home/Administrator/boost-1.70"
win32:BOOST_LIB_PATH="/home/Administrator/boost-1.70/stage/lib"
win32:BOOST_LIB_SUFFIX=-mgw49-mt-x64-1_77
win32:BOOST_INCLUDE_PATH="/home/Administrator/boost-1.77"
win32:BOOST_LIB_PATH="/home/Administrator/boost-1.77/stage/lib"
win32:BDB_INCLUDE_PATH="/home/Administrator/db-5.3.28/build_unix"
win32:BDB_LIB_PATH="/home/Administrator/db-5.3.28/build_unix"
win32:OPENSSL_INCLUDE_PATH="/home/Administrator/openssl-1.0.2u/include"
Expand Down Expand Up @@ -120,7 +120,6 @@ contains(USE_DBUS, 1) {
# or: qmake "USE_IPV6=0" (compiled and disabled by default)
# or: qmake "USE_IPV6=-" (not compiled)
contains(USE_IPV6, -) {
message(Building without IPv6 support)
message("Building without IPv6 support$$escape_expand(\\n)")
} else {
message("Building with the IPv6 support$$escape_expand(\\n)")
Expand All @@ -130,14 +129,14 @@ contains(USE_IPV6, -) {
DEFINES += USE_IPV6=$$USE_IPV6
}

contains(PHOENIXCOIN_NEED_QT_PLUGINS, 1) {
DEFINES += PHOENIXCOIN_NEED_QT_PLUGINS
contains(NEED_QT_PLUGINS, 1) {
DEFINES += NEED_QT_PLUGINS
QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs qtaccessiblewidgets
}


# regenerate src/build.h
!windows|contains(USE_BUILD_INFO, 1) {
!win32|contains(USE_BUILD_INFO, 1) {
genbuild.depends = FORCE
genbuild.commands = cd $$PWD; /bin/sh share/genbuild.sh $$OUT_PWD/build/build.h
genbuild.target = $$OUT_PWD/build/build.h
Expand Down Expand Up @@ -323,16 +322,6 @@ SOURCES += src/qt/qrcodedialog.cpp
FORMS += src/qt/forms/qrcodedialog.ui
}

contains(PHOENIXCOIN_QT_TEST, 1) {
SOURCES += src/qt/test/test_main.cpp \
src/qt/test/uritests.cpp
HEADERS += src/qt/test/uritests.h
DEPENDPATH += src/qt/test
QT += testlib
TARGET = phoenixcoin-qt_test
DEFINES += PHOENIXCOIN_QT_TEST
}

CODECFORTR = UTF-8

# for lrelease/lupdate
Expand All @@ -354,11 +343,11 @@ QMAKE_EXTRA_COMPILERS += TSQM

# "Other files" to show in Qt Creator
OTHER_FILES += \
doc/*.rst doc/*.txt doc/README README.md res/phoenixcoin-qt.rc src/test/*.cpp src/test/*.h src/qt/test/*.cpp src/qt/test/*.h
doc/*.rst doc/*.txt doc/README README.md res/phoenixcoin-qt.rc

windows:RC_FILE = src/qt/res/phoenixcoin-qt.rc
win32:RC_FILE = src/qt/res/phoenixcoin-qt.rc

windows:!contains(MINGW_THREAD_BUGFIX, 0) {
win32:!contains(MINGW_THREAD_BUGFIX, 0) {
# At least qmake's win32-g++-cross profile is missing the -lmingwthrd
# thread-safety flag. GCC has -mthreads to enable this, but it doesn't
# work with static linking. -lmingwthrd must come BEFORE -lmingw, so
Expand All @@ -369,7 +358,7 @@ windows:!contains(MINGW_THREAD_BUGFIX, 0) {
QMAKE_LIBS_QT_ENTRY = -lmingwthrd $$QMAKE_LIBS_QT_ENTRY
}

!windows:!macx {
!win32:!macx {
DEFINES += LINUX
LIBS += -lrt
}
Expand Down
2 changes: 1 addition & 1 deletion src/addrman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#include <algorithm>

#include "util.h"
#include "netbase.h"
#include "protocol.h"
#include "util.h"
#include "addrman.h"

using namespace std;
Expand Down
7 changes: 5 additions & 2 deletions src/addrman.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
#include <set>

#include "sync.h"
#include "protocol.h"
#include "netbase.h"

#include <openssl/rand.h>

extern int64 GetAdjustedTime();

/** Extended statistics about a CAddress */
class CAddrInfo : public CAddress
{
class CAddrInfo : public CAddress {
private:
// where knowledge about this address first came from
CNetAddr source;
Expand Down
8 changes: 4 additions & 4 deletions src/alert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Alert system
//

#include <boost/foreach.hpp>

#include <utility>
#include <map>
#include <limits>

#include <boost/foreach.hpp>

#include "key.h"
#include "sync.h"
#include "net.h"
Expand Down Expand Up @@ -51,8 +51,8 @@ std::string CUnsignedAlert::ToString() const
return strprintf(
"CAlert(\n"
" nVersion = %d\n"
" nRelayUntil = %" PRI64d"\n"
" nExpiration = %" PRI64d"\n"
" nRelayUntil = %" PRI64d "\n"
" nExpiration = %" PRI64d "\n"
" nID = %d\n"
" nCancel = %d\n"
" setCancel = %s\n"
Expand Down
5 changes: 3 additions & 2 deletions src/alert.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
#include <vector>
#include <set>

#include "uint256.h"
#include "util.h"
#include "datatypes.h"
#include "serialize.h"

class uint256;
class CNode;

/** Alerts are for notifying old versions if they become too obsolete and
Expand Down
65 changes: 25 additions & 40 deletions src/allocators.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,23 @@
#ifndef ALLOCATORS_H
#define ALLOCATORS_H

#include <string.h>
#include <boost/thread/mutex.hpp>
#include <openssl/crypto.h> // for OPENSSL_cleanse()

#include <map>
#include <utility>
#include <string>
#include <memory>

#ifdef WINDOWS
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0501
#define WIN32_LEAN_AND_MEAN 1
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
// This is used to attempt to keep keying material out of swap
// Note that VirtualLock does not provide this as a guarantee on Windows,
// but, in practice, memory that has been VirtualLock'd almost never gets written to
// the pagefile except in rare circumstances where memory is extremely low.
#else
#include <string.h>

#include <boost/thread/mutex.hpp>

#include <openssl/crypto.h> /* for OPENSSL_cleanse() */

#include "compat.h"

#ifndef WINDOWS
#include <sys/mman.h>
#include <limits.h> // for PAGESIZE
#include <unistd.h> // for sysconf
#include <limits.h> /* for PAGESIZE */
#include <unistd.h> /* for PAGESIZE through sysconf() */
#endif

/**
Expand Down Expand Up @@ -120,19 +110,20 @@ template <class Locker> class LockedPageManagerBase
};

/** Determine system page size in bytes */
static inline size_t GetSystemPageSize()
{
static inline size_t GetSystemPageSize() {
size_t page_size;
#ifdef WINDOWS
#if defined(WINDOWS)
SYSTEM_INFO sSysInfo;
GetSystemInfo(&sSysInfo);
page_size = sSysInfo.dwPageSize;
#elif defined(PAGESIZE) // defined in limits.h
#elif defined(PAGESIZE)
/* Should be defined in limits.h */
page_size = PAGESIZE;
#else // assume some POSIX OS
#else
/* Try sysconf() otherwise */
page_size = sysconf(_SC_PAGESIZE);
#endif
return page_size;
return(page_size);
}

/**
Expand Down Expand Up @@ -204,19 +195,15 @@ struct secure_allocator : public std::allocator<T>
template<typename _Other> struct rebind
{ typedef secure_allocator<_Other> other; };

T* allocate(std::size_t n, const void *hint = 0)
{
T* allocate(std::size_t n, const void *hint = 0) {
T *p;
p = std::allocator<T>::allocate(n, hint);
if (p != NULL)
LockedPageManager::instance.LockRange(p, sizeof(T) * n);
return p;
if(p) LockedPageManager::instance.LockRange(p, sizeof(T) * n);
return(p);
}

void deallocate(T* p, std::size_t n)
{
if (p != NULL)
{
void deallocate(T* p, std::size_t n) {
if(p) {
OPENSSL_cleanse(p, sizeof(T) * n);
LockedPageManager::instance.UnlockRange(p, sizeof(T) * n);
}
Expand Down Expand Up @@ -248,10 +235,8 @@ struct zero_after_free_allocator : public std::allocator<T>
template<typename _Other> struct rebind
{ typedef zero_after_free_allocator<_Other> other; };

void deallocate(T* p, std::size_t n)
{
if (p != NULL)
OPENSSL_cleanse(p, sizeof(T) * n);
void deallocate(T *p, std::size_t n) {
if(p) OPENSSL_cleanse(p, sizeof(T) * n);
std::allocator<T>::deallocate(p, n);
}
};
Expand Down
7 changes: 3 additions & 4 deletions src/base58.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,8 @@ class CBase58Data {
}

~CBase58Data() {
// zero the memory, as it may contain sensitive data
if(!vchData.empty())
OPENSSL_cleanse(&vchData[0], vchData.size());
/* Zero the memory, as it may contain sensitive data */
if(!vchData.empty()) OPENSSL_cleanse((void *) &vchData[0], vchData.size());
}

void SetData(int nVersionIn, const void* pdata, size_t nSize) {
Expand All @@ -205,7 +204,7 @@ class CBase58Data {
nVersion = vchTemp[0];
vchData.resize(vchTemp.size() - 1);
if(!vchData.empty())
memcpy(&vchData[0], &vchTemp[1], vchData.size());
memcpy(&vchData[0], &vchTemp[1], vchData.size());
OPENSSL_cleanse(&vchTemp[0], vchData.size());
return(true);
}
Expand Down
7 changes: 4 additions & 3 deletions src/bignum.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#include <stdexcept>
#include <vector>

#include "util.h"
#include "uint256.h"
#include "serialize.h"

/** Errors thrown by the bignum class */
class bignum_error : public std::runtime_error {
Expand Down Expand Up @@ -664,9 +665,9 @@ inline const CBigNum operator+(const CBigNum &a, const CBigNum &b) {
inline const CBigNum operator-(const CBigNum &a, const CBigNum &b) {
CBigNum r;
#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
if(!BN_add(&r, &a, &b))
if(!BN_sub(&r, &a, &b))
#else
if(!BN_add(r.get(), a.cget(), b.cget()))
if(!BN_sub(r.get(), a.cget(), b.cget()))
#endif
throw(bignum_error("CBigNum::operator- : BN_sub() failed"));
return(r);
Expand Down
4 changes: 2 additions & 2 deletions src/checkpoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
#include <boost/foreach.hpp>

#include "uint256.h"
#include "checkpoints.h"

#include "main.h"
#include "uint256.h"
extern bool fTestNet;

namespace Checkpoints
{
Expand Down
2 changes: 1 addition & 1 deletion src/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0501
#define WIN32_LEAN_AND_MEAN 1
#define WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX
#define NOMINMAX
#endif
Expand Down
9 changes: 3 additions & 6 deletions src/crypter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <openssl/aes.h>
#include <openssl/evp.h>
#include <vector>
#include <string>

#ifdef WINDOWS
#include <windows.h>
#endif

#include "crypter.h"

#include <openssl/aes.h>
#include <openssl/evp.h>

bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::vector<unsigned char>& chSalt, const unsigned int nRounds, const unsigned int nDerivationMethod) {
if(nRounds < 1 || chSalt.size() != WALLET_CRYPTO_SALT_SIZE)
return(false);
Expand Down
2 changes: 1 addition & 1 deletion src/crypter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <vector>

#include "allocators.h" /* for SecureString */
#include "key.h"
#include "serialize.h"
#include "key.h"

const unsigned int WALLET_CRYPTO_KEY_SIZE = 32;
const unsigned int WALLET_CRYPTO_SALT_SIZE = 8;
Expand Down
16 changes: 8 additions & 8 deletions src/datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ typedef unsigned long long int uint64; /* uint64_t */
#if defined(_MSC_VER) || defined(__MSVCRT__)
/* (s)size_t and ptrdiff_t have the same size specifier in MSVC:
* http://msdn.microsoft.com/en-us/library/tcxf1dw6%28v=vs.100%29.aspx */
#define PRIszx "Ix"
#define PRIszu "Iu"
#define PRIszd "Id"
#define PRIpdx "Ix"
#define PRIpdu "Iu"
#define PRIszu "Iu"
#define PRIszx "Ix"
#define PRIpdd "Id"
#define PRIpdu "Iu"
#define PRIpdx "Ix"
#else /* C99 standard */
#define PRIszx "zx"
#define PRIszu "zu"
#define PRIszd "zd"
#define PRIpdx "tx"
#define PRIpdu "tu"
#define PRIszu "zu"
#define PRIszx "zx"
#define PRIpdd "td"
#define PRIpdu "tu"
#define PRIpdx "tx"
#endif /* _MSC_VER */

#endif /* DATATYPES_H */
Loading

0 comments on commit 69d6d78

Please sign in to comment.