summaryrefslogtreecommitdiff
path: root/mdc.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-08-04 19:11:53 -0400
committerJeffrey Walton <noloader@gmail.com>2017-08-04 19:11:53 -0400
commit662cccce3be959eacda271dac1859f6168750e2a (patch)
treed7e1d1da793ce49ec37fddcfc7c706bfd339fe93 /mdc.h
parent3fe6709ae7b2289ea9f5cf925aeae6e4300324e3 (diff)
downloadcryptopp-git-662cccce3be959eacda271dac1859f6168750e2a.tar.gz
Switch to reinterpret_cast in MDC
Diffstat (limited to 'mdc.h')
-rw-r--r--mdc.h13
1 files changed, 6 insertions, 7 deletions
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<H>
{
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<const HashWordType*>(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<const HashWordType*>(inBlock), this->BLOCKSIZE);
H::Transform(Buffer(), Key());
if (xorBlock)
@@ -55,7 +54,7 @@ class MDC : public MDC_Info<H>
}
else
{
- ConditionalByteReverse(BIG_ENDIAN_ORDER, (HashWordType *)outBlock, Buffer(), this->BLOCKSIZE);
+ ConditionalByteReverse(BIG_ENDIAN_ORDER, reinterpret_cast<HashWordType*>(outBlock), Buffer(), this->BLOCKSIZE);
}
}
@@ -64,9 +63,9 @@ class MDC : public MDC_Info<H>
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<HashWordType*>(m_key.data());}
+ const HashWordType *Key() const {return reinterpret_cast<const HashWordType*>(m_key.data());}
+ HashWordType *Buffer() const {return reinterpret_cast<HashWordType*>(m_buffer.data());}
// VC60 workaround: bug triggered if using FixedSizeAllocatorWithCleanup
FixedSizeSecBlock<byte, MDC_Info<H>::KEYLENGTH, AllocatorWithCleanup<byte> > m_key;