aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/global_rng.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstate/global_rng.cpp')
-rw-r--r--src/libstate/global_rng.cpp21
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;