diff options
author | lloyd <[email protected]> | 2009-01-31 12:30:31 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-01-31 12:30:31 +0000 |
commit | b118c41af387f765effcca47c08fc2dcc3844778 (patch) | |
tree | 5b63b0ee31cdb8226249e3488b065e51ddfc18e3 /src/utils | |
parent | 3f5c33c9ece2e7373dde96af045cd5a4853697be (diff) | |
parent | f985e438ca768e59626ff08b143a6c80cf671b9e (diff) |
propagate from branch 'net.randombit.botan' (head 4518ef63a5e28e22a61d21a6066d0d4a5cf0616e)
to branch 'net.randombit.botan.entropy-poll-redesign' (head c8e07f10a193b25bab726af99ea2ea77a0f30eaf)
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/info.txt | 1 | ||||
-rw-r--r-- | src/utils/xor_buf.cpp | 44 | ||||
-rw-r--r-- | src/utils/xor_buf.h | 18 |
3 files changed, 0 insertions, 63 deletions
diff --git a/src/utils/info.txt b/src/utils/info.txt index 915ce50b0..ffc19c852 100644 --- a/src/utils/info.txt +++ b/src/utils/info.txt @@ -42,6 +42,5 @@ util.cpp util.h version.cpp version.h -xor_buf.cpp xor_buf.h </add> diff --git a/src/utils/xor_buf.cpp b/src/utils/xor_buf.cpp deleted file mode 100644 index 779be81c3..000000000 --- a/src/utils/xor_buf.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/** -* XOR operations -* (C) 1999-2008 Jack Lloyd -*/ - -#include <botan/xor_buf.h> -#include <botan/loadstor.h> - -namespace Botan { - -/** -* Xor values into buffer -*/ -u32bit xor_into_buf(byte buf[], u32bit buf_i, u32bit length, - const void* in_void, u32bit in_len) - { - const byte* in = static_cast<const byte*>(in_void); - - byte last = 0; - byte count = 0; - - for(u32bit i = 0; i != in_len; ++i) - { - if(in[i] != last) - { - buf[buf_i] ^= last; - buf_i = (buf_i + 1) % length; - - buf[buf_i] ^= count; - buf_i = (buf_i + 1) % length; - - last = in[i]; - count = 1; - } - else - ++count; - } - - // final values of last, count are thrown away - - return buf_i; - } - -} diff --git a/src/utils/xor_buf.h b/src/utils/xor_buf.h index 076877e02..2bf6ced59 100644 --- a/src/utils/xor_buf.h +++ b/src/utils/xor_buf.h @@ -67,24 +67,6 @@ inline void xor_buf(byte out[], out[j] = in[j] ^ in2[j]; } -/** -* XOR values into buffer. Uses RLE compression -* Intended for use in entropy sources to gather collected -* data into a buffer to pass to an RNG. -*/ -u32bit xor_into_buf(byte buf[], u32bit buf_i, u32bit length, - const void* in_void, u32bit in_len); - -/** -* XOR integer value (or something else, I guess) into buffer -*/ -template<typename T> -u32bit xor_into_buf(byte buf[], u32bit buf_i, - u32bit length, const T& in) - { - return xor_into_buf(buf, buf_i, length, &in, sizeof(in)); - } - } #endif |