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);
39 void 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);
58 void ANSI_X931_RNG::rekey()
60 const size_t BLOCK_SIZE = cipher->
block_size();
66 if(V.
size() != BLOCK_SIZE)
105 return (V.
size() > 0);
126 return "X9.31(" + cipher->
name() +
")";
135 if(!prng_in || !cipher_in)
virtual void randomize(byte output[], size_t length)=0
virtual bool is_seeded() const
virtual void add_entropy(const byte in[], size_t length)=0
SecureVector< byte > random_vec(size_t bytes)
void add_entropy(const byte[], size_t)
void randomize(byte[], size_t)
virtual void add_entropy_source(EntropySource *source)=0
virtual void reseed(size_t bits_to_collect)=0
std::invalid_argument Invalid_Argument
ANSI_X931_RNG(BlockCipher *cipher, RandomNumberGenerator *rng)
void set_key(const SymmetricKey &key)
void reseed(size_t poll_bits)
void copy_mem(T *out, const T *in, size_t n)
virtual std::string name() const =0
void encrypt(const byte in[], byte out[]) const
size_t maximum_keylength() const
void add_entropy_source(EntropySource *)
void xor_buf(byte out[], const byte in[], size_t length)
void zeroise(MemoryRegion< T > &vec)
virtual size_t block_size() const =0