diff options
Diffstat (limited to 'src/lib/rng/hmac_drbg/hmac_drbg.cpp')
-rw-r--r-- | src/lib/rng/hmac_drbg/hmac_drbg.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/rng/hmac_drbg/hmac_drbg.cpp b/src/lib/rng/hmac_drbg/hmac_drbg.cpp index af0565120..22236c0cb 100644 --- a/src/lib/rng/hmac_drbg/hmac_drbg.cpp +++ b/src/lib/rng/hmac_drbg/hmac_drbg.cpp @@ -20,6 +20,18 @@ HMAC_DRBG::HMAC_DRBG(MessageAuthenticationCode* mac, m_mac->set_key(std::vector<byte>(m_mac->output_length(), 0x00)); } +HMAC_DRBG::HMAC_DRBG(const std::string& mac_name, + RandomNumberGenerator* prng) : + m_prng(prng), + m_V(m_mac->output_length(), 0x01), + m_reseed_counter(0) + { + m_mac = MessageAuthenticationCode::create(mac_name); + if(!m_mac) + throw Algorithm_Not_Found(mac_name); + m_mac->set_key(std::vector<byte>(m_mac->output_length(), 0x00)); + } + void HMAC_DRBG::randomize(byte out[], size_t length) { if(!is_seeded() || m_reseed_counter > BOTAN_RNG_MAX_OUTPUT_BEFORE_RESEED) |