diff options
author | lloyd <[email protected]> | 2011-07-12 11:52:39 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-07-12 11:52:39 +0000 |
commit | 9e84dbf6c6ee9297f2a707f49d1cf175b6e149a5 (patch) | |
tree | e93fc28388c762d11bae0a52edcc17576a2ae1f6 /src/libstate/global_rng.cpp | |
parent | 82e218500e6f305d02feecc000b43a5d9448e11a (diff) | |
parent | dcc7e959eff557811c3cf414adde096285821816 (diff) |
propagate from branch 'net.randombit.botan' (head 23a326fa36a31dd39347a8864e1f5740669a905e)
to branch 'net.randombit.botan.cxx11' (head 9d3ac8dd45f7673c85dca41968e7750acc90bdff)
Diffstat (limited to 'src/libstate/global_rng.cpp')
-rw-r--r-- | src/libstate/global_rng.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/libstate/global_rng.cpp b/src/libstate/global_rng.cpp index a73924213..7968613c9 100644 --- a/src/libstate/global_rng.cpp +++ b/src/libstate/global_rng.cpp @@ -6,7 +6,6 @@ */ #include <botan/libstate.h> -#include <botan/internal/mutex.h> #if defined(BOTAN_HAS_RANDPOOL) #include <botan/randpool.h> @@ -107,60 +106,60 @@ class Serialized_PRNG : public RandomNumberGenerator public: void randomize(byte out[], size_t len) { - Mutex_Holder lock(mutex); + std::lock_guard<std::mutex> lock(mutex); rng->randomize(out, len); } bool is_seeded() const { - Mutex_Holder lock(mutex); + std::lock_guard<std::mutex> lock(mutex); return rng->is_seeded(); } void clear() { - Mutex_Holder lock(mutex); + std::lock_guard<std::mutex> lock(mutex); rng->clear(); } std::string name() const { - Mutex_Holder lock(mutex); + std::lock_guard<std::mutex> lock(mutex); return rng->name(); } void reseed(size_t poll_bits) { - Mutex_Holder lock(mutex); + std::lock_guard<std::mutex> lock(mutex); rng->reseed(poll_bits); } void add_entropy_source(EntropySource* es) { - Mutex_Holder lock(mutex); + std::lock_guard<std::mutex> lock(mutex); rng->add_entropy_source(es); } void add_entropy(const byte in[], size_t len) { - Mutex_Holder lock(mutex); + std::lock_guard<std::mutex> lock(mutex); rng->add_entropy(in, len); } // We do not own the mutex; Library_State does - Serialized_PRNG(RandomNumberGenerator* r, Mutex* m) : + Serialized_PRNG(RandomNumberGenerator* r, std::mutex& m) : mutex(m), rng(r) {} ~Serialized_PRNG() { delete rng; } private: - Mutex* mutex; + std::mutex& mutex; RandomNumberGenerator* rng; }; } RandomNumberGenerator* Library_State::make_global_rng(Algorithm_Factory& af, - Mutex* mutex) + std::mutex& mutex) { RandomNumberGenerator* rng = 0; |