diff options
author | lloyd <[email protected]> | 2008-11-08 22:45:28 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-08 22:45:28 +0000 |
commit | dbccddadefdcd9d1f7bd8612d6af4449f4910b1c (patch) | |
tree | 0e3a47f70280df03d7bd3b58eaecea6c07c31155 /src/modes/cbc | |
parent | cccd3fafcffa318fa783f857f84b5545028daca2 (diff) |
Remove lookup.h use from ECB, CBC, CFB
Diffstat (limited to 'src/modes/cbc')
-rw-r--r-- | src/modes/cbc/cbc.cpp | 37 | ||||
-rw-r--r-- | src/modes/cbc/cbc.h | 8 |
2 files changed, 20 insertions, 25 deletions
diff --git a/src/modes/cbc/cbc.cpp b/src/modes/cbc/cbc.cpp index eea039ce3..ff0c417b2 100644 --- a/src/modes/cbc/cbc.cpp +++ b/src/modes/cbc/cbc.cpp @@ -4,7 +4,6 @@ *************************************************/ #include <botan/cbc.h> -#include <botan/lookup.h> #include <botan/xor_buf.h> #include <algorithm> @@ -13,11 +12,10 @@ namespace Botan { /************************************************* * CBC Encryption Constructor * *************************************************/ -CBC_Encryption::CBC_Encryption(const std::string& cipher_name, - const std::string& padding_name) : - BlockCipherMode(get_block_cipher(cipher_name), - "CBC", block_size_of(cipher_name)), - padder(get_bc_pad(padding_name)) +CBC_Encryption::CBC_Encryption(BlockCipher* ciph, + const BlockCipherModePaddingMethod* pad) : + BlockCipherMode(ciph, "CBC", ciph->BLOCK_SIZE), + padder(pad) { if(!padder->valid_blocksize(BLOCK_SIZE)) throw Invalid_Block_Size(name(), padder->name()); @@ -26,13 +24,12 @@ CBC_Encryption::CBC_Encryption(const std::string& cipher_name, /************************************************* * CBC Encryption Constructor * *************************************************/ -CBC_Encryption::CBC_Encryption(const std::string& cipher_name, - const std::string& padding_name, +CBC_Encryption::CBC_Encryption(BlockCipher* ciph, + const BlockCipherModePaddingMethod* pad, const SymmetricKey& key, const InitializationVector& iv) : - BlockCipherMode(get_block_cipher(cipher_name), - "CBC", block_size_of(cipher_name)), - padder(get_bc_pad(padding_name)) + BlockCipherMode(ciph, "CBC", ciph->BLOCK_SIZE), + padder(pad) { if(!padder->valid_blocksize(BLOCK_SIZE)) throw Invalid_Block_Size(name(), padder->name()); @@ -84,11 +81,10 @@ std::string CBC_Encryption::name() const /************************************************* * CBC Decryption Constructor * *************************************************/ -CBC_Decryption::CBC_Decryption(const std::string& cipher_name, - const std::string& padding_name) : - BlockCipherMode(get_block_cipher(cipher_name), - "CBC", block_size_of(cipher_name)), - padder(get_bc_pad(padding_name)) +CBC_Decryption::CBC_Decryption(BlockCipher* ciph, + const BlockCipherModePaddingMethod* pad) : + BlockCipherMode(ciph, "CBC", ciph->BLOCK_SIZE), + padder(pad) { if(!padder->valid_blocksize(BLOCK_SIZE)) throw Invalid_Block_Size(name(), padder->name()); @@ -98,13 +94,12 @@ CBC_Decryption::CBC_Decryption(const std::string& cipher_name, /************************************************* * CBC Decryption Constructor * *************************************************/ -CBC_Decryption::CBC_Decryption(const std::string& cipher_name, - const std::string& padding_name, +CBC_Decryption::CBC_Decryption(BlockCipher* ciph, + const BlockCipherModePaddingMethod* pad, const SymmetricKey& key, const InitializationVector& iv) : - BlockCipherMode(get_block_cipher(cipher_name), - "CBC", block_size_of(cipher_name)), - padder(get_bc_pad(padding_name)) + BlockCipherMode(ciph, "CBC", ciph->BLOCK_SIZE), + padder(pad) { if(!padder->valid_blocksize(BLOCK_SIZE)) throw Invalid_Block_Size(name(), padder->name()); diff --git a/src/modes/cbc/cbc.h b/src/modes/cbc/cbc.h index a0a30f90f..3069d6cb5 100644 --- a/src/modes/cbc/cbc.h +++ b/src/modes/cbc/cbc.h @@ -17,8 +17,8 @@ namespace Botan { class BOTAN_DLL CBC_Encryption : public BlockCipherMode { public: - CBC_Encryption(const std::string&, const std::string&); - CBC_Encryption(const std::string&, const std::string&, + CBC_Encryption(BlockCipher*, const BlockCipherModePaddingMethod*); + CBC_Encryption(BlockCipher*, const BlockCipherModePaddingMethod*, const SymmetricKey&, const InitializationVector&); private: std::string name() const; @@ -33,8 +33,8 @@ class BOTAN_DLL CBC_Encryption : public BlockCipherMode class BOTAN_DLL CBC_Decryption : public BlockCipherMode { public: - CBC_Decryption(const std::string&, const std::string&); - CBC_Decryption(const std::string&, const std::string&, + CBC_Decryption(BlockCipher*, const BlockCipherModePaddingMethod*); + CBC_Decryption(BlockCipher*, const BlockCipherModePaddingMethod*, const SymmetricKey&, const InitializationVector&); private: std::string name() const; |