Botan  1.10.9
x931_rng.h
Go to the documentation of this file.
1 /*
2 * ANSI X9.31 RNG
3 * (C) 1999-2009 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_ANSI_X931_RNG_H__
9 #define BOTAN_ANSI_X931_RNG_H__
10 
11 #include <botan/rng.h>
12 #include <botan/block_cipher.h>
13 
14 namespace Botan {
15 
16 /**
17 * ANSI X9.31 RNG
18 */
19 class BOTAN_DLL ANSI_X931_RNG : public RandomNumberGenerator
20  {
21  public:
22  void randomize(byte[], size_t);
23  bool is_seeded() const;
24  void clear();
25  std::string name() const;
26 
27  void reseed(size_t poll_bits);
28  void add_entropy_source(EntropySource*);
29  void add_entropy(const byte[], size_t);
30 
31  /**
32  * @param cipher the block cipher to use in this PRNG
33  * @param rng the underlying PRNG for generating inputs
34  * (eg, an HMAC_RNG)
35  */
36  ANSI_X931_RNG(BlockCipher* cipher,
38  ~ANSI_X931_RNG();
39  private:
40  void rekey();
41  void update_buffer();
42 
43  BlockCipher* cipher;
45  SecureVector<byte> V, R;
46  size_t position;
47  };
48 
49 }
50 
51 #endif
unsigned char byte
Definition: types.h:22
RandomNumberGenerator * rng
Definition: global_rng.cpp:165