diff options
-rw-r--r-- | src/engine/def_engine/def_mode.cpp | 2 | ||||
-rw-r--r-- | src/modes/ctr/ctr.cpp | 10 | ||||
-rw-r--r-- | src/modes/ctr/ctr.h | 10 |
3 files changed, 10 insertions, 12 deletions
diff --git a/src/engine/def_engine/def_mode.cpp b/src/engine/def_engine/def_mode.cpp index c514c5034..88d6639eb 100644 --- a/src/engine/def_engine/def_mode.cpp +++ b/src/engine/def_engine/def_mode.cpp @@ -99,7 +99,7 @@ Keyed_Filter* Default_Engine::get_cipher(const std::string& algo_spec, else if(mode == "CTR-BE") { #if defined(BOTAN_HAS_CTR) - return new CTR_BE(cipher); + return new CTR_BE(get_block_cipher(cipher)); #else return 0; #endif diff --git a/src/modes/ctr/ctr.cpp b/src/modes/ctr/ctr.cpp index c537178f9..e61c8746c 100644 --- a/src/modes/ctr/ctr.cpp +++ b/src/modes/ctr/ctr.cpp @@ -13,19 +13,17 @@ namespace Botan { /************************************************* * CTR-BE Constructor * *************************************************/ -CTR_BE::CTR_BE(const std::string& cipher_name) : - BlockCipherMode(get_block_cipher(cipher_name), - "CTR-BE", block_size_of(cipher_name), 1) +CTR_BE::CTR_BE(BlockCipher* ciph) : + BlockCipherMode(ciph, "CTR-BE", ciph->BLOCK_SIZE, 1) { } /************************************************* * CTR-BE Constructor * *************************************************/ -CTR_BE::CTR_BE(const std::string& cipher_name, const SymmetricKey& key, +CTR_BE::CTR_BE(BlockCipher* ciph, const SymmetricKey& key, const InitializationVector& iv) : - BlockCipherMode(get_block_cipher(cipher_name), - "CTR-BE", block_size_of(cipher_name), 1) + BlockCipherMode(ciph, "CTR-BE", ciph->BLOCK_SIZE, 1) { set_key(key); set_iv(iv); diff --git a/src/modes/ctr/ctr.h b/src/modes/ctr/ctr.h index c3217a5d1..86fe3b661 100644 --- a/src/modes/ctr/ctr.h +++ b/src/modes/ctr/ctr.h @@ -3,10 +3,11 @@ * (C) 1999-2007 Jack Lloyd * *************************************************/ -#ifndef BOTAN_CTR_H__ -#define BOTAN_CTR_H__ +#ifndef BOTAN_COUNTER_MODE_H_ +#define BOTAN_COUNTER_MODE_H_ #include <botan/modebase.h> +#include <botan/modebase.h> namespace Botan { @@ -16,9 +17,8 @@ namespace Botan { class BOTAN_DLL CTR_BE : public BlockCipherMode { public: - CTR_BE(const std::string&); - CTR_BE(const std::string&, - const SymmetricKey&, const InitializationVector&); + CTR_BE(BlockCipher*); + CTR_BE(BlockCipher*, const SymmetricKey&, const InitializationVector&); private: void write(const byte[], u32bit); void increment_counter(); |