diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2007-05-04 15:04:58 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2007-05-04 15:04:58 +0000 |
commit | cdd57fd49c847250ce5d8e3cc39b7d882a529fc3 (patch) | |
tree | af7086b6bdb722b9a90c1abe0dd994166f32040b /rng.h | |
parent | 061bcd669cf286d0043e1060bb36761df2df907e (diff) | |
download | cryptopp-cdd57fd49c847250ce5d8e3cc39b7d882a529fc3.tar.gz |
reduce risk of random number reuse after VM rollback
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@328 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'rng.h')
-rw-r--r-- | rng.h | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -16,7 +16,7 @@ public: LC_RNG(word32 init_seed) : seed(init_seed) {} - byte GenerateByte(); + void GenerateBlock(byte *output, size_t size); word32 GetSeed() {return seed;} @@ -37,14 +37,13 @@ public: // cipher will be deleted by destructor, deterministicTimeVector = 0 means obtain time vector from system X917RNG(BlockTransformation *cipher, const byte *seed, const byte *deterministicTimeVector = 0); - byte GenerateByte(); + void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size); private: member_ptr<BlockTransformation> cipher; - const int S; // blocksize of cipher + unsigned int S; // blocksize of cipher SecByteBlock dtbuf; // buffer for enciphered timestamp - SecByteBlock randseed, randbuf, m_deterministicTimeVector; - int randbuf_counter; // # of unused bytes left in randbuf + SecByteBlock randseed, m_lastBlock, m_deterministicTimeVector; }; /** This class implements Maurer's Universal Statistical Test for Random Bit Generators |