fix AlgorithmName() for ExternalCipher classes and move SetCipher() into CipherModeBase
parent
ef6d8d1b00
commit
8046864b01
|
|
@ -42,6 +42,23 @@ public:
|
||||||
unsigned int IVSize() const {return BlockSize();}
|
unsigned int IVSize() const {return BlockSize();}
|
||||||
virtual IV_Requirement IVRequirement() const =0;
|
virtual IV_Requirement IVRequirement() const =0;
|
||||||
|
|
||||||
|
void SetCipher(BlockCipher &cipher)
|
||||||
|
{
|
||||||
|
this->ThrowIfResynchronizable();
|
||||||
|
this->m_cipher = &cipher;
|
||||||
|
this->ResizeBuffers();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCipherWithIV(BlockCipher &cipher, const byte *iv, int feedbackSize = 0)
|
||||||
|
{
|
||||||
|
this->ThrowIfInvalidIV(iv);
|
||||||
|
this->m_cipher = &cipher;
|
||||||
|
this->ResizeBuffers();
|
||||||
|
this->SetFeedbackSize(feedbackSize);
|
||||||
|
if (this->IsResynchronizable())
|
||||||
|
this->Resynchronize(iv);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline unsigned int BlockSize() const {assert(m_register.size() > 0); return (unsigned int)m_register.size();}
|
inline unsigned int BlockSize() const {assert(m_register.size() > 0); return (unsigned int)m_register.size();}
|
||||||
virtual void SetFeedbackSize(unsigned int feedbackSize)
|
virtual void SetFeedbackSize(unsigned int feedbackSize)
|
||||||
|
|
@ -295,29 +312,10 @@ public:
|
||||||
CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher, const byte *iv, int feedbackSize = 0)
|
CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher, const byte *iv, int feedbackSize = 0)
|
||||||
{SetCipherWithIV(cipher, iv, feedbackSize);}
|
{SetCipherWithIV(cipher, iv, feedbackSize);}
|
||||||
|
|
||||||
void SetCipher(BlockCipher &cipher);
|
std::string AlgorithmName() const
|
||||||
void SetCipherWithIV(BlockCipher &cipher, const byte *iv, int feedbackSize = 0);
|
{return m_cipher->AlgorithmName() + "/" + BASE::StaticAlgorithmName();}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class BASE>
|
|
||||||
void CipherModeFinalTemplate_ExternalCipher<BASE>::SetCipher(BlockCipher &cipher)
|
|
||||||
{
|
|
||||||
this->ThrowIfResynchronizable();
|
|
||||||
this->m_cipher = &cipher;
|
|
||||||
this->ResizeBuffers();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class BASE>
|
|
||||||
void CipherModeFinalTemplate_ExternalCipher<BASE>::SetCipherWithIV(BlockCipher &cipher, const byte *iv, int feedbackSize)
|
|
||||||
{
|
|
||||||
this->ThrowIfInvalidIV(iv);
|
|
||||||
this->m_cipher = &cipher;
|
|
||||||
this->ResizeBuffers();
|
|
||||||
this->SetFeedbackSize(feedbackSize);
|
|
||||||
if (this->IsResynchronizable())
|
|
||||||
this->Resynchronize(iv);
|
|
||||||
}
|
|
||||||
|
|
||||||
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
|
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
|
||||||
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
|
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
|
||||||
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
|
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue