summaryrefslogtreecommitdiff
path: root/randpool.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-01-24 23:09:28 -0500
committerJeffrey Walton <noloader@gmail.com>2016-01-24 23:09:28 -0500
commitbf3b80f25c6adedc05c876ad2e64589d8c9791ee (patch)
treec6f3579bd056be9d9176898bc5315f85acea07a2 /randpool.h
parent9a5dde9013da26e3031c87d7d44338d89699e5b5 (diff)
downloadcryptopp-git-bf3b80f25c6adedc05c876ad2e64589d8c9791ee.tar.gz
Cleared -Wcast-align (Issue 122)
Diffstat (limited to 'randpool.h')
-rw-r--r--randpool.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/randpool.h b/randpool.h
index 9393ff92..79fa63f1 100644
--- a/randpool.h
+++ b/randpool.h
@@ -1,3 +1,8 @@
+// randpool.h - written and placed in the public domain by Wei Dai
+
+//! \file randpool.h
+//! \brief Class file for Randomness Pool
+
#ifndef CRYPTOPP_RANDPOOL_H
#define CRYPTOPP_RANDPOOL_H
@@ -9,12 +14,18 @@
NAMESPACE_BEGIN(CryptoPP)
-//! Randomness Pool
-/*! This class can be used to generate cryptographic quality
- pseudorandom bytes after seeding the pool with IncorporateEntropy() */
+//! \brief Randomness Pool
+//! \details RandomPool can be used to generate cryptographic quality pseudorandom bytes
+//! after seeding the pool with IncorporateEntropy(). Internally, the generator uses
+//! AES-256 to produce the stream. Entropy is stirred in using SHA-256.
+//! \details RandomPool used to follow the design of randpool in PGP 2.6.x,
+//! but as of version 5.5 it has been redesigned to reduce the risk
+//! of reusing random numbers after state rollback (which may occur
+//! when running in a virtual machine like VMware).
class CRYPTOPP_DLL RandomPool : public RandomNumberGenerator, public NotCopyable
{
public:
+ //! \brief Construct a RandomPool
RandomPool();
bool CanIncorporateEntropy() const {return true;}
@@ -25,8 +36,8 @@ public:
void Put(const byte *input, size_t length) {IncorporateEntropy(input, length);}
private:
+ FixedSizeAlignedSecBlock<byte, 16, true> m_seed;
FixedSizeAlignedSecBlock<byte, 32> m_key;
- FixedSizeAlignedSecBlock<byte, 16> m_seed;
member_ptr<BlockCipher> m_pCipher;
bool m_keySet;
};