diff --git a/mdc.h b/mdc.h index ac5ba977..80279454 100644 --- a/mdc.h +++ b/mdc.h @@ -39,13 +39,12 @@ class MDC : public MDC_Info { CRYPTOPP_UNUSED(params); this->AssertValidKeyLength(length); - memcpy_s(m_key, m_key.size(), userKey, this->KEYLENGTH); - ConditionalByteReverse(BIG_ENDIAN_ORDER, Key(), Key(), this->KEYLENGTH); + ConditionalByteReverse(BIG_ENDIAN_ORDER, Key(), reinterpret_cast(userKey), this->KEYLENGTH); } void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const { - ConditionalByteReverse(BIG_ENDIAN_ORDER, Buffer(), (HashWordType *)inBlock, this->BLOCKSIZE); + ConditionalByteReverse(BIG_ENDIAN_ORDER, Buffer(), reinterpret_cast(inBlock), this->BLOCKSIZE); H::Transform(Buffer(), Key()); if (xorBlock) @@ -55,7 +54,7 @@ class MDC : public MDC_Info } else { - ConditionalByteReverse(BIG_ENDIAN_ORDER, (HashWordType *)outBlock, Buffer(), this->BLOCKSIZE); + ConditionalByteReverse(BIG_ENDIAN_ORDER, reinterpret_cast(outBlock), Buffer(), this->BLOCKSIZE); } } @@ -64,9 +63,9 @@ class MDC : public MDC_Info unsigned int OptimalDataAlignment() const {return sizeof(HashWordType);} private: - HashWordType *Key() {return (HashWordType *)m_key.data();} - const HashWordType *Key() const {return (const HashWordType *)m_key.data();} - HashWordType *Buffer() const {return (HashWordType *)m_buffer.data();} + HashWordType *Key() {return reinterpret_cast(m_key.data());} + const HashWordType *Key() const {return reinterpret_cast(m_key.data());} + HashWordType *Buffer() const {return reinterpret_cast(m_buffer.data());} // VC60 workaround: bug triggered if using FixedSizeAllocatorWithCleanup FixedSizeSecBlock::KEYLENGTH, AllocatorWithCleanup > m_key;