Remove use of temporary t[] for digest calculation. Remove unneeded header. Whitespace

This commit is contained in:
Jeffrey Walton 2016-12-17 10:14:37 -05:00
parent 716cd1fed9
commit cc6702a434
No known key found for this signature in database
GPG Key ID: B36AB348921B1838

View File

@ -31,8 +31,6 @@
#include "secblock.h"
#include "misc.h"
#include <iostream>
NAMESPACE_BEGIN(CryptoPP)
template <bool T_128bit>
@ -99,7 +97,7 @@ protected:
private:
FixedSizeSecBlock<word64, 4> m_v;
FixedSizeSecBlock<word64, 2> m_k;
FixedSizeSecBlock<word64, 1> m_b;
FixedSizeSecBlock<word64, 2> m_b;
// Tail bytes
FixedSizeSecBlock<byte, 8> m_acc;
@ -235,9 +233,8 @@ void SipHash_Base<C,D,T_128bit>::TruncatedFinal(byte *digest, size_t digestSize)
for (unsigned int i=0; i<D; i++)
SIPROUND();
word64 t[2];
m_b[0] = m_v[0] ^ m_v[1] ^ m_v[2] ^ m_v[3];
t[0] = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, m_b[0]);
m_b[0] = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, m_b[0]);
if (T_128bit)
{
@ -245,11 +242,11 @@ void SipHash_Base<C,D,T_128bit>::TruncatedFinal(byte *digest, size_t digestSize)
for (unsigned int i = 0; i<D; ++i)
SIPROUND();
m_b[0] = m_v[0] ^ m_v[1] ^ m_v[2] ^ m_v[3];
t[1] = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, m_b[0]);
m_b[1] = m_v[0] ^ m_v[1] ^ m_v[2] ^ m_v[3];
m_b[1] = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, m_b[1]);
}
memcpy_s(digest, digestSize, t, STDMIN(digestSize, (size_t)SipHash_Info<T_128bit>::DIGESTSIZE));
memcpy_s(digest, digestSize, m_b.begin(), STDMIN(digestSize, (size_t)SipHash_Info<T_128bit>::DIGESTSIZE));
Restart();
}