diff options
author | lloyd <[email protected]> | 2010-06-16 03:54:59 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-06-16 03:54:59 +0000 |
commit | aa0c77746be858f094debf0d96e87c02908e8dc3 (patch) | |
tree | 98d66a941f476ad035ffc18138998b4bc1dfb8b9 /src/rng | |
parent | 85780f6bbe02d7abd573f5b47bf9e79c611f5022 (diff) |
Yet more Doxygen comments
Diffstat (limited to 'src/rng')
-rw-r--r-- | src/rng/hmac_rng/hmac_rng.cpp | 16 | ||||
-rw-r--r-- | src/rng/hmac_rng/hmac_rng.h | 4 | ||||
-rw-r--r-- | src/rng/randpool/randpool.cpp | 22 | ||||
-rw-r--r-- | src/rng/randpool/randpool.h | 10 | ||||
-rw-r--r-- | src/rng/x931_rng/x931_rng.cpp | 22 | ||||
-rw-r--r-- | src/rng/x931_rng/x931_rng.h | 8 |
6 files changed, 50 insertions, 32 deletions
diff --git a/src/rng/hmac_rng/hmac_rng.cpp b/src/rng/hmac_rng/hmac_rng.cpp index 3ce97ea46..fbfa87f70 100644 --- a/src/rng/hmac_rng/hmac_rng.cpp +++ b/src/rng/hmac_rng/hmac_rng.cpp @@ -31,7 +31,7 @@ void hmac_prf(MessageAuthenticationCode* prf, } -/** +/* * Generate a buffer of random bytes */ void HMAC_RNG::randomize(byte out[], u32bit length) @@ -54,7 +54,7 @@ void HMAC_RNG::randomize(byte out[], u32bit length) } } -/** +/* * Poll for entropy and reset the internal keys */ void HMAC_RNG::reseed(u32bit poll_bits) @@ -115,7 +115,7 @@ void HMAC_RNG::reseed(u32bit poll_bits) seeded = true; } -/** +/* * Add user-supplied entropy to the extractor input */ void HMAC_RNG::add_entropy(const byte input[], u32bit length) @@ -132,7 +132,7 @@ void HMAC_RNG::add_entropy(const byte input[], u32bit length) reseed(128); } -/** +/* * Add another entropy source to the list */ void HMAC_RNG::add_entropy_source(EntropySource* src) @@ -140,7 +140,7 @@ void HMAC_RNG::add_entropy_source(EntropySource* src) entropy_sources.push_back(src); } -/** +/* * Clear memory of sensitive data */ void HMAC_RNG::clear() @@ -153,7 +153,7 @@ void HMAC_RNG::clear() seeded = false; } -/** +/* * Return the name of this type */ std::string HMAC_RNG::name() const @@ -161,7 +161,7 @@ std::string HMAC_RNG::name() const return "HMAC_RNG(" + extractor->name() + "," + prf->name() + ")"; } -/** +/* * HMAC_RNG Constructor */ HMAC_RNG::HMAC_RNG(MessageAuthenticationCode* extractor_mac, @@ -209,7 +209,7 @@ HMAC_RNG::HMAC_RNG(MessageAuthenticationCode* extractor_mac, extractor->set_key(prf->process("Botan HMAC_RNG XTS")); } -/** +/* * HMAC_RNG Destructor */ HMAC_RNG::~HMAC_RNG() diff --git a/src/rng/hmac_rng/hmac_rng.h b/src/rng/hmac_rng/hmac_rng.h index 452357130..fc712b3ec 100644 --- a/src/rng/hmac_rng/hmac_rng.h +++ b/src/rng/hmac_rng/hmac_rng.h @@ -36,6 +36,10 @@ class BOTAN_DLL HMAC_RNG : public RandomNumberGenerator void add_entropy_source(EntropySource* es); void add_entropy(const byte[], u32bit); + /** + * @param extractor a MAC used for extracting the entropy + * @param prf a MAC used as a PRF using HKDF construction + */ HMAC_RNG(MessageAuthenticationCode* extractor, MessageAuthenticationCode* prf); diff --git a/src/rng/randpool/randpool.cpp b/src/rng/randpool/randpool.cpp index 9a4d77e55..c3e496638 100644 --- a/src/rng/randpool/randpool.cpp +++ b/src/rng/randpool/randpool.cpp @@ -15,7 +15,7 @@ namespace Botan { namespace { -/** +/* * PRF based on a MAC */ enum RANDPOOL_PRF_TAG { @@ -26,7 +26,7 @@ enum RANDPOOL_PRF_TAG { } -/** +/* * Generate a buffer of random bytes */ void Randpool::randomize(byte out[], u32bit length) @@ -45,7 +45,7 @@ void Randpool::randomize(byte out[], u32bit length) } } -/** +/* * Refill the output buffer */ void Randpool::update_buffer() @@ -66,7 +66,7 @@ void Randpool::update_buffer() mix_pool(); } -/** +/* * Mix the entropy pool */ void Randpool::mix_pool() @@ -94,7 +94,7 @@ void Randpool::mix_pool() update_buffer(); } -/** +/* * Reseed the internal state */ void Randpool::reseed(u32bit poll_bits) @@ -121,7 +121,7 @@ void Randpool::reseed(u32bit poll_bits) seeded = true; } -/** +/* * Add user-supplied entropy */ void Randpool::add_entropy(const byte input[], u32bit length) @@ -134,7 +134,7 @@ void Randpool::add_entropy(const byte input[], u32bit length) seeded = true; } -/** +/* * Add another entropy source to the list */ void Randpool::add_entropy_source(EntropySource* src) @@ -142,7 +142,7 @@ void Randpool::add_entropy_source(EntropySource* src) entropy_sources.push_back(src); } -/** +/* * Clear memory of sensitive data */ void Randpool::clear() @@ -155,7 +155,7 @@ void Randpool::clear() seeded = false; } -/** +/* * Return the name of this type */ std::string Randpool::name() const @@ -163,7 +163,7 @@ std::string Randpool::name() const return "Randpool(" + cipher->name() + "," + mac->name() + ")"; } -/** +/* * Randpool Constructor */ Randpool::Randpool(BlockCipher* cipher_in, @@ -194,7 +194,7 @@ Randpool::Randpool(BlockCipher* cipher_in, seeded = false; } -/** +/* * Randpool Destructor */ Randpool::~Randpool() diff --git a/src/rng/randpool/randpool.h b/src/rng/randpool/randpool.h index ab6ed6748..471bb791a 100644 --- a/src/rng/randpool/randpool.h +++ b/src/rng/randpool/randpool.h @@ -30,7 +30,15 @@ class BOTAN_DLL Randpool : public RandomNumberGenerator void add_entropy_source(EntropySource* es); void add_entropy(const byte input[], u32bit length); - Randpool(BlockCipher* cipher, MessageAuthenticationCode* mac, + /** + * @param cipher a block cipher to use + * @param mac a message authentication code to use + * @param pool_blocks how many cipher blocks to use for the pool + * @param iterations_before_reseed how many times we'll use the + * internal state to generate output before reseeding + */ + Randpool(BlockCipher* cipher, + MessageAuthenticationCode* mac, u32bit pool_blocks = 32, u32bit iterations_before_reseed = 128); diff --git a/src/rng/x931_rng/x931_rng.cpp b/src/rng/x931_rng/x931_rng.cpp index 3ff180898..f812377ed 100644 --- a/src/rng/x931_rng/x931_rng.cpp +++ b/src/rng/x931_rng/x931_rng.cpp @@ -11,7 +11,7 @@ namespace Botan { -/** +/* * Generate a buffer of random bytes */ void ANSI_X931_RNG::randomize(byte out[], u32bit length) @@ -33,7 +33,7 @@ void ANSI_X931_RNG::randomize(byte out[], u32bit length) } } -/** +/* * Refill the internal state */ void ANSI_X931_RNG::update_buffer() @@ -52,7 +52,7 @@ void ANSI_X931_RNG::update_buffer() position = 0; } -/** +/* * Reset V and the cipher key with new values */ void ANSI_X931_RNG::rekey() @@ -71,7 +71,7 @@ void ANSI_X931_RNG::rekey() } } -/** +/* * Reseed the internal state */ void ANSI_X931_RNG::reseed(u32bit poll_bits) @@ -80,7 +80,7 @@ void ANSI_X931_RNG::reseed(u32bit poll_bits) rekey(); } -/** +/* * Add a entropy source to the underlying PRNG */ void ANSI_X931_RNG::add_entropy_source(EntropySource* src) @@ -88,7 +88,7 @@ void ANSI_X931_RNG::add_entropy_source(EntropySource* src) prng->add_entropy_source(src); } -/** +/* * Add some entropy to the underlying PRNG */ void ANSI_X931_RNG::add_entropy(const byte input[], u32bit length) @@ -97,7 +97,7 @@ void ANSI_X931_RNG::add_entropy(const byte input[], u32bit length) rekey(); } -/** +/* * Check if the the PRNG is seeded */ bool ANSI_X931_RNG::is_seeded() const @@ -105,7 +105,7 @@ bool ANSI_X931_RNG::is_seeded() const return (V.size() > 0); } -/** +/* * Clear memory of sensitive data */ void ANSI_X931_RNG::clear() @@ -118,7 +118,7 @@ void ANSI_X931_RNG::clear() position = 0; } -/** +/* * Return the name of this type */ std::string ANSI_X931_RNG::name() const @@ -126,7 +126,7 @@ std::string ANSI_X931_RNG::name() const return "X9.31(" + cipher->name() + ")"; } -/** +/* * ANSI X931 RNG Constructor */ ANSI_X931_RNG::ANSI_X931_RNG(BlockCipher* cipher_in, @@ -142,7 +142,7 @@ ANSI_X931_RNG::ANSI_X931_RNG(BlockCipher* cipher_in, position = 0; } -/** +/* * ANSI X931 RNG Destructor */ ANSI_X931_RNG::~ANSI_X931_RNG() diff --git a/src/rng/x931_rng/x931_rng.h b/src/rng/x931_rng/x931_rng.h index d5ba2e9eb..345ee3ca9 100644 --- a/src/rng/x931_rng/x931_rng.h +++ b/src/rng/x931_rng/x931_rng.h @@ -28,7 +28,13 @@ class BOTAN_DLL ANSI_X931_RNG : public RandomNumberGenerator void add_entropy_source(EntropySource*); void add_entropy(const byte[], u32bit); - ANSI_X931_RNG(BlockCipher*, RandomNumberGenerator*); + /** + * @param cipher the block cipher to use in this PRNG + * @param rng the underlying PRNG for generating inputs + * (eg, an HMAC_RNG) + */ + ANSI_X931_RNG(BlockCipher* cipher, + RandomNumberGenerator* rng); ~ANSI_X931_RNG(); private: void rekey(); |