summaryrefslogtreecommitdiff
path: root/strciphr.h
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2006-12-10 02:12:23 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2006-12-10 02:12:23 +0000
commitc3bad1afc1564f3bfac8434d45d6694811139333 (patch)
treeebfbbcf4dffdf4914b9ce879d3d2c93d3615f7ab /strciphr.h
parente553818e00684e8905ede16e53aa490c153b7e7a (diff)
downloadcryptopp-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.h22
1 files changed, 8 insertions, 14 deletions
diff --git a/strciphr.h b/strciphr.h
index 76d7b3d..e905d7b 100644
--- a/strciphr.h
+++ b/strciphr.h
@@ -135,7 +135,7 @@ public:
typedef typename BASE::PolicyInterface PolicyInterface;
protected:
- void UncheckedSetKey(const NameValuePairs &params, const byte *key, unsigned int length, const byte *iv);
+ void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params);
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 &params, const byte *key, unsigned int length, const byte *iv);
+ void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params);
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 &params = 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 &params, const byte *key, unsigned int length, const byte *iv)
+void AdditiveCipherTemplate<S>::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params)
{
PolicyInterface &policy = this->AccessPolicy();
policy.CipherSetKey(params, key, length);
@@ -290,17 +284,17 @@ void AdditiveCipherTemplate<S>::UncheckedSetKey(const NameValuePairs &params, 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 &params, const byte *key, unsigned int length, const byte *iv)
+void CFB_CipherTemplate<BASE>::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params)
{
PolicyInterface &policy = this->AccessPolicy();
policy.CipherSetKey(params, key, length);
if (this->IsResynchronizable())
- policy.CipherResynchronize(iv);
+ policy.CipherResynchronize(this->GetIVAndThrowIfInvalid(params));
m_leftOver = policy.GetBytesPerIteration();
}