aboutsummaryrefslogtreecommitdiffstats
path: root/checks
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-06-28 14:28:27 +0000
committerlloyd <[email protected]>2008-06-28 14:28:27 +0000
commiteeb6859df0be3034cefd81ccce20494b9f7bc308 (patch)
tree6251fe589c8de164904329385f49e71b4ca52ad5 /checks
parent0071ad80fc8eafc607d31018da27640c80d52af2 (diff)
Add interfaces for add_entropy_source and add_entropy to
RandomNumberGenerator, and make ANSI_X931_PRNG's implementations just forward the arguments to the underlying RNG. This allows seeding the RNG even if no entropy modules are loaded into the library. Also it allows actually adding user-specified data; to do it otherwise would require creating the RNG objects yourself and retaining a pointer to the Randpool, which is pretty bogus. Move Null_RNG to rng.h
Diffstat (limited to 'checks')
-rw-r--r--checks/common.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/checks/common.h b/checks/common.h
index e42fa8e44..06cb638ee 100644
--- a/checks/common.h
+++ b/checks/common.h
@@ -78,21 +78,19 @@ class Fixed_Output_RNG : public Botan::RandomNumberGenerator
std::string name() const { return "Fixed_Output_RNG"; }
- void clear() throw() {}
+ void add_entropy_source(Botan::EntropySource* src) { delete src; }
+ void add_entropy(const byte[], u32bit) {};
- void add_randomness(const byte in[], u32bit len) throw()
- {
- buf.insert(buf.end(), in, in + len);
- }
+ void clear() throw() {}
- Fixed_Output_RNG(const Botan::SecureVector<byte>& x)
+ Fixed_Output_RNG(const Botan::SecureVector<byte>& in)
{
- add_randomness(x.begin(), x.size());
+ buf.insert(buf.end(), in.begin(), in.begin() + in.size());
}
- Fixed_Output_RNG(const std::string& in)
+ Fixed_Output_RNG(const std::string& in_str)
{
- Botan::SecureVector<byte> x = decode_hex(in);
- add_randomness(x.begin(), x.size());
+ Botan::SecureVector<byte> in = decode_hex(in_str);
+ buf.insert(buf.end(), in.begin(), in.begin() + in.size());
}
Fixed_Output_RNG() {}