summaryrefslogtreecommitdiff
path: root/rng.h
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2007-05-04 15:04:58 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2007-05-04 15:04:58 +0000
commitcdd57fd49c847250ce5d8e3cc39b7d882a529fc3 (patch)
treeaf7086b6bdb722b9a90c1abe0dd994166f32040b /rng.h
parent061bcd669cf286d0043e1060bb36761df2df907e (diff)
downloadcryptopp-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.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/rng.h b/rng.h
index 4d1fdca..2439dee 100644
--- a/rng.h
+++ b/rng.h
@@ -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