diff options
author | lloyd <[email protected]> | 2008-11-08 19:22:39 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-08 19:22:39 +0000 |
commit | 8f86d41613db588e4912fd23a61f7c6b3947e32a (patch) | |
tree | a73ec2d231700f6ac6063e07c94a37af7b81b941 | |
parent | e021640afb43a70d2950a8cce3d71f0b7dade777 (diff) |
Move declaration of StreamCipher to stream_cipher.h
-rw-r--r-- | src/cipher/arc4/arc4.h | 3 | ||||
-rw-r--r-- | src/cipher/lion/lion.h | 1 | ||||
-rw-r--r-- | src/cipher/salsa20/salsa20.h | 2 | ||||
-rw-r--r-- | src/cipher/turing/turing.h | 2 | ||||
-rw-r--r-- | src/cipher/wid_wake/wid_wake.h | 2 | ||||
-rw-r--r-- | src/core/base.h | 80 | ||||
-rw-r--r-- | src/core/info.txt | 3 | ||||
-rw-r--r-- | src/core/stream_cipher.cpp (renamed from src/core/base.cpp) | 2 | ||||
-rw-r--r-- | src/filters/filters.h | 1 | ||||
-rw-r--r-- | src/libstate/engine.h | 1 | ||||
-rw-r--r-- | src/utils/types.h | 2 |
11 files changed, 13 insertions, 86 deletions
diff --git a/src/cipher/arc4/arc4.h b/src/cipher/arc4/arc4.h index c99691484..0976ce7ea 100644 --- a/src/cipher/arc4/arc4.h +++ b/src/cipher/arc4/arc4.h @@ -6,7 +6,8 @@ #ifndef BOTAN_ARC4_H__ #define BOTAN_ARC4_H__ -#include <botan/base.h> +#include <botan/stream_cipher.h> +#include <botan/types.h> namespace Botan { diff --git a/src/cipher/lion/lion.h b/src/cipher/lion/lion.h index 1f8e1ab9c..9b8133143 100644 --- a/src/cipher/lion/lion.h +++ b/src/cipher/lion/lion.h @@ -7,6 +7,7 @@ #define BOTAN_LION_H__ #include <botan/base.h> +#include <botan/stream_cipher.h> #include <botan/hash.h> namespace Botan { diff --git a/src/cipher/salsa20/salsa20.h b/src/cipher/salsa20/salsa20.h index e107d8569..345a8dbbd 100644 --- a/src/cipher/salsa20/salsa20.h +++ b/src/cipher/salsa20/salsa20.h @@ -6,7 +6,7 @@ #ifndef BOTAN_SALSA20_H__ #define BOTAN_SALSA20_H__ -#include <botan/base.h> +#include <botan/stream_cipher.h> namespace Botan { diff --git a/src/cipher/turing/turing.h b/src/cipher/turing/turing.h index a73d08d07..f50fd9370 100644 --- a/src/cipher/turing/turing.h +++ b/src/cipher/turing/turing.h @@ -6,7 +6,7 @@ #ifndef BOTAN_TURING_H__ #define BOTAN_TURING_H__ -#include <botan/base.h> +#include <botan/stream_cipher.h> namespace Botan { diff --git a/src/cipher/wid_wake/wid_wake.h b/src/cipher/wid_wake/wid_wake.h index 09171a8f5..284572910 100644 --- a/src/cipher/wid_wake/wid_wake.h +++ b/src/cipher/wid_wake/wid_wake.h @@ -6,7 +6,7 @@ #ifndef BOTAN_WIDER_WAKE_H__ #define BOTAN_WIDER_WAKE_H__ -#include <botan/base.h> +#include <botan/stream_cipher.h> namespace Botan { diff --git a/src/core/base.h b/src/core/base.h index d23a71471..8e4341713 100644 --- a/src/core/base.h +++ b/src/core/base.h @@ -12,11 +12,6 @@ namespace Botan { -/************************************************* -* Constants * -*************************************************/ -static const u32bit DEFAULT_BUFFERSIZE = BOTAN_DEFAULT_BUFFER_SIZE; - /** * This class represents a block cipher object. */ @@ -85,81 +80,6 @@ class BOTAN_DLL BlockCipher : public SymmetricAlgorithm virtual void dec(const byte[], byte[]) const = 0; }; -/************************************************* -* Stream Cipher * -*************************************************/ -class BOTAN_DLL StreamCipher : public SymmetricAlgorithm - { - public: - const u32bit IV_LENGTH; - - /** - * Encrypt a message. - * @param i the plaintext - * @param o the byte array to hold the output, i.e. the ciphertext - * @param len the length of both i and o - */ - void encrypt(const byte i[], byte o[], u32bit len) { cipher(i, o, len); } - - /** - * Decrypt a message. - * @param i the ciphertext to decrypt - * @param o the byte array to hold the output, i.e. the plaintext - * @param len the length of both i and o - */ - void decrypt(const byte i[], byte o[], u32bit len) { cipher(i, o, len); } - - /** - * Encrypt a message. - * @param in the plaintext as input, after the function has - * returned it will hold the ciphertext - - * @param len the length of in - */ - void encrypt(byte in[], u32bit len) { cipher(in, in, len); } - - /** - * Decrypt a message. - * @param in the ciphertext as input, after the function has - * returned it will hold the plaintext - * @param len the length of in - */ - void decrypt(byte in[], u32bit len) { cipher(in, in, len); } - - /** - * Resync the cipher using the IV - * @param iv the initialization vector - * @param iv_len the length of the IV in bytes - */ - virtual void resync(const byte iv[], u32bit iv_len); - - /** - * Seek ahead in the stream. - * @param len the length to seek ahead. - */ - virtual void seek(u32bit len); - - /** - * Get a new object representing the same algorithm as *this - */ - virtual StreamCipher* clone() const = 0; - - /** - * Zeroize internal state - */ - virtual void clear() throw() = 0; - - StreamCipher(u32bit key_min, u32bit key_max = 0, - u32bit key_mod = 1, - u32bit iv_len = 0) : - SymmetricAlgorithm(key_min, key_max, key_mod), - IV_LENGTH(iv_len) {} - - virtual ~StreamCipher() {} - private: - virtual void cipher(const byte[], byte[], u32bit) = 0; - }; - } #endif diff --git a/src/core/info.txt b/src/core/info.txt index d95e3e486..fd62867e0 100644 --- a/src/core/info.txt +++ b/src/core/info.txt @@ -15,7 +15,6 @@ timer <add> allocate.h -base.cpp base.h botan.h data_src.cpp @@ -33,4 +32,6 @@ secmem.h sym_algo.h symkey.cpp symkey.h +stream_cipher.h +stream_cipher.cpp </add> diff --git a/src/core/base.cpp b/src/core/stream_cipher.cpp index 846217d66..04bb54484 100644 --- a/src/core/base.cpp +++ b/src/core/stream_cipher.cpp @@ -3,7 +3,7 @@ * (C) 1999-2007 Jack Lloyd */ -#include <botan/base.h> +#include <botan/stream_cipher.h> namespace Botan { diff --git a/src/filters/filters.h b/src/filters/filters.h index 84e157742..0dd7fc39d 100644 --- a/src/filters/filters.h +++ b/src/filters/filters.h @@ -7,6 +7,7 @@ #define BOTAN_FILTERS_H__ #include <botan/base.h> +#include <botan/stream_cipher.h> #include <botan/hash.h> #include <botan/mac.h> diff --git a/src/libstate/engine.h b/src/libstate/engine.h index bd8d1b408..3279cdcf9 100644 --- a/src/libstate/engine.h +++ b/src/libstate/engine.h @@ -7,6 +7,7 @@ #define BOTAN_ENGINE_H__ #include <botan/base.h> +#include <botan/stream_cipher.h> #include <botan/hash.h> #include <botan/mac.h> diff --git a/src/utils/types.h b/src/utils/types.h index 49d1a3c4c..6c435952a 100644 --- a/src/utils/types.h +++ b/src/utils/types.h @@ -26,6 +26,8 @@ typedef signed int s32bit; typedef unsigned long long u64bit; #endif +static const u32bit DEFAULT_BUFFERSIZE = BOTAN_DEFAULT_BUFFER_SIZE; + } namespace Botan_types { |