diff options
author | lloyd <[email protected]> | 2008-11-23 18:42:55 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-23 18:42:55 +0000 |
commit | f4b969459033752f32ac878b6eac932713866f88 (patch) | |
tree | 0185e14a14700b7a56a29178a75bdef62649b77d /src/entropy | |
parent | 763d3a6d337dcd6339d6bd4858f84783274b3fec (diff) |
Remove now unused buf_es module
Diffstat (limited to 'src/entropy')
-rw-r--r-- | src/entropy/buf_es/buf_es.cpp | 85 | ||||
-rw-r--r-- | src/entropy/buf_es/buf_es.h | 39 | ||||
-rw-r--r-- | src/entropy/buf_es/info.txt | 10 |
3 files changed, 0 insertions, 134 deletions
diff --git a/src/entropy/buf_es/buf_es.cpp b/src/entropy/buf_es/buf_es.cpp deleted file mode 100644 index 4a88d67bd..000000000 --- a/src/entropy/buf_es/buf_es.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************* -* Buffered EntropySource Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#include <botan/buf_es.h> -#include <botan/xor_buf.h> -#include <botan/util.h> -#include <algorithm> - -namespace Botan { - -/************************************************* -* Buffered_EntropySource Constructor * -*************************************************/ -Buffered_EntropySource::Buffered_EntropySource() : buffer(128) - { - read_pos = write_pos = 0; - } - -/************************************************* -* Fast Poll * -*************************************************/ -u32bit Buffered_EntropySource::fast_poll(byte out[], u32bit length) - { - do_fast_poll(); - return copy_out(out, length, buffer.size() / 4); - } - -/************************************************* -* Slow Poll * -*************************************************/ -u32bit Buffered_EntropySource::slow_poll(byte out[], u32bit length) - { - do_slow_poll(); - return copy_out(out, length, buffer.size()); - } - -/************************************************* -* Default fast poll operation * -*************************************************/ -void Buffered_EntropySource::do_fast_poll() - { - return do_slow_poll(); - } - -/************************************************* -* Add entropy to the internal buffer * -*************************************************/ -void Buffered_EntropySource::add_bytes(const void* entropy_ptr, u32bit length) - { - const byte* bytes = static_cast<const byte*>(entropy_ptr); - - while(length) - { - u32bit copied = std::min(length, buffer.size() - write_pos); - xor_buf(buffer + write_pos, bytes, copied); - bytes += copied; - length -= copied; - write_pos = (write_pos + copied) % buffer.size(); - } - } - -/************************************************* -* Add entropy to the internal buffer * -*************************************************/ -void Buffered_EntropySource::add_bytes(u64bit entropy) - { - add_bytes(&entropy, 8); - } - -/************************************************* -* Take entropy from the internal buffer * -*************************************************/ -u32bit Buffered_EntropySource::copy_out(byte out[], u32bit length, - u32bit max_read) - { - length = std::min(length, max_read); - u32bit copied = std::min(length, buffer.size() - read_pos); - xor_buf(out, buffer + read_pos, copied); - read_pos = (read_pos + copied) % buffer.size(); - return copied; - } - -} diff --git a/src/entropy/buf_es/buf_es.h b/src/entropy/buf_es/buf_es.h deleted file mode 100644 index f8ec9991c..000000000 --- a/src/entropy/buf_es/buf_es.h +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************* -* Buffered EntropySource Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_BUFFERED_ES_H__ -#define BOTAN_BUFFERED_ES_H__ - -#include <botan/entropy_src.h> -#include <botan/secmem.h> - -namespace Botan { - -/************************************************* -* Buffered EntropySource * -*************************************************/ -class BOTAN_DLL Buffered_EntropySource : public EntropySource - { - public: - u32bit slow_poll(byte[], u32bit); - u32bit fast_poll(byte[], u32bit); - protected: - Buffered_EntropySource(); - u32bit copy_out(byte[], u32bit, u32bit); - - void add_bytes(const void*, u32bit); - void add_bytes(u64bit); - - virtual void do_slow_poll() = 0; - virtual void do_fast_poll(); - private: - SecureVector<byte> buffer; - u32bit write_pos, read_pos; - bool done_slow_poll; - }; - -} - -#endif diff --git a/src/entropy/buf_es/info.txt b/src/entropy/buf_es/info.txt deleted file mode 100644 index b30ece6e6..000000000 --- a/src/entropy/buf_es/info.txt +++ /dev/null @@ -1,10 +0,0 @@ -realname "Buffered Entropy Source" - -define BUFFERED_ENTROPY_SOURCE - -load_on auto - -<add> -buf_es.cpp -buf_es.h -</add> |