diff options
author | lloyd <[email protected]> | 2008-06-10 19:55:45 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-06-10 19:55:45 +0000 |
commit | 7253964aba9ca41a88261557d8cd91df39cd4b88 (patch) | |
tree | 1cd269297c898a8ed126906518f10864cf10d498 | |
parent | b36db2d74992f2ea80329378c32a6321d6a60b26 (diff) |
Move the declaration of the RandomNumberGenerator base class from base.h
to rng.h (eventually base.h will be split up entirely and go away)
-rw-r--r-- | include/base.h | 31 | ||||
-rw-r--r-- | include/bigint.h | 3 | ||||
-rw-r--r-- | include/buf_es.h | 3 | ||||
-rw-r--r-- | include/libstate.h | 1 | ||||
-rw-r--r-- | include/pbe.h | 1 | ||||
-rw-r--r-- | include/pk_keys.h | 3 | ||||
-rw-r--r-- | include/pk_util.h | 1 | ||||
-rw-r--r-- | include/randpool.h | 1 | ||||
-rw-r--r-- | include/rng.h | 46 | ||||
-rw-r--r-- | include/s2k.h | 3 | ||||
-rw-r--r-- | include/sha1prng.h | 1 | ||||
-rw-r--r-- | include/timers.h | 2 | ||||
-rw-r--r-- | include/x509_obj.h | 1 | ||||
-rw-r--r-- | include/x931_rng.h | 1 | ||||
-rw-r--r-- | modules/es_capi/es_capi.h | 2 | ||||
-rw-r--r-- | modules/es_dev/es_dev.h | 2 | ||||
-rw-r--r-- | modules/es_egd/es_egd.h | 2 | ||||
-rw-r--r-- | src/base.cpp | 1 |
18 files changed, 66 insertions, 39 deletions
diff --git a/include/base.h b/include/base.h index efeb5e895..69bc71bca 100644 --- a/include/base.h +++ b/include/base.h @@ -138,37 +138,6 @@ class BOTAN_DLL MessageAuthenticationCode : public BufferedComputation, virtual ~MessageAuthenticationCode() {} }; -/************************************************* -* Entropy Source * -*************************************************/ -class BOTAN_DLL EntropySource - { - public: - virtual u32bit slow_poll(byte[], u32bit) = 0; - virtual u32bit fast_poll(byte[], u32bit); - virtual ~EntropySource() {} - }; - -/************************************************* -* Random Number Generator * -*************************************************/ -class BOTAN_DLL RandomNumberGenerator - { - public: - virtual void randomize(byte[], u32bit) throw(PRNG_Unseeded) = 0; - virtual bool is_seeded() const = 0; - virtual void clear() throw() {}; - - byte next_byte(); - - void add_entropy(const byte[], u32bit); - u32bit add_entropy(EntropySource&, bool = true); - - virtual ~RandomNumberGenerator() {} - private: - virtual void add_randomness(const byte[], u32bit) = 0; - }; - } #endif diff --git a/include/bigint.h b/include/bigint.h index 2487fa91c..c1dbc7171 100644 --- a/include/bigint.h +++ b/include/bigint.h @@ -6,7 +6,8 @@ #ifndef BOTAN_BIGINT_H__ #define BOTAN_BIGINT_H__ -#include <botan/base.h> +#include <botan/rng.h> +#include <botan/secmem.h> #include <botan/mp_types.h> #include <iosfwd> diff --git a/include/buf_es.h b/include/buf_es.h index fafec7c80..5748613da 100644 --- a/include/buf_es.h +++ b/include/buf_es.h @@ -6,7 +6,8 @@ #ifndef BOTAN_BUFFERED_ES_H__ #define BOTAN_BUFFERED_ES_H__ -#include <botan/base.h> +#include <botan/rng.h> +#include <botan/secmem.h> namespace Botan { diff --git a/include/libstate.h b/include/libstate.h index e38acd90a..69f30a886 100644 --- a/include/libstate.h +++ b/include/libstate.h @@ -7,6 +7,7 @@ #define BOTAN_LIB_STATE_H__ #include <botan/base.h> +#include <botan/rng.h> #include <botan/init.h> #include <string> #include <vector> diff --git a/include/pbe.h b/include/pbe.h index 35d6d774d..0a2d1ff97 100644 --- a/include/pbe.h +++ b/include/pbe.h @@ -9,6 +9,7 @@ #include <botan/asn1_oid.h> #include <botan/data_src.h> #include <botan/filter.h> +#include <botan/rng.h> namespace Botan { diff --git a/include/pk_keys.h b/include/pk_keys.h index c6f9ced3c..ea79ab4ec 100644 --- a/include/pk_keys.h +++ b/include/pk_keys.h @@ -6,7 +6,8 @@ #ifndef BOTAN_PK_KEYS_H__ #define BOTAN_PK_KEYS_H__ -#include <botan/base.h> +#include <botan/rng.h> +#include <botan/secmem.h> #include <botan/asn1_oid.h> namespace Botan { diff --git a/include/pk_util.h b/include/pk_util.h index 86b8859fd..af5a052b1 100644 --- a/include/pk_util.h +++ b/include/pk_util.h @@ -7,6 +7,7 @@ #define BOTAN_PUBKEY_UTIL_H__ #include <botan/base.h> +#include <botan/rng.h> namespace Botan { diff --git a/include/randpool.h b/include/randpool.h index c64eae903..dc8750dc3 100644 --- a/include/randpool.h +++ b/include/randpool.h @@ -6,6 +6,7 @@ #ifndef BOTAN_RANDPOOL_H__ #define BOTAN_RANDPOOL_H__ +#include <botan/rng.h> #include <botan/base.h> namespace Botan { diff --git a/include/rng.h b/include/rng.h new file mode 100644 index 000000000..13902385f --- /dev/null +++ b/include/rng.h @@ -0,0 +1,46 @@ +/************************************************* +* RandomNumberGenerator Header File * +* (C) 1999-2008 Jack Lloyd * +*************************************************/ + +#ifndef BOTAN_RANDOM_NUMBER_GENERATOR__ +#define BOTAN_RANDOM_NUMBER_GENERATOR__ + +#include <botan/exceptn.h> + +namespace Botan { + +/************************************************* +* Entropy Source * +*************************************************/ +class BOTAN_DLL EntropySource + { + public: + virtual u32bit slow_poll(byte[], u32bit) = 0; + virtual u32bit fast_poll(byte[], u32bit); + virtual ~EntropySource() {} + }; + +/************************************************* +* Random Number Generator * +*************************************************/ +class BOTAN_DLL RandomNumberGenerator + { + public: + virtual void randomize(byte[], u32bit) throw(PRNG_Unseeded) = 0; + virtual bool is_seeded() const = 0; + virtual void clear() throw() {}; + + byte next_byte(); + + void add_entropy(const byte[], u32bit); + u32bit add_entropy(EntropySource&, bool = true); + + virtual ~RandomNumberGenerator() {} + private: + virtual void add_randomness(const byte[], u32bit) = 0; + }; + +} + +#endif diff --git a/include/s2k.h b/include/s2k.h index cfe735cd9..031592513 100644 --- a/include/s2k.h +++ b/include/s2k.h @@ -6,7 +6,8 @@ #ifndef BOTAN_S2K_H__ #define BOTAN_S2K_H__ -#include <botan/base.h> +#include <botan/symkey.h> +#include <botan/rng.h> namespace Botan { diff --git a/include/sha1prng.h b/include/sha1prng.h index 0ba2a96a9..8237f57c0 100644 --- a/include/sha1prng.h +++ b/include/sha1prng.h @@ -7,6 +7,7 @@ #ifndef BOTAN_SHA1PRNG_H__ #define BOTAN_SHA1PRNG_H__ +#include <botan/rng.h> #include <botan/base.h> namespace Botan { diff --git a/include/timers.h b/include/timers.h index 8bff4134d..253f71f6b 100644 --- a/include/timers.h +++ b/include/timers.h @@ -6,7 +6,7 @@ #ifndef BOTAN_TIMERS_H__ #define BOTAN_TIMERS_H__ -#include <botan/base.h> +#include <botan/rng.h> namespace Botan { diff --git a/include/x509_obj.h b/include/x509_obj.h index 2ec3740cf..8808fd686 100644 --- a/include/x509_obj.h +++ b/include/x509_obj.h @@ -9,6 +9,7 @@ #include <botan/asn1_obj.h> #include <botan/pipe.h> #include <botan/enums.h> +#include <botan/rng.h> #include <vector> namespace Botan { diff --git a/include/x931_rng.h b/include/x931_rng.h index 8bb8cc2ac..3bb15ed6f 100644 --- a/include/x931_rng.h +++ b/include/x931_rng.h @@ -6,6 +6,7 @@ #ifndef BOTAN_ANSI_X931_RNG_H__ #define BOTAN_ANSI_X931_RNG_H__ +#include <botan/rng.h> #include <botan/base.h> namespace Botan { diff --git a/modules/es_capi/es_capi.h b/modules/es_capi/es_capi.h index e16b8cb9c..36b4acd8d 100644 --- a/modules/es_capi/es_capi.h +++ b/modules/es_capi/es_capi.h @@ -6,7 +6,7 @@ #ifndef BOTAN_EXT_ENTROPY_SRC_WIN32_CAPI_H__ #define BOTAN_EXT_ENTROPY_SRC_WIN32_CAPI_H__ -#include <botan/base.h> +#include <botan/rng.h> #include <vector> namespace Botan { diff --git a/modules/es_dev/es_dev.h b/modules/es_dev/es_dev.h index c2b64e9f1..21d28b9bb 100644 --- a/modules/es_dev/es_dev.h +++ b/modules/es_dev/es_dev.h @@ -6,7 +6,7 @@ #ifndef BOTAN_ENTROPY_SRC_DEVICE_H__ #define BOTAN_ENTROPY_SRC_DEVICE_H__ -#include <botan/base.h> +#include <botan/rng.h> #include <vector> namespace Botan { diff --git a/modules/es_egd/es_egd.h b/modules/es_egd/es_egd.h index 20df8b606..e3ff2fec8 100644 --- a/modules/es_egd/es_egd.h +++ b/modules/es_egd/es_egd.h @@ -6,7 +6,7 @@ #ifndef BOTAN_EXT_ENTROPY_SRC_EGD_H__ #define BOTAN_EXT_ENTROPY_SRC_EGD_H__ -#include <botan/base.h> +#include <botan/rng.h> #include <string> #include <vector> diff --git a/src/base.cpp b/src/base.cpp index 3cca7c594..a1fd1ab1a 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -4,6 +4,7 @@ *************************************************/ #include <botan/base.h> +#include <botan/rng.h> #include <botan/version.h> #include <botan/util.h> #include <botan/config.h> |