8#include <botan/x931_rng.h>
9#include <botan/internal/xor_buf.h>
24 if(position == R.size())
27 const size_t copied = std::min<size_t>(length, R.size() - position);
39void ANSI_X931_RNG::update_buffer()
41 const size_t BLOCK_SIZE = cipher->
block_size();
46 xor_buf(&R[0], &V[0], &DT[0], BLOCK_SIZE);
49 xor_buf(&V[0], &R[0], &DT[0], BLOCK_SIZE);
58void ANSI_X931_RNG::rekey()
60 const size_t BLOCK_SIZE = cipher->
block_size();
66 if(V.
size() != BLOCK_SIZE)
79 prng->reseed(poll_bits);
88 prng->add_entropy_source(src);
96 prng->add_entropy(input, length);
105 return (V.size() > 0);
126 return "X9.31(" + cipher->name() +
")";
135 if(!prng_in || !cipher_in)
141 R.resize(cipher->block_size());
void reseed(size_t poll_bits)
ANSI_X931_RNG(BlockCipher *cipher, RandomNumberGenerator *rng)
void add_entropy(const byte[], size_t)
void randomize(byte[], size_t)
void add_entropy_source(EntropySource *)
void encrypt(const byte in[], byte out[]) const
virtual size_t block_size() const =0
virtual bool is_seeded() const
SecureVector< byte > random_vec(size_t bytes)
virtual void randomize(byte output[], size_t length)=0
void set_key(const SymmetricKey &key)
size_t maximum_keylength() const
void zeroise(MemoryRegion< T > &vec)
void xor_buf(byte out[], const byte in[], size_t length)
void copy_mem(T *out, const T *in, size_t n)
std::invalid_argument Invalid_Argument
PRNG_Unseeded(const std::string &algo)