aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-07-14 11:34:47 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-07-14 11:35:30 +0200
commit6513a9f7033737458735305a08606280d6d0d33c (patch)
tree79b0a23420171992d8f4da85dfabd186670cc9ac /src/wallet.cpp
parentd4bed1a6d32e415b5d460bf60217d4950d28165e (diff)
parent4eedf4ffeea6a3734f245f785a8d82d69634dccd (diff)
Merge pull request #4400
4eedf4f make RandAddSeed() use OPENSSL_cleanse() (Philip Kaufmann) 6354935 move rand functions from util to new random.h/.cpp (Philip Kaufmann) 001a53d add GetRandBytes() as wrapper for RAND_bytes() (Philip Kaufmann)
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 560cbc10b9..8d27da9d40 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();