summaryrefslogtreecommitdiff
path: root/modes.h
diff options
context:
space:
mode:
Diffstat (limited to 'modes.h')
-rw-r--r--modes.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/modes.h b/modes.h
index e6b30e0..34dd21a 100644
--- a/modes.h
+++ b/modes.h
@@ -275,19 +275,26 @@ template <class BASE>
class CipherModeFinalTemplate_ExternalCipher : public BASE
{
public:
- CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher);
-
- CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher, const byte *iv, int feedbackSize = 0);
+ CipherModeFinalTemplate_ExternalCipher() {}
+ CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher)
+ {SetCipher(cipher);}
+ CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher, const byte *iv, int feedbackSize = 0)
+ {SetCipherWithIV(cipher, iv, feedbackSize);}
+
+ void SetCipher(BlockCipher &cipher);
+ void SetCipherWithIV(BlockCipher &cipher, const byte *iv, int feedbackSize = 0);
};
-template <class BASE> CipherModeFinalTemplate_ExternalCipher<BASE>::CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher)
+template <class BASE>
+void CipherModeFinalTemplate_ExternalCipher<BASE>::SetCipher(BlockCipher &cipher)
{
ThrowIfResynchronizable();
m_cipher = &cipher;
ResizeBuffers();
}
-template <class BASE> CipherModeFinalTemplate_ExternalCipher<BASE>::CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher, const byte *iv, int feedbackSize)
+template <class BASE>
+void CipherModeFinalTemplate_ExternalCipher<BASE>::SetCipherWithIV(BlockCipher &cipher, const byte *iv, int feedbackSize)
{
ThrowIfInvalidIV(iv);
m_cipher = &cipher;