diff options
author | lloyd <[email protected]> | 2008-11-08 21:59:52 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-08 21:59:52 +0000 |
commit | da5a5cbea7f611ebf41a8d3065700106a8d89f2d (patch) | |
tree | 2063c22d19d8583d93208889967b68b10c0a3760 | |
parent | a9f747ab6c6f1949410368514e5af74786494318 (diff) |
Remove lookup.h from modebase
-rw-r--r-- | src/modes/cbc/cbc.cpp | 12 | ||||
-rw-r--r-- | src/modes/cfb/cfb.cpp | 12 | ||||
-rw-r--r-- | src/modes/ctr/ctr.cpp | 6 | ||||
-rw-r--r-- | src/modes/cts/cts.cpp | 12 | ||||
-rw-r--r-- | src/modes/ecb/ecb.cpp | 3 | ||||
-rw-r--r-- | src/modes/modebase/modebase.cpp | 7 | ||||
-rw-r--r-- | src/modes/modebase/modebase.h | 2 | ||||
-rw-r--r-- | src/modes/ofb/ofb.cpp | 6 |
8 files changed, 38 insertions, 22 deletions
diff --git a/src/modes/cbc/cbc.cpp b/src/modes/cbc/cbc.cpp index 9ad598bed..eea039ce3 100644 --- a/src/modes/cbc/cbc.cpp +++ b/src/modes/cbc/cbc.cpp @@ -15,7 +15,8 @@ namespace Botan { *************************************************/ CBC_Encryption::CBC_Encryption(const std::string& cipher_name, const std::string& padding_name) : - BlockCipherMode(cipher_name, "CBC", block_size_of(cipher_name)), + BlockCipherMode(get_block_cipher(cipher_name), + "CBC", block_size_of(cipher_name)), padder(get_bc_pad(padding_name)) { if(!padder->valid_blocksize(BLOCK_SIZE)) @@ -29,7 +30,8 @@ CBC_Encryption::CBC_Encryption(const std::string& cipher_name, const std::string& padding_name, const SymmetricKey& key, const InitializationVector& iv) : - BlockCipherMode(cipher_name, "CBC", block_size_of(cipher_name)), + BlockCipherMode(get_block_cipher(cipher_name), + "CBC", block_size_of(cipher_name)), padder(get_bc_pad(padding_name)) { if(!padder->valid_blocksize(BLOCK_SIZE)) @@ -84,7 +86,8 @@ std::string CBC_Encryption::name() const *************************************************/ CBC_Decryption::CBC_Decryption(const std::string& cipher_name, const std::string& padding_name) : - BlockCipherMode(cipher_name, "CBC", block_size_of(cipher_name)), + BlockCipherMode(get_block_cipher(cipher_name), + "CBC", block_size_of(cipher_name)), padder(get_bc_pad(padding_name)) { if(!padder->valid_blocksize(BLOCK_SIZE)) @@ -99,7 +102,8 @@ CBC_Decryption::CBC_Decryption(const std::string& cipher_name, const std::string& padding_name, const SymmetricKey& key, const InitializationVector& iv) : - BlockCipherMode(cipher_name, "CBC", block_size_of(cipher_name)), + BlockCipherMode(get_block_cipher(cipher_name), + "CBC", block_size_of(cipher_name)), padder(get_bc_pad(padding_name)) { if(!padder->valid_blocksize(BLOCK_SIZE)) diff --git a/src/modes/cfb/cfb.cpp b/src/modes/cfb/cfb.cpp index dbfbff6ae..60599464b 100644 --- a/src/modes/cfb/cfb.cpp +++ b/src/modes/cfb/cfb.cpp @@ -31,7 +31,8 @@ void check_feedback(u32bit BLOCK_SIZE, u32bit FEEDBACK_SIZE, u32bit bits, *************************************************/ CFB_Encryption::CFB_Encryption(const std::string& cipher_name, u32bit fback_bits) : - BlockCipherMode(cipher_name, "CFB", block_size_of(cipher_name), 1), + BlockCipherMode(get_block_cipher(cipher_name), + "CFB", block_size_of(cipher_name), 1), FEEDBACK_SIZE(fback_bits ? fback_bits / 8: BLOCK_SIZE) { check_feedback(BLOCK_SIZE, FEEDBACK_SIZE, fback_bits, name()); @@ -44,7 +45,8 @@ CFB_Encryption::CFB_Encryption(const std::string& cipher_name, const SymmetricKey& key, const InitializationVector& iv, u32bit fback_bits) : - BlockCipherMode(cipher_name, "CFB", block_size_of(cipher_name), 1), + BlockCipherMode(get_block_cipher(cipher_name), + "CFB", block_size_of(cipher_name), 1), FEEDBACK_SIZE(fback_bits ? fback_bits / 8: BLOCK_SIZE) { check_feedback(BLOCK_SIZE, FEEDBACK_SIZE, fback_bits, name()); @@ -87,7 +89,8 @@ void CFB_Encryption::feedback() *************************************************/ CFB_Decryption::CFB_Decryption(const std::string& cipher_name, u32bit fback_bits) : - BlockCipherMode(cipher_name, "CFB", block_size_of(cipher_name), 1), + BlockCipherMode(get_block_cipher(cipher_name), + "CFB", block_size_of(cipher_name), 1), FEEDBACK_SIZE(fback_bits ? fback_bits / 8 : BLOCK_SIZE) { check_feedback(BLOCK_SIZE, FEEDBACK_SIZE, fback_bits, name()); @@ -100,7 +103,8 @@ CFB_Decryption::CFB_Decryption(const std::string& cipher_name, const SymmetricKey& key, const InitializationVector& iv, u32bit fback_bits) : - BlockCipherMode(cipher_name, "CFB", block_size_of(cipher_name), 1), + BlockCipherMode(get_block_cipher(cipher_name), + "CFB", block_size_of(cipher_name), 1), FEEDBACK_SIZE(fback_bits ? fback_bits / 8 : BLOCK_SIZE) { check_feedback(BLOCK_SIZE, FEEDBACK_SIZE, fback_bits, name()); diff --git a/src/modes/ctr/ctr.cpp b/src/modes/ctr/ctr.cpp index 8b8c5f35f..c537178f9 100644 --- a/src/modes/ctr/ctr.cpp +++ b/src/modes/ctr/ctr.cpp @@ -14,7 +14,8 @@ namespace Botan { * CTR-BE Constructor * *************************************************/ CTR_BE::CTR_BE(const std::string& cipher_name) : - BlockCipherMode(cipher_name, "CTR-BE", block_size_of(cipher_name), 1) + BlockCipherMode(get_block_cipher(cipher_name), + "CTR-BE", block_size_of(cipher_name), 1) { } @@ -23,7 +24,8 @@ CTR_BE::CTR_BE(const std::string& cipher_name) : *************************************************/ CTR_BE::CTR_BE(const std::string& cipher_name, const SymmetricKey& key, const InitializationVector& iv) : - BlockCipherMode(cipher_name, "CTR-BE", block_size_of(cipher_name), 1) + BlockCipherMode(get_block_cipher(cipher_name), + "CTR-BE", block_size_of(cipher_name), 1) { set_key(key); set_iv(iv); diff --git a/src/modes/cts/cts.cpp b/src/modes/cts/cts.cpp index 8af775713..0bce248b5 100644 --- a/src/modes/cts/cts.cpp +++ b/src/modes/cts/cts.cpp @@ -14,7 +14,8 @@ namespace Botan { * CTS Encryption Constructor * *************************************************/ CTS_Encryption::CTS_Encryption(const std::string& cipher_name) : - BlockCipherMode(cipher_name, "CTS", block_size_of(cipher_name), 0, 2) + BlockCipherMode(get_block_cipher(cipher_name), + "CTS", block_size_of(cipher_name), 0, 2) { } @@ -24,7 +25,8 @@ CTS_Encryption::CTS_Encryption(const std::string& cipher_name) : CTS_Encryption::CTS_Encryption(const std::string& cipher_name, const SymmetricKey& key, const InitializationVector& iv) : - BlockCipherMode(cipher_name, "CTS", block_size_of(cipher_name), 0, 2) + BlockCipherMode(get_block_cipher(cipher_name), + "CTS", block_size_of(cipher_name), 0, 2) { set_key(key); set_iv(iv); @@ -93,7 +95,8 @@ void CTS_Encryption::end_msg() * CTS Decryption Constructor * *************************************************/ CTS_Decryption::CTS_Decryption(const std::string& cipher_name) : - BlockCipherMode(cipher_name, "CTS", block_size_of(cipher_name), 0, 2) + BlockCipherMode(get_block_cipher(cipher_name), + "CTS", block_size_of(cipher_name), 0, 2) { temp.create(BLOCK_SIZE); } @@ -104,7 +107,8 @@ CTS_Decryption::CTS_Decryption(const std::string& cipher_name) : CTS_Decryption::CTS_Decryption(const std::string& cipher_name, const SymmetricKey& key, const InitializationVector& iv) : - BlockCipherMode(cipher_name, "CTS", block_size_of(cipher_name), 0, 2) + BlockCipherMode(get_block_cipher(cipher_name), + "CTS", block_size_of(cipher_name), 0, 2) { temp.create(BLOCK_SIZE); set_key(key); diff --git a/src/modes/ecb/ecb.cpp b/src/modes/ecb/ecb.cpp index 8effac1d5..2d0888cea 100644 --- a/src/modes/ecb/ecb.cpp +++ b/src/modes/ecb/ecb.cpp @@ -12,7 +12,8 @@ namespace Botan { * ECB Constructor * *************************************************/ ECB::ECB(const std::string& cipher_name, const std::string& padding_name) : - BlockCipherMode(cipher_name, "ECB", 0), padder(get_bc_pad(padding_name)) + BlockCipherMode(get_block_cipher(cipher_name), + "ECB", 0), padder(get_bc_pad(padding_name)) { } diff --git a/src/modes/modebase/modebase.cpp b/src/modes/modebase/modebase.cpp index 6661d9f33..bf3de2572 100644 --- a/src/modes/modebase/modebase.cpp +++ b/src/modes/modebase/modebase.cpp @@ -4,21 +4,20 @@ *************************************************/ #include <botan/modebase.h> -#include <botan/lookup.h> namespace Botan { /************************************************* * Block Cipher Mode Constructor * *************************************************/ -BlockCipherMode::BlockCipherMode(const std::string& cipher_name, +BlockCipherMode::BlockCipherMode(BlockCipher* cipher_ptr, const std::string& cipher_mode_name, u32bit iv_size, u32bit iv_meth, u32bit buf_mult) : - BLOCK_SIZE(block_size_of(cipher_name)), BUFFER_SIZE(buf_mult * BLOCK_SIZE), + BLOCK_SIZE(cipher_ptr->BLOCK_SIZE), BUFFER_SIZE(buf_mult * BLOCK_SIZE), IV_METHOD(iv_meth), mode_name(cipher_mode_name) { - base_ptr = cipher = get_block_cipher(cipher_name); + base_ptr = cipher = cipher_ptr; buffer.create(BUFFER_SIZE); state.create(iv_size); position = 0; diff --git a/src/modes/modebase/modebase.h b/src/modes/modebase/modebase.h index a16b149be..9793c23d2 100644 --- a/src/modes/modebase/modebase.h +++ b/src/modes/modebase/modebase.h @@ -19,7 +19,7 @@ class BOTAN_DLL BlockCipherMode : public Keyed_Filter public: std::string name() const; - BlockCipherMode(const std::string&, const std::string&, + BlockCipherMode(BlockCipher*, const std::string&, u32bit, u32bit = 0, u32bit = 1); virtual ~BlockCipherMode() { delete cipher; } diff --git a/src/modes/ofb/ofb.cpp b/src/modes/ofb/ofb.cpp index db254d329..8162f97ba 100644 --- a/src/modes/ofb/ofb.cpp +++ b/src/modes/ofb/ofb.cpp @@ -14,7 +14,8 @@ namespace Botan { * OFB Constructor * *************************************************/ OFB::OFB(const std::string& cipher_name) : - BlockCipherMode(cipher_name, "OFB", block_size_of(cipher_name), 2) + BlockCipherMode(get_block_cipher(cipher_name), + "OFB", block_size_of(cipher_name), 2) { } @@ -23,7 +24,8 @@ OFB::OFB(const std::string& cipher_name) : *************************************************/ OFB::OFB(const std::string& cipher_name, const SymmetricKey& key, const InitializationVector& iv) : - BlockCipherMode(cipher_name, "OFB", block_size_of(cipher_name), 2) + BlockCipherMode(get_block_cipher(cipher_name), + "OFB", block_size_of(cipher_name), 2) { set_key(key); set_iv(iv); |