diff --git a/src/base58.h b/src/base58.h index 8b38bcd..e9aee9e 100644 --- a/src/base58.h +++ b/src/base58.h @@ -48,7 +48,7 @@ inline std::string EncodeBase58(const unsigned char* pbegin, const unsigned char CBigNum rem; while (bn > bn0) { - if (!BN_div(&dv, &rem, &bn, &bn58, pctx)) + if (!BN_div(dv.get(), rem.get(), bn.get(), bn58.get(), pctx)) throw bignum_error("EncodeBase58 : BN_div failed"); bn = dv; unsigned int c = rem.getulong(); @@ -95,7 +95,7 @@ inline bool DecodeBase58(const char* psz, std::vector& vchRet) break; } bnChar.setulong(p1 - pszBase58); - if (!BN_mul(&bn, &bn, &bn58, pctx)) + if (!BN_mul(bn.get(), bn.get(), bn58.get(), pctx)) throw bignum_error("DecodeBase58 : BN_mul failed"); bn += bnChar; } diff --git a/src/bignum.h b/src/bignum.h index a245fed..19a6092 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -54,52 +54,64 @@ public: /** C++ wrapper for BIGNUM (OpenSSL bignum) */ -class CBigNum : public BIGNUM +class CBigNum { +private: + BIGNUM* pbn; + public: CBigNum() { - BN_init(this); + pbn = BN_new(); + if (pbn == NULL) + throw bignum_error("CBigNum::CBigNum() : BN_new() returned NULL"); } CBigNum(const CBigNum& b) { - BN_init(this); - if (!BN_copy(this, &b)) + pbn = BN_new(); + if (pbn == NULL) + throw bignum_error("CBigNum::CBigNum(const CBigNum&) : BN_new() returned NULL"); + if (!BN_copy(pbn, b.pbn)) { - BN_clear_free(this); + BN_clear_free(pbn); throw bignum_error("CBigNum::CBigNum(const CBigNum&) : BN_copy failed"); } } CBigNum& operator=(const CBigNum& b) { - if (!BN_copy(this, &b)) + if (!BN_copy(pbn, b.pbn)) throw bignum_error("CBigNum::operator= : BN_copy failed"); return (*this); } ~CBigNum() { - BN_clear_free(this); + if (pbn != NULL) + BN_clear_free(pbn); } + // Access to the underlying BIGNUM pointer + BIGNUM* get() { return pbn; } + const BIGNUM* get() const { return pbn; } + //CBigNum(char n) is not portable. Use 'signed char' or 'unsigned char'. - CBigNum(signed char n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); } - CBigNum(short n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); } - CBigNum(int n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); } - CBigNum(long n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); } - CBigNum(long long n) { BN_init(this); setint64(n); } - CBigNum(unsigned char n) { BN_init(this); setulong(n); } - CBigNum(unsigned short n) { BN_init(this); setulong(n); } - CBigNum(unsigned int n) { BN_init(this); setulong(n); } - CBigNum(unsigned long n) { BN_init(this); setulong(n); } - CBigNum(unsigned long long n) { BN_init(this); setuint64(n); } - explicit CBigNum(uint256 n) { BN_init(this); setuint256(n); } + CBigNum(signed char n) { pbn = BN_new(); if (n >= 0) setulong(n); else setint64(n); } + CBigNum(short n) { pbn = BN_new(); if (n >= 0) setulong(n); else setint64(n); } + CBigNum(int n) { pbn = BN_new(); if (n >= 0) setulong(n); else setint64(n); } + CBigNum(long n) { pbn = BN_new(); if (n >= 0) setulong(n); else setint64(n); } + CBigNum(long long n) { pbn = BN_new(); setint64(n); } + CBigNum(unsigned char n) { pbn = BN_new(); setulong(n); } + CBigNum(unsigned short n) { pbn = BN_new(); setulong(n); } + CBigNum(unsigned int n) { pbn = BN_new(); setulong(n); } + CBigNum(unsigned long n) { pbn = BN_new(); setulong(n); } + CBigNum(unsigned long long n) { pbn = BN_new(); setuint64(n); } + explicit CBigNum(uint256 n) { pbn = BN_new(); setuint256(n); } explicit CBigNum(const std::vector& vch) { - BN_init(this); + pbn = BN_new(); setvch(vch); } @@ -110,7 +122,7 @@ public: */ static CBigNum randBignum(const CBigNum& range) { CBigNum ret; - if(!BN_rand_range(&ret, &range)){ + if(!BN_rand_range(ret.pbn, range.pbn)){ throw bignum_error("CBigNum:rand element : BN_rand_range failed"); } return ret; @@ -122,7 +134,7 @@ public: */ static CBigNum RandKBitBigum(const uint32_t k){ CBigNum ret; - if(!BN_rand(&ret, k, -1, 0)){ + if(!BN_rand(ret.pbn, k, -1, 0)){ throw bignum_error("CBigNum:rand element : BN_rand failed"); } return ret; @@ -133,30 +145,30 @@ public: * @return the size */ int bitSize() const{ - return BN_num_bits(this); + return BN_num_bits(pbn); } void setulong(unsigned long n) { - if (!BN_set_word(this, n)) + if (!BN_set_word(pbn, n)) throw bignum_error("CBigNum conversion from unsigned long : BN_set_word failed"); } unsigned long getulong() const { - return BN_get_word(this); + return BN_get_word(pbn); } unsigned int getuint() const { - return BN_get_word(this); + return BN_get_word(pbn); } int getint() const { - unsigned long n = BN_get_word(this); - if (!BN_is_negative(this)) + unsigned long n = BN_get_word(pbn); + if (!BN_is_negative(pbn)) return (n > (unsigned long)std::numeric_limits::max() ? std::numeric_limits::max() : n); else return (n > (unsigned long)std::numeric_limits::max() ? std::numeric_limits::min() : -(int)n); @@ -202,16 +214,16 @@ 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, pbn); } uint64_t getuint64() { - unsigned int nSize = BN_bn2mpi(this, NULL); + unsigned int nSize = BN_bn2mpi(pbn, NULL); if (nSize < 4) return 0; std::vector vch(nSize); - BN_bn2mpi(this, &vch[0]); + BN_bn2mpi(pbn, &vch[0]); if (vch.size() > 4) vch[4] &= 0x7f; uint64_t n = 0; @@ -244,7 +256,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, pbn); } void setuint256(uint256 n) @@ -272,16 +284,16 @@ public: pch[1] = (nSize >> 16) & 0xff; pch[2] = (nSize >> 8) & 0xff; pch[3] = (nSize >> 0) & 0xff; - BN_mpi2bn(pch, p - pch, this); + BN_mpi2bn(pch, p - pch, pbn); } uint256 getuint256() const { - unsigned int nSize = BN_bn2mpi(this, NULL); + unsigned int nSize = BN_bn2mpi(pbn, NULL); if (nSize < 4) return 0; std::vector vch(nSize); - BN_bn2mpi(this, &vch[0]); + BN_bn2mpi(pbn, &vch[0]); if (vch.size() > 4) vch[4] &= 0x7f; uint256 n = 0; @@ -303,16 +315,16 @@ 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(), pbn); } std::vector getvch() const { - unsigned int nSize = BN_bn2mpi(this, NULL); + unsigned int nSize = BN_bn2mpi(pbn, NULL); if (nSize <= 4) return std::vector(); std::vector vch(nSize); - BN_bn2mpi(this, &vch[0]); + BN_bn2mpi(pbn, &vch[0]); vch.erase(vch.begin(), vch.begin() + 4); reverse(vch.begin(), vch.end()); return vch; @@ -326,16 +338,16 @@ public: if (nSize >= 1) vch[4] = (nCompact >> 16) & 0xff; if (nSize >= 2) vch[5] = (nCompact >> 8) & 0xff; if (nSize >= 3) vch[6] = (nCompact >> 0) & 0xff; - BN_mpi2bn(&vch[0], vch.size(), this); + BN_mpi2bn(&vch[0], vch.size(), pbn); return *this; } unsigned int GetCompact() const { - unsigned int nSize = BN_bn2mpi(this, NULL); + unsigned int nSize = BN_bn2mpi(pbn, NULL); std::vector vch(nSize); nSize -= 4; - BN_bn2mpi(this, &vch[0]); + BN_bn2mpi(pbn, &vch[0]); unsigned int nCompact = nSize << 24; if (nSize >= 1) nCompact |= (vch[4] << 16); if (nSize >= 2) nCompact |= (vch[5] << 8); @@ -380,20 +392,20 @@ public: CBigNum bn0 = 0; std::string str; CBigNum bn = *this; - BN_set_negative(&bn, false); + BN_set_negative(bn.pbn, false); CBigNum dv; CBigNum rem; - if (BN_cmp(&bn, &bn0) == 0) + if (BN_cmp(bn.pbn, bn0.pbn) == 0) return "0"; - while (BN_cmp(&bn, &bn0) > 0) + while (BN_cmp(bn.pbn, bn0.pbn) > 0) { - if (!BN_div(&dv, &rem, &bn, &bnBase, pctx)) + if (!BN_div(dv.pbn, rem.pbn, bn.pbn, bnBase.pbn, pctx)) throw bignum_error("CBigNum::ToString() : BN_div failed"); bn = dv; unsigned int c = rem.getulong(); str += "0123456789abcdef"[c]; } - if (BN_is_negative(this)) + if (BN_is_negative(pbn)) str += "-"; reverse(str.begin(), str.end()); return str; @@ -440,7 +452,7 @@ public: CBigNum pow(const CBigNum& e) const { CAutoBN_CTX pctx; CBigNum ret; - if (!BN_exp(&ret, this, &e, pctx)) + if (!BN_exp(ret.pbn, pbn, e.pbn, pctx)) throw bignum_error("CBigNum::pow : BN_exp failed"); return ret; } @@ -453,9 +465,9 @@ public: CBigNum mul_mod(const CBigNum& b, const CBigNum& m) const { CAutoBN_CTX pctx; CBigNum ret; - if (!BN_mod_mul(&ret, this, &b, &m, pctx)) + if (!BN_mod_mul(ret.pbn, pbn, b.pbn, m.pbn, pctx)) throw bignum_error("CBigNum::mul_mod : BN_mod_mul failed"); - + return ret; } @@ -471,10 +483,10 @@ public: // g^-x = (g^-1)^x CBigNum inv = this->inverse(m); CBigNum posE = e * -1; - if (!BN_mod_exp(&ret, &inv, &posE, &m, pctx)) + if (!BN_mod_exp(ret.pbn, inv.pbn, posE.pbn, m.pbn, pctx)) throw bignum_error("CBigNum::pow_mod: BN_mod_exp failed on negative exponent"); }else - if (!BN_mod_exp(&ret, this, &e, &m, pctx)) + if (!BN_mod_exp(ret.pbn, pbn, e.pbn, m.pbn, pctx)) throw bignum_error("CBigNum::pow_mod : BN_mod_exp failed"); return ret; @@ -489,7 +501,7 @@ public: CBigNum inverse(const CBigNum& m) const { CAutoBN_CTX pctx; CBigNum ret; - if (!BN_mod_inverse(&ret, this, &m, pctx)) + if (!BN_mod_inverse(ret.pbn, pbn, m.pbn, pctx)) throw bignum_error("CBigNum::inverse*= :BN_mod_inverse"); return ret; } @@ -502,7 +514,7 @@ public: */ static CBigNum generatePrime(const unsigned int numBits, bool safe = false) { CBigNum ret; - if(!BN_generate_prime_ex(&ret, numBits, (safe == true), NULL, NULL, NULL)) + if(!BN_generate_prime_ex(ret.pbn, numBits, (safe == true), NULL, NULL, NULL)) throw bignum_error("CBigNum::generatePrime*= :BN_generate_prime_ex"); return ret; } @@ -515,7 +527,7 @@ public: CBigNum gcd( const CBigNum& b) const{ CAutoBN_CTX pctx; CBigNum ret; - if (!BN_gcd(&ret, this, &b, pctx)) + if (!BN_gcd(ret.pbn, pbn, b.pbn, pctx)) throw bignum_error("CBigNum::gcd*= :BN_gcd"); return ret; } @@ -528,26 +540,26 @@ public: */ bool isPrime(const int checks=BN_prime_checks) const { CAutoBN_CTX pctx; - int ret = BN_is_prime(this, checks, NULL, pctx, NULL); + int ret = BN_is_prime_ex(pbn, checks, pctx, NULL); if(ret < 0){ - throw bignum_error("CBigNum::isPrime :BN_is_prime"); + throw bignum_error("CBigNum::isPrime :BN_is_prime_ex"); } return ret; } bool isOne() const { - return BN_is_one(this); + return BN_is_one(pbn); } bool operator!() const { - return BN_is_zero(this); + return BN_is_zero(pbn); } CBigNum& operator+=(const CBigNum& b) { - if (!BN_add(this, this, &b)) + if (!BN_add(pbn, pbn, b.pbn)) throw bignum_error("CBigNum::operator+= : BN_add failed"); return *this; } @@ -561,7 +573,7 @@ public: CBigNum& operator*=(const CBigNum& b) { CAutoBN_CTX pctx; - if (!BN_mul(this, this, &b, pctx)) + if (!BN_mul(pbn, pbn, b.pbn, pctx)) throw bignum_error("CBigNum::operator*= : BN_mul failed"); return *this; } @@ -580,7 +592,7 @@ public: CBigNum& operator<<=(unsigned int shift) { - if (!BN_lshift(this, this, shift)) + if (!BN_lshift(pbn, pbn, shift)) throw bignum_error("CBigNum:operator<<= : BN_lshift failed"); return *this; } @@ -591,13 +603,13 @@ public: // if built on ubuntu 9.04 or 9.10, probably depends on version of OpenSSL CBigNum a = 1; a <<= shift; - if (BN_cmp(&a, this) > 0) + if (BN_cmp(a.pbn, pbn) > 0) { *this = 0; return *this; } - if (!BN_rshift(this, this, shift)) + if (!BN_rshift(pbn, pbn, shift)) throw bignum_error("CBigNum:operator>>= : BN_rshift failed"); return *this; } @@ -606,7 +618,7 @@ public: CBigNum& operator++() { // prefix operator - if (!BN_add(this, this, BN_value_one())) + if (!BN_add(pbn, pbn, BN_value_one())) throw bignum_error("CBigNum::operator++ : BN_add failed"); return *this; } @@ -623,7 +635,7 @@ public: { // prefix operator CBigNum r; - if (!BN_sub(&r, this, BN_value_one())) + if (!BN_sub(r.pbn, pbn, BN_value_one())) throw bignum_error("CBigNum::operator-- : BN_sub failed"); *this = r; return *this; @@ -642,7 +654,17 @@ public: 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, const CBigNum& b); + friend inline const CBigNum operator+(const CBigNum& a, const CBigNum& b); + friend inline const CBigNum operator-(const CBigNum& a); + friend inline const CBigNum operator<<(const CBigNum& a, unsigned int shift); + friend inline const CBigNum operator>>(const CBigNum& a, unsigned int shift); + 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); + friend inline std::ostream& operator<<(std::ostream &strm, const CBigNum &b); }; @@ -650,7 +672,7 @@ public: inline const CBigNum operator+(const CBigNum& a, const CBigNum& b) { CBigNum r; - if (!BN_add(&r, &a, &b)) + if (!BN_add(r.pbn, a.pbn, b.pbn)) throw bignum_error("CBigNum::operator+ : BN_add failed"); return r; } @@ -658,7 +680,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.pbn, a.pbn, b.pbn)) throw bignum_error("CBigNum::operator- : BN_sub failed"); return r; } @@ -666,7 +688,7 @@ 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.pbn, !BN_is_negative(r.pbn)); return r; } @@ -674,7 +696,7 @@ inline const CBigNum operator*(const CBigNum& a, const CBigNum& b) { CAutoBN_CTX pctx; CBigNum r; - if (!BN_mul(&r, &a, &b, pctx)) + if (!BN_mul(r.pbn, a.pbn, b.pbn, pctx)) throw bignum_error("CBigNum::operator* : BN_mul failed"); return r; } @@ -683,7 +705,7 @@ inline const CBigNum operator/(const CBigNum& a, const CBigNum& b) { CAutoBN_CTX pctx; CBigNum r; - if (!BN_div(&r, NULL, &a, &b, pctx)) + if (!BN_div(r.pbn, NULL, a.pbn, b.pbn, pctx)) throw bignum_error("CBigNum::operator/ : BN_div failed"); return r; } @@ -692,7 +714,7 @@ inline const CBigNum operator%(const CBigNum& a, const CBigNum& b) { CAutoBN_CTX pctx; CBigNum r; - if (!BN_nnmod(&r, &a, &b, pctx)) + if (!BN_nnmod(r.pbn, a.pbn, b.pbn, pctx)) throw bignum_error("CBigNum::operator% : BN_div failed"); return r; } @@ -700,7 +722,7 @@ inline const CBigNum operator%(const CBigNum& a, const CBigNum& b) inline const CBigNum operator<<(const CBigNum& a, unsigned int shift) { CBigNum r; - if (!BN_lshift(&r, &a, shift)) + if (!BN_lshift(r.pbn, a.pbn, shift)) throw bignum_error("CBigNum:operator<< : BN_lshift failed"); return r; } @@ -712,16 +734,15 @@ inline const CBigNum operator>>(const CBigNum& a, unsigned int shift) 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.pbn, b.pbn) == 0); } +inline bool operator!=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.pbn, b.pbn) != 0); } +inline bool operator<=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.pbn, b.pbn) <= 0); } +inline bool operator>=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.pbn, b.pbn) >= 0); } +inline bool operator<(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.pbn, b.pbn) < 0); } +inline bool operator>(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.pbn, b.pbn) > 0); } inline std::ostream& operator<<(std::ostream &strm, const CBigNum &b) { return strm << b.ToString(10); } typedef CBigNum Bignum; #endif - diff --git a/src/crypter.cpp b/src/crypter.cpp index 3a7f997..9f37328 100644 --- a/src/crypter.cpp +++ b/src/crypter.cpp @@ -70,15 +70,15 @@ bool CCrypter::Encrypt(const CKeyingMaterial& vchPlaintext, std::vector (nCLen); - EVP_CIPHER_CTX ctx; + EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); + if (!ctx) return false; bool fOk = true; - EVP_CIPHER_CTX_init(&ctx); - if (fOk) fOk = EVP_EncryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, chKey, chIV); - if (fOk) fOk = EVP_EncryptUpdate(&ctx, &vchCiphertext[0], &nCLen, &vchPlaintext[0], nLen); - if (fOk) fOk = EVP_EncryptFinal_ex(&ctx, (&vchCiphertext[0])+nCLen, &nFLen); - EVP_CIPHER_CTX_cleanup(&ctx); + if (fOk) fOk = EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, chKey, chIV); + if (fOk) fOk = EVP_EncryptUpdate(ctx, &vchCiphertext[0], &nCLen, &vchPlaintext[0], nLen); + if (fOk) fOk = EVP_EncryptFinal_ex(ctx, (&vchCiphertext[0])+nCLen, &nFLen); + EVP_CIPHER_CTX_free(ctx); if (!fOk) return false; @@ -97,15 +97,15 @@ bool CCrypter::Decrypt(const std::vector& vchCiphertext, CKeyingM vchPlaintext = CKeyingMaterial(nPLen); - EVP_CIPHER_CTX ctx; + EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); + if (!ctx) return false; bool fOk = true; - EVP_CIPHER_CTX_init(&ctx); - if (fOk) fOk = EVP_DecryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, chKey, chIV); - if (fOk) fOk = EVP_DecryptUpdate(&ctx, &vchPlaintext[0], &nPLen, &vchCiphertext[0], nLen); - if (fOk) fOk = EVP_DecryptFinal_ex(&ctx, (&vchPlaintext[0])+nPLen, &nFLen); - EVP_CIPHER_CTX_cleanup(&ctx); + if (fOk) fOk = EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, chKey, chIV); + if (fOk) fOk = EVP_DecryptUpdate(ctx, &vchPlaintext[0], &nPLen, &vchCiphertext[0], nLen); + if (fOk) fOk = EVP_DecryptFinal_ex(ctx, (&vchPlaintext[0])+nPLen, &nFLen); + EVP_CIPHER_CTX_free(ctx); if (!fOk) return false; diff --git a/src/db.cpp b/src/db.cpp index 03478ca..2b4c3eb 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -17,6 +17,7 @@ using namespace std; using namespace boost; +namespace fs = boost::filesystem; unsigned int nWalletDBUpdated; @@ -39,7 +40,7 @@ void CDBEnv::EnvShutdown() if (ret != 0) printf("EnvShutdown exception: %s (%d)\n", DbEnv::strerror(ret), ret); if (!fMockDb) - DbEnv(0).remove(strPath.c_str(), 0); + DbEnv((u_int32_t)0).remove(strPath.c_str(), 0); } CDBEnv::CDBEnv() : dbenv(DB_CXX_NO_EXCEPTIONS) @@ -58,7 +59,7 @@ void CDBEnv::Close() EnvShutdown(); } -bool CDBEnv::Open(boost::filesystem::path pathEnv_) +bool CDBEnv::Open(fs::path pathEnv_) { if (fDbEnvInit) return true; @@ -67,11 +68,11 @@ bool CDBEnv::Open(boost::filesystem::path pathEnv_) return false; pathEnv = pathEnv_; - filesystem::path pathDataDir = pathEnv; + fs::path pathDataDir = pathEnv; strPath = pathDataDir.string(); - filesystem::path pathLogDir = pathDataDir / "database"; - filesystem::create_directory(pathLogDir); - filesystem::path pathErrorFile = pathDataDir / "db.log"; + fs::path pathLogDir = pathDataDir / "database"; + fs::create_directory(pathLogDir); + fs::path pathErrorFile = pathDataDir / "db.log"; printf("dbenv.open LogDir=%s ErrorFile=%s\n", pathLogDir.string().c_str(), pathErrorFile.string().c_str()); unsigned int nEnvFlags = 0; @@ -517,7 +518,7 @@ bool CAddrDB::Write(const CAddrMan& addr) ssPeers << hash; // open temp output file, and associate with CAutoFile - boost::filesystem::path pathTmp = GetDataDir() / tmpfn; + fs::path pathTmp = GetDataDir() / tmpfn; FILE *file = fopen(pathTmp.string().c_str(), "wb"); CAutoFile fileout = CAutoFile(file, SER_DISK, CLIENT_VERSION); if (!fileout) @@ -549,7 +550,7 @@ bool CAddrDB::Read(CAddrMan& addr) return error("CAddrman::Read() : open failed"); // use file size to size memory buffer - int fileSize = boost::filesystem::file_size(pathAddr); + int fileSize = fs::file_size(pathAddr); int dataSize = fileSize - sizeof(uint256); // Don't try to resize to a negative number if file is small if ( dataSize < 0 ) dataSize = 0; diff --git a/src/init.cpp b/src/init.cpp index a105503..ca90c54 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -13,7 +13,7 @@ #include "smessage.h" #include #include -#include +// boost/filesystem/convenience.hpp removed in modern Boost; functionality is in filesystem.hpp #include #include #include @@ -25,6 +25,7 @@ using namespace std; using namespace boost; +namespace fs = boost::filesystem; CWallet* pwalletMain; CClientUIInterface uiInterface; @@ -97,7 +98,7 @@ void Shutdown(void* parg) bitdb.Flush(false); StopNode(); bitdb.Flush(true); - boost::filesystem::remove(GetPidFile()); + fs::remove(GetPidFile()); UnregisterWallet(pwalletMain); delete pwalletMain; NewThread(ExitTimeout, NULL); @@ -147,7 +148,7 @@ bool AppInit(int argc, char* argv[]) // // If Qt is used, parameters/triangles.conf are parsed in qt/triangles.cpp's main() ParseParameters(argc, argv); - if (!boost::filesystem::is_directory(GetDataDir(false))) + if (!fs::is_directory(GetDataDir(false))) { fprintf(stderr, "Error: Specified directory does not exist\n"); Shutdown(NULL); @@ -526,11 +527,11 @@ bool AppInit2() std::string strWalletFileName = GetArg("-wallet", "wallet.dat"); // strWalletFileName must be a plain filename without a directory - if (strWalletFileName != boost::filesystem::basename(strWalletFileName) + boost::filesystem::extension(strWalletFileName)) + if (strWalletFileName != fs::path(strWalletFileName).stem().string() + fs::path(strWalletFileName).extension().string()) return InitError(strprintf(_("Wallet %s resides outside data directory %s."), strWalletFileName.c_str(), strDataDir.c_str())); // Make sure only a single Triangles process is using the data directory. - boost::filesystem::path pathLockFile = GetDataDir() / ".lock"; + fs::path pathLockFile = GetDataDir() / ".lock"; FILE* file = fopen(pathLockFile.string().c_str(), "a"); // empty lock file; created if it doesn't exist. if (file) fclose(file); static boost::interprocess::file_lock lock(pathLockFile.string().c_str()); @@ -594,7 +595,7 @@ bool AppInit2() return false; } - if (filesystem::exists(GetDataDir() / strWalletFileName)) + if (fs::exists(GetDataDir() / strWalletFileName)) { CDBEnv::VerifyResult r = bitdb.Verify(strWalletFileName, CWalletDB::Recover); if (r == CDBEnv::RECOVER_OK) @@ -690,10 +691,10 @@ bool AppInit2() } } else { string automatic_onion; - filesystem::path const hostname_path = GetDataDir( + fs::path const hostname_path = GetDataDir( ) / "onion" / "hostname"; if ( - !filesystem::exists( + !fs::exists( hostname_path ) ) { @@ -891,13 +892,13 @@ bool AppInit2() exit(0); } - filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat"; - if (filesystem::exists(pathBootstrap)) { + fs::path pathBootstrap = GetDataDir() / "bootstrap.dat"; + if (fs::exists(pathBootstrap)) { uiInterface.InitMessage(_("Importing bootstrap blockchain data file.")); FILE *file = fopen(pathBootstrap.string().c_str(), "rb"); if (file) { - filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old"; + fs::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old"; LoadExternalBlockFile(file); RenameOver(pathBootstrap, pathBootstrapOld); } diff --git a/src/key.cpp b/src/key.cpp index 148ce96..6bf60f3 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -73,12 +73,14 @@ int ECDSA_SIG_recover_key_GFp(EC_KEY *eckey, ECDSA_SIG *ecsig, const unsigned ch const EC_GROUP *group = EC_KEY_get0_group(eckey); if ((ctx = BN_CTX_new()) == NULL) { ret = -1; goto err; } BN_CTX_start(ctx); + const BIGNUM *sig_r, *sig_s; + ECDSA_SIG_get0(ecsig, &sig_r, &sig_s); order = BN_CTX_get(ctx); if (!EC_GROUP_get_order(group, order, ctx)) { ret = -2; goto err; } 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; } @@ -96,12 +98,12 @@ int ECDSA_SIG_recover_key_GFp(EC_KEY *eckey, ECDSA_SIG *ecsig, const unsigned ch if (!BN_bin2bn(msg, msglen, e)) { ret=-1; goto err; } if (8*msglen > n) BN_rshift(e, e, 8-(n & 7)); zero = BN_CTX_get(ctx); - if (!BN_zero(zero)) { ret=-1; goto err; } + BN_zero(zero); 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; } @@ -355,9 +357,14 @@ bool CKey::Sign(uint256 hash, std::vector& vchSig) BIGNUM *halforder = BN_CTX_get(ctx); EC_GROUP_get_order(group, order, ctx); BN_rshift1(halforder, order); - if (BN_cmp(sig->s, halforder) > 0) { + const BIGNUM *sig_r, *sig_s; + ECDSA_SIG_get0(sig, &sig_r, &sig_s); + if (BN_cmp(sig_s, halforder) > 0) { // enforce low S values, by negating the value (modulo the order) if above order/2. - BN_sub(sig->s, order, sig->s); + BIGNUM *new_s = BN_new(); + BN_sub(new_s, order, sig_s); + BIGNUM *dup_r = BN_dup(sig_r); + ECDSA_SIG_set0(sig, dup_r, new_s); } BN_CTX_end(ctx); BN_CTX_free(ctx); @@ -382,8 +389,10 @@ bool CKey::SignCompact(uint256 hash, std::vector& vchSig) return false; vchSig.clear(); vchSig.resize(65,0); - int nBitsR = BN_num_bits(sig->r); - int nBitsS = BN_num_bits(sig->s); + const BIGNUM *sig_r, *sig_s; + ECDSA_SIG_get0(sig, &sig_r, &sig_s); + int nBitsR = BN_num_bits(sig_r); + int nBitsS = BN_num_bits(sig_s); if (nBitsR <= 256 && nBitsS <= 256) { int nRecId = -1; @@ -408,8 +417,8 @@ bool CKey::SignCompact(uint256 hash, std::vector& vchSig) } vchSig[0] = nRecId+27+(fCompressedPubKey ? 4 : 0); - BN_bn2bin(sig->r,&vchSig[33-(nBitsR+7)/8]); - BN_bn2bin(sig->s,&vchSig[65-(nBitsS+7)/8]); + BN_bn2bin(sig_r,&vchSig[33-(nBitsR+7)/8]); + BN_bn2bin(sig_s,&vchSig[65-(nBitsS+7)/8]); fOk = true; } ECDSA_SIG_free(sig); @@ -428,8 +437,9 @@ bool CKey::SetCompactSignature(uint256 hash, const std::vector& v if (nV<27 || nV>=35) return false; ECDSA_SIG *sig = ECDSA_SIG_new(); - BN_bin2bn(&vchSig[1],32,sig->r); - BN_bin2bn(&vchSig[33],32,sig->s); + BIGNUM *sig_r = BN_bin2bn(&vchSig[1],32,NULL); + BIGNUM *sig_s = BN_bin2bn(&vchSig[33],32,NULL); + ECDSA_SIG_set0(sig, sig_r, sig_s); EC_KEY_free(pkey); pkey = EC_KEY_new_by_curve_name(NID_secp256k1); diff --git a/src/main.cpp b/src/main.cpp index 1b16618..7395971 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,6 +19,7 @@ using namespace std; using namespace boost; +namespace fs = boost::filesystem; // // Global state @@ -2451,7 +2452,7 @@ bool CBlock::CheckBlockSignature() const bool CheckDiskSpace(uint64_t nAdditionalBytes) { - uint64_t nFreeBytesAvailable = filesystem::space(GetDataDir()).available; + uint64_t nFreeBytesAvailable = fs::space(GetDataDir()).available; // Check for nMinDiskSpace bytes (currently 50MB) if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes) @@ -2467,7 +2468,7 @@ bool CheckDiskSpace(uint64_t nAdditionalBytes) return true; } -static filesystem::path BlockFilePath(unsigned int nFile) +static fs::path BlockFilePath(unsigned int nFile) { string strBlockFn = strprintf("blk%04u.dat", nFile); return GetDataDir() / strBlockFn; diff --git a/src/net.cpp b/src/net.cpp index bb6fb03..c06b5e4 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -27,7 +27,8 @@ using namespace std; using namespace boost; extern "C" { -int tor_main(int argc, char *argv[]); +// Old embedded Tor v2 removed - using external Tor via SOCKS5 for v3 +// int tor_main(int argc, char *argv[]); } static const int MAX_OUTBOUND_CONNECTIONS = 16; @@ -1139,16 +1140,17 @@ void ThreadMapPort2(void* parg) /* miniupnpc 1.5 */ devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0); #else - /* miniupnpc 1.6 */ + /* miniupnpc 1.6+ */ int error = 0; - devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error); + devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, 2, &error); #endif struct UPNPUrls urls; struct IGDdatas data; int r; - r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr)); + char wanaddr[64] = ""; + r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr), wanaddr, sizeof(wanaddr)); if (r == 1) { //if (fDiscover) { @@ -1934,19 +1936,10 @@ void static Discover() } static void run_tor() { - printf("Onion thread started.\n"); - - std::string logDecl = "notice file " + GetDataDir().string() + "/tor/tor.log"; - char *argvLogDecl = (char*) logDecl.c_str(); - - char* argv[] = { - "tor", - "--hush", - "--Log", - argvLogDecl - }; - - tor_main(4, argv); + // Old embedded Tor v2 client removed - incompatible with OpenSSL 3.x. + // Tor v3 onion services are handled by onion_v3.cpp via external Tor/SOCKS5. + printf("Tor v3 mode: using external Tor process via SOCKS5 proxy.\n"); + set_initialized(); } diff --git a/src/qt/forms/mainwindow.ui b/src/qt/forms/mainwindow.ui index c4c7b21..d794a15 100644 --- a/src/qt/forms/mainwindow.ui +++ b/src/qt/forms/mainwindow.ui @@ -619,14 +619,14 @@ QWidget { - 152 - 32 + 300 + 63 - 152 - 32 + 300 + 63 diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index 6f4806c..c200368 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -840,7 +840,7 @@ QWidget#line { </style> </head> <body> - <a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> + <a href="https://313.cash"> &#187; TRI on Pinball</a></body> Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter diff --git a/src/qt/locale/triangles_af_ZA.ts b/src/qt/locale/triangles_af_ZA.ts index 5b1c63c..bf81fb0 100644 --- a/src/qt/locale/triangles_af_ZA.ts +++ b/src/qt/locale/triangles_af_ZA.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_ar.ts b/src/qt/locale/triangles_ar.ts index 12aa71f..af6ff16 100644 --- a/src/qt/locale/triangles_ar.ts +++ b/src/qt/locale/triangles_ar.ts @@ -1430,7 +1430,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_be_BY.ts b/src/qt/locale/triangles_be_BY.ts index 1cbcd9e..2010f9f 100644 --- a/src/qt/locale/triangles_be_BY.ts +++ b/src/qt/locale/triangles_be_BY.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_bg.ts b/src/qt/locale/triangles_bg.ts index aa2795e..dcd8798 100644 --- a/src/qt/locale/triangles_bg.ts +++ b/src/qt/locale/triangles_bg.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_bs.ts b/src/qt/locale/triangles_bs.ts index 19ed6fa..dcfc03a 100644 --- a/src/qt/locale/triangles_bs.ts +++ b/src/qt/locale/triangles_bs.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_ca.ts b/src/qt/locale/triangles_ca.ts index 28e4084..650ba55 100644 --- a/src/qt/locale/triangles_ca.ts +++ b/src/qt/locale/triangles_ca.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_ca@valencia.ts b/src/qt/locale/triangles_ca@valencia.ts index 5eb8023..6eadb60 100644 --- a/src/qt/locale/triangles_ca@valencia.ts +++ b/src/qt/locale/triangles_ca@valencia.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_ca_ES.ts b/src/qt/locale/triangles_ca_ES.ts index 72fc284..dae9812 100644 --- a/src/qt/locale/triangles_ca_ES.ts +++ b/src/qt/locale/triangles_ca_ES.ts @@ -1435,7 +1435,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_cs.ts b/src/qt/locale/triangles_cs.ts index a074459..4633252 100644 --- a/src/qt/locale/triangles_cs.ts +++ b/src/qt/locale/triangles_cs.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_cy.ts b/src/qt/locale/triangles_cy.ts index ebbf2be..2b22159 100644 --- a/src/qt/locale/triangles_cy.ts +++ b/src/qt/locale/triangles_cy.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_da.ts b/src/qt/locale/triangles_da.ts index 953320e..5de8284 100644 --- a/src/qt/locale/triangles_da.ts +++ b/src/qt/locale/triangles_da.ts @@ -1440,7 +1440,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_de.ts b/src/qt/locale/triangles_de.ts index 5509a55..5a70fcb 100644 --- a/src/qt/locale/triangles_de.ts +++ b/src/qt/locale/triangles_de.ts @@ -1426,7 +1426,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_el_GR.ts b/src/qt/locale/triangles_el_GR.ts index 5e75c18..b10beba 100644 --- a/src/qt/locale/triangles_el_GR.ts +++ b/src/qt/locale/triangles_el_GR.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_en.ts b/src/qt/locale/triangles_en.ts index 8e26b1b..bc0287a 100644 --- a/src/qt/locale/triangles_en.ts +++ b/src/qt/locale/triangles_en.ts @@ -1426,7 +1426,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_eo.ts b/src/qt/locale/triangles_eo.ts index 7423a26..c255d11 100644 --- a/src/qt/locale/triangles_eo.ts +++ b/src/qt/locale/triangles_eo.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_es.ts b/src/qt/locale/triangles_es.ts index e1e3dbb..a3f2cb6 100644 --- a/src/qt/locale/triangles_es.ts +++ b/src/qt/locale/triangles_es.ts @@ -1443,7 +1443,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_es_CL.ts b/src/qt/locale/triangles_es_CL.ts index 607f772..d82e39f 100644 --- a/src/qt/locale/triangles_es_CL.ts +++ b/src/qt/locale/triangles_es_CL.ts @@ -1435,7 +1435,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_es_DO.ts b/src/qt/locale/triangles_es_DO.ts index 4b92f81..51fe56a 100644 --- a/src/qt/locale/triangles_es_DO.ts +++ b/src/qt/locale/triangles_es_DO.ts @@ -1435,7 +1435,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_es_MX.ts b/src/qt/locale/triangles_es_MX.ts index b105f9b..f82a9b1 100644 --- a/src/qt/locale/triangles_es_MX.ts +++ b/src/qt/locale/triangles_es_MX.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_es_UY.ts b/src/qt/locale/triangles_es_UY.ts index eb1e443..a7a45ab 100644 --- a/src/qt/locale/triangles_es_UY.ts +++ b/src/qt/locale/triangles_es_UY.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_et.ts b/src/qt/locale/triangles_et.ts index 8f56a66..0dff293 100644 --- a/src/qt/locale/triangles_et.ts +++ b/src/qt/locale/triangles_et.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_eu_ES.ts b/src/qt/locale/triangles_eu_ES.ts index 3644f2c..aafbda4 100644 --- a/src/qt/locale/triangles_eu_ES.ts +++ b/src/qt/locale/triangles_eu_ES.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_fa.ts b/src/qt/locale/triangles_fa.ts index a5909c9..62466f3 100644 --- a/src/qt/locale/triangles_fa.ts +++ b/src/qt/locale/triangles_fa.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_fa_IR.ts b/src/qt/locale/triangles_fa_IR.ts index 326478a..1c21c1e 100644 --- a/src/qt/locale/triangles_fa_IR.ts +++ b/src/qt/locale/triangles_fa_IR.ts @@ -1428,7 +1428,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_fi.ts b/src/qt/locale/triangles_fi.ts index 50f3171..a20aa91 100644 --- a/src/qt/locale/triangles_fi.ts +++ b/src/qt/locale/triangles_fi.ts @@ -1441,7 +1441,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_fr.ts b/src/qt/locale/triangles_fr.ts index c811bcc..8138071 100644 --- a/src/qt/locale/triangles_fr.ts +++ b/src/qt/locale/triangles_fr.ts @@ -1440,7 +1440,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_fr_CA.ts b/src/qt/locale/triangles_fr_CA.ts index b499134..8b903d2 100644 --- a/src/qt/locale/triangles_fr_CA.ts +++ b/src/qt/locale/triangles_fr_CA.ts @@ -1440,7 +1440,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_gl.ts b/src/qt/locale/triangles_gl.ts index a2e491c..2a3d5cf 100644 --- a/src/qt/locale/triangles_gl.ts +++ b/src/qt/locale/triangles_gl.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_he.ts b/src/qt/locale/triangles_he.ts index 8ae7e7e..924b3fc 100644 --- a/src/qt/locale/triangles_he.ts +++ b/src/qt/locale/triangles_he.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_hi_IN.ts b/src/qt/locale/triangles_hi_IN.ts index 3ef0302..b284c04 100644 --- a/src/qt/locale/triangles_hi_IN.ts +++ b/src/qt/locale/triangles_hi_IN.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_hr.ts b/src/qt/locale/triangles_hr.ts index f80a590..27ece3c 100644 --- a/src/qt/locale/triangles_hr.ts +++ b/src/qt/locale/triangles_hr.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_hu.ts b/src/qt/locale/triangles_hu.ts index 87130cc..ebeda0e 100644 --- a/src/qt/locale/triangles_hu.ts +++ b/src/qt/locale/triangles_hu.ts @@ -1431,7 +1431,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_id_ID.ts b/src/qt/locale/triangles_id_ID.ts index 75b85fd..dc27928 100644 --- a/src/qt/locale/triangles_id_ID.ts +++ b/src/qt/locale/triangles_id_ID.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_it.ts b/src/qt/locale/triangles_it.ts index 6b24a2a..48607fe 100644 --- a/src/qt/locale/triangles_it.ts +++ b/src/qt/locale/triangles_it.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_ja.ts b/src/qt/locale/triangles_ja.ts index 7028738..8b20ce2 100644 --- a/src/qt/locale/triangles_ja.ts +++ b/src/qt/locale/triangles_ja.ts @@ -1440,7 +1440,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_ka.ts b/src/qt/locale/triangles_ka.ts index 875c03b..56393af 100644 --- a/src/qt/locale/triangles_ka.ts +++ b/src/qt/locale/triangles_ka.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_kk_KZ.ts b/src/qt/locale/triangles_kk_KZ.ts index 3270f6b..b5063ca 100644 --- a/src/qt/locale/triangles_kk_KZ.ts +++ b/src/qt/locale/triangles_kk_KZ.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_ko_KR.ts b/src/qt/locale/triangles_ko_KR.ts index f194a96..441396d 100644 --- a/src/qt/locale/triangles_ko_KR.ts +++ b/src/qt/locale/triangles_ko_KR.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_ky.ts b/src/qt/locale/triangles_ky.ts index a38225a..929ac33 100644 --- a/src/qt/locale/triangles_ky.ts +++ b/src/qt/locale/triangles_ky.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_la.ts b/src/qt/locale/triangles_la.ts index 6f0abd6..279f153 100644 --- a/src/qt/locale/triangles_la.ts +++ b/src/qt/locale/triangles_la.ts @@ -1431,7 +1431,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_lt.ts b/src/qt/locale/triangles_lt.ts index 149cf22..c42bf26 100644 --- a/src/qt/locale/triangles_lt.ts +++ b/src/qt/locale/triangles_lt.ts @@ -1431,7 +1431,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_lv_LV.ts b/src/qt/locale/triangles_lv_LV.ts index 59c96d8..67d9b34 100644 --- a/src/qt/locale/triangles_lv_LV.ts +++ b/src/qt/locale/triangles_lv_LV.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_ms_MY.ts b/src/qt/locale/triangles_ms_MY.ts index c1b70e5..3e12d28 100644 --- a/src/qt/locale/triangles_ms_MY.ts +++ b/src/qt/locale/triangles_ms_MY.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_nb.ts b/src/qt/locale/triangles_nb.ts index 5464b2c..04dc82d 100644 --- a/src/qt/locale/triangles_nb.ts +++ b/src/qt/locale/triangles_nb.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_nl.ts b/src/qt/locale/triangles_nl.ts index 13b12b5..a1d9a22 100644 --- a/src/qt/locale/triangles_nl.ts +++ b/src/qt/locale/triangles_nl.ts @@ -1440,7 +1440,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_pam.ts b/src/qt/locale/triangles_pam.ts index 794669b..50a2aa1 100644 --- a/src/qt/locale/triangles_pam.ts +++ b/src/qt/locale/triangles_pam.ts @@ -1430,7 +1430,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_pl.ts b/src/qt/locale/triangles_pl.ts index 5463a11..35cdac9 100644 --- a/src/qt/locale/triangles_pl.ts +++ b/src/qt/locale/triangles_pl.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_pt_BR.ts b/src/qt/locale/triangles_pt_BR.ts index 67bbd81..afeb8d3 100644 --- a/src/qt/locale/triangles_pt_BR.ts +++ b/src/qt/locale/triangles_pt_BR.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_pt_PT.ts b/src/qt/locale/triangles_pt_PT.ts index c8725f8..734724d 100644 --- a/src/qt/locale/triangles_pt_PT.ts +++ b/src/qt/locale/triangles_pt_PT.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_ro_RO.ts b/src/qt/locale/triangles_ro_RO.ts index 29b0cd8..4ca27c7 100644 --- a/src/qt/locale/triangles_ro_RO.ts +++ b/src/qt/locale/triangles_ro_RO.ts @@ -1440,7 +1440,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_ru.ts b/src/qt/locale/triangles_ru.ts index 8a06b4f..f15eeff 100644 --- a/src/qt/locale/triangles_ru.ts +++ b/src/qt/locale/triangles_ru.ts @@ -1426,7 +1426,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_sah.ts b/src/qt/locale/triangles_sah.ts index 273616a..2d26655 100644 --- a/src/qt/locale/triangles_sah.ts +++ b/src/qt/locale/triangles_sah.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_sk.ts b/src/qt/locale/triangles_sk.ts index 6dfd935..db34fac 100644 --- a/src/qt/locale/triangles_sk.ts +++ b/src/qt/locale/triangles_sk.ts @@ -1440,7 +1440,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_sl_SI.ts b/src/qt/locale/triangles_sl_SI.ts index 6c829d4..ffd3002 100644 --- a/src/qt/locale/triangles_sl_SI.ts +++ b/src/qt/locale/triangles_sl_SI.ts @@ -1440,7 +1440,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_sq.ts b/src/qt/locale/triangles_sq.ts index 7f3a539..1750aee 100644 --- a/src/qt/locale/triangles_sq.ts +++ b/src/qt/locale/triangles_sq.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_sr.ts b/src/qt/locale/triangles_sr.ts index ebe4977..d357563 100644 --- a/src/qt/locale/triangles_sr.ts +++ b/src/qt/locale/triangles_sr.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_sv.ts b/src/qt/locale/triangles_sv.ts index 3ee4d19..7bddde9 100644 --- a/src/qt/locale/triangles_sv.ts +++ b/src/qt/locale/triangles_sv.ts @@ -1441,7 +1441,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_th_TH.ts b/src/qt/locale/triangles_th_TH.ts index 008c0f1..a9628f2 100644 --- a/src/qt/locale/triangles_th_TH.ts +++ b/src/qt/locale/triangles_th_TH.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_tr.ts b/src/qt/locale/triangles_tr.ts index 5f0ec70..d479286 100644 --- a/src/qt/locale/triangles_tr.ts +++ b/src/qt/locale/triangles_tr.ts @@ -1446,7 +1446,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_uk.ts b/src/qt/locale/triangles_uk.ts index 0fee228..c238d35 100644 --- a/src/qt/locale/triangles_uk.ts +++ b/src/qt/locale/triangles_uk.ts @@ -1432,7 +1432,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_ur_PK.ts b/src/qt/locale/triangles_ur_PK.ts index 3d3d639..e80658d 100644 --- a/src/qt/locale/triangles_ur_PK.ts +++ b/src/qt/locale/triangles_ur_PK.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_vi.ts b/src/qt/locale/triangles_vi.ts index 604583e..9c03050 100644 --- a/src/qt/locale/triangles_vi.ts +++ b/src/qt/locale/triangles_vi.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_vi_VN.ts b/src/qt/locale/triangles_vi_VN.ts index 0673a9e..9c0283d 100644 --- a/src/qt/locale/triangles_vi_VN.ts +++ b/src/qt/locale/triangles_vi_VN.ts @@ -1427,7 +1427,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_zh_CN.ts b/src/qt/locale/triangles_zh_CN.ts index 12f2881..471616d 100644 --- a/src/qt/locale/triangles_zh_CN.ts +++ b/src/qt/locale/triangles_zh_CN.ts @@ -1433,7 +1433,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/locale/triangles_zh_TW.ts b/src/qt/locale/triangles_zh_TW.ts index d77b42d..ccc711e 100644 --- a/src/qt/locale/triangles_zh_TW.ts +++ b/src/qt/locale/triangles_zh_TW.ts @@ -1434,7 +1434,7 @@ a:active { color:#f26522; text-decoration: underline; } </style> </head> <body> -<a href="https://bittrex.com/Market/Index?MarketName=BTC-TRI"> &#187; TRI on Bittrex</a></body> +<a href="https://313.cash"> &#187; TRI on Pinball</a></body> diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 5941f1f..a841663 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -35,6 +35,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) : ui->proxyIp->setEnabled(false); ui->proxyPort->setEnabled(false); ui->proxyPort->setValidator(new QIntValidator(1, 65535, this)); + ui->connectSocks->setText(tr("&Use Tor (SOCKS5):")); ui->socksVersion->setEnabled(false); ui->socksVersion->addItem("5", 5); @@ -45,6 +46,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) : connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool))); connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->socksVersion, SLOT(setEnabled(bool))); connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning_Proxy())); + connect(ui->connectSocks, SIGNAL(toggled(bool)), this, SLOT(applyTorDefaults(bool))); ui->proxyIp->installEventFilter(this); @@ -277,6 +279,17 @@ void OptionsDialog::handleProxyIpValid(QValidatedLineEdit *object, bool fState) } } +void OptionsDialog::applyTorDefaults(bool enabled) +{ + if (!enabled) + return; + + // One-click Tor mode: populate standard local Tor SOCKS settings. + ui->proxyIp->setText("127.0.0.1"); + ui->proxyPort->setText("9050"); + ui->socksVersion->setCurrentIndex(ui->socksVersion->findData(5)); +} + bool OptionsDialog::eventFilter(QObject *object, QEvent *event) { if(event->type() == QEvent::FocusOut) diff --git a/src/qt/optionsdialog.h b/src/qt/optionsdialog.h index 18469f5..2a58457 100644 --- a/src/qt/optionsdialog.h +++ b/src/qt/optionsdialog.h @@ -44,6 +44,7 @@ private slots: void showRestartWarning_Lang(); void updateDisplayUnit(); void handleProxyIpValid(QValidatedLineEdit *object, bool fState); + void applyTorDefaults(bool enabled); signals: void proxyIpValid(QValidatedLineEdit *object, bool fValid); diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index e09f428..b102abd 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -33,6 +33,11 @@ bool static ApplyProxySettings() #endif SetNameProxy(addrProxy, nSocksVersion); } + + // Keep Tor transport aligned with proxy settings for one-click Tor mode. + SoftSetArg("-tor", addrProxy.ToStringIPPort()); + SoftSetArg("-torproxy", addrProxy.ToStringIPPort()); + return true; } @@ -58,6 +63,11 @@ void OptionsModel::Init() SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString()); if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool()) SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString()); + if (settings.value("fUseProxy", false).toBool()) { + const std::string proxyAddr = settings.value("addrProxy", "127.0.0.1:9050").toString().toStdString(); + SoftSetArg("-tor", proxyAddr); + SoftSetArg("-torproxy", proxyAddr); + } if (settings.contains("detachDB")) SoftSetBoolArg("-detachdb", settings.value("detachDB").toBool()); if (!language.isEmpty()) diff --git a/src/qt/res/images/header_logo.png b/src/qt/res/images/header_logo.png index c632094..5880cbb 100644 Binary files a/src/qt/res/images/header_logo.png and b/src/qt/res/images/header_logo.png differ diff --git a/src/script.cpp b/src/script.cpp index 90b33a0..22bdc95 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -890,17 +890,17 @@ bool EvalScript(vector >& stack, const CScript& script, co break; case OP_MUL: - if (!BN_mul(&bn, &bn1, &bn2, pctx)) + if (!BN_mul(bn.get(), bn1.get(), bn2.get(), pctx)) return false; break; case OP_DIV: - if (!BN_div(&bn, NULL, &bn1, &bn2, pctx)) + if (!BN_div(bn.get(), NULL, bn1.get(), bn2.get(), pctx)) return false; break; case OP_MOD: - if (!BN_mod(&bn, &bn1, &bn2, pctx)) + if (!BN_mod(bn.get(), bn1.get(), bn2.get(), pctx)) return false; break; diff --git a/src/smessage.cpp b/src/smessage.cpp index 3444d82..ac89d8a 100644 --- a/src/smessage.cpp +++ b/src/smessage.cpp @@ -125,21 +125,22 @@ bool SecMsgCrypter::Encrypt(unsigned char* chPlaintext, uint32_t nPlain, std::ve int nCLen = nLen + AES_BLOCK_SIZE, nFLen = 0; vchCiphertext = std::vector (nCLen); - EVP_CIPHER_CTX ctx; + EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); + if (!ctx) + return false; bool fOk = true; - EVP_CIPHER_CTX_init(&ctx); - if (fOk) fOk = EVP_EncryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, &chKey[0], &chIV[0]); - if (fOk) fOk = EVP_EncryptUpdate(&ctx, &vchCiphertext[0], &nCLen, chPlaintext, nLen); - if (fOk) fOk = EVP_EncryptFinal_ex(&ctx, (&vchCiphertext[0])+nCLen, &nFLen); - EVP_CIPHER_CTX_cleanup(&ctx); + if (fOk) fOk = EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, &chKey[0], &chIV[0]); + if (fOk) fOk = EVP_EncryptUpdate(ctx, &vchCiphertext[0], &nCLen, chPlaintext, nLen); + if (fOk) fOk = EVP_EncryptFinal_ex(ctx, (&vchCiphertext[0])+nCLen, &nFLen); + EVP_CIPHER_CTX_free(ctx); if (!fOk) return false; vchCiphertext.resize(nCLen + nFLen); - + return true; }; @@ -153,15 +154,16 @@ bool SecMsgCrypter::Decrypt(unsigned char* chCiphertext, uint32_t nCipher, std:: vchPlaintext.resize(nCipher); - EVP_CIPHER_CTX ctx; + EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); + if (!ctx) + return false; bool fOk = true; - EVP_CIPHER_CTX_init(&ctx); - if (fOk) fOk = EVP_DecryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, &chKey[0], &chIV[0]); - if (fOk) fOk = EVP_DecryptUpdate(&ctx, &vchPlaintext[0], &nPLen, &chCiphertext[0], nCipher); - if (fOk) fOk = EVP_DecryptFinal_ex(&ctx, (&vchPlaintext[0])+nPLen, &nFLen); - EVP_CIPHER_CTX_cleanup(&ctx); + if (fOk) fOk = EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, &chKey[0], &chIV[0]); + if (fOk) fOk = EVP_DecryptUpdate(ctx, &vchPlaintext[0], &nPLen, &chCiphertext[0], nCipher); + if (fOk) fOk = EVP_DecryptFinal_ex(ctx, (&vchPlaintext[0])+nPLen, &nFLen); + EVP_CIPHER_CTX_free(ctx); if (!fOk) return false; @@ -3154,15 +3156,14 @@ int SecureMsgValidate(unsigned char *pHeader, unsigned char *pPayload, uint32_t for (int i = 0; i < 32; i+=4) memcpy(civ+i, &nonse, 4); - HMAC_CTX ctx; - HMAC_CTX_init(&ctx); - + HMAC_CTX *ctx = HMAC_CTX_new(); + unsigned int nBytes; - if (!HMAC_Init_ex(&ctx, &civ[0], 32, EVP_sha256(), NULL) - || !HMAC_Update(&ctx, (unsigned char*) pHeader+4, SMSG_HDR_LEN-4) - || !HMAC_Update(&ctx, (unsigned char*) pPayload, nPayload) - || !HMAC_Update(&ctx, pPayload, nPayload) - || !HMAC_Final(&ctx, sha256Hash, &nBytes) + if (!HMAC_Init_ex(ctx, &civ[0], 32, EVP_sha256(), NULL) + || !HMAC_Update(ctx, (unsigned char*) pHeader+4, SMSG_HDR_LEN-4) + || !HMAC_Update(ctx, (unsigned char*) pPayload, nPayload) + || !HMAC_Update(ctx, pPayload, nPayload) + || !HMAC_Final(ctx, sha256Hash, &nBytes) || nBytes != 32) { if (fDebugSmsg) @@ -3178,7 +3179,7 @@ int SecureMsgValidate(unsigned char *pHeader, unsigned char *pPayload, uint32_t printf("Hash Valid.\n"); rv = 0; // smsg is valid }; - + if (memcmp(psmsg->hash, sha256Hash, 4) != 0) { if (fDebugSmsg) @@ -3186,7 +3187,7 @@ int SecureMsgValidate(unsigned char *pHeader, unsigned char *pPayload, uint32_t rv = 3; // checksum mismatch } } - HMAC_CTX_cleanup(&ctx); + HMAC_CTX_free(ctx); return rv; }; @@ -3214,34 +3215,33 @@ int SecureMsgSetHash(unsigned char *pHeader, unsigned char *pPayload, uint32_t n //vchHash.resize(32); bool found = false; - HMAC_CTX ctx; - HMAC_CTX_init(&ctx); - + HMAC_CTX *ctx = HMAC_CTX_new(); + uint32_t nonse = 0; - + //CBigNum bnTarget(2); //bnTarget = bnTarget.pow(256 - 40); - - // -- break for HMAC_CTX_cleanup + + // -- break for HMAC_CTX_free for (;;) { if (!fSecMsgEnabled) break; - + //psmsg->timestamp = GetTime(); //memcpy(&psmsg->timestamp, &now, 8); memcpy(&psmsg->nonse[0], &nonse, 4); - + for (int i = 0; i < 32; i+=4) memcpy(civ+i, &nonse, 4); - + unsigned int nBytes; - if (!HMAC_Init_ex(&ctx, &civ[0], 32, EVP_sha256(), NULL) - || !HMAC_Update(&ctx, (unsigned char*) pHeader+4, SMSG_HDR_LEN-4) - || !HMAC_Update(&ctx, (unsigned char*) pPayload, nPayload) - || !HMAC_Update(&ctx, pPayload, nPayload) - || !HMAC_Final(&ctx, sha256Hash, &nBytes) - //|| !HMAC_Final(&ctx, &vchHash[0], &nBytes) + if (!HMAC_Init_ex(ctx, &civ[0], 32, EVP_sha256(), NULL) + || !HMAC_Update(ctx, (unsigned char*) pHeader+4, SMSG_HDR_LEN-4) + || !HMAC_Update(ctx, (unsigned char*) pPayload, nPayload) + || !HMAC_Update(ctx, pPayload, nPayload) + || !HMAC_Final(ctx, sha256Hash, &nBytes) + //|| !HMAC_Final(ctx, &vchHash[0], &nBytes) || nBytes != 32) break; @@ -3277,8 +3277,8 @@ int SecureMsgSetHash(unsigned char *pHeader, unsigned char *pPayload, uint32_t n nonse++; }; - HMAC_CTX_cleanup(&ctx); - + HMAC_CTX_free(ctx); + if (!fSecMsgEnabled) { if (fDebugSmsg) @@ -3423,7 +3423,6 @@ int SecureMsgEncrypt(SecureMessage& smsg, std::string& addressFrom, std::string& //printf("secret_len %d.\n", secret_len); // -- ECDH_compute_key returns the same P if fed compressed or uncompressed public keys - ECDH_set_method(pkeyr, ECDH_OpenSSL()); int lenP = ECDH_compute_key(&vchP[0], 32, EC_KEY_get0_public_key(pkeyK), pkeyr, NULL); if (lenP != 32) @@ -3556,17 +3555,16 @@ int SecureMsgEncrypt(SecureMessage& smsg, std::string& addressFrom, std::string& // Message authentication code, (hash of timestamp + destination + payload) bool fHmacOk = true; unsigned int nBytes = 32; - HMAC_CTX ctx; - HMAC_CTX_init(&ctx); - - if (!HMAC_Init_ex(&ctx, &key_m[0], 32, EVP_sha256(), NULL) - || !HMAC_Update(&ctx, (unsigned char*) &smsg.timestamp, sizeof(smsg.timestamp)) - || !HMAC_Update(&ctx, &vchCiphertext[0], vchCiphertext.size()) - || !HMAC_Final(&ctx, smsg.mac, &nBytes) + HMAC_CTX *ctx = HMAC_CTX_new(); + + if (!HMAC_Init_ex(ctx, &key_m[0], 32, EVP_sha256(), NULL) + || !HMAC_Update(ctx, (unsigned char*) &smsg.timestamp, sizeof(smsg.timestamp)) + || !HMAC_Update(ctx, &vchCiphertext[0], vchCiphertext.size()) + || !HMAC_Final(ctx, smsg.mac, &nBytes) || nBytes != 32) fHmacOk = false; - - HMAC_CTX_cleanup(&ctx); + + HMAC_CTX_free(ctx); if (!fHmacOk) { @@ -3835,7 +3833,6 @@ int SecureMsgDecrypt(bool fTestOnly, std::string& address, unsigned char *pHeade EC_KEY* pkeyk = keyDest.GetECKey(); EC_KEY* pkeyR = keyR.GetECKey(); - ECDH_set_method(pkeyk, ECDH_OpenSSL()); int lenPdec = ECDH_compute_key(&vchP[0], 32, EC_KEY_get0_public_key(pkeyR), pkeyk, NULL); if (lenPdec != 32) @@ -3858,17 +3855,16 @@ int SecureMsgDecrypt(bool fTestOnly, std::string& address, unsigned char *pHeade unsigned char MAC[32]; bool fHmacOk = true; unsigned int nBytes = 32; - HMAC_CTX ctx; - HMAC_CTX_init(&ctx); - - if (!HMAC_Init_ex(&ctx, &key_m[0], 32, EVP_sha256(), NULL) - || !HMAC_Update(&ctx, (unsigned char*) &psmsg->timestamp, sizeof(psmsg->timestamp)) - || !HMAC_Update(&ctx, pPayload, nPayload) - || !HMAC_Final(&ctx, MAC, &nBytes) + HMAC_CTX *ctx = HMAC_CTX_new(); + + if (!HMAC_Init_ex(ctx, &key_m[0], 32, EVP_sha256(), NULL) + || !HMAC_Update(ctx, (unsigned char*) &psmsg->timestamp, sizeof(psmsg->timestamp)) + || !HMAC_Update(ctx, pPayload, nPayload) + || !HMAC_Final(ctx, MAC, &nBytes) || nBytes != 32) fHmacOk = false; - - HMAC_CTX_cleanup(&ctx); + + HMAC_CTX_free(ctx); if (!fHmacOk) { diff --git a/src/tor/aes.c b/src/tor/aes.c index e4cfe91..6dd27b2 100644 --- a/src/tor/aes.c +++ b/src/tor/aes.c @@ -89,7 +89,7 @@ #ifdef USE_EVP_AES_CTR struct aes_cnt_cipher { - EVP_CIPHER_CTX evp; + EVP_CIPHER_CTX *evp; }; aes_cnt_cipher_t * @@ -97,7 +97,8 @@ aes_new_cipher(const char *key, const char *iv) { aes_cnt_cipher_t *cipher; cipher = tor_malloc_zero(sizeof(aes_cnt_cipher_t)); - EVP_EncryptInit(&cipher->evp, EVP_aes_128_ctr(), + cipher->evp = EVP_CIPHER_CTX_new(); + EVP_EncryptInit(cipher->evp, EVP_aes_128_ctr(), (const unsigned char*)key, (const unsigned char *)iv); return cipher; } @@ -106,7 +107,7 @@ aes_cipher_free(aes_cnt_cipher_t *cipher) { if (!cipher) return; - EVP_CIPHER_CTX_cleanup(&cipher->evp); + EVP_CIPHER_CTX_free(cipher->evp); memwipe(cipher, 0, sizeof(aes_cnt_cipher_t)); tor_free(cipher); } @@ -118,7 +119,7 @@ aes_crypt(aes_cnt_cipher_t *cipher, const char *input, size_t len, tor_assert(len < INT_MAX); - EVP_EncryptUpdate(&cipher->evp, (unsigned char*)output, + EVP_EncryptUpdate(cipher->evp, (unsigned char*)output, &outl, (const unsigned char *)input, (int)len); } void @@ -128,7 +129,7 @@ aes_crypt_inplace(aes_cnt_cipher_t *cipher, char *data, size_t len) tor_assert(len < INT_MAX); - EVP_EncryptUpdate(&cipher->evp, (unsigned char*)data, + EVP_EncryptUpdate(cipher->evp, (unsigned char*)data, &outl, (unsigned char*)data, (int)len); } int diff --git a/src/tor/anonymize.cpp b/src/tor/anonymize.cpp index 0d35b8b..b900e96 100644 --- a/src/tor/anonymize.cpp +++ b/src/tor/anonymize.cpp @@ -12,6 +12,7 @@ #include #include #include +#include char const* anonymize_tor_data_directory( ) { @@ -43,7 +44,7 @@ int check_interrupted( static boost::mutex initializing; -static std::auto_ptr > uninitialized( +static std::unique_ptr > uninitialized( new boost::unique_lock( initializing ) diff --git a/src/tor/crypto.c b/src/tor/crypto.c index 044e151..3c67c03 100644 --- a/src/tor/crypto.c +++ b/src/tor/crypto.c @@ -71,9 +71,9 @@ #define MAX_DNS_LABEL_SIZE 63 /** Macro: is k a valid RSA public or private key? */ -#define PUBLIC_KEY_OK(k) ((k) && (k)->key && (k)->key->n) +#define PUBLIC_KEY_OK(k) ((k) && (k)->key && RSA_get0_n((k)->key)) /** Macro: is k a valid RSA private key? */ -#define PRIVATE_KEY_OK(k) ((k) && (k)->key && (k)->key->p) +#define PRIVATE_KEY_OK(k) ((k) && (k)->key && RSA_get0_p((k)->key)) #ifdef TOR_IS_MULTITHREADED /** A number of preallocated mutexes for use by OpenSSL. */ @@ -311,8 +311,10 @@ crypto_global_init(int useAccel, const char *accelName, const char *accelDir) used by Tor and the set of algorithms available in the engine */ log_engine("RSA", ENGINE_get_default_RSA()); log_engine("DH", ENGINE_get_default_DH()); +#if OPENSSL_VERSION_NUMBER < 0x30000000L log_engine("ECDH", ENGINE_get_default_ECDH()); log_engine("ECDSA", ENGINE_get_default_ECDSA()); +#endif log_engine("RAND", ENGINE_get_default_RAND()); log_engine("RAND (which we will not use)", ENGINE_get_default_RAND()); log_engine("SHA1", ENGINE_get_digest_engine(NID_sha1)); @@ -335,12 +337,14 @@ crypto_global_init(int useAccel, const char *accelName, const char *accelDir) log_info(LD_CRYPTO, "NOT using OpenSSL engine support."); } +#if OPENSSL_VERSION_NUMBER < 0x30000000L if (RAND_get_rand_method() != RAND_SSLeay()) { log_notice(LD_CRYPTO, "It appears that one of our engines has provided " "a replacement the OpenSSL RNG. Resetting it to the default " "implementation."); RAND_set_rand_method(RAND_SSLeay()); } +#endif evaluate_evp_for_aes(-1); evaluate_ctr_for_aes(); @@ -769,7 +773,7 @@ crypto_pk_public_exponent_ok(crypto_pk_t *env) tor_assert(env); tor_assert(env->key); - return BN_is_word(env->key->e, 65537); + return BN_is_word(RSA_get0_e(env->key), 65537); } /** Compare the public-key components of a and b. Return less than 0 @@ -792,10 +796,10 @@ crypto_pk_cmp_keys(crypto_pk_t *a, crypto_pk_t *b) tor_assert(PUBLIC_KEY_OK(a)); tor_assert(PUBLIC_KEY_OK(b)); - result = BN_cmp((a->key)->n, (b->key)->n); + result = BN_cmp(RSA_get0_n(a->key), RSA_get0_n(b->key)); if (result) return result; - return BN_cmp((a->key)->e, (b->key)->e); + return BN_cmp(RSA_get0_e(a->key), RSA_get0_e(b->key)); } /** Compare the public-key components of a and b. Return non-zero iff @@ -826,9 +830,9 @@ crypto_pk_num_bits(crypto_pk_t *env) { tor_assert(env); tor_assert(env->key); - tor_assert(env->key->n); + tor_assert(RSA_get0_n(env->key)); - return BN_num_bits(env->key->n); + return BN_num_bits(RSA_get0_n(env->key)); } /** Increase the reference count of env, and return it. @@ -921,7 +925,7 @@ crypto_pk_private_decrypt(crypto_pk_t *env, char *to, tor_assert(env->key); tor_assert(fromlen= crypto_pk_keysize(env)); - if (!env->key->p) + if (!RSA_get0_p(env->key)) /* Not a private key */ return -1; @@ -1027,7 +1031,7 @@ crypto_pk_private_sign(crypto_pk_t *env, char *to, size_t tolen, tor_assert(to); tor_assert(fromlen < INT_MAX); tor_assert(tolen >= crypto_pk_keysize(env)); - if (!env->key->p) + if (!RSA_get0_p(env->key)) /* Not a private key */ return -1; @@ -1713,7 +1717,7 @@ crypto_generate_dynamic_dh_modulus(void) r = DH_check(dh_parameters, &dh_codes); tor_assert(r && !dh_codes); - BN_copy(dynamic_dh_modulus, dh_parameters->p); + BN_copy(dynamic_dh_modulus, DH_get0_p(dh_parameters)); tor_assert(dynamic_dh_modulus); DH_free(dh_parameters); @@ -1752,12 +1756,17 @@ crypto_store_dynamic_dh_modulus(const char *fname) if (!(dh = DH_new())) goto done; - if (!(dh->p = BN_dup(dh_param_p_tls))) - goto done; - if (!(dh->g = BN_new())) - goto done; - if (!BN_set_word(dh->g, DH_GENERATOR)) - goto done; + { + BIGNUM *p_bn = BN_dup(dh_param_p_tls); + BIGNUM *g_bn = BN_new(); + if (!p_bn || !g_bn || !BN_set_word(g_bn, DH_GENERATOR) || + !DH_set0_pqg(dh, p_bn, NULL, g_bn)) { + if (p_bn) BN_free(p_bn); + if (g_bn) BN_free(g_bn); + goto done; + } + /* DH_set0_pqg takes ownership of p_bn and g_bn, do not free them */ + } len = i2d_DHparams(dh, &dh_string_repr); if ((len < 0) || (dh_string_repr == NULL)) { @@ -1860,7 +1869,7 @@ crypto_get_stored_dynamic_dh_modulus(const char *fname) goto err; } - if (!BN_is_word(stored_dh->g, 2)) { + if (!BN_is_word(DH_get0_g(stored_dh), 2)) { log_warn(LD_CRYPTO, "Stored dynamic DH parameters do not use '2' " "as the group generator."); goto err; @@ -1868,7 +1877,7 @@ crypto_get_stored_dynamic_dh_modulus(const char *fname) } { /* log the dynamic DH modulus: */ - char *s = BN_bn2hex(stored_dh->p); + char *s = BN_bn2hex(DH_get0_p(stored_dh)); tor_assert(s); log_info(LD_OR, "Found stored dynamic DH modulus: [%s]", s); OPENSSL_free(s); @@ -1902,7 +1911,7 @@ crypto_get_stored_dynamic_dh_modulus(const char *fname) tor_free(base64_decoded_dh); if (stored_dh) { - dynamic_dh_modulus = BN_dup(stored_dh->p); + dynamic_dh_modulus = BN_dup(DH_get0_p(stored_dh)); DH_free(stored_dh); } @@ -2031,18 +2040,23 @@ crypto_dh_new(int dh_type) if (!(res->dh = DH_new())) goto err; - if (dh_type == DH_TYPE_TLS) { - if (!(res->dh->p = BN_dup(dh_param_p_tls))) - goto err; - } else { - if (!(res->dh->p = BN_dup(dh_param_p))) + { + BIGNUM *p_bn, *g_bn; + if (dh_type == DH_TYPE_TLS) { + p_bn = BN_dup(dh_param_p_tls); + } else { + p_bn = BN_dup(dh_param_p); + } + g_bn = BN_dup(dh_param_g); + if (!p_bn || !g_bn || !DH_set0_pqg(res->dh, p_bn, NULL, g_bn)) { + if (p_bn) BN_free(p_bn); + if (g_bn) BN_free(g_bn); goto err; + } + /* DH_set0_pqg takes ownership of p_bn and g_bn, do not free them */ } - if (!(res->dh->g = BN_dup(dh_param_g))) - goto err; - - res->dh->length = DH_PRIVATE_KEY_BITS; + DH_set_length(res->dh, DH_PRIVATE_KEY_BITS); return res; err: @@ -2082,13 +2096,11 @@ crypto_dh_generate_public(crypto_dh_t *dh) crypto_log_errors(LOG_WARN, "generating DH key"); return -1; } - if (tor_check_dh_key(LOG_WARN, dh->dh->pub_key)<0) { + if (tor_check_dh_key(LOG_WARN, (BIGNUM*)DH_get0_pub_key(dh->dh))<0) { log_warn(LD_CRYPTO, "Weird! Our own DH key was invalid. I guess once-in-" "the-universe chances really do happen. Trying again."); /* Free and clear the keys, so OpenSSL will actually try again. */ - BN_clear_free(dh->dh->pub_key); - BN_clear_free(dh->dh->priv_key); - dh->dh->pub_key = dh->dh->priv_key = NULL; + DH_set0_key(dh->dh, NULL, NULL); goto again; } return 0; @@ -2103,13 +2115,13 @@ crypto_dh_get_public(crypto_dh_t *dh, char *pubkey, size_t pubkey_len) { int bytes; tor_assert(dh); - if (!dh->dh->pub_key) { + if (!DH_get0_pub_key(dh->dh)) { if (crypto_dh_generate_public(dh)<0) return -1; } - tor_assert(dh->dh->pub_key); - bytes = BN_num_bytes(dh->dh->pub_key); + tor_assert(DH_get0_pub_key(dh->dh)); + bytes = BN_num_bytes(DH_get0_pub_key(dh->dh)); tor_assert(bytes >= 0); if (pubkey_len < (size_t)bytes) { log_warn(LD_CRYPTO, @@ -2119,7 +2131,7 @@ crypto_dh_get_public(crypto_dh_t *dh, char *pubkey, size_t pubkey_len) } memset(pubkey, 0, pubkey_len); - BN_bn2bin(dh->dh->pub_key, (unsigned char*)(pubkey+(pubkey_len-bytes))); + BN_bn2bin(DH_get0_pub_key(dh->dh), (unsigned char*)(pubkey+(pubkey_len-bytes))); return 0; } @@ -2605,23 +2617,28 @@ base64_encode(char *dest, size_t destlen, const char *src, size_t srclen) { /* FFFF we might want to rewrite this along the lines of base64_decode, if * it ever shows up in the profile. */ - EVP_ENCODE_CTX ctx; + EVP_ENCODE_CTX *ctx = EVP_ENCODE_CTX_new(); int len, ret; tor_assert(srclen < INT_MAX); /* 48 bytes of input -> 64 bytes of output plus newline. Plus one more byte, in case I'm wrong. */ - if (destlen < ((srclen/48)+1)*66) + if (destlen < ((srclen/48)+1)*66) { + EVP_ENCODE_CTX_free(ctx); return -1; - if (destlen > SIZE_T_CEILING) + } + if (destlen > SIZE_T_CEILING) { + EVP_ENCODE_CTX_free(ctx); return -1; + } - EVP_EncodeInit(&ctx); - EVP_EncodeUpdate(&ctx, (unsigned char*)dest, &len, + EVP_EncodeInit(ctx); + EVP_EncodeUpdate(ctx, (unsigned char*)dest, &len, (unsigned char*)src, (int)srclen); - EVP_EncodeFinal(&ctx, (unsigned char*)(dest+len), &ret); + EVP_EncodeFinal(ctx, (unsigned char*)(dest+len), &ret); ret += len; + EVP_ENCODE_CTX_free(ctx); return ret; } @@ -2670,21 +2687,26 @@ int base64_decode(char *dest, size_t destlen, const char *src, size_t srclen) { #ifdef USE_OPENSSL_BASE64 - EVP_ENCODE_CTX ctx; + EVP_ENCODE_CTX *ctx = EVP_ENCODE_CTX_new(); int len, ret; /* 64 bytes of input -> *up to* 48 bytes of output. Plus one more byte, in case I'm wrong. */ - if (destlen < ((srclen/64)+1)*49) + if (destlen < ((srclen/64)+1)*49) { + EVP_ENCODE_CTX_free(ctx); return -1; - if (destlen > SIZE_T_CEILING) + } + if (destlen > SIZE_T_CEILING) { + EVP_ENCODE_CTX_free(ctx); return -1; + } - EVP_DecodeInit(&ctx); - EVP_DecodeUpdate(&ctx, (unsigned char*)dest, &len, + EVP_DecodeInit(ctx); + EVP_DecodeUpdate(ctx, (unsigned char*)dest, &len, (unsigned char*)src, srclen); - EVP_DecodeFinal(&ctx, (unsigned char*)dest, &ret); + EVP_DecodeFinal(ctx, (unsigned char*)dest, &ret); ret += len; + EVP_ENCODE_CTX_free(ctx); return ret; #else const char *eos = src+srclen; diff --git a/src/tor/onion_v3.cpp b/src/tor/onion_v3.cpp index 2269407..c0f1a22 100644 --- a/src/tor/onion_v3.cpp +++ b/src/tor/onion_v3.cpp @@ -8,6 +8,13 @@ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif +// Ensure inet_pton is available +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#elif _WIN32_WINNT < 0x0600 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif #endif #include "onion_v3.h" @@ -116,12 +123,6 @@ bool DecodeBase32(const std::string& encoded, std::vector& decode return true; } -// Legacy function for backward compatibility -std::string EncodeBase32(const unsigned char* data, size_t len) -{ - return EncodeBase32Proper(data, len); -} - // CTorV3Service Implementation CTorV3Service::CTorV3Service() : port(19112), isActive(false) { @@ -1722,7 +1723,8 @@ bool CTorV3Manager::ConnectThroughSocks5Proxy(const std::string& onionAddr, int proxyAddr.sin_family = AF_INET; proxyAddr.sin_port = htons(proxyPort); - if (inet_pton(AF_INET, proxyHost.c_str(), &proxyAddr.sin_addr) <= 0) { + proxyAddr.sin_addr.s_addr = inet_addr(proxyHost.c_str()); + if (proxyAddr.sin_addr.s_addr == INADDR_NONE) { printf("ERROR: Invalid SOCKS5 proxy IP address: %s\n", proxyHost.c_str()); closesocket(hSocket); return false; @@ -2004,54 +2006,6 @@ void CTorV3Manager::RequestSeederListFromPeers() } } -void CTorV3Manager::HandleSeederListMessage(CNode* pfrom, const std::vector& seederList) -{ - printf("Received seeder list from %s with %d entries\n", - pfrom->addr.ToString().c_str(), (int)seederList.size()); - - // Add new seeders to our known list - std::set newSeeders; - - if (pwalletMain) { - CWalletDB walletdb(pwalletMain->strWalletFile); - - // Get existing seeders - std::string existingList; - walletdb.ReadSetting("known_seeders", existingList); - - std::set existing; - std::stringstream ss(existingList); - std::string seeder; - while (std::getline(ss, seeder, ',')) { - if (!seeder.empty()) { - existing.insert(seeder); - } - } - - // Add new seeders - for (const std::string& newSeeder : seederList) { - if (existing.find(newSeeder) == existing.end()) { - existing.insert(newSeeder); - newSeeders.insert(newSeeder); - printf("Added new seeder: %s\n", newSeeder.c_str()); - } - } - - // Save updated list - std::string updatedList; - for (const std::string& s : existing) { - if (!updatedList.empty()) updatedList += ","; - updatedList += s; - } - walletdb.WriteSetting("known_seeders", updatedList); - } - - // Auto-connect to new seeders - for (const std::string& newSeeder : newSeeders) { - ConnectToSeederNode(newSeeder); - } -} - void CTorV3Manager::BroadcastSeederList() { if (!torV3Config.enableSeederMode) return; @@ -2153,9 +2107,4 @@ bool InitTorV3() void ShutdownTorV3() { CTorV3Manager::GetInstance()->ShutdownTor(); -} - -TorV3Config& GetTorV3Config() -{ - return torV3Config; } \ No newline at end of file diff --git a/src/tor/onion_v3.h b/src/tor/onion_v3.h index 697c1d4..028409c 100644 --- a/src/tor/onion_v3.h +++ b/src/tor/onion_v3.h @@ -60,7 +60,7 @@ public: // Ed25519 key management functions bool ValidateEd25519Keys(const unsigned char* privateKey, const unsigned char* publicKey); bool GenerateV3OnionAddress(const unsigned char* publicKey, std::string& address); - bool ValidateOnionAddress(const std::string& address); + static bool ValidateOnionAddress(const std::string& address); // Key extraction and validation bool ExtractKeysFromHex(const std::string& privKeyHex, unsigned char* privKey, unsigned char* pubKey); diff --git a/src/tor/orconfig_win32.h b/src/tor/orconfig_win32.h index 0d6fe69..274f04c 100644 --- a/src/tor/orconfig_win32.h +++ b/src/tor/orconfig_win32.h @@ -74,7 +74,7 @@ #undef HAVE_SOCKETPAIR /* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H +#define HAVE_STDINT_H /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H @@ -179,25 +179,25 @@ #define SIZEOF_INT 4 /* The size of a `int16_t', as computed by sizeof. */ -#undef SIZEOF_INT16_T +#define SIZEOF_INT16_T 2 /* The size of a `int32_t', as computed by sizeof. */ -#undef SIZEOF_INT32_T +#define SIZEOF_INT32_T 4 /* The size of a `int64_t', as computed by sizeof. */ -#undef SIZEOF_INT64_T +#define SIZEOF_INT64_T 8 /* The size of a `int8_t', as computed by sizeof. */ -#undef SIZEOF_INT8_T +#define SIZEOF_INT8_T 1 /* The size of a `long', as computed by sizeof. */ #define SIZEOF_LONG 4 /* The size of a `long long', as computed by sizeof. */ -#undef SIZEOF_LONG_LONG +#define SIZEOF_LONG_LONG 8 /* The size of `pid_t', as computed by sizeof. */ -#define SIZEOF_PID_T 0 +#define SIZEOF_PID_T 4 /* The size of a `short', as computed by sizeof. */ #define SIZEOF_SHORT 2 @@ -206,25 +206,33 @@ #define SIZEOF_TIME_T 4 /* The size of a `uint16_t', as computed by sizeof. */ -#undef SIZEOF_UINT16_T +#define SIZEOF_UINT16_T 2 /* The size of a `uint32_t', as computed by sizeof. */ -#undef SIZEOF_UINT32_T +#define SIZEOF_UINT32_T 4 /* The size of a `uint64_t', as computed by sizeof. */ -#undef SIZEOF_UINT64_T +#define SIZEOF_UINT64_T 8 /* The size of a `uint8_t', as computed by sizeof. */ -#undef SIZEOF_UINT8_T +#define SIZEOF_UINT8_T 1 /* The size of a `void *', as computed by sizeof. */ +#ifdef _WIN64 +#define SIZEOF_VOID_P 8 +#else #define SIZEOF_VOID_P 4 +#endif /* The size of a `__int64', as computed by sizeof. */ #define SIZEOF___INT64 8 /* The sizeof a size_t, as computed by sizeof. */ +#ifdef _WIN64 +#define SIZEOF_SIZE_T 8 +#else #define SIZEOF_SIZE_T 4 +#endif /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS diff --git a/src/tor/tor_crypto_compat.h b/src/tor/tor_crypto_compat.h index d912102..ec5bf7d 100644 --- a/src/tor/tor_crypto_compat.h +++ b/src/tor/tor_crypto_compat.h @@ -326,10 +326,8 @@ static inline const void* RAND_get_rand_method_compat(void) { #endif // USING_LIBRESSL || USING_LIBRESSL_3X -// SHA compatibility for Tor v3 operations -#if defined(USING_LIBRESSL) || defined(USING_LIBRESSL_3X) +// SHA3-256 compatibility for Tor v3 operations (needed for all OpenSSL versions) -// Ensure SHA3 functions are available for v3 onion address generation #include // SHA3-256 wrapper for onion address checksum calculation @@ -337,34 +335,34 @@ static inline int SHA3_256_compat(const unsigned char *data, size_t len, unsigne if (!data || !md) { return 0; } - + EVP_MD_CTX *ctx = EVP_MD_CTX_new(); if (!ctx) { return 0; } - + const EVP_MD *sha3_256 = EVP_sha3_256(); if (!sha3_256) { EVP_MD_CTX_free(ctx); return 0; } - + if (EVP_DigestInit_ex(ctx, sha3_256, NULL) != 1) { EVP_MD_CTX_free(ctx); return 0; } - + if (EVP_DigestUpdate(ctx, data, len) != 1) { EVP_MD_CTX_free(ctx); return 0; } - + unsigned int md_len; if (EVP_DigestFinal_ex(ctx, md, &md_len) != 1) { EVP_MD_CTX_free(ctx); return 0; } - + EVP_MD_CTX_free(ctx); return (md_len == 32) ? 1 : 0; // SHA3-256 should produce 32 bytes } @@ -373,8 +371,6 @@ static inline int SHA3_256_compat(const unsigned char *data, size_t len, unsigne #define SHA3_256(data, len, md) SHA3_256_compat(data, len, md) #endif -#endif // USING_LIBRESSL || USING_LIBRESSL_3X - // Ed25519 compatibility for Tor v3 key generation #if defined(USING_LIBRESSL) || defined(USING_LIBRESSL_3X) diff --git a/src/trianglesrpc.cpp b/src/trianglesrpc.cpp index 52da163..517161d 100644 --- a/src/trianglesrpc.cpp +++ b/src/trianglesrpc.cpp @@ -32,6 +32,7 @@ using namespace std; using namespace boost; using namespace boost::asio; using namespace json_spirit; +namespace fs = boost::filesystem; void ThreadRPCServer2(void* parg); @@ -566,15 +567,14 @@ bool ClientAllowed(const boost::asio::ip::address& address) { // Make sure that IPv4-compatible and IPv4-mapped IPv6 addresses are treated as IPv4 addresses if (address.is_v6() - && (address.to_v6().is_v4_compatible() - || address.to_v6().is_v4_mapped())) - return ClientAllowed(address.to_v6().to_v4()); + && address.to_v6().is_v4_mapped()) + return ClientAllowed(make_address_v4(boost::asio::ip::v4_mapped, address.to_v6())); if (address == asio::ip::address_v4::loopback() || address == asio::ip::address_v6::loopback() || (address.is_v4() // Check whether IPv4 addresses match 127.0.0.0/8 (loopback subnet) - && (address.to_v4().to_ulong() & 0xff000000) == 0x7f000000)) + && (address.to_v4().to_uint() & 0xff000000) == 0x7f000000)) return true; const string strAddress = address.to_string(); @@ -617,15 +617,15 @@ public: } bool connect(const std::string& server, const std::string& port) { - ip::tcp::resolver resolver(stream.get_io_service()); - ip::tcp::resolver::query query(server.c_str(), port.c_str()); - ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve(query); - ip::tcp::resolver::iterator end; + ip::tcp::resolver resolver(stream.get_executor()); + auto results = resolver.resolve(server, port); boost::system::error_code error = asio::error::host_not_found; - while (error && endpoint_iterator != end) + for (const auto& ep : results) { stream.lowest_layer().close(); - stream.lowest_layer().connect(*endpoint_iterator++, error); + stream.lowest_layer().connect(ep.endpoint(), error); + if (!error) + break; } if (error) return false; @@ -653,10 +653,10 @@ class AcceptedConnectionImpl : public AcceptedConnection { public: AcceptedConnectionImpl( - asio::io_service& io_service, + const boost::asio::any_io_executor& executor, ssl::context &context, bool fUseSSL) : - sslStream(io_service, context), + sslStream(executor, context), _d(sslStream, fUseSSL), _stream(_d) { @@ -723,7 +723,7 @@ static void RPCListen(boost::shared_ptr< basic_socket_acceptor* conn = new AcceptedConnectionImpl(acceptor->get_io_service(), context, fUseSSL); + AcceptedConnectionImpl* conn = new AcceptedConnectionImpl(acceptor->get_executor(), context, fUseSSL); acceptor->async_accept( conn->sslStream.lowest_layer(), @@ -817,25 +817,25 @@ void ThreadRPCServer2(void* parg) const bool fUseSSL = GetBoolArg("-rpcssl"); - asio::io_service io_service; + asio::io_context io_service; - ssl::context context(io_service, ssl::context::sslv23); + ssl::context context(ssl::context::sslv23); if (fUseSSL) { context.set_options(ssl::context::no_sslv2); - filesystem::path pathCertFile(GetArg("-rpcsslcertificatechainfile", "server.cert")); - if (!pathCertFile.is_complete()) pathCertFile = filesystem::path(GetDataDir()) / pathCertFile; - if (filesystem::exists(pathCertFile)) context.use_certificate_chain_file(pathCertFile.string()); + fs::path pathCertFile(GetArg("-rpcsslcertificatechainfile", "server.cert")); + if (!pathCertFile.is_absolute()) pathCertFile = fs::path(GetDataDir()) / pathCertFile; + if (fs::exists(pathCertFile)) context.use_certificate_chain_file(pathCertFile.string()); else printf("ThreadRPCServer ERROR: missing server certificate file %s\n", pathCertFile.string().c_str()); - filesystem::path pathPKFile(GetArg("-rpcsslprivatekeyfile", "server.pem")); - if (!pathPKFile.is_complete()) pathPKFile = filesystem::path(GetDataDir()) / pathPKFile; - if (filesystem::exists(pathPKFile)) context.use_private_key_file(pathPKFile.string(), ssl::context::pem); + fs::path pathPKFile(GetArg("-rpcsslprivatekeyfile", "server.pem")); + if (!pathPKFile.is_absolute()) pathPKFile = fs::path(GetDataDir()) / pathPKFile; + if (fs::exists(pathPKFile)) context.use_private_key_file(pathPKFile.string(), ssl::context::pem); else printf("ThreadRPCServer ERROR: missing server private key file %s\n", pathPKFile.string().c_str()); string strCiphers = GetArg("-rpcsslciphers", "TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH"); - SSL_CTX_set_cipher_list(context.impl(), strCiphers.c_str()); + SSL_CTX_set_cipher_list(context.native_handle(), strCiphers.c_str()); } // Try a dual IPv6/IPv4 socket, falling back to separate IPv4 and IPv6 sockets @@ -858,7 +858,7 @@ void ThreadRPCServer2(void* parg) acceptor->set_option(boost::asio::ip::v6_only(loopback), v6_only_error); acceptor->bind(endpoint); - acceptor->listen(socket_base::max_connections); + acceptor->listen(socket_base::max_listen_connections); RPCListen(acceptor, context, fUseSSL); // Cancel outstanding listen-requests for this acceptor when shutting down @@ -884,7 +884,7 @@ void ThreadRPCServer2(void* parg) acceptor->open(endpoint.protocol()); acceptor->set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); acceptor->bind(endpoint); - acceptor->listen(socket_base::max_connections); + acceptor->listen(socket_base::max_listen_connections); RPCListen(acceptor, context, fUseSSL); // Cancel outstanding listen-requests for this acceptor when shutting down @@ -1129,8 +1129,8 @@ Object CallRPC(const string& strMethod, const Array& params) // Connect to localhost bool fUseSSL = GetBoolArg("-rpcssl"); - asio::io_service io_service; - ssl::context context(io_service, ssl::context::sslv23); + asio::io_context io_service; + ssl::context context(ssl::context::sslv23); context.set_options(ssl::context::no_sslv2); asio::ssl::stream sslStream(io_service, context); SSLIOStreamDevice d(sslStream, fUseSSL); diff --git a/src/txdb-leveldb.cpp b/src/txdb-leveldb.cpp index 58320cb..3859da0 100644 --- a/src/txdb-leveldb.cpp +++ b/src/txdb-leveldb.cpp @@ -22,6 +22,7 @@ using namespace std; using namespace boost; +namespace fs = boost::filesystem; leveldb::DB *txdb; // global pointer for LevelDB object instance @@ -35,27 +36,27 @@ static leveldb::Options GetOptions() { void init_blockindex(leveldb::Options& options, bool fRemoveOld = false) { // First time init. - filesystem::path directory = GetDataDir() / "txleveldb"; + fs::path directory = GetDataDir() / "txleveldb"; if (fRemoveOld) { - filesystem::remove_all(directory); // remove directory + fs::remove_all(directory); // remove directory unsigned int nFile = 1; while (true) { - filesystem::path strBlockFile = GetDataDir() / strprintf("blk%04u.dat", nFile); + fs::path strBlockFile = GetDataDir() / strprintf("blk%04u.dat", nFile); // Break if no such file - if( !filesystem::exists( strBlockFile ) ) + if( !fs::exists( strBlockFile ) ) break; - filesystem::remove(strBlockFile); + fs::remove(strBlockFile); nFile++; } } - filesystem::create_directory(directory); + fs::create_directory(directory); printf("Opening LevelDB in %s\n", directory.string().c_str()); leveldb::Status status = leveldb::DB::Open(options, directory.string(), &txdb); if (!status.ok()) { diff --git a/src/ui_interface.h b/src/ui_interface.h index 7567877..2a83a02 100644 --- a/src/ui_interface.h +++ b/src/ui_interface.h @@ -8,6 +8,8 @@ #include #include +#include +using namespace boost::placeholders; #include diff --git a/src/util.cpp b/src/util.cpp index 5b3ac15..995ec7f 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1075,7 +1075,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) boost::filesystem::path GetConfigFile() { boost::filesystem::path pathConfigFile(GetArg("-conf", "triangles.conf")); - if (!pathConfigFile.is_complete()) pathConfigFile = GetDataDir(false) / pathConfigFile; + if (!pathConfigFile.is_absolute()) pathConfigFile = GetDataDir(false) / pathConfigFile; return pathConfigFile; } @@ -1106,7 +1106,7 @@ void ReadConfigFile(map& mapSettingsRet, boost::filesystem::path GetPidFile() { boost::filesystem::path pathPidFile(GetArg("-pid", "trianglesd.pid")); - if (!pathPidFile.is_complete()) pathPidFile = GetDataDir() / pathPidFile; + if (!pathPidFile.is_absolute()) pathPidFile = GetDataDir() / pathPidFile; return pathPidFile; } diff --git a/src/walletdb.cpp b/src/walletdb.cpp index aed93ae..8e18646 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -10,6 +10,7 @@ using namespace std; using namespace boost; +namespace fs = boost::filesystem; static uint64_t nAccountingEntryNumber = 0; @@ -608,20 +609,20 @@ bool BackupWallet(const CWallet& wallet, const string& strDest) bitdb.mapFileUseCount.erase(wallet.strWalletFile); // Copy wallet.dat - filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile; - filesystem::path pathDest(strDest); - if (filesystem::is_directory(pathDest)) + fs::path pathSrc = GetDataDir() / wallet.strWalletFile; + fs::path pathDest(strDest); + if (fs::is_directory(pathDest)) pathDest /= wallet.strWalletFile; try { #if BOOST_VERSION >= 104000 - filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists); + fs::copy_file(pathSrc, pathDest, fs::copy_options::overwrite_existing); #else - filesystem::copy_file(pathSrc, pathDest); + fs::copy_file(pathSrc, pathDest); #endif printf("copied wallet.dat to %s\n", pathDest.string().c_str()); return true; - } catch(const filesystem::filesystem_error &e) { + } catch(const fs::filesystem_error &e) { printf("error copying wallet.dat to %s - %s\n", pathDest.string().c_str(), e.what()); return false; } diff --git a/triangles-qt.pro b/triangles-qt.pro index 9696b40..210e4f3 100644 --- a/triangles-qt.pro +++ b/triangles-qt.pro @@ -3,7 +3,7 @@ TARGET = triangles-qt VERSION = 5.0.0.0 INCLUDEPATH += src src/json src/qt src/qt/plugins/mrichtexteditor -DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN __NO_SYSTEM_INCLUDES +DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN BOOST_BIND_GLOBAL_PLACEHOLDERS __NO_SYSTEM_INCLUDES CONFIG += no_include_pwd CONFIG += thread @@ -64,7 +64,7 @@ QMAKE_LFLAGS *= -fstack-protector-all --param ssp-buffer-size=1 # This can be enabled for Windows, when we switch to MinGW >= 4.4.x. } # for extra security on Windows: enable ASLR and DEP via GCC linker flags -win32:QMAKE_LFLAGS *= -Wl,--large-address-aware -static +win32:QMAKE_LFLAGS *= -static win32:QMAKE_LFLAGS += -static-libgcc -static-libstdc++ lessThan(QT_MAJOR_VERSION, 5): win32: QMAKE_LFLAGS *= -static @@ -89,7 +89,7 @@ contains(USE_UPNP, -) { count(USE_UPNP, 0) { USE_UPNP=1 } - DEFINES += USE_UPNP=$$USE_UPNP STATICLIB + DEFINES += USE_UPNP=$$USE_UPNP STATICLIB MINIUPNP_STATICLIB INCLUDEPATH += $$MINIUPNPC_INCLUDE_PATH LIBS += $$join(MINIUPNPC_LIB_PATH,,-L,) -lminiupnpc win32:LIBS += -liphlpapi @@ -312,83 +312,9 @@ SOURCES += src/qt/triangles.cpp src/qt/trianglesgui.cpp \ src/qt/aboutdialog.cpp \ src/qt/editaddressdialog.cpp \ src/qt/trianglesaddressvalidator.cpp \ - src/tor/address.c \ - src/tor/addressmap.c \ - src/tor/aes.c \ - src/tor/backtrace.c \ - src/tor/buffers.c \ - src/tor/channel.c \ - src/tor/channeltls.c \ - src/tor/circpathbias.c \ - src/tor/circuitbuild.c \ - src/tor/circuitlist.c \ - src/tor/circuitmux.c \ - src/tor/circuitmux_ewma.c \ - src/tor/circuitstats.c \ - src/tor/circuituse.c \ - src/tor/command.c \ - src/tor/compat.c \ - src/tor/compat_libevent.c \ - src/tor/config.c \ - src/tor/config_codedigest.c \ - src/tor/confparse.c \ - src/tor/connection.c \ - src/tor/connection_edge.c \ - src/tor/connection_or.c \ - src/tor/container.c \ - src/tor/control.c \ - src/tor/cpuworker.c \ - src/tor/crypto.c \ - src/tor/crypto_curve25519.c \ - src/tor/crypto_format.c \ - src/tor/curve25519-donna.c \ - src/tor/di_ops.c \ - src/tor/directory.c \ - src/tor/dirserv.c \ - src/tor/dirvote.c \ - src/tor/dns.c \ - src/tor/dnsserv.c \ - src/tor/entrynodes.c \ - src/tor/ext_orport.c \ - src/tor/fp_pair.c \ - src/tor/geoip.c \ - src/tor/hibernate.c \ - src/tor/log.c \ - src/tor/memarea.c \ - src/tor/mempool.c \ - src/tor/microdesc.c \ - src/tor/networkstatus.c \ - src/tor/nodelist.c \ - src/tor/onion.c \ - src/tor/onion_fast.c \ - src/tor/onion_main.c \ - src/tor/onion_ntor.c \ - src/tor/onion_tap.c \ - src/tor/policies.c \ + # Old embedded Tor v2 client removed - incompatible with OpenSSL 3.x + # Tor v3 onion services handled by onion_v3.cpp via external Tor/SOCKS5 src/tor/anonymize.cpp \ - src/tor/procmon.c \ - src/tor/reasons.c \ - src/tor/relay.c \ - src/tor/rendclient.c \ - src/tor/rendcommon.c \ - src/tor/rendmid.c \ - src/tor/rendservice.c \ - src/tor/rephist.c \ - src/tor/replaycache.c \ - src/tor/router.c \ - src/tor/routerlist.c \ - src/tor/routerparse.c \ - src/tor/routerset.c \ - src/tor/sandbox.c \ - src/tor/statefile.c \ - src/tor/status.c \ - src/tor/strlcat.c \ - src/tor/strlcpy.c \ - src/tor/tor_util.c \ - src/tor/torgzip.c \ - src/tor/tortls.c \ - src/tor/transports.c \ - src/tor/util_codedigest.c \ src/alert.cpp \ src/version.cpp \ src/sync.cpp \ @@ -593,9 +519,9 @@ LIBS += $$join(BOOST_LIB_PATH,,-L,) \ LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX LIBS += -levent -lz # -lgdi32 has to happen after -lcrypto (see #681) -windows:LIBS += -lws2_32 -lshlwapi -lmswsock -lole32 -loleaut32 -luuid -lgdi32 +windows:LIBS += -lws2_32 -lshlwapi -lmswsock -lole32 -loleaut32 -luuid -lgdi32 -lcrypt32 -LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX +LIBS += -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX windows:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX contains(RELEASE, 1) {