aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2014-06-24 14:27:32 +0200
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2014-07-09 09:42:18 +0200
commit001a53d7427dcbcceef3c6754d9cca19df6dafa1 (patch)
treec599b2ecf2358276c8b86524348954b06c5757c4 /src/wallet.cpp
parent2ee918d1214d0027285bb7558c237888d6ee175b (diff)
downloadbitcoin-001a53d7427dcbcceef3c6754d9cca19df6dafa1.tar.xz
add GetRandBytes() as wrapper for RAND_bytes()
- add a small wrapper in util around RAND_bytes() and replace with GetRandBytes() in the code to log errors from calling RAND_bytes() - remove OpenSSL header rand.h where no longer needed
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r--src/wallet.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index a54494f935..d61f01d096 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -12,7 +12,6 @@
#include "timedata.h"
#include <boost/algorithm/string/replace.hpp>
-#include <openssl/rand.h>
using namespace std;
@@ -384,13 +383,15 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
RandAddSeedPerfmon();
vMasterKey.resize(WALLET_CRYPTO_KEY_SIZE);
- RAND_bytes(&vMasterKey[0], WALLET_CRYPTO_KEY_SIZE);
+ if (!GetRandBytes(&vMasterKey[0], WALLET_CRYPTO_KEY_SIZE))
+ return false;
CMasterKey kMasterKey;
-
RandAddSeedPerfmon();
+
kMasterKey.vchSalt.resize(WALLET_CRYPTO_SALT_SIZE);
- RAND_bytes(&kMasterKey.vchSalt[0], WALLET_CRYPTO_SALT_SIZE);
+ if (!GetRandBytes(&kMasterKey.vchSalt[0], WALLET_CRYPTO_SALT_SIZE))
+ return false;
CCrypter crypter;
int64_t nStartTime = GetTimeMillis();