diff options
author | lloyd <[email protected]> | 2008-09-28 18:15:52 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-28 18:15:52 +0000 |
commit | 983a8ecb42e844f89466d0ae52bba591d4fc4275 (patch) | |
tree | de01378ee9be0ba8bec28bc08d3bde6e422ff898 /include | |
parent | d59f6a2c9e797ee22c21b2d85c662e0fe8d1cf35 (diff) |
Modularize cipher modes
Diffstat (limited to 'include')
-rw-r--r-- | include/cbc.h | 49 | ||||
-rw-r--r-- | include/cfb.h | 45 | ||||
-rw-r--r-- | include/ctr.h | 29 | ||||
-rw-r--r-- | include/cts.h | 46 | ||||
-rw-r--r-- | include/eax.h | 72 | ||||
-rw-r--r-- | include/ecb.h | 57 | ||||
-rw-r--r-- | include/ofb.h | 28 |
7 files changed, 0 insertions, 326 deletions
diff --git a/include/cbc.h b/include/cbc.h deleted file mode 100644 index a0a30f90f..000000000 --- a/include/cbc.h +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************* -* CBC Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_CBC_H__ -#define BOTAN_CBC_H__ - -#include <botan/modebase.h> -#include <botan/mode_pad.h> - -namespace Botan { - -/************************************************* -* CBC Encryption * -*************************************************/ -class BOTAN_DLL CBC_Encryption : public BlockCipherMode - { - public: - CBC_Encryption(const std::string&, const std::string&); - CBC_Encryption(const std::string&, const std::string&, - const SymmetricKey&, const InitializationVector&); - private: - std::string name() const; - void write(const byte[], u32bit); - void end_msg(); - const BlockCipherModePaddingMethod* padder; - }; - -/************************************************* -* CBC Decryption * -*************************************************/ -class BOTAN_DLL CBC_Decryption : public BlockCipherMode - { - public: - CBC_Decryption(const std::string&, const std::string&); - CBC_Decryption(const std::string&, const std::string&, - const SymmetricKey&, const InitializationVector&); - private: - std::string name() const; - void write(const byte[], u32bit); - void end_msg(); - const BlockCipherModePaddingMethod* padder; - SecureVector<byte> temp; - }; - -} - -#endif diff --git a/include/cfb.h b/include/cfb.h deleted file mode 100644 index e8133bcf4..000000000 --- a/include/cfb.h +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************* -* CFB Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_CFB_H__ -#define BOTAN_CFB_H__ - -#include <botan/modebase.h> - -namespace Botan { - -/************************************************* -* CFB Encryption * -*************************************************/ -class BOTAN_DLL CFB_Encryption : public BlockCipherMode - { - public: - CFB_Encryption(const std::string&, u32bit = 0); - CFB_Encryption(const std::string&, const SymmetricKey&, - const InitializationVector&, u32bit = 0); - private: - void write(const byte[], u32bit); - void feedback(); - const u32bit FEEDBACK_SIZE; - }; - -/************************************************* -* CFB Decryption * -*************************************************/ -class BOTAN_DLL CFB_Decryption : public BlockCipherMode - { - public: - CFB_Decryption(const std::string&, u32bit = 0); - CFB_Decryption(const std::string&, const SymmetricKey&, - const InitializationVector&, u32bit = 0); - private: - void write(const byte[], u32bit); - void feedback(); - const u32bit FEEDBACK_SIZE; - }; - -} - -#endif diff --git a/include/ctr.h b/include/ctr.h deleted file mode 100644 index c3217a5d1..000000000 --- a/include/ctr.h +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************* -* CTR Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_CTR_H__ -#define BOTAN_CTR_H__ - -#include <botan/modebase.h> - -namespace Botan { - -/************************************************* -* CTR-BE Mode * -*************************************************/ -class BOTAN_DLL CTR_BE : public BlockCipherMode - { - public: - CTR_BE(const std::string&); - CTR_BE(const std::string&, - const SymmetricKey&, const InitializationVector&); - private: - void write(const byte[], u32bit); - void increment_counter(); - }; - -} - -#endif diff --git a/include/cts.h b/include/cts.h deleted file mode 100644 index 6a07c4eb2..000000000 --- a/include/cts.h +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************* -* CTS Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_CTS_H__ -#define BOTAN_CTS_H__ - -#include <botan/modebase.h> - -namespace Botan { - -/************************************************* -* CTS Encryption * -*************************************************/ -class BOTAN_DLL CTS_Encryption : public BlockCipherMode - { - public: - CTS_Encryption(const std::string&); - CTS_Encryption(const std::string&, - const SymmetricKey&, const InitializationVector&); - private: - void write(const byte[], u32bit); - void end_msg(); - void encrypt(const byte[]); - }; - -/************************************************* -* CTS Decryption * -*************************************************/ -class BOTAN_DLL CTS_Decryption : public BlockCipherMode - { - public: - CTS_Decryption(const std::string&); - CTS_Decryption(const std::string&, - const SymmetricKey&, const InitializationVector&); - private: - void write(const byte[], u32bit); - void end_msg(); - void decrypt(const byte[]); - SecureVector<byte> temp; - }; - -} - -#endif diff --git a/include/eax.h b/include/eax.h deleted file mode 100644 index 676e5334e..000000000 --- a/include/eax.h +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************* -* EAX Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_EAX_H__ -#define BOTAN_EAX_H__ - -#include <botan/basefilt.h> - -namespace Botan { - -/************************************************* -* EAX Base Class * -*************************************************/ -class BOTAN_DLL EAX_Base : public Keyed_Filter - { - public: - void set_key(const SymmetricKey&); - void set_iv(const InitializationVector&); - void set_header(const byte[], u32bit); - std::string name() const; - - bool valid_keylength(u32bit) const; - - ~EAX_Base() { delete cipher; delete mac; } - protected: - EAX_Base(const std::string&, u32bit); - void start_msg(); - void increment_counter(); - - const u32bit TAG_SIZE, BLOCK_SIZE; - BlockCipher* cipher; - MessageAuthenticationCode* mac; - SecureVector<byte> nonce_mac, header_mac, state, buffer; - u32bit position; - }; - -/************************************************* -* EAX Encryption * -*************************************************/ -class BOTAN_DLL EAX_Encryption : public EAX_Base - { - public: - EAX_Encryption(const std::string&, u32bit = 0); - EAX_Encryption(const std::string&, const SymmetricKey&, - const InitializationVector&, u32bit = 0); - private: - void write(const byte[], u32bit); - void end_msg(); - }; - -/************************************************* -* EAX Decryption * -*************************************************/ -class BOTAN_DLL EAX_Decryption : public EAX_Base - { - public: - EAX_Decryption(const std::string&, u32bit = 0); - EAX_Decryption(const std::string&, const SymmetricKey&, - const InitializationVector&, u32bit = 0); - private: - void write(const byte[], u32bit); - void do_write(const byte[], u32bit); - void end_msg(); - SecureVector<byte> queue; - u32bit queue_start, queue_end; - }; - -} - -#endif diff --git a/include/ecb.h b/include/ecb.h deleted file mode 100644 index b730a4fd4..000000000 --- a/include/ecb.h +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************* -* ECB Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_ECB_H__ -#define BOTAN_ECB_H__ - -#include <botan/modebase.h> -#include <botan/mode_pad.h> - -namespace Botan { - -/************************************************* -* ECB * -*************************************************/ -class BOTAN_DLL ECB : public BlockCipherMode - { - protected: - ECB(const std::string&, const std::string&); - std::string name() const; - const BlockCipherModePaddingMethod* padder; - private: - bool valid_iv_size(u32bit) const; - }; - -/************************************************* -* ECB Encryption * -*************************************************/ -class BOTAN_DLL ECB_Encryption : public ECB - { - public: - ECB_Encryption(const std::string&, const std::string&); - ECB_Encryption(const std::string&, const std::string&, - const SymmetricKey&); - private: - void write(const byte[], u32bit); - void end_msg(); - }; - -/************************************************* -* ECB Decryption * -*************************************************/ -class BOTAN_DLL ECB_Decryption : public ECB - { - public: - ECB_Decryption(const std::string&, const std::string&); - ECB_Decryption(const std::string&, const std::string&, - const SymmetricKey&); - private: - void write(const byte[], u32bit); - void end_msg(); - }; - -} - -#endif diff --git a/include/ofb.h b/include/ofb.h deleted file mode 100644 index 3bf6f9883..000000000 --- a/include/ofb.h +++ /dev/null @@ -1,28 +0,0 @@ -/************************************************* -* OFB Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_OFB_H__ -#define BOTAN_OFB_H__ - -#include <botan/modebase.h> - -namespace Botan { - -/************************************************* -* OFB Mode * -*************************************************/ -class BOTAN_DLL OFB : public BlockCipherMode - { - public: - OFB(const std::string&); - OFB(const std::string&, - const SymmetricKey&, const InitializationVector&); - private: - void write(const byte[], u32bit); - }; - -} - -#endif |