aboutsummaryrefslogtreecommitdiffstats
path: root/src/modes/cts
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-08 22:49:01 +0000
committerlloyd <[email protected]>2008-11-08 22:49:01 +0000
commit1a93a9c7e73becbfce821705b387ce3cf660dad0 (patch)
treeadbec625c67e1c30afaeaf0c639b92ac87bf38ad /src/modes/cts
parentdbccddadefdcd9d1f7bd8612d6af4449f4910b1c (diff)
Remove lookup.h from CTS mode
Diffstat (limited to 'src/modes/cts')
-rw-r--r--src/modes/cts/cts.cpp46
-rw-r--r--src/modes/cts/cts.h24
2 files changed, 18 insertions, 52 deletions
diff --git a/src/modes/cts/cts.cpp b/src/modes/cts/cts.cpp
index 0bce248b5..12756eb58 100644
--- a/src/modes/cts/cts.cpp
+++ b/src/modes/cts/cts.cpp
@@ -11,28 +11,6 @@
namespace Botan {
/*************************************************
-* CTS Encryption Constructor *
-*************************************************/
-CTS_Encryption::CTS_Encryption(const std::string& cipher_name) :
- BlockCipherMode(get_block_cipher(cipher_name),
- "CTS", block_size_of(cipher_name), 0, 2)
- {
- }
-
-/*************************************************
-* CTS Encryption Constructor *
-*************************************************/
-CTS_Encryption::CTS_Encryption(const std::string& cipher_name,
- const SymmetricKey& key,
- const InitializationVector& iv) :
- BlockCipherMode(get_block_cipher(cipher_name),
- "CTS", block_size_of(cipher_name), 0, 2)
- {
- set_key(key);
- set_iv(iv);
- }
-
-/*************************************************
* Encrypt a block *
*************************************************/
void CTS_Encryption::encrypt(const byte block[])
@@ -92,30 +70,6 @@ void CTS_Encryption::end_msg()
}
/*************************************************
-* CTS Decryption Constructor *
-*************************************************/
-CTS_Decryption::CTS_Decryption(const std::string& cipher_name) :
- BlockCipherMode(get_block_cipher(cipher_name),
- "CTS", block_size_of(cipher_name), 0, 2)
- {
- temp.create(BLOCK_SIZE);
- }
-
-/*************************************************
-* CTS Decryption Constructor *
-*************************************************/
-CTS_Decryption::CTS_Decryption(const std::string& cipher_name,
- const SymmetricKey& key,
- const InitializationVector& iv) :
- BlockCipherMode(get_block_cipher(cipher_name),
- "CTS", block_size_of(cipher_name), 0, 2)
- {
- temp.create(BLOCK_SIZE);
- set_key(key);
- set_iv(iv);
- }
-
-/*************************************************
* Decrypt a block *
*************************************************/
void CTS_Decryption::decrypt(const byte block[])
diff --git a/src/modes/cts/cts.h b/src/modes/cts/cts.h
index 6a07c4eb2..57582d8de 100644
--- a/src/modes/cts/cts.h
+++ b/src/modes/cts/cts.h
@@ -7,6 +7,7 @@
#define BOTAN_CTS_H__
#include <botan/modebase.h>
+#include <botan/block_cipher.h>
namespace Botan {
@@ -16,9 +17,14 @@ namespace Botan {
class BOTAN_DLL CTS_Encryption : public BlockCipherMode
{
public:
- CTS_Encryption(const std::string&);
- CTS_Encryption(const std::string&,
- const SymmetricKey&, const InitializationVector&);
+ CTS_Encryption(BlockCipher* ciph) :
+ BlockCipherMode(ciph, "CTS", ciph->BLOCK_SIZE, 0, 2) {}
+
+ CTS_Encryption(BlockCipher* ciph,
+ const SymmetricKey& key,
+ const InitializationVector& iv) :
+ BlockCipherMode(ciph, "CTS", ciph->BLOCK_SIZE, 0, 2)
+ { set_key(key); set_iv(iv); }
private:
void write(const byte[], u32bit);
void end_msg();
@@ -31,9 +37,15 @@ class BOTAN_DLL CTS_Encryption : public BlockCipherMode
class BOTAN_DLL CTS_Decryption : public BlockCipherMode
{
public:
- CTS_Decryption(const std::string&);
- CTS_Decryption(const std::string&,
- const SymmetricKey&, const InitializationVector&);
+ CTS_Decryption(BlockCipher* ciph) :
+ BlockCipherMode(ciph, "CTS", ciph->BLOCK_SIZE, 0, 2)
+ { temp.create(BLOCK_SIZE); }
+
+ CTS_Decryption(BlockCipher* ciph,
+ const SymmetricKey& key,
+ const InitializationVector& iv) :
+ BlockCipherMode(ciph, "CTS", ciph->BLOCK_SIZE, 0, 2)
+ { set_key(key); set_iv(iv); temp.create(BLOCK_SIZE); }
private:
void write(const byte[], u32bit);
void end_msg();