diff options
author | lloyd <[email protected]> | 2008-09-30 05:41:04 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-30 05:41:04 +0000 |
commit | 75ef07ee5378341adf054bd729232167c73e9e47 (patch) | |
tree | 7c84c43a431f0313b4f08b4267ff066650948bb0 /src/cipher | |
parent | bc9e881d7c7a569664b5e753c12e4c8cbde06d2d (diff) |
Remove lookup/libstate dependency on Lion, KDF1, KDF2, EMSA[1-4]
Diffstat (limited to 'src/cipher')
-rw-r--r-- | src/cipher/lion/lion.cpp | 14 | ||||
-rw-r--r-- | src/cipher/lion/lion.h | 5 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/cipher/lion/lion.cpp b/src/cipher/lion/lion.cpp index 009e98408..c5d6fc9de 100644 --- a/src/cipher/lion/lion.cpp +++ b/src/cipher/lion/lion.cpp @@ -4,7 +4,6 @@ *************************************************/ #include <botan/lion.h> -#include <botan/lookup.h> #include <botan/xor_buf.h> #include <botan/parsing.h> @@ -76,7 +75,7 @@ std::string Lion::name() const *************************************************/ BlockCipher* Lion::clone() const { - return new Lion(hash->name(), cipher->name(), BLOCK_SIZE); + return new Lion(hash->clone(), cipher->clone(), BLOCK_SIZE); } /************************************************* @@ -93,14 +92,11 @@ void Lion::clear() throw() /************************************************* * Lion Constructor * *************************************************/ -Lion::Lion(const std::string& hash_name, const std::string& sc_name, - u32bit block_len) : - BlockCipher(block_len, 2, 2*output_length_of(hash_name), 2), - LEFT_SIZE(output_length_of(hash_name)), RIGHT_SIZE(BLOCK_SIZE - LEFT_SIZE) +Lion::Lion(HashFunction* hash_in, StreamCipher* sc_in, u32bit block_len) : + BlockCipher(block_len, 2, 2*hash_in->OUTPUT_LENGTH, 2), + LEFT_SIZE(hash->OUTPUT_LENGTH), RIGHT_SIZE(BLOCK_SIZE - LEFT_SIZE), + hash(hash_in), cipher(sc_in) { - hash = get_hash(hash_name); - cipher = get_stream_cipher(sc_name); - if(2*LEFT_SIZE + 1 > BLOCK_SIZE) throw Invalid_Argument(name() + ": Chosen block size is too small"); if(!cipher->valid_keylength(LEFT_SIZE)) diff --git a/src/cipher/lion/lion.h b/src/cipher/lion/lion.h index 70018838a..445682987 100644 --- a/src/cipher/lion/lion.h +++ b/src/cipher/lion/lion.h @@ -19,13 +19,16 @@ class BOTAN_DLL Lion : public BlockCipher void clear() throw(); std::string name() const; BlockCipher* clone() const; - Lion(const std::string&, const std::string&, u32bit); + + Lion(HashFunction*, StreamCipher*, u32bit); ~Lion() { delete hash; delete cipher; } private: void enc(const byte[], byte[]) const; void dec(const byte[], byte[]) const; void key(const byte[], u32bit); + const u32bit LEFT_SIZE, RIGHT_SIZE; + HashFunction* hash; StreamCipher* cipher; SecureVector<byte> key1, key2; |