Cleared -Wcast-align (Issue 122)
parent
bce92ed5e5
commit
917b7467b7
19
vmac.cpp
19
vmac.cpp
|
|
@ -47,6 +47,8 @@ static const word128 m126 = (word128(m62)<<64)|m64; /* 126-bit mask */
|
||||||
|
|
||||||
void VMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs ¶ms)
|
void VMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs ¶ms)
|
||||||
{
|
{
|
||||||
|
assert(IsAlignedOn(m_l3Key(),GetAlignmentOf<word64>()));
|
||||||
|
|
||||||
int digestLength = params.GetIntValueWithDefault(Name::DigestSize(), DefaultDigestSize());
|
int digestLength = params.GetIntValueWithDefault(Name::DigestSize(), DefaultDigestSize());
|
||||||
if (digestLength != 8 && digestLength != 16)
|
if (digestLength != 8 && digestLength != 16)
|
||||||
throw InvalidArgument("VMAC: DigestSize must be 8 or 16");
|
throw InvalidArgument("VMAC: DigestSize must be 8 or 16");
|
||||||
|
|
@ -168,13 +170,15 @@ __attribute__ ((noinline)) // Intel Compiler 9.1 workaround
|
||||||
#endif
|
#endif
|
||||||
VMAC_Base::VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWord64, int tagPart)
|
VMAC_Base::VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWord64, int tagPart)
|
||||||
{
|
{
|
||||||
const word64 *nhK = m_nhKey();
|
assert(IsAlignedOn(m_polyState(),GetAlignmentOf<word64>()));
|
||||||
word64 *polyS = m_polyState();
|
assert(IsAlignedOn(m_nhKey(),GetAlignmentOf<word64>()));
|
||||||
word32 L1KeyLength = m_L1KeyLength;
|
|
||||||
|
|
||||||
CRYPTOPP_UNUSED(data); CRYPTOPP_UNUSED(tagPart); CRYPTOPP_UNUSED(L1KeyLength);
|
CRYPTOPP_UNUSED(data); CRYPTOPP_UNUSED(tagPart); CRYPTOPP_UNUSED(L1KeyLength);
|
||||||
CRYPTOPP_UNUSED(blocksRemainingInWord64);
|
CRYPTOPP_UNUSED(blocksRemainingInWord64);
|
||||||
|
|
||||||
|
const word64 *nhK = m_nhKey();
|
||||||
|
word64 *polyS = (word64*)(void*)m_polyState();
|
||||||
|
word32 L1KeyLength = m_L1KeyLength;
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
word32 temp;
|
word32 temp;
|
||||||
__asm__ __volatile__
|
__asm__ __volatile__
|
||||||
|
|
@ -532,6 +536,9 @@ template <bool T_128BitTag>
|
||||||
#endif
|
#endif
|
||||||
void VMAC_Base::VHASH_Update_Template(const word64 *data, size_t blocksRemainingInWord64)
|
void VMAC_Base::VHASH_Update_Template(const word64 *data, size_t blocksRemainingInWord64)
|
||||||
{
|
{
|
||||||
|
assert(IsAlignedOn(m_polyState(),GetAlignmentOf<word64>()));
|
||||||
|
assert(IsAlignedOn(m_nhKey(),GetAlignmentOf<word64>()));
|
||||||
|
|
||||||
#define INNER_LOOP_ITERATION(j) {\
|
#define INNER_LOOP_ITERATION(j) {\
|
||||||
word64 d0 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+0]);\
|
word64 d0 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+0]);\
|
||||||
word64 d1 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+1]);\
|
word64 d1 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+1]);\
|
||||||
|
|
@ -546,7 +553,7 @@ void VMAC_Base::VHASH_Update_Template(const word64 *data, size_t blocksRemaining
|
||||||
size_t L1KeyLengthInWord64 = m_L1KeyLength / 8;
|
size_t L1KeyLengthInWord64 = m_L1KeyLength / 8;
|
||||||
size_t innerLoopEnd = L1KeyLengthInWord64;
|
size_t innerLoopEnd = L1KeyLengthInWord64;
|
||||||
const word64 *nhK = m_nhKey();
|
const word64 *nhK = m_nhKey();
|
||||||
word64 *polyS = m_polyState();
|
word64 *polyS = (word64*)(void*)m_polyState();
|
||||||
bool isFirstBlock = true;
|
bool isFirstBlock = true;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
|
@ -861,6 +868,8 @@ static word64 L3Hash(const word64 *input, const word64 *l3Key, size_t len)
|
||||||
|
|
||||||
void VMAC_Base::TruncatedFinal(byte *mac, size_t size)
|
void VMAC_Base::TruncatedFinal(byte *mac, size_t size)
|
||||||
{
|
{
|
||||||
|
assert(IsAlignedOn(DataBuf(),GetAlignmentOf<word64>()));
|
||||||
|
assert(IsAlignedOn(m_polyState(),GetAlignmentOf<word64>()));
|
||||||
size_t len = ModPowerOf2(GetBitCountLo()/8, m_L1KeyLength);
|
size_t len = ModPowerOf2(GetBitCountLo()/8, m_L1KeyLength);
|
||||||
|
|
||||||
if (len)
|
if (len)
|
||||||
|
|
|
||||||
2
vmac.h
2
vmac.h
|
|
@ -41,7 +41,7 @@ protected:
|
||||||
size_t HashMultipleBlocks(const word64 *input, size_t length);
|
size_t HashMultipleBlocks(const word64 *input, size_t length);
|
||||||
void Init() {}
|
void Init() {}
|
||||||
word64* StateBuf() {return NULL;}
|
word64* StateBuf() {return NULL;}
|
||||||
word64* DataBuf() {return (word64 *)m_data();}
|
word64* DataBuf() {return (word64 *)(void*)m_data();}
|
||||||
|
|
||||||
void VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWord64, int tagPart);
|
void VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWord64, int tagPart);
|
||||||
#if !(defined(_MSC_VER) && _MSC_VER < 1300) // can't use function template here with VC6
|
#if !(defined(_MSC_VER) && _MSC_VER < 1300) // can't use function template here with VC6
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue