diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-07-14 11:34:47 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-07-14 11:35:30 +0200 |
commit | 6513a9f7033737458735305a08606280d6d0d33c (patch) | |
tree | 79b0a23420171992d8f4da85dfabd186670cc9ac /src/key.cpp | |
parent | d4bed1a6d32e415b5d460bf60217d4950d28165e (diff) | |
parent | 4eedf4ffeea6a3734f245f785a8d82d69634dccd (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/key.cpp')
-rw-r--r-- | src/key.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/key.cpp b/src/key.cpp index 3c4fa77e72..a253f8666a 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -1,11 +1,11 @@ -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "key.h" #include "crypto/sha2.h" -#include <openssl/rand.h> +#include "random.h" #ifdef USE_SECP256K1 #include <secp256k1.h> @@ -194,7 +194,7 @@ public: if (d2i_ECPrivateKey(&pkey, &pbegin, privkey.size())) { if(fSkipCheck) return true; - + // d2i_ECPrivateKey returns true if parsing succeeds. // This doesn't necessarily mean the key is valid. if (EC_KEY_check_key(pkey)) @@ -412,7 +412,7 @@ bool CKey::CheckSignatureElement(const unsigned char *vch, int len, bool half) { void CKey::MakeNewKey(bool fCompressedIn) { do { - RAND_bytes(vch, sizeof(vch)); + GetRandBytes(vch, sizeof(vch)); } while (!Check(vch)); fValid = true; fCompressed = fCompressedIn; @@ -745,5 +745,3 @@ bool ECC_InitSanityCheck() { return true; #endif } - - |