diff options
author | luigi1111 <luigi1111w@gmail.com> | 2019-08-27 15:14:15 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2019-08-27 15:14:15 -0500 |
commit | 8f6f674753bae7494e1ee4569004947d47a4e983 (patch) | |
tree | 454eabd74a6fa1b9de32feafd8fedd21c0d731e9 /src/crypto/crypto.cpp | |
parent | Merge pull request #5559 (diff) | |
parent | wallet: add --extra-entropy command line flag (diff) | |
download | monero-8f6f674753bae7494e1ee4569004947d47a4e983.tar.xz |
Merge pull request #5609
1dc3b1a wallet: add --extra-entropy command line flag (moneromooo-monero)
Diffstat (limited to 'src/crypto/crypto.cpp')
-rw-r--r-- | src/crypto/crypto.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/crypto/crypto.cpp b/src/crypto/crypto.cpp index d4b2a22bc..0ec992de9 100644 --- a/src/crypto/crypto.cpp +++ b/src/crypto/crypto.cpp @@ -88,13 +88,24 @@ namespace crypto { return &reinterpret_cast<const unsigned char &>(scalar); } - void generate_random_bytes_thread_safe(size_t N, uint8_t *bytes) + boost::mutex &get_random_lock() { static boost::mutex random_lock; - boost::lock_guard<boost::mutex> lock(random_lock); + return random_lock; + } + + void generate_random_bytes_thread_safe(size_t N, uint8_t *bytes) + { + boost::lock_guard<boost::mutex> lock(get_random_lock()); generate_random_bytes_not_thread_safe(N, bytes); } + void add_extra_entropy_thread_safe(const void *ptr, size_t bytes) + { + boost::lock_guard<boost::mutex> lock(get_random_lock()); + add_extra_entropy_not_thread_safe(ptr, bytes); + } + static inline bool less32(const unsigned char *k0, const unsigned char *k1) { for (int n = 31; n >= 0; --n) |