diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2012-11-14 21:26:56 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-11-14 21:26:56 +0000 |
commit | f1a9aad7893173b0351ad32e684dad6f31598210 (patch) | |
tree | 21373860cc7f22da72e28d97263813f53e450920 /src | |
parent | 8b11b682f14f20cf2935c4a5abb4dbd3d508e46e (diff) | |
parent | 8045273a015cc72857ca168b0ad224b3acbbaf8a (diff) |
Merge branch '0.6.0.x' into 0.6.x
Conflicts:
src/init.cpp
src/main.cpp
src/serialize.h
Diffstat (limited to 'src')
-rw-r--r-- | src/base58.h | 6 | ||||
-rw-r--r-- | src/bitcoinrpc.cpp | 2 | ||||
-rw-r--r-- | src/crypter.cpp | 4 | ||||
-rw-r--r-- | src/crypter.h | 4 | ||||
-rw-r--r-- | src/main.cpp | 3 | ||||
-rw-r--r-- | src/netbase.cpp | 2 | ||||
-rw-r--r-- | src/qt/addressbookpage.h | 2 | ||||
-rw-r--r-- | src/qt/askpassphrasedialog.cpp | 4 | ||||
-rw-r--r-- | src/qt/bitcoin.cpp | 4 | ||||
-rw-r--r-- | src/qt/bitcoinamountfield.h | 6 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 8 | ||||
-rw-r--r-- | src/qt/bitcoingui.h | 2 | ||||
-rw-r--r-- | src/qt/forms/sendcoinsentry.ui | 2 | ||||
-rw-r--r-- | src/qt/macdockiconhandler.h | 2 | ||||
-rw-r--r-- | src/qt/qtipcserver.cpp | 2 | ||||
-rw-r--r-- | src/qt/transactiontablemodel.h | 3 | ||||
-rw-r--r-- | src/serialize.h | 2 | ||||
-rw-r--r-- | src/util.cpp | 2 | ||||
-rw-r--r-- | src/wallet.cpp | 8 |
19 files changed, 35 insertions, 33 deletions
diff --git a/src/base58.h b/src/base58.h index 78cb40f11d..ff0dad791c 100644 --- a/src/base58.h +++ b/src/base58.h @@ -17,6 +17,8 @@ #include <string> #include <vector> +#include <openssl/crypto.h> // for OPENSSL_cleanse() + #include "bignum.h" #include "key.h" @@ -189,7 +191,7 @@ protected: { // zero the memory, as it may contain sensitive data if (!vchData.empty()) - memset(&vchData[0], 0, vchData.size()); + OPENSSL_cleanse(&vchData[0], vchData.size()); } void SetData(int nVersionIn, const void* pdata, size_t nSize) @@ -220,7 +222,7 @@ public: vchData.resize(vchTemp.size() - 1); if (!vchData.empty()) memcpy(&vchData[0], &vchTemp[1], vchData.size()); - memset(&vchTemp[0], 0, vchTemp.size()); + OPENSSL_cleanse(&vchTemp[0], vchData.size()); return true; } diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index afd249578b..d737657928 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -1708,7 +1708,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."; } diff --git a/src/crypter.cpp b/src/crypter.cpp index 411a1ee4c1..ca4618886d 100644 --- a/src/crypter.cpp +++ b/src/crypter.cpp @@ -30,8 +30,8 @@ bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::v if (i != (int)WALLET_CRYPTO_KEY_SIZE) { - memset(&chKey, 0, sizeof chKey); - memset(&chIV, 0, sizeof chIV); + OPENSSL_cleanse(chKey, sizeof(chKey)); + OPENSSL_cleanse(chIV, sizeof(chIV)); return false; } diff --git a/src/crypter.h b/src/crypter.h index d1bdb92c91..f46c32a227 100644 --- a/src/crypter.h +++ b/src/crypter.h @@ -76,8 +76,8 @@ public: void CleanKey() { - memset(&chKey, 0, sizeof chKey); - memset(&chIV, 0, sizeof chIV); + OPENSSL_cleanse(chKey, sizeof(chKey)); + OPENSSL_cleanse(chIV, sizeof(chIV)); munlock(&chKey, sizeof chKey); munlock(&chIV, sizeof chIV); fKeySet = false; diff --git a/src/main.cpp b/src/main.cpp index af78036b0b..9f5312a7ea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3260,7 +3260,7 @@ uint64 nLastBlockSize = 0; CBlock* CreateNewBlock(CReserveKey& reservekey) { - CBlockIndex* pindexPrev = pindexBest; + CBlockIndex* pindexPrev; // Create new block auto_ptr<CBlock> pblock(new CBlock()); @@ -3281,6 +3281,7 @@ CBlock* CreateNewBlock(CReserveKey& reservekey) int64 nFees = 0; { LOCK2(cs_main, mempool.cs); + pindexPrev = pindexBest; CTxDB txdb("r"); // Priority order to process transactions diff --git a/src/netbase.cpp b/src/netbase.cpp index f790f1a5de..81866ad1bc 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -297,7 +297,7 @@ bool ConnectSocket(const CService &addrDest, SOCKET& hSocketRet, int nTimeout) void CNetAddr::Init() { - memset(ip, 0, 16); + memset(ip, 0, sizeof(ip)); } void CNetAddr::SetIP(const CNetAddr& ipIn) diff --git a/src/qt/addressbookpage.h b/src/qt/addressbookpage.h index b2cf2db979..125ba8559d 100644 --- a/src/qt/addressbookpage.h +++ b/src/qt/addressbookpage.h @@ -69,4 +69,4 @@ private slots: void onEditAction(); }; -#endif // ADDRESSBOOKDIALOG_H +#endif // ADDRESSBOOKPAGE_H diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index cae021c982..7b9d4912ff 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -222,7 +222,7 @@ bool AskPassphraseDialog::event(QEvent *event) return QWidget::event(event); } -bool AskPassphraseDialog::eventFilter(QObject *, QEvent *event) +bool AskPassphraseDialog::eventFilter(QObject *object, QEvent *event) { /* Detect Caps Lock. * There is no good OS-independent way to check a key state in Qt, but we @@ -245,5 +245,5 @@ bool AskPassphraseDialog::eventFilter(QObject *, QEvent *event) } } } - return false; + return QDialog::eventFilter(object, event); } diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 5acfd1ca74..1e7c582684 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -134,7 +134,7 @@ static void handleRunawayException(std::exception *e) #ifndef BITCOIN_QT_TEST int main(int argc, char *argv[]) { -#if !defined(MAC_OSX) && !defined(WIN32) +#if !defined(MAC_OSX) && !defined(WIN32) && !defined(__FreeBSD__) // TODO: implement qtipcserver.cpp for Mac and Windows // Do this early as we don't want to bother initializing if we are just calling IPC @@ -264,7 +264,7 @@ int main(int argc, char *argv[]) // Place this here as guiref has to be defined if we don't want to lose URIs ipcInit(); -#if !defined(MAC_OSX) && !defined(WIN32) +#if !defined(MAC_OSX) && !defined(WIN32) && !defined(__FreeBSD__) // TODO: implement qtipcserver.cpp for Mac and Windows // Check for URI in argv diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h index 66792e00a9..4797c4c882 100644 --- a/src/qt/bitcoinamountfield.h +++ b/src/qt/bitcoinamountfield.h @@ -1,5 +1,5 @@ -#ifndef BITCOINFIELD_H -#define BITCOINFIELD_H +#ifndef BITCOINAMOUNTFIELD_H +#define BITCOINAMOUNTFIELD_H #include <QWidget> @@ -57,4 +57,4 @@ private slots: }; -#endif // BITCOINFIELD_H +#endif // BITCOINAMOUNTFIELD_H diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index d9fcbd9390..d9754b2008 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -629,11 +629,9 @@ 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("Sending..."), strMessage, QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Yes); diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index f66c420d53..1db43e4ad6 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -170,4 +170,4 @@ private slots: void toggleHidden(); }; -#endif +#endif // BITCOINGUI_H diff --git a/src/qt/forms/sendcoinsentry.ui b/src/qt/forms/sendcoinsentry.ui index 22a3f8fdc6..10bf603de8 100644 --- a/src/qt/forms/sendcoinsentry.ui +++ b/src/qt/forms/sendcoinsentry.ui @@ -90,7 +90,7 @@ <item> <widget class="QValidatedLineEdit" name="payTo"> <property name="toolTip"> - <string>The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</string> + <string>The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</string> </property> <property name="maxLength"> <number>34</number> diff --git a/src/qt/macdockiconhandler.h b/src/qt/macdockiconhandler.h index d02c148f91..d39c780233 100644 --- a/src/qt/macdockiconhandler.h +++ b/src/qt/macdockiconhandler.h @@ -1,7 +1,7 @@ #ifndef MACDOCKICONHANDLER_H #define MACDOCKICONHANDLER_H -#include <QtCore/QObject> +#include <QObject> class QMenu; class QIcon; diff --git a/src/qt/qtipcserver.cpp b/src/qt/qtipcserver.cpp index 102ac0ff4e..8a7bdabbfc 100644 --- a/src/qt/qtipcserver.cpp +++ b/src/qt/qtipcserver.cpp @@ -46,7 +46,7 @@ void ipcThread(void* parg) void ipcInit() { -#ifdef MAC_OSX +#if defined(MAC_OSX) || defined(__FreeBSD__) // TODO: implement bitcoin: URI handling the Mac Way return; #endif diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h index 3efeaa61bc..bcd35b80e6 100644 --- a/src/qt/transactiontablemodel.h +++ b/src/qt/transactiontablemodel.h @@ -80,5 +80,4 @@ public slots: friend class TransactionTablePriv; }; -#endif - +#endif // TRANSACTIONTABLEMODEL_H diff --git a/src/serialize.h b/src/serialize.h index 349a40bfe8..3d01199275 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -14,6 +14,8 @@ #include <cstring> #include <cstdio> +#include <openssl/crypto.h> // for OPENSSL_cleanse() + #include <boost/type_traits/is_fundamental.hpp> #include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple_comparison.hpp> diff --git a/src/util.cpp b/src/util.cpp index 8a2e0d65db..07319f0df0 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -149,7 +149,7 @@ void RandAddSeedPerfmon() if (ret == ERROR_SUCCESS) { RAND_add(pdata, nSize, nSize/100.0); - memset(pdata, 0, nSize); + OPENSSL_cleanse(pdata, nSize); printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M", GetTime()).c_str(), nSize); } #endif diff --git a/src/wallet.cpp b/src/wallet.cpp index 3c09f3ce3e..c115a53340 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1216,7 +1216,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; } @@ -1224,9 +1224,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; } @@ -1235,7 +1235,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."); MainFrameRepaint(); return ""; |