From c07e181cca7c98898573716b7cce6e6ba26a8146 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 16 Nov 2012 19:36:13 +0000 Subject: [PATCH] Revert NACK'd fixes for 0.7.2. This reverts commits: - 220de9aafbdb76fa620531fc5c0b01ffa6616d7b Qt: small header changes / fixes - caeafd1bd1b217276005c6bb422136f379d881cf fix some double-spaces in strings - deb9f100a04dbb9c25d6ba320eba4c653a2f5423 fix some double-spaces in strings - 65cee0bbbdea49c08bc84be7824ab004cc19f57e don't use memset() in privacy/security relevant code parts - ff31f1fa10e2062465520ad8a3ff846c23b7a96f don't use memset() in privacy/security relevant code parts --- src/base58.h | 6 ++---- src/crypter.cpp | 4 ++-- src/crypter.h | 4 ++-- src/netbase.cpp | 2 +- src/qt/addressbookpage.h | 2 +- src/qt/bitcoinamountfield.h | 6 +++--- src/qt/bitcoingui.cpp | 8 +++++--- src/qt/bitcoingui.h | 2 +- src/qt/forms/sendcoinsentry.ui | 2 +- src/qt/macdockiconhandler.h | 2 +- src/qt/transactiontablemodel.h | 3 ++- src/rpcwallet.cpp | 2 +- src/serialize.h | 2 -- src/util.cpp | 2 +- src/wallet.cpp | 8 ++++---- 15 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/base58.h b/src/base58.h index 309d35f5..9dfea86f 100644 --- a/src/base58.h +++ b/src/base58.h @@ -17,8 +17,6 @@ #include #include -#include // for OPENSSL_cleanse() - #include "bignum.h" #include "key.h" #include "script.h" @@ -192,7 +190,7 @@ protected: { // zero the memory, as it may contain sensitive data if (!vchData.empty()) - OPENSSL_cleanse(&vchData[0], vchData.size()); + memset(&vchData[0], 0, vchData.size()); } void SetData(int nVersionIn, const void* pdata, size_t nSize) @@ -223,7 +221,7 @@ public: vchData.resize(vchTemp.size() - 1); if (!vchData.empty()) memcpy(&vchData[0], &vchTemp[1], vchData.size()); - OPENSSL_cleanse(&vchTemp[0], vchData.size()); + memset(&vchTemp[0], 0, vchTemp.size()); return true; } diff --git a/src/crypter.cpp b/src/crypter.cpp index a2b62a87..181b8fa0 100644 --- a/src/crypter.cpp +++ b/src/crypter.cpp @@ -24,8 +24,8 @@ bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::v if (i != (int)WALLET_CRYPTO_KEY_SIZE) { - OPENSSL_cleanse(chKey, sizeof(chKey)); - OPENSSL_cleanse(chIV, sizeof(chIV)); + memset(&chKey, 0, sizeof chKey); + memset(&chIV, 0, sizeof chIV); return false; } diff --git a/src/crypter.h b/src/crypter.h index 6f75170b..04538a3f 100644 --- a/src/crypter.h +++ b/src/crypter.h @@ -76,8 +76,8 @@ public: void CleanKey() { - OPENSSL_cleanse(chKey, sizeof(chKey)); - OPENSSL_cleanse(chIV, sizeof(chIV)); + memset(&chKey, 0, sizeof chKey); + memset(&chIV, 0, sizeof chIV); fKeySet = false; } diff --git a/src/netbase.cpp b/src/netbase.cpp index f8efacbb..95d64939 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -548,7 +548,7 @@ bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest void CNetAddr::Init() { - memset(ip, 0, sizeof(ip)); + memset(ip, 0, 16); } void CNetAddr::SetIP(const CNetAddr& ipIn) diff --git a/src/qt/addressbookpage.h b/src/qt/addressbookpage.h index f7d177c5..df874869 100644 --- a/src/qt/addressbookpage.h +++ b/src/qt/addressbookpage.h @@ -82,4 +82,4 @@ signals: void verifyMessage(QString addr); }; -#endif // ADDRESSBOOKPAGE_H +#endif // ADDRESSBOOKDIALOG_H diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h index 4797c4c8..66792e00 100644 --- a/src/qt/bitcoinamountfield.h +++ b/src/qt/bitcoinamountfield.h @@ -1,5 +1,5 @@ -#ifndef BITCOINAMOUNTFIELD_H -#define BITCOINAMOUNTFIELD_H +#ifndef BITCOINFIELD_H +#define BITCOINFIELD_H #include @@ -57,4 +57,4 @@ private slots: }; -#endif // BITCOINAMOUNTFIELD_H +#endif // BITCOINFIELD_H diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 0a99f163..19a6a65a 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -622,9 +622,11 @@ void BitcoinGUI::closeEvent(QCloseEvent *event) void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee) { - QString strMessage = tr("This transaction is over the size limit. You can still send it for a fee of %1, " - "which goes to the nodes that process your transaction and helps to support the network. " - "Do you want to pay the fee?").arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, nFeeRequired)); + QString strMessage = + tr("This transaction is over the size limit. You can still send it for a fee of %1, " + "which goes to the nodes that process your transaction and helps to support the network. " + "Do you want to pay the fee?").arg( + BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, nFeeRequired)); QMessageBox::StandardButton retval = QMessageBox::question( this, tr("Confirm transaction fee"), strMessage, QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Yes); diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 6ebf4496..c67e887c 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -176,4 +176,4 @@ private slots: void toggleHidden(); }; -#endif // BITCOINGUI_H +#endif diff --git a/src/qt/forms/sendcoinsentry.ui b/src/qt/forms/sendcoinsentry.ui index 10bf603d..22a3f8fd 100644 --- a/src/qt/forms/sendcoinsentry.ui +++ b/src/qt/forms/sendcoinsentry.ui @@ -90,7 +90,7 @@ - The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L) + The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L) 34 diff --git a/src/qt/macdockiconhandler.h b/src/qt/macdockiconhandler.h index dd85e0c3..2092fb26 100644 --- a/src/qt/macdockiconhandler.h +++ b/src/qt/macdockiconhandler.h @@ -1,7 +1,7 @@ #ifndef MACDOCKICONHANDLER_H #define MACDOCKICONHANDLER_H -#include +#include class QMenu; class QIcon; diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h index b0687d53..fd321ce2 100644 --- a/src/qt/transactiontablemodel.h +++ b/src/qt/transactiontablemodel.h @@ -81,4 +81,5 @@ public slots: friend class TransactionTablePriv; }; -#endif // TRANSACTIONTABLEMODEL_H +#endif + diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 65c5523c..9e914f33 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -1396,7 +1396,7 @@ Value encryptwallet(const Array& params, bool fHelp) // slack space in .dat files; that is bad if the old data is // unencrypted private keys. So: StartShutdown(); - return "wallet encrypted; Bitcoin server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup."; + return "wallet encrypted; Bitcoin server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup."; } class DescribeAddressVisitor : public boost::static_visitor diff --git a/src/serialize.h b/src/serialize.h index 5c6337c3..63df3160 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -14,8 +14,6 @@ #include #include -#include // for OPENSSL_cleanse() - #include #include #include diff --git a/src/util.cpp b/src/util.cpp index 6072ec5d..8b08827d 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -155,7 +155,7 @@ void RandAddSeedPerfmon() if (ret == ERROR_SUCCESS) { RAND_add(pdata, nSize, nSize/100.0); - OPENSSL_cleanse(pdata, nSize); + memset(pdata, 0, nSize); printf("RandAddSeed() %lu bytes\n", nSize); } #endif diff --git a/src/wallet.cpp b/src/wallet.cpp index 5fceea76..3e3d5eac 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1333,7 +1333,7 @@ string CWallet::SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, if (IsLocked()) { - string strError = _("Error: Wallet locked, unable to create transaction."); + string strError = _("Error: Wallet locked, unable to create transaction "); printf("SendMoney() : %s", strError.c_str()); return strError; } @@ -1341,9 +1341,9 @@ string CWallet::SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, { string strError; if (nValue + nFeeRequired > GetBalance()) - strError = strprintf(_("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds."), FormatMoney(nFeeRequired).c_str()); + strError = strprintf(_("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds "), FormatMoney(nFeeRequired).c_str()); else - strError = _("Error: Transaction creation failed."); + strError = _("Error: Transaction creation failed "); printf("SendMoney() : %s", strError.c_str()); return strError; } @@ -1352,7 +1352,7 @@ string CWallet::SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, return "ABORTED"; if (!CommitTransaction(wtxNew, reservekey)) - return _("Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."); + return _("Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."); return ""; }