Cleared -Wcast-align (Issue 122)

This commit is contained in:
Jeffrey Walton 2016-01-25 00:12:37 -05:00
parent 475c574e5f
commit cdcff65a35
2 changed files with 11 additions and 7 deletions

14
gcm.cpp
View File

@ -89,8 +89,11 @@ inline static void SSE2_Xor16(byte *a, const byte *b, const byte *c)
inline static void Xor16(byte *a, const byte *b, const byte *c)
{
((word64 *)a)[0] = ((word64 *)b)[0] ^ ((word64 *)c)[0];
((word64 *)a)[1] = ((word64 *)b)[1] ^ ((word64 *)c)[1];
assert(IsAlignedOn(a,GetAlignmentOf<word64>()));
assert(IsAlignedOn(b,GetAlignmentOf<word64>()));
assert(IsAlignedOn(c,GetAlignmentOf<word64>()));
((word64 *)(void *)a)[0] = ((word64 *)(void *)b)[0] ^ ((word64 *)(void *)c)[0];
((word64 *)(void *)a)[1] = ((word64 *)(void *)b)[1] ^ ((word64 *)(void *)c)[1];
}
#if CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE
@ -436,7 +439,8 @@ size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len)
#endif
typedef BlockGetAndPut<word64, NativeByteOrder> Block;
word64 *hashBuffer = (word64 *)HashBuffer();
word64 *hashBuffer = (word64 *)(void *)HashBuffer();
assert(IsAlignedOn(hashBuffer,GetAlignmentOf<word64>()));
switch (2*(m_buffer.size()>=64*1024)
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
@ -459,7 +463,7 @@ size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len)
data += HASH_BLOCKSIZE;
len -= HASH_BLOCKSIZE;
#define READ_TABLE_WORD64_COMMON(a, b, c, d) *(word64 *)(table+(a*1024)+(b*256)+c+d*8)
#define READ_TABLE_WORD64_COMMON(a, b, c, d) *(word64 *)(void *)(table+(a*1024)+(b*256)+c+d*8)
#ifdef IS_LITTLE_ENDIAN
#if CRYPTOPP_BOOL_SLOW_WORD64
@ -530,7 +534,7 @@ size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len)
#undef READ_TABLE_WORD64_COMMON
#undef READ_TABLE_WORD64
#define READ_TABLE_WORD64_COMMON(a, c, d) *(word64 *)(table+(a)*256*16+(c)+(d)*8)
#define READ_TABLE_WORD64_COMMON(a, c, d) *(word64 *)(void *)(table+(a)*256*16+(c)+(d)*8)
#ifdef IS_LITTLE_ENDIAN
#if CRYPTOPP_BOOL_SLOW_WORD64

View File

@ -47,8 +47,6 @@ static const word128 m126 = (word128(m62)<<64)|m64; /* 126-bit mask */
void VMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &params)
{
assert(IsAlignedOn(m_l3Key(),GetAlignmentOf<word64>()));
int digestLength = params.GetIntValueWithDefault(Name::DigestSize(), DefaultDigestSize());
if (digestLength != 8 && digestLength != 16)
throw InvalidArgument("VMAC: DigestSize must be 8 or 16");
@ -89,6 +87,8 @@ void VMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, con
in[0] = 0xE0;
in[15] = 0;
word64 *l3Key = m_l3Key();
assert(IsAlignedOn(l3Key,GetAlignmentOf<word64>()));
for (i = 0; i <= (size_t)m_is128; i++)
do
{