aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/global_rng.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-13 03:25:16 +0000
committerlloyd <[email protected]>2010-10-13 03:25:16 +0000
commitba142ed2eaa21445d49cbbc8ae3b3d4dc625b9d7 (patch)
treebe1a9fa07d0ea26fd7713bb52205f7a3bcc3e907 /src/libstate/global_rng.cpp
parent406d4f8556d41083bfa551e7a777b0cb02925b6c (diff)
parent5913bf42b4c32e43d0db11bf9299130f3b0b62a4 (diff)
propagate from branch 'net.randombit.botan' (head 2898d79f992f27a328a3e41d34b46eb1052da0de)
to branch 'net.randombit.botan.c++0x' (head 6cba76268fd69a73195760c021b7f881b8a6552c)
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;