diff options
Diffstat (limited to 'src/rng/randpool')
-rw-r--r-- | src/rng/randpool/randpool.cpp | 17 | ||||
-rw-r--r-- | src/rng/randpool/randpool.h | 7 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/rng/randpool/randpool.cpp b/src/rng/randpool/randpool.cpp index 69ef3b9e7..d7d1763ec 100644 --- a/src/rng/randpool/randpool.cpp +++ b/src/rng/randpool/randpool.cpp @@ -4,7 +4,6 @@ *************************************************/ #include <botan/randpool.h> -#include <botan/lookup.h> #include <botan/loadstor.h> #include <botan/xor_buf.h> #include <botan/util.h> @@ -180,13 +179,15 @@ std::string Randpool::name() const /************************************************* * Randpool Constructor * *************************************************/ -Randpool::Randpool(const std::string& cipher_name, - const std::string& mac_name) : - ITERATIONS_BEFORE_RESEED(128), POOL_BLOCKS(32) +Randpool::Randpool(BlockCipher* cipher_in, + MessageAuthenticationCode* mac_in, + u32bit pool_blocks, + u32bit iter_before_reseed) : + ITERATIONS_BEFORE_RESEED(iter_before_reseed), + POOL_BLOCKS(pool_blocks), + cipher(cipher_in), + mac(mac_in) { - 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; @@ -197,7 +198,7 @@ Randpool::Randpool(const std::string& cipher_name, delete cipher; delete mac; throw Internal_Error("Randpool: Invalid algorithm combination " + - cipher_name + "/" + mac_name); + cipher->name() + "/" + mac->name()); } buffer.create(BLOCK_SIZE); diff --git a/src/rng/randpool/randpool.h b/src/rng/randpool/randpool.h index b68dec765..16ffcefd6 100644 --- a/src/rng/randpool/randpool.h +++ b/src/rng/randpool/randpool.h @@ -27,13 +27,16 @@ class BOTAN_DLL Randpool : public RandomNumberGenerator void add_entropy_source(EntropySource*); void add_entropy(const byte[], u32bit); - Randpool(const std::string&, const std::string&); + Randpool(BlockCipher*, MessageAuthenticationCode*, + u32bit pool_blocks = 32, + u32bit iterations_before_reseed = 128); + ~Randpool(); private: void update_buffer(); void mix_pool(); - const u32bit ITERATIONS_BEFORE_RESEED, POOL_BLOCKS; + u32bit ITERATIONS_BEFORE_RESEED, POOL_BLOCKS; BlockCipher* cipher; MessageAuthenticationCode* mac; |