diff options
author | Ilya Kitaev <mbg033@gmail.com> | 2016-05-27 11:33:08 +0300 |
---|---|---|
committer | Ilya Kitaev <mbg033@gmail.com> | 2016-05-27 11:33:08 +0300 |
commit | bc4584c1ff6dc54653c780864f36a867855c992e (patch) | |
tree | f4819579e573bbd48daad96fc963d1e8583fb473 /src/crypto/crypto.h | |
parent | installing wallet_api header (diff) | |
parent | Merge pull request #842 (diff) | |
download | monero-bc4584c1ff6dc54653c780864f36a867855c992e.tar.xz |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to '')
-rw-r--r-- | src/crypto/crypto.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/crypto/crypto.h b/src/crypto/crypto.h index 883aa521a..fa55c2aab 100644 --- a/src/crypto/crypto.h +++ b/src/crypto/crypto.h @@ -117,13 +117,20 @@ namespace crypto { const public_key *const *, std::size_t, const signature *); }; + /* Generate N random bytes + */ + inline void rand(size_t N, uint8_t *bytes) { + boost::lock_guard<boost::mutex> lock(random_lock); + generate_random_bytes_not_thread_safe(N, bytes); + } + /* Generate a value filled with random bytes. */ template<typename T> typename std::enable_if<std::is_pod<T>::value, T>::type rand() { typename std::remove_cv<T>::type res; boost::lock_guard<boost::mutex> lock(random_lock); - generate_random_bytes(sizeof(T), &res); + generate_random_bytes_not_thread_safe(sizeof(T), &res); return res; } |