From 8dba7b5264403e781bbb86ff61850e4377dca7b9 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sat, 8 Nov 2008 19:42:16 +0000 Subject: Split base.h into block_cipher.h and stream_cipher.h It turned out many files were including base.h merely to get other includes (like types.h, secmem.h, and exceptn.h). Those have been changed to directly include the files containing the declarations that code needs. --- src/cipher/aes/aes.h | 2 +- src/cipher/blowfish/blowfish.h | 2 +- src/cipher/cast/cast128.h | 2 +- src/cipher/cast/cast256.h | 2 +- src/cipher/des/des.h | 2 +- src/cipher/gost/gost.h | 2 +- src/cipher/idea/idea.h | 2 +- src/cipher/kasumi/kasumi.h | 2 +- src/cipher/lion/lion.h | 2 +- src/cipher/lubyrack/lubyrack.h | 2 +- src/cipher/mars/mars.h | 2 +- src/cipher/misty1/misty1.h | 2 +- src/cipher/noekeon/noekeon.h | 2 +- src/cipher/rc2/rc2.h | 2 +- src/cipher/rc5/rc5.h | 2 +- src/cipher/rc6/rc6.h | 2 +- src/cipher/safer/safer_sk.h | 2 +- src/cipher/seed/seed.h | 2 +- src/cipher/serpent/serpent.h | 2 +- src/cipher/skipjack/skipjack.h | 2 +- src/cipher/square/square.h | 2 +- src/cipher/tea/tea.h | 2 +- src/cipher/twofish/twofish.h | 2 +- src/cipher/xtea/xtea.h | 2 +- src/cms/cms_enc.h | 1 + src/codec/base64/base64.cpp | 1 + src/codec/bzip2/bzip2.cpp | 2 + src/codec/hex/hex.cpp | 1 + src/codec/zlib/zlib.cpp | 2 + src/core/base.h | 85 --------------------------------- src/core/block_cipher.h | 85 +++++++++++++++++++++++++++++++++ src/core/data_src.cpp | 2 + src/core/data_src.h | 3 +- src/core/info.txt | 2 +- src/core/stream_cipher.h | 92 ++++++++++++++++++++++++++++++++++++ src/core/sym_algo.h | 93 +++++++++++++++++++++++++++++++++++++ src/entropy/unix_procs/unix_cmd.cpp | 2 + src/filters/basefilt.h | 1 + src/filters/buf_filt.cpp | 1 + src/filters/data_snk.cpp | 1 + src/filters/fd_unix/fd_unix.cpp | 1 + src/filters/filter.cpp | 1 + src/filters/filter.h | 2 +- src/filters/filters.h | 2 +- src/filters/pipe.h | 1 + src/hash/info.txt | 11 +++++ src/libstate/engine.h | 2 +- src/libstate/libstate.h | 4 +- src/libstate/look_add.h | 8 +++- src/libstate/lookup.h | 7 ++- src/mac/cbc_mac/cbc_mac.h | 1 + src/mac/cmac/cmac.h | 1 + src/mac/mac.h | 2 +- src/mac/x919_mac/x919_mac.h | 1 + src/modes/eax/eax.h | 1 + src/modes/mode_pad/mode_pad.cpp | 1 + src/modes/mode_pad/mode_pad.h | 2 +- src/modes/modebase/modebase.h | 1 + src/pk_pad/pk_pad.h | 2 +- src/pubkey/pubkey/pubkey.h | 3 +- src/rng/auto_rng/auto_rng.h | 2 +- src/rng/randpool/randpool.h | 2 +- src/rng/x931_rng/x931_rng.h | 2 +- src/selftest/selftest.h | 2 +- 64 files changed, 357 insertions(+), 127 deletions(-) delete mode 100644 src/core/base.h create mode 100644 src/core/block_cipher.h create mode 100644 src/core/stream_cipher.h create mode 100644 src/core/sym_algo.h create mode 100644 src/hash/info.txt (limited to 'src') diff --git a/src/cipher/aes/aes.h b/src/cipher/aes/aes.h index 5b43735ad..e287a303d 100644 --- a/src/cipher/aes/aes.h +++ b/src/cipher/aes/aes.h @@ -6,7 +6,7 @@ #ifndef BOTAN_AES_H__ #define BOTAN_AES_H__ -#include +#include namespace Botan { diff --git a/src/cipher/blowfish/blowfish.h b/src/cipher/blowfish/blowfish.h index 79875ba90..16f5239e3 100644 --- a/src/cipher/blowfish/blowfish.h +++ b/src/cipher/blowfish/blowfish.h @@ -6,7 +6,7 @@ #ifndef BOTAN_BLOWFISH_H__ #define BOTAN_BLOWFISH_H__ -#include +#include namespace Botan { diff --git a/src/cipher/cast/cast128.h b/src/cipher/cast/cast128.h index 0a7c53864..b9d02cd7a 100644 --- a/src/cipher/cast/cast128.h +++ b/src/cipher/cast/cast128.h @@ -6,7 +6,7 @@ #ifndef BOTAN_CAST128_H__ #define BOTAN_CAST128_H__ -#include +#include namespace Botan { diff --git a/src/cipher/cast/cast256.h b/src/cipher/cast/cast256.h index d4b7c6b18..cf0bcc953 100644 --- a/src/cipher/cast/cast256.h +++ b/src/cipher/cast/cast256.h @@ -6,7 +6,7 @@ #ifndef BOTAN_CAST256_H__ #define BOTAN_CAST256_H__ -#include +#include namespace Botan { diff --git a/src/cipher/des/des.h b/src/cipher/des/des.h index eb4689849..8cd490b3c 100644 --- a/src/cipher/des/des.h +++ b/src/cipher/des/des.h @@ -6,7 +6,7 @@ #ifndef BOTAN_DES_H__ #define BOTAN_DES_H__ -#include +#include namespace Botan { diff --git a/src/cipher/gost/gost.h b/src/cipher/gost/gost.h index d78e3245f..ef2897fae 100644 --- a/src/cipher/gost/gost.h +++ b/src/cipher/gost/gost.h @@ -6,7 +6,7 @@ #ifndef BOTAN_GOST_H__ #define BOTAN_GOST_H__ -#include +#include namespace Botan { diff --git a/src/cipher/idea/idea.h b/src/cipher/idea/idea.h index 4c5e82aca..824a9c6ed 100644 --- a/src/cipher/idea/idea.h +++ b/src/cipher/idea/idea.h @@ -6,7 +6,7 @@ #ifndef BOTAN_IDEA_H__ #define BOTAN_IDEA_H__ -#include +#include namespace Botan { diff --git a/src/cipher/kasumi/kasumi.h b/src/cipher/kasumi/kasumi.h index 49050480c..40fa7c36a 100644 --- a/src/cipher/kasumi/kasumi.h +++ b/src/cipher/kasumi/kasumi.h @@ -6,7 +6,7 @@ #ifndef BOTAN_KASUMI_H__ #define BOTAN_KASUMI_H__ -#include +#include namespace Botan { diff --git a/src/cipher/lion/lion.h b/src/cipher/lion/lion.h index 9b8133143..d541eb76e 100644 --- a/src/cipher/lion/lion.h +++ b/src/cipher/lion/lion.h @@ -6,7 +6,7 @@ #ifndef BOTAN_LION_H__ #define BOTAN_LION_H__ -#include +#include #include #include diff --git a/src/cipher/lubyrack/lubyrack.h b/src/cipher/lubyrack/lubyrack.h index c22fdde43..ba5a4d052 100644 --- a/src/cipher/lubyrack/lubyrack.h +++ b/src/cipher/lubyrack/lubyrack.h @@ -6,7 +6,7 @@ #ifndef BOTAN_LUBY_RACKOFF_H__ #define BOTAN_LUBY_RACKOFF_H__ -#include +#include #include namespace Botan { diff --git a/src/cipher/mars/mars.h b/src/cipher/mars/mars.h index 6e1bc9f34..950c1eb6a 100644 --- a/src/cipher/mars/mars.h +++ b/src/cipher/mars/mars.h @@ -6,7 +6,7 @@ #ifndef BOTAN_MARS_H__ #define BOTAN_MARS_H__ -#include +#include namespace Botan { diff --git a/src/cipher/misty1/misty1.h b/src/cipher/misty1/misty1.h index 9e506d536..0bd3ca1e4 100644 --- a/src/cipher/misty1/misty1.h +++ b/src/cipher/misty1/misty1.h @@ -6,7 +6,7 @@ #ifndef BOTAN_MISTY1_H__ #define BOTAN_MISTY1_H__ -#include +#include namespace Botan { diff --git a/src/cipher/noekeon/noekeon.h b/src/cipher/noekeon/noekeon.h index 660ab487a..fb06f8c79 100644 --- a/src/cipher/noekeon/noekeon.h +++ b/src/cipher/noekeon/noekeon.h @@ -6,7 +6,7 @@ #ifndef BOTAN_NOEKEON_H__ #define BOTAN_NOEKEON_H__ -#include +#include namespace Botan { diff --git a/src/cipher/rc2/rc2.h b/src/cipher/rc2/rc2.h index 8f46821a4..ddf5154b8 100644 --- a/src/cipher/rc2/rc2.h +++ b/src/cipher/rc2/rc2.h @@ -6,7 +6,7 @@ #ifndef BOTAN_RC2_H__ #define BOTAN_RC2_H__ -#include +#include namespace Botan { diff --git a/src/cipher/rc5/rc5.h b/src/cipher/rc5/rc5.h index 0827048dc..bb91c3e68 100644 --- a/src/cipher/rc5/rc5.h +++ b/src/cipher/rc5/rc5.h @@ -6,7 +6,7 @@ #ifndef BOTAN_RC5_H__ #define BOTAN_RC5_H__ -#include +#include namespace Botan { diff --git a/src/cipher/rc6/rc6.h b/src/cipher/rc6/rc6.h index d629b0995..3517b4671 100644 --- a/src/cipher/rc6/rc6.h +++ b/src/cipher/rc6/rc6.h @@ -6,7 +6,7 @@ #ifndef BOTAN_RC6_H__ #define BOTAN_RC6_H__ -#include +#include namespace Botan { diff --git a/src/cipher/safer/safer_sk.h b/src/cipher/safer/safer_sk.h index 1bc65e2f7..121cf545b 100644 --- a/src/cipher/safer/safer_sk.h +++ b/src/cipher/safer/safer_sk.h @@ -6,7 +6,7 @@ #ifndef BOTAN_SAFER_SK_H__ #define BOTAN_SAFER_SK_H__ -#include +#include namespace Botan { diff --git a/src/cipher/seed/seed.h b/src/cipher/seed/seed.h index 95ddbe1d5..9e96ec8c2 100644 --- a/src/cipher/seed/seed.h +++ b/src/cipher/seed/seed.h @@ -6,7 +6,7 @@ #ifndef BOTAN_SEED_H__ #define BOTAN_SEED_H__ -#include +#include namespace Botan { diff --git a/src/cipher/serpent/serpent.h b/src/cipher/serpent/serpent.h index 76acff487..cac042185 100644 --- a/src/cipher/serpent/serpent.h +++ b/src/cipher/serpent/serpent.h @@ -6,7 +6,7 @@ #ifndef BOTAN_SERPENT_H__ #define BOTAN_SERPENT_H__ -#include +#include namespace Botan { diff --git a/src/cipher/skipjack/skipjack.h b/src/cipher/skipjack/skipjack.h index 240148f19..c7c9ec9b9 100644 --- a/src/cipher/skipjack/skipjack.h +++ b/src/cipher/skipjack/skipjack.h @@ -6,7 +6,7 @@ #ifndef BOTAN_SKIPJACK_H__ #define BOTAN_SKIPJACK_H__ -#include +#include namespace Botan { diff --git a/src/cipher/square/square.h b/src/cipher/square/square.h index efbc6e730..97326e7ea 100644 --- a/src/cipher/square/square.h +++ b/src/cipher/square/square.h @@ -6,7 +6,7 @@ #ifndef BOTAN_SQUARE_H__ #define BOTAN_SQUARE_H__ -#include +#include namespace Botan { diff --git a/src/cipher/tea/tea.h b/src/cipher/tea/tea.h index 2fc9fe838..71d4e02f9 100644 --- a/src/cipher/tea/tea.h +++ b/src/cipher/tea/tea.h @@ -6,7 +6,7 @@ #ifndef BOTAN_TEA_H__ #define BOTAN_TEA_H__ -#include +#include namespace Botan { diff --git a/src/cipher/twofish/twofish.h b/src/cipher/twofish/twofish.h index 8519a9aa8..f7788722c 100644 --- a/src/cipher/twofish/twofish.h +++ b/src/cipher/twofish/twofish.h @@ -6,7 +6,7 @@ #ifndef BOTAN_TWOFISH_H__ #define BOTAN_TWOFISH_H__ -#include +#include namespace Botan { diff --git a/src/cipher/xtea/xtea.h b/src/cipher/xtea/xtea.h index 193c13bb9..03b41f683 100644 --- a/src/cipher/xtea/xtea.h +++ b/src/cipher/xtea/xtea.h @@ -6,7 +6,7 @@ #ifndef BOTAN_XTEA_H__ #define BOTAN_XTEA_H__ -#include +#include namespace Botan { diff --git a/src/cms/cms_enc.h b/src/cms/cms_enc.h index adfa57400..f62c56ffa 100644 --- a/src/cms/cms_enc.h +++ b/src/cms/cms_enc.h @@ -9,6 +9,7 @@ #include #include #include +#include namespace Botan { diff --git a/src/codec/base64/base64.cpp b/src/codec/base64/base64.cpp index 0e01d94f3..b1a802376 100644 --- a/src/codec/base64/base64.cpp +++ b/src/codec/base64/base64.cpp @@ -5,6 +5,7 @@ #include #include +#include #include namespace Botan { diff --git a/src/codec/bzip2/bzip2.cpp b/src/codec/bzip2/bzip2.cpp index 712dacd7d..18b3c51f0 100644 --- a/src/codec/bzip2/bzip2.cpp +++ b/src/codec/bzip2/bzip2.cpp @@ -6,6 +6,8 @@ *************************************************/ #include +#include + #include #include #define BZ_NO_STDIO diff --git a/src/codec/hex/hex.cpp b/src/codec/hex/hex.cpp index afb082f76..4cbc1d37b 100644 --- a/src/codec/hex/hex.cpp +++ b/src/codec/hex/hex.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include namespace Botan { diff --git a/src/codec/zlib/zlib.cpp b/src/codec/zlib/zlib.cpp index 36a9640e3..6f1e2b770 100644 --- a/src/codec/zlib/zlib.cpp +++ b/src/codec/zlib/zlib.cpp @@ -6,6 +6,8 @@ *************************************************/ #include +#include + #include #include #include diff --git a/src/core/base.h b/src/core/base.h deleted file mode 100644 index 8e4341713..000000000 --- a/src/core/base.h +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************* -* Base Classes Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_BASE_H__ -#define BOTAN_BASE_H__ - -#include -#include -#include - -namespace Botan { - -/** -* This class represents a block cipher object. -*/ -class BOTAN_DLL BlockCipher : public SymmetricAlgorithm - { - public: - /** - * The block size of this algorithm. - */ - const u32bit BLOCK_SIZE; - - /** - * Encrypt a block. - * @param in The plaintext block to be encrypted as a byte array. - * Must be of length BLOCK_SIZE. - * @param out The byte array designated to hold the encrypted block. - * Must be of length BLOCK_SIZE. - */ - void encrypt(const byte in[], byte out[]) const { enc(in, out); } - - /** - * Decrypt a block. - * @param in The ciphertext block to be decypted as a byte array. - * Must be of length BLOCK_SIZE. - * @param out The byte array designated to hold the decrypted block. - * Must be of length BLOCK_SIZE. - */ - void decrypt(const byte in[], byte out[]) const { dec(in, out); } - - /** - * Encrypt a block. - * @param in The plaintext block to be encrypted as a byte array. - * Must be of length BLOCK_SIZE. Will hold the result when the function - * has finished. - */ - void encrypt(byte block[]) const { enc(block, block); } - - /** - * Decrypt a block. - * @param in The ciphertext block to be decrypted as a byte array. - * Must be of length BLOCK_SIZE. Will hold the result when the function - * has finished. - */ - void decrypt(byte block[]) const { dec(block, block); } - - /** - * Get a new object representing the same algorithm as *this - */ - virtual BlockCipher* clone() const = 0; - - /** - * Zeroize internal state - */ - virtual void clear() throw() = 0; - - BlockCipher(u32bit block_size, - u32bit key_min, - u32bit key_max = 0, - u32bit key_mod = 1) : - SymmetricAlgorithm(key_min, key_max, key_mod), - BLOCK_SIZE(block_size) {} - - virtual ~BlockCipher() {} - private: - virtual void enc(const byte[], byte[]) const = 0; - virtual void dec(const byte[], byte[]) const = 0; - }; - -} - -#endif diff --git a/src/core/block_cipher.h b/src/core/block_cipher.h new file mode 100644 index 000000000..1a4302581 --- /dev/null +++ b/src/core/block_cipher.h @@ -0,0 +1,85 @@ +/** +* Block Cipher Base Class +* (C) 1999-2007 Jack Lloyd +*/ + +#ifndef BOTAN_BLOCK_CIPHER__ +#define BOTAN_BLOCK_CIPHER__ + +#include +#include +#include + +namespace Botan { + +/** +* This class represents a block cipher object. +*/ +class BOTAN_DLL BlockCipher : public SymmetricAlgorithm + { + public: + /** + * The block size of this algorithm. + */ + const u32bit BLOCK_SIZE; + + /** + * Encrypt a block. + * @param in The plaintext block to be encrypted as a byte array. + * Must be of length BLOCK_SIZE. + * @param out The byte array designated to hold the encrypted block. + * Must be of length BLOCK_SIZE. + */ + void encrypt(const byte in[], byte out[]) const { enc(in, out); } + + /** + * Decrypt a block. + * @param in The ciphertext block to be decypted as a byte array. + * Must be of length BLOCK_SIZE. + * @param out The byte array designated to hold the decrypted block. + * Must be of length BLOCK_SIZE. + */ + void decrypt(const byte in[], byte out[]) const { dec(in, out); } + + /** + * Encrypt a block. + * @param in The plaintext block to be encrypted as a byte array. + * Must be of length BLOCK_SIZE. Will hold the result when the function + * has finished. + */ + void encrypt(byte block[]) const { enc(block, block); } + + /** + * Decrypt a block. + * @param in The ciphertext block to be decrypted as a byte array. + * Must be of length BLOCK_SIZE. Will hold the result when the function + * has finished. + */ + void decrypt(byte block[]) const { dec(block, block); } + + /** + * Get a new object representing the same algorithm as *this + */ + virtual BlockCipher* clone() const = 0; + + /** + * Zeroize internal state + */ + virtual void clear() throw() = 0; + + BlockCipher(u32bit block_size, + u32bit key_min, + u32bit key_max = 0, + u32bit key_mod = 1) : + SymmetricAlgorithm(key_min, key_max, key_mod), + BLOCK_SIZE(block_size) {} + + virtual ~BlockCipher() {} + private: + virtual void enc(const byte[], byte[]) const = 0; + virtual void dec(const byte[], byte[]) const = 0; + }; + +} + +#endif diff --git a/src/core/data_src.cpp b/src/core/data_src.cpp index 1ec1ae090..de5544885 100644 --- a/src/core/data_src.cpp +++ b/src/core/data_src.cpp @@ -5,6 +5,8 @@ *************************************************/ #include +#include + #include #include diff --git a/src/core/data_src.h b/src/core/data_src.h index d250addfc..25bdce00f 100644 --- a/src/core/data_src.h +++ b/src/core/data_src.h @@ -6,7 +6,8 @@ #ifndef BOTAN_DATA_SRC_H__ #define BOTAN_DATA_SRC_H__ -#include +#include +#include #include namespace Botan { diff --git a/src/core/info.txt b/src/core/info.txt index fd62867e0..c5276ce46 100644 --- a/src/core/info.txt +++ b/src/core/info.txt @@ -15,7 +15,7 @@ timer allocate.h -base.h +block_cipher.h botan.h data_src.cpp buf_comp.h diff --git a/src/core/stream_cipher.h b/src/core/stream_cipher.h new file mode 100644 index 000000000..6c013c6d6 --- /dev/null +++ b/src/core/stream_cipher.h @@ -0,0 +1,92 @@ +/** +* Stream Cipher +* (C) 1999-2007 Jack Lloyd +*/ + +#ifndef BOTAN_STREAM_CIPHER_H__ +#define BOTAN_STREAM_CIPHER_H__ + +#include +#include +#include + +namespace Botan { + +/************************************************* +* 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/sym_algo.h b/src/core/sym_algo.h new file mode 100644 index 000000000..02343ed56 --- /dev/null +++ b/src/core/sym_algo.h @@ -0,0 +1,93 @@ +/** +* Symmetric Algorithm Base Class +* (C) 1999-2007 Jack Lloyd +*/ + +#ifndef BOTAN_SYMMETRIC_ALGORITHM_H__ +#define BOTAN_SYMMETRIC_ALGORITHM_H__ + +#include +#include +#include + +namespace Botan { + +/** +* This class represents a symmetric algorithm object. +*/ +class BOTAN_DLL SymmetricAlgorithm + { + public: + + /** + * The maximum allowed key length. + */ + const u32bit MAXIMUM_KEYLENGTH; + + /** + * The minimal allowed key length. + */ + const u32bit MINIMUM_KEYLENGTH; + + /** + * A valid keylength is a multiple of this value. + */ + const u32bit KEYLENGTH_MULTIPLE; + + /** + * The name of the algorithm. + * @return the name of the algorithm + */ + virtual std::string name() const = 0; + + /** + * Set the symmetric key of this object. + * @param key the SymmetricKey to be set. + */ + void set_key(const SymmetricKey& skey) throw(Invalid_Key_Length) + { set_key(skey.begin(), skey.length()); } + + /** + * Set the symmetric key of this object. + * @param key the to be set as a byte array. + * @param the length of the byte array. + */ + void set_key(const byte skey[], u32bit length) throw(Invalid_Key_Length) + { + if(!valid_keylength(length)) + throw Invalid_Key_Length(name(), length); + key(skey, length); + } + + /** + * Check whether a given key length is valid for this algorithm. + * @param length the key length to be checked. + * @return true if the key length is valid. + */ + bool valid_keylength(u32bit length) const + { + return ((length >= MINIMUM_KEYLENGTH) && + (length <= MAXIMUM_KEYLENGTH) && + (length % KEYLENGTH_MULTIPLE == 0)); + } + + /** + * Construct a SymmetricAlgorithm. + * @param key_min the minimum allowed key length + * @param key_max the maximum allowed key length + * @param key_mod any valid key length must be a multiple of this value + */ + SymmetricAlgorithm(u32bit key_min, u32bit key_max, u32bit key_mod) : + MAXIMUM_KEYLENGTH(key_max ? key_max : key_min), + MINIMUM_KEYLENGTH(key_min), + KEYLENGTH_MULTIPLE(key_mod) + {} + + virtual ~SymmetricAlgorithm() {} + private: + virtual void key(const byte[], u32bit) = 0; + }; + +} + +#endif diff --git a/src/entropy/unix_procs/unix_cmd.cpp b/src/entropy/unix_procs/unix_cmd.cpp index 32829b91b..79cce7da4 100644 --- a/src/entropy/unix_procs/unix_cmd.cpp +++ b/src/entropy/unix_procs/unix_cmd.cpp @@ -13,6 +13,8 @@ #include #include +#include + #include #include #include diff --git a/src/filters/basefilt.h b/src/filters/basefilt.h index 004e076c4..085a4bc60 100644 --- a/src/filters/basefilt.h +++ b/src/filters/basefilt.h @@ -7,6 +7,7 @@ #define BOTAN_BASEFILT_H__ #include +#include namespace Botan { diff --git a/src/filters/buf_filt.cpp b/src/filters/buf_filt.cpp index 7acd37435..983f5184b 100644 --- a/src/filters/buf_filt.cpp +++ b/src/filters/buf_filt.cpp @@ -4,6 +4,7 @@ *************************************************/ #include +#include #include namespace Botan { diff --git a/src/filters/data_snk.cpp b/src/filters/data_snk.cpp index bb5226f0c..da677f47d 100644 --- a/src/filters/data_snk.cpp +++ b/src/filters/data_snk.cpp @@ -5,6 +5,7 @@ *************************************************/ #include +#include #include namespace Botan { diff --git a/src/filters/fd_unix/fd_unix.cpp b/src/filters/fd_unix/fd_unix.cpp index ac88ac391..6c96449bd 100644 --- a/src/filters/fd_unix/fd_unix.cpp +++ b/src/filters/fd_unix/fd_unix.cpp @@ -4,6 +4,7 @@ *************************************************/ #include +#include #include namespace Botan { diff --git a/src/filters/filter.cpp b/src/filters/filter.cpp index 253f20c32..27170ed65 100644 --- a/src/filters/filter.cpp +++ b/src/filters/filter.cpp @@ -5,6 +5,7 @@ #include #include +#include namespace Botan { diff --git a/src/filters/filter.h b/src/filters/filter.h index 51db50a57..e6a7b6918 100644 --- a/src/filters/filter.h +++ b/src/filters/filter.h @@ -6,7 +6,7 @@ #ifndef BOTAN_FILTER_H__ #define BOTAN_FILTER_H__ -#include +#include #include namespace Botan { diff --git a/src/filters/filters.h b/src/filters/filters.h index 0dd7fc39d..fce38318c 100644 --- a/src/filters/filters.h +++ b/src/filters/filters.h @@ -6,7 +6,7 @@ #ifndef BOTAN_FILTERS_H__ #define BOTAN_FILTERS_H__ -#include +#include #include #include #include diff --git a/src/filters/pipe.h b/src/filters/pipe.h index 4ac59617d..a7ef13bc4 100644 --- a/src/filters/pipe.h +++ b/src/filters/pipe.h @@ -8,6 +8,7 @@ #include #include +#include #include namespace Botan { diff --git a/src/hash/info.txt b/src/hash/info.txt new file mode 100644 index 000000000..fb1f734d7 --- /dev/null +++ b/src/hash/info.txt @@ -0,0 +1,11 @@ +realname "Hash Functions" + +load_on auto + + +utils + + + +hash.h + diff --git a/src/libstate/engine.h b/src/libstate/engine.h index 3279cdcf9..6c0fa93ad 100644 --- a/src/libstate/engine.h +++ b/src/libstate/engine.h @@ -6,7 +6,7 @@ #ifndef BOTAN_ENGINE_H__ #define BOTAN_ENGINE_H__ -#include +#include #include #include #include diff --git a/src/libstate/libstate.h b/src/libstate/libstate.h index 74d3d8ef3..606a091d8 100644 --- a/src/libstate/libstate.h +++ b/src/libstate/libstate.h @@ -6,8 +6,10 @@ #ifndef BOTAN_LIB_STATE_H__ #define BOTAN_LIB_STATE_H__ -#include +#include #include +#include + #include #include #include diff --git a/src/libstate/look_add.h b/src/libstate/look_add.h index 8c170049d..44ae77727 100644 --- a/src/libstate/look_add.h +++ b/src/libstate/look_add.h @@ -6,10 +6,14 @@ #ifndef BOTAN_LOOKUP_MANGEMENT_H__ #define BOTAN_LOOKUP_MANGEMENT_H__ -#include #include -#include + +#include +#include +#include +#include #include +#include namespace Botan { diff --git a/src/libstate/lookup.h b/src/libstate/lookup.h index f45f49033..ac65799da 100644 --- a/src/libstate/lookup.h +++ b/src/libstate/lookup.h @@ -6,15 +6,18 @@ #ifndef BOTAN_LOOKUP_H__ #define BOTAN_LOOKUP_H__ -#include +#include +#include #include +#include +#include + #include #include #include #include #include #include -#include namespace Botan { diff --git a/src/mac/cbc_mac/cbc_mac.h b/src/mac/cbc_mac/cbc_mac.h index 2b30fedd2..7e93097d5 100644 --- a/src/mac/cbc_mac/cbc_mac.h +++ b/src/mac/cbc_mac/cbc_mac.h @@ -7,6 +7,7 @@ #define BOTAN_CBC_MAC_H__ #include +#include namespace Botan { diff --git a/src/mac/cmac/cmac.h b/src/mac/cmac/cmac.h index 556d9dd9e..66eb46a69 100644 --- a/src/mac/cmac/cmac.h +++ b/src/mac/cmac/cmac.h @@ -7,6 +7,7 @@ #define BOTAN_CMAC_H__ #include +#include namespace Botan { diff --git a/src/mac/mac.h b/src/mac/mac.h index 99184fd3f..ff5939f6e 100644 --- a/src/mac/mac.h +++ b/src/mac/mac.h @@ -7,7 +7,7 @@ #define BOTAN_MESSAGE_AUTH_CODE_BASE_H__ #include -#include +#include #include namespace Botan { diff --git a/src/mac/x919_mac/x919_mac.h b/src/mac/x919_mac/x919_mac.h index 85b8254a5..46196f8f4 100644 --- a/src/mac/x919_mac/x919_mac.h +++ b/src/mac/x919_mac/x919_mac.h @@ -7,6 +7,7 @@ #define BOTAN_ANSI_X919_MAC_H__ #include +#include namespace Botan { diff --git a/src/modes/eax/eax.h b/src/modes/eax/eax.h index f3fc6970c..aea1383db 100644 --- a/src/modes/eax/eax.h +++ b/src/modes/eax/eax.h @@ -7,6 +7,7 @@ #define BOTAN_EAX_H__ #include +#include #include namespace Botan { diff --git a/src/modes/mode_pad/mode_pad.cpp b/src/modes/mode_pad/mode_pad.cpp index 3a07afcb4..3944837cc 100644 --- a/src/modes/mode_pad/mode_pad.cpp +++ b/src/modes/mode_pad/mode_pad.cpp @@ -4,6 +4,7 @@ *************************************************/ #include +#include #include namespace Botan { diff --git a/src/modes/mode_pad/mode_pad.h b/src/modes/mode_pad/mode_pad.h index 4041efcdc..3dc28fa81 100644 --- a/src/modes/mode_pad/mode_pad.h +++ b/src/modes/mode_pad/mode_pad.h @@ -6,7 +6,7 @@ #ifndef BOTAN_CBC_PADDING_H__ #define BOTAN_CBC_PADDING_H__ -#include +#include #include namespace Botan { diff --git a/src/modes/modebase/modebase.h b/src/modes/modebase/modebase.h index 620a5c618..a16b149be 100644 --- a/src/modes/modebase/modebase.h +++ b/src/modes/modebase/modebase.h @@ -7,6 +7,7 @@ #define BOTAN_MODEBASE_H__ #include +#include namespace Botan { diff --git a/src/pk_pad/pk_pad.h b/src/pk_pad/pk_pad.h index ed1742155..e26235c74 100644 --- a/src/pk_pad/pk_pad.h +++ b/src/pk_pad/pk_pad.h @@ -6,7 +6,7 @@ #ifndef BOTAN_PUBKEY_PAD_H__ #define BOTAN_PUBKEY_PAD_H__ -#include +#include #include namespace Botan { diff --git a/src/pubkey/pubkey/pubkey.h b/src/pubkey/pubkey/pubkey.h index ed66c212e..14faa1096 100644 --- a/src/pubkey/pubkey/pubkey.h +++ b/src/pubkey/pubkey/pubkey.h @@ -6,9 +6,10 @@ #ifndef BOTAN_PUBKEY_H__ #define BOTAN_PUBKEY_H__ -#include #include #include +#include +#include namespace Botan { diff --git a/src/rng/auto_rng/auto_rng.h b/src/rng/auto_rng/auto_rng.h index bbc3703c1..dea735470 100644 --- a/src/rng/auto_rng/auto_rng.h +++ b/src/rng/auto_rng/auto_rng.h @@ -7,7 +7,7 @@ #define BOTAN_AUTO_SEEDING_RNG_H__ #include -#include +#include namespace Botan { diff --git a/src/rng/randpool/randpool.h b/src/rng/randpool/randpool.h index 198a34552..f6bae9d52 100644 --- a/src/rng/randpool/randpool.h +++ b/src/rng/randpool/randpool.h @@ -7,7 +7,7 @@ #define BOTAN_RANDPOOL_H__ #include -#include +#include #include #include diff --git a/src/rng/x931_rng/x931_rng.h b/src/rng/x931_rng/x931_rng.h index 220b47ab8..e1d090c3c 100644 --- a/src/rng/x931_rng/x931_rng.h +++ b/src/rng/x931_rng/x931_rng.h @@ -7,7 +7,7 @@ #define BOTAN_ANSI_X931_RNG_H__ #include -#include +#include namespace Botan { diff --git a/src/selftest/selftest.h b/src/selftest/selftest.h index ff011a32c..adea9ebe6 100644 --- a/src/selftest/selftest.h +++ b/src/selftest/selftest.h @@ -6,7 +6,7 @@ #ifndef BOTAN_SELF_TEST_H__ #define BOTAN_SELF_TEST_H__ -#include +#include namespace Botan { -- cgit v1.2.3