aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libstate.cpp3
-rw-r--r--src/randpool.cpp13
2 files changed, 8 insertions, 8 deletions
diff --git a/src/libstate.cpp b/src/libstate.cpp
index b988625ce..7751216cb 100644
--- a/src/libstate.cpp
+++ b/src/libstate.cpp
@@ -273,7 +273,8 @@ void Library_State::initialize(const InitializerOptions& args,
for(u32bit j = 0; j != sources.size(); ++j)
add_entropy_source(sources[j]);
- set_prng(new ANSI_X931_RNG("AES-256", new Randpool));
+ set_prng(new ANSI_X931_RNG("AES-256",
+ new Randpool("AES-256", "HMAC(SHA-256)")));
if(args.seed_rng())
{
diff --git a/src/randpool.cpp b/src/randpool.cpp
index 46968eee1..be50ce2be 100644
--- a/src/randpool.cpp
+++ b/src/randpool.cpp
@@ -147,13 +147,12 @@ std::string Randpool::name() const
/*************************************************
* Randpool Constructor *
*************************************************/
-Randpool::Randpool() : ITERATIONS_BEFORE_RESEED(8), POOL_BLOCKS(32)
+Randpool::Randpool(const std::string& cipher_name,
+ const std::string& mac_name) :
+ ITERATIONS_BEFORE_RESEED(8), POOL_BLOCKS(32)
{
- const std::string CIPHER_NAME = "AES-256";
- const std::string MAC_NAME = "HMAC(SHA-256)";
-
- cipher = get_block_cipher(CIPHER_NAME);
- mac = get_mac(MAC_NAME);
+ cipher = get_block_cipher(cipher_name);
+ mac = get_mac(mac_name);
const u32bit BLOCK_SIZE = cipher->BLOCK_SIZE;
const u32bit OUTPUT_LENGTH = mac->OUTPUT_LENGTH;
@@ -165,7 +164,7 @@ Randpool::Randpool() : ITERATIONS_BEFORE_RESEED(8), POOL_BLOCKS(32)
delete cipher;
delete mac;
throw Internal_Error("Randpool: Invalid algorithm combination " +
- CIPHER_NAME + "/" + MAC_NAME);
+ cipher_name + "/" + mac_name);
}
buffer.create(BLOCK_SIZE);