diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2007-04-16 00:34:13 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2007-04-16 00:34:13 +0000 |
commit | 866f75e49a3f1a83ad937acb6dd66f84fe422d8e (patch) | |
tree | 56bf19a09990ed7a57c8d48da5ceaf509e7a8fdc /modes.h | |
parent | 6320616a7ffda3e44bc6a82a60abc8e9929ea5bd (diff) | |
download | cryptopp-866f75e49a3f1a83ad937acb6dd66f84fe422d8e.tar.gz |
rename STRUCTURED_IV to UNIQUE_IV. assert correct cipher direction
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@311 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'modes.h')
-rw-r--r-- | modes.h | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -87,6 +87,7 @@ protected: byte * GetRegisterBegin() {return m_register + BlockSize() - m_feedbackSize;} void TransformRegister() { + assert(m_cipher->IsForwardTransformation()); // CFB mode needs the "encrypt" direction of the underlying block cipher, even to decrypt m_cipher->ProcessBlock(m_register, m_temp); unsigned int updateSize = BlockSize()-m_feedbackSize; memmove_s(m_register, m_register.size(), m_register+m_feedbackSize, updateSize); @@ -125,7 +126,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE OFB_ModePolicy : public ModePolicyCommonTe { public: bool IsRandomAccess() const {return false;} - IV_Requirement IVRequirement() const {return STRUCTURED_IV;} + IV_Requirement IVRequirement() const {return UNIQUE_IV;} static const char * CRYPTOPP_API StaticAlgorithmName() {return "OFB";} private: @@ -134,6 +135,7 @@ private: void WriteKeystream(byte *keystreamBuffer, size_t iterationCount) { assert(iterationCount == 1); + assert(m_cipher->IsForwardTransformation()); // OFB mode needs the "encrypt" direction of the underlying block cipher, even to decrypt m_cipher->ProcessBlock(keystreamBuffer); memcpy_s(m_register, m_register.size(), keystreamBuffer, BlockSize()); } @@ -147,7 +149,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CTR_ModePolicy : public ModePolicyCommonTe { public: bool IsRandomAccess() const {return true;} - IV_Requirement IVRequirement() const {return STRUCTURED_IV;} + IV_Requirement IVRequirement() const {return UNIQUE_IV;} void CipherGetNextIV(byte *IV); static const char * CRYPTOPP_API StaticAlgorithmName() {return "CTR";} @@ -192,6 +194,8 @@ protected: class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE ECB_OneWay : public BlockOrientedCipherModeBase { public: + void SetKey(const byte *key, size_t length, const NameValuePairs ¶ms = g_nullNameValuePairs) + {m_cipher->SetKey(key, length, params); BlockOrientedCipherModeBase::ResizeBuffers();} IV_Requirement IVRequirement() const {return NOT_RESYNCHRONIZABLE;} unsigned int OptimalBlockSize() const {return BlockSize() * m_cipher->OptimalNumberOfParallelBlocks();} void ProcessBlocks(byte *outString, const byte *inString, size_t numberOfBlocks) |