9 #ifndef CRYPTOPP_IMPORTS 26 : m_pCipher(new
AES::Encryption), m_keySet(false)
28 ::memset(m_key, 0, m_key.SizeInBytes());
29 ::memset(m_seed, 0, m_seed.SizeInBytes());
36 hash.
Update(input, length);
46 m_pCipher->
SetKey(m_key, 32);
52 TimerWord tw = timer.GetCurrentTimerValue();
54 *(TimerWord *)(
void*)m_seed.
data() += tw;
55 time_t t = time(NULLPTR);
59 word64 tt1 = 0, tt2 = (word64)t;
60 ::memcpy(&tt1, m_seed.
data()+8, 8);
61 ::memcpy(m_seed.
data()+8, &(tt2 += tt1), 8);
64 *((
volatile TimerWord*)&tw) = 0;
65 *((
volatile word64*)&tt1) = 0;
66 *((
volatile word64*)&tt2) = 0;
85 ::memset(pool, 0, poolSize);
86 ::memset(key, 0, key.
size());
92 while (length > (t = pool.
size() - addPos))
94 xorbuf(pool+addPos, input, t);
102 xorbuf(pool+addPos, input, length);
104 getPos = pool.
size();
108 void OldRandomPool::Stir()
112 for (
int i=0; i<2; i++)
114 cipher.SetKeyWithIV(key, key.
size(), pool.
end()-cipher.IVSize());
115 cipher.ProcessString(pool, pool.
size());
116 ::memcpy(key, pool, key.
size());
127 if (getPos == pool.
size())
137 if (getPos == pool.
size())
140 return pool[getPos++];
void IncorporateEntropy(const byte *input, size_t length)
Update RNG state with additional unpredictable values.
iterator end()
Provides an iterator pointing beyond the last element in the memory block.
Randomness Pool based on AES-256.
virtual void SetKey(const byte *key, size_t length, const NameValuePairs ¶ms=g_nullNameValuePairs)
Sets or reset the key of this object.
Class file for Randomness Pool.
Classes for block cipher modes of operation.
void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size)
Generate random bytes into a BufferedTransformation.
void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size)
Generate random bytes into a BufferedTransformation.
void Update(const byte *input, size_t length)
Updates a hash with additional input.
Copy input to a memory buffer.
const std::string DEFAULT_CHANNEL
Default channel for BufferedTransformation.
Block cipher mode of operation aggregate.
#define CRYPTOPP_COMPILE_ASSERT(expr)
Compile time assertion.
A::pointer data()
Provides a pointer to the first element in the memory block.
Class file for the AES cipher (Rijndael)
const T1 UnsignedMin(const T1 &a, const T2 &b)
Safe comparison of values that could be neagtive and incorrectly promoted.
void IncorporateEntropy(const byte *input, size_t length)
Update RNG state with additional unpredictable values.
AES block cipher (Rijndael)
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
OldRandomPool(unsigned int poolSize=384)
Construct an OldRandomPool.
Classes for SHA-1 and SHA-2 family of message digests.
byte GenerateByte()
Generate new random byte and return it.
Classes for the MDC message digest.
void xorbuf(byte *buf, const byte *mask, size_t count)
Performs an XOR of a buffer with a mask.
Debugging and diagnostic assertions.
void GenerateBlock(byte *output, size_t size)
Generate random array of bytes.
Crypto++ library namespace.
size_type size() const
Provides the count of elements in the SecBlock.