aboutsummaryrefslogtreecommitdiff
path: root/src/key.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/key.cpp
parent2ee918d1214d0027285bb7558c237888d6ee175b (diff)
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/key.cpp')
-rw-r--r--src/key.cpp10
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
}
-
-