diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2006-12-10 02:12:23 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2006-12-10 02:12:23 +0000 |
commit | c3bad1afc1564f3bfac8434d45d6694811139333 (patch) | |
tree | ebfbbcf4dffdf4914b9ce879d3d2c93d3615f7ab /strciphr.h | |
parent | e553818e00684e8905ede16e53aa490c153b7e7a (diff) | |
download | cryptopp-c3bad1afc1564f3bfac8434d45d6694811139333.tar.gz |
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
Diffstat (limited to 'strciphr.h')
-rw-r--r-- | strciphr.h | 22 |
1 files changed, 8 insertions, 14 deletions
@@ -135,7 +135,7 @@ public: typedef typename BASE::PolicyInterface PolicyInterface; protected: - void UncheckedSetKey(const NameValuePairs ¶ms, const byte *key, unsigned int length, const byte *iv); + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); unsigned int GetBufferByteSize(const PolicyInterface &policy) const {return policy.GetBytesPerIteration() * policy.GetIterationsToBuffer();} @@ -233,7 +233,7 @@ public: protected: virtual void CombineMessageAndShiftRegister(byte *output, byte *reg, const byte *message, size_t length) =0; - void UncheckedSetKey(const NameValuePairs ¶ms, const byte *key, unsigned int length, const byte *iv); + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); size_t m_leftOver; }; @@ -266,23 +266,17 @@ class SymmetricCipherFinal : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE public: SymmetricCipherFinal() {} SymmetricCipherFinal(const byte *key) - {SetKey(key, this->DEFAULT_KEYLENGTH);} + {this->SetKey(key, this->DEFAULT_KEYLENGTH);} SymmetricCipherFinal(const byte *key, size_t length) - {SetKey(key, length);} + {this->SetKey(key, length);} SymmetricCipherFinal(const byte *key, size_t length, const byte *iv) {this->SetKeyWithIV(key, length, iv);} - void SetKey(const byte *key, size_t length, const NameValuePairs ¶ms = g_nullNameValuePairs) - { - this->ThrowIfInvalidKeyLength(length); - this->UncheckedSetKey(params, key, (unsigned int)length, this->GetIVAndThrowIfInvalid(params)); - } - Clonable * Clone() const {return static_cast<SymmetricCipher *>(new SymmetricCipherFinal<BASE, INFO>(*this));} }; template <class S> -void AdditiveCipherTemplate<S>::UncheckedSetKey(const NameValuePairs ¶ms, const byte *key, unsigned int length, const byte *iv) +void AdditiveCipherTemplate<S>::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) { PolicyInterface &policy = this->AccessPolicy(); policy.CipherSetKey(params, key, length); @@ -290,17 +284,17 @@ void AdditiveCipherTemplate<S>::UncheckedSetKey(const NameValuePairs ¶ms, co m_buffer.New(GetBufferByteSize(policy)); if (this->IsResynchronizable()) - policy.CipherResynchronize(m_buffer, iv); + policy.CipherResynchronize(m_buffer, this->GetIVAndThrowIfInvalid(params)); } template <class BASE> -void CFB_CipherTemplate<BASE>::UncheckedSetKey(const NameValuePairs ¶ms, const byte *key, unsigned int length, const byte *iv) +void CFB_CipherTemplate<BASE>::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) { PolicyInterface &policy = this->AccessPolicy(); policy.CipherSetKey(params, key, length); if (this->IsResynchronizable()) - policy.CipherResynchronize(iv); + policy.CipherResynchronize(this->GetIVAndThrowIfInvalid(params)); m_leftOver = policy.GetBytesPerIteration(); } |