From c3bad1afc1564f3bfac8434d45d6694811139333 Mon Sep 17 00:00:00 2001 From: weidai Date: Sun, 10 Dec 2006 02:12:23 +0000 Subject: port to GCC 4, reorganize implementations of SetKey git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@248 57ff6487-cd31-0410-9ec3-f628ee90f5f0 --- tea.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'tea.h') diff --git a/tea.h b/tea.h index c05c98a..d8ddded 100644 --- a/tea.h +++ b/tea.h @@ -21,7 +21,7 @@ class TEA : public TEA_Info, public BlockCipherDocumentation class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl { public: - void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length, unsigned int rounds); + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); protected: FixedSizeSecBlock m_k; @@ -60,7 +60,7 @@ class XTEA : public XTEA_Info, public BlockCipherDocumentation class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl { public: - void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length, unsigned int rounds); + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); protected: FixedSizeSecBlock m_k; @@ -97,12 +97,10 @@ class BTEA : public BTEA_Info, public BlockCipherDocumentation class CRYPTOPP_NO_VTABLE Base : public AlgorithmImpl, BTEA_Info>, public BTEA_Info { public: - template - static inline void CheckedSetKey(T *obj, CipherDir dir, const byte *key, size_t length, const NameValuePairs ¶m) + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) { - obj->ThrowIfInvalidKeyLength(length); - obj->m_blockSize = param.GetIntValueWithDefault("BlockSize", 60*4); - GetUserKey(BIG_ENDIAN_ORDER, obj->m_k.begin(), 4, key, KEYLENGTH); + m_blockSize = params.GetIntValueWithDefault("BlockSize", 60*4); + GetUserKey(BIG_ENDIAN_ORDER, m_k.begin(), 4, key, KEYLENGTH); } unsigned int BlockSize() const {return m_blockSize;} -- cgit v1.2.1