Cleared -Wcast-align (Issue 122)

pull/136/head
Jeffrey Walton 2016-01-25 09:48:26 -05:00
parent d4f0dee87a
commit be491ef007
3 changed files with 9 additions and 4 deletions

View File

@ -500,8 +500,10 @@ template <class B>
void PanamaCipherPolicy<B>::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) void PanamaCipherPolicy<B>::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount)
{ {
#if (CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)) && !defined(CRYPTOPP_DISABLE_PANAMA_ASM) #if (CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)) && !defined(CRYPTOPP_DISABLE_PANAMA_ASM)
assert(IsAlignedOn(input,GetAlignmentOf<word32>()));
assert(IsAlignedOn(output,GetAlignmentOf<word32>()));
if (B::ToEnum() == LITTLE_ENDIAN_ORDER && HasSSE2()) if (B::ToEnum() == LITTLE_ENDIAN_ORDER && HasSSE2())
Panama_SSE2_Pull(iterationCount, this->m_state, (word32 *)output, (const word32 *)input); Panama_SSE2_Pull(iterationCount, this->m_state, (word32 *)(void *)output, (const word32 *)(void *)input);
else else
#endif #endif
this->Iterate(iterationCount, NULL, output, input, operation); this->Iterate(iterationCount, NULL, output, input, operation);

View File

@ -96,7 +96,8 @@ template <const byte *sbox, const ArrayOf256Word64s *cbox>
struct SharkProcessAndXorBlock{ // VC60 workaround: problem with template functions struct SharkProcessAndXorBlock{ // VC60 workaround: problem with template functions
inline SharkProcessAndXorBlock(const word64 *roundKeys, unsigned int rounds, const byte *inBlock, const byte *xorBlock, byte *outBlock) inline SharkProcessAndXorBlock(const word64 *roundKeys, unsigned int rounds, const byte *inBlock, const byte *xorBlock, byte *outBlock)
{ {
word64 tmp = *(word64 *)inBlock ^ roundKeys[0]; assert(IsAlignedOn(input,GetAlignmentOf<word64>()));
word64 tmp = *(word64 *)(void *)inBlock ^ roundKeys[0];
ByteOrder order = GetNativeByteOrder(); ByteOrder order = GetNativeByteOrder();
tmp = cbox[0][GetByte(order, tmp, 0)] ^ cbox[1][GetByte(order, tmp, 1)] tmp = cbox[0][GetByte(order, tmp, 0)] ^ cbox[1][GetByte(order, tmp, 1)]
@ -124,7 +125,8 @@ inline SharkProcessAndXorBlock(const word64 *roundKeys, unsigned int rounds, con
(sbox[GETBYTE(tmp, 1)]) (sbox[GETBYTE(tmp, 1)])
(sbox[GETBYTE(tmp, 0)]); (sbox[GETBYTE(tmp, 0)]);
*(word64 *)outBlock ^= roundKeys[rounds]; assert(IsAlignedOn(output,GetAlignmentOf<word64>()));
*(word64 *)(void *)outBlock ^= roundKeys[rounds];
}}; }};
void SHARK::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const void SHARK::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const

View File

@ -158,7 +158,8 @@ bool Socket::Connect(const char *addr, unsigned int port)
} }
else else
{ {
sa.sin_addr.s_addr = ((in_addr *)lphost->h_addr)->s_addr; assert(IsAlignedOn(lphost->h_addr,GetAlignmentOf<in_addr>()));
sa.sin_addr.s_addr = ((in_addr *)(void *)lphost->h_addr)->s_addr;
} }
} }