diff options
author | lloyd <[email protected]> | 2008-10-26 20:55:57 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-10-26 20:55:57 +0000 |
commit | ac4bab4e40a45a7d1b6061142ab831813bf0d6ca (patch) | |
tree | cbaad5829ae4a65689a4b5cbfa4ed4dfcbcdbcc3 /src/entropy/egd | |
parent | a78b39c6bd171c8851aa53debe8ebc1665104d9b (diff) |
Move EntropySource base class to new entropy_src.h (which allows the implementations
to decouple from knowing about RandomNumberGenerator).
Diffstat (limited to 'src/entropy/egd')
-rw-r--r-- | src/entropy/egd/es_egd.cpp | 9 | ||||
-rw-r--r-- | src/entropy/egd/es_egd.h | 4 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/entropy/egd/es_egd.cpp b/src/entropy/egd/es_egd.cpp index da4aaf847..8390552c6 100644 --- a/src/entropy/egd/es_egd.cpp +++ b/src/entropy/egd/es_egd.cpp @@ -6,6 +6,7 @@ #include <botan/es_egd.h> #include <botan/bit_ops.h> #include <botan/parsing.h> +#include <botan/exceptn.h> #include <cstring> #include <sys/types.h> @@ -73,4 +74,12 @@ u32bit EGD_EntropySource::slow_poll(byte output[], u32bit length) return 0; } +/** +* Gather Entropy from EGD, limiting to 32 bytes +*/ +u32bit EGD_EntropySource::fast_poll(byte output[], u32bit length) + { + return slow_poll(output, std::max<u32bit>(length, 64)); + } + } diff --git a/src/entropy/egd/es_egd.h b/src/entropy/egd/es_egd.h index 6f5cae1b3..4f1eb9127 100644 --- a/src/entropy/egd/es_egd.h +++ b/src/entropy/egd/es_egd.h @@ -6,7 +6,7 @@ #ifndef BOTAN_ENTROPY_SRC_EGD_H__ #define BOTAN_ENTROPY_SRC_EGD_H__ -#include <botan/rng.h> +#include <botan/entropy_src.h> #include <string> #include <vector> @@ -18,7 +18,9 @@ namespace Botan { class BOTAN_DLL EGD_EntropySource : public EntropySource { public: + u32bit fast_poll(byte[], u32bit); u32bit slow_poll(byte[], u32bit); + EGD_EntropySource(const std::vector<std::string>& p) : paths(p) {} private: u32bit do_poll(byte[], u32bit, const std::string&) const; |