aboutsummaryrefslogtreecommitdiffstats
path: root/checks
diff options
context:
space:
mode:
Diffstat (limited to 'checks')
-rw-r--r--checks/dolook2.cpp25
-rw-r--r--checks/rng.cpp12
2 files changed, 15 insertions, 22 deletions
diff --git a/checks/dolook2.cpp b/checks/dolook2.cpp
index f52d1fc09..a47efaff9 100644
--- a/checks/dolook2.cpp
+++ b/checks/dolook2.cpp
@@ -113,28 +113,31 @@ Filter* lookup_rng(const std::string& algname,
RandomNumberGenerator* prng = 0;
if(algname == "X9.31-RNG(TripleDES)")
- prng = new ANSI_X931_RNG("TripleDES", new Fixed_Output_RNG);
+ prng = new ANSI_X931_RNG("TripleDES", new Fixed_Output_RNG(decode_hex(key)));
else if(algname == "X9.31-RNG(AES-128)")
- prng = new ANSI_X931_RNG("AES-128", new Fixed_Output_RNG);
+ prng = new ANSI_X931_RNG("AES-128", new Fixed_Output_RNG(decode_hex(key)));
else if(algname == "X9.31-RNG(AES-192)")
- prng = new ANSI_X931_RNG("AES-192", new Fixed_Output_RNG);
+ prng = new ANSI_X931_RNG("AES-192", new Fixed_Output_RNG(decode_hex(key)));
else if(algname == "X9.31-RNG(AES-256)")
- prng = new ANSI_X931_RNG("AES-256", new Fixed_Output_RNG);
+ prng = new ANSI_X931_RNG("AES-256", new Fixed_Output_RNG(decode_hex(key)));
// these are used for benchmarking: AES-256/SHA-256 matches library
// defaults, so benchmark reflects real-world performance (maybe)
else if(algname == "Randpool")
- prng = new Randpool("AES-256", "HMAC(SHA-256)");
+ {
+ Randpool* randpool = new Randpool("AES-256", "HMAC(SHA-256)");
+ randpool->add_entropy((const byte*)key.c_str(), key.length());
+ prng = randpool;
+ }
else if(algname == "X9.31-RNG")
- prng = new ANSI_X931_RNG("AES-256",
- new Randpool("AES-256", "HMAC(SHA-256)"));
+ {
+ Randpool* randpool = new Randpool("AES-256", "HMAC(SHA-256)");
+ randpool->add_entropy((const byte*)key.c_str(), key.length());
+ prng = new ANSI_X931_RNG("AES-256", randpool);
+ }
if(prng)
- {
- SecureVector<byte> seed = decode_hex(key);
- prng->add_entropy(seed.begin(), seed.size());
return new RNG_Filter(prng);
- }
return 0;
}
diff --git a/checks/rng.cpp b/checks/rng.cpp
index 03c4d9990..05cd4da8e 100644
--- a/checks/rng.cpp
+++ b/checks/rng.cpp
@@ -1,9 +1,5 @@
#include "common.h"
-#include <botan/x931_rng.h>
-#include <botan/randpool.h>
-#include <botan/es_dev.h>
-#include <botan/parsing.h>
using namespace Botan;
@@ -12,13 +8,7 @@ RandomNumberGenerator& global_rng()
static RandomNumberGenerator* rng = 0;
if(!rng)
- {
- rng = new ANSI_X931_RNG("AES-256", new Randpool("AES-256", "HMAC(SHA-256)"));
-
- Device_EntropySource dev(split_on("/dev/random:/dev/srandom:/dev/urandom", ':'));
-
- rng->add_entropy(dev);
- }
+ rng = make_rng();
return *rng;
}