From 24db613a8174172aefc23a12ae7bbfd2d6c0fec7 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 4 Aug 2017 16:02:32 -0400 Subject: [PATCH] Switch to ConditionalByteReverse. Removed mutuable hash member --- mdc.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mdc.h b/mdc.h index c3e8d2ce..ac5ba977 100644 --- a/mdc.h +++ b/mdc.h @@ -40,20 +40,23 @@ class MDC : public MDC_Info CRYPTOPP_UNUSED(params); this->AssertValidKeyLength(length); memcpy_s(m_key, m_key.size(), userKey, this->KEYLENGTH); - m_hash.CorrectEndianess(Key(), Key(), this->KEYLENGTH); + ConditionalByteReverse(BIG_ENDIAN_ORDER, Key(), Key(), this->KEYLENGTH); } void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const { - m_hash.CorrectEndianess(Buffer(), (HashWordType *)inBlock, this->BLOCKSIZE); + ConditionalByteReverse(BIG_ENDIAN_ORDER, Buffer(), (HashWordType *)inBlock, this->BLOCKSIZE); H::Transform(Buffer(), Key()); + if (xorBlock) { - m_hash.CorrectEndianess(Buffer(), Buffer(), this->BLOCKSIZE); + ConditionalByteReverse(BIG_ENDIAN_ORDER, Buffer(), Buffer(), this->BLOCKSIZE); xorbuf(outBlock, xorBlock, m_buffer, this->BLOCKSIZE); } else - m_hash.CorrectEndianess((HashWordType *)outBlock, Buffer(), this->BLOCKSIZE); + { + ConditionalByteReverse(BIG_ENDIAN_ORDER, (HashWordType *)outBlock, Buffer(), this->BLOCKSIZE); + } } bool IsPermutation() const {return false;} @@ -68,7 +71,6 @@ class MDC : public MDC_Info // VC60 workaround: bug triggered if using FixedSizeAllocatorWithCleanup FixedSizeSecBlock::KEYLENGTH, AllocatorWithCleanup > m_key; mutable FixedSizeSecBlock::BLOCKSIZE, AllocatorWithCleanup > m_buffer; - mutable H m_hash; }; public: