Skip to content

Commit

Permalink
Revert NACK'd fixes for 0.7.2.
Browse files Browse the repository at this point in the history
This reverts commits:
- 220de9a Qt: small header changes / fixes
- caeafd1 fix some double-spaces in strings
- deb9f10 fix some double-spaces in strings
- 65cee0b don't use memset() in privacy/security relevant code parts
- ff31f1f don't use memset() in privacy/security relevant code parts
  • Loading branch information
luke-jr committed Nov 16, 2012
1 parent ab67ec8 commit c07e181
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 28 deletions.
6 changes: 2 additions & 4 deletions src/base58.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

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

#include "bignum.h"
#include "key.h"
#include "script.h"
Expand Down Expand Up @@ -192,7 +190,7 @@ class CBase58Data
{
// 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)
Expand Down Expand Up @@ -223,7 +221,7 @@ class CBase58Data
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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/crypter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/crypter.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class CCrypter

void CleanKey()
{
OPENSSL_cleanse(chKey, sizeof(chKey));
OPENSSL_cleanse(chIV, sizeof(chIV));
memset(&chKey, 0, sizeof chKey);
memset(&chIV, 0, sizeof chIV);
fKeySet = false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/netbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/qt/addressbookpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ private slots:
void verifyMessage(QString addr);
};

#endif // ADDRESSBOOKPAGE_H
#endif // ADDRESSBOOKDIALOG_H
6 changes: 3 additions & 3 deletions src/qt/bitcoinamountfield.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef BITCOINAMOUNTFIELD_H
#define BITCOINAMOUNTFIELD_H
#ifndef BITCOINFIELD_H
#define BITCOINFIELD_H

#include <QWidget>

Expand Down Expand Up @@ -57,4 +57,4 @@ private slots:
};


#endif // BITCOINAMOUNTFIELD_H
#endif // BITCOINFIELD_H
8 changes: 5 additions & 3 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,4 @@ private slots:
void toggleHidden();
};

#endif // BITCOINGUI_H
#endif
2 changes: 1 addition & 1 deletion src/qt/forms/sendcoinsentry.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/macdockiconhandler.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef MACDOCKICONHANDLER_H
#define MACDOCKICONHANDLER_H

#include <QObject>
#include <QtCore/QObject>

class QMenu;
class QIcon;
Expand Down
3 changes: 2 additions & 1 deletion src/qt/transactiontablemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,5 @@ public slots:
friend class TransactionTablePriv;
};

#endif // TRANSACTIONTABLEMODEL_H
#endif

2 changes: 1 addition & 1 deletion src/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object>
Expand Down
2 changes: 0 additions & 2 deletions src/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#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>
Expand Down
2 changes: 1 addition & 1 deletion src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1333,17 +1333,17 @@ 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;
}
if (!CreateTransaction(scriptPubKey, nValue, wtxNew, reservekey, nFeeRequired))
{
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;
}
Expand All @@ -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 "";
}
Expand Down

0 comments on commit c07e181

Please sign in to comment.