diff --git a/vmac.cpp b/vmac.cpp index 535cce21..cd5dcbc3 100644 --- a/vmac.cpp +++ b/vmac.cpp @@ -184,23 +184,21 @@ __attribute__ ((noinline)) // Intel Compiler 9.1 workaround #endif VMAC_Base::VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWord64, int tagPart) { - CRYPTOPP_ASSERT(IsAlignedOn(m_polyState(),GetAlignmentOf())); - CRYPTOPP_ASSERT(IsAlignedOn(m_nhKey(),GetAlignmentOf())); - const word64 *nhK = m_nhKey(); word64 *polyS = (word64*)(void*)m_polyState(); word32 L1KeyLength = m_L1KeyLength; - // These are used in the ASM, but some analysis engines cnnot determine it. - CRYPTOPP_UNUSED(data); CRYPTOPP_UNUSED(tagPart); CRYPTOPP_UNUSED(L1KeyLength); + // These are used in the ASM, but some analysis services miss it. + CRYPTOPP_UNUSED(data); CRYPTOPP_UNUSED(tagPart); + CRYPTOPP_UNUSED(L1KeyLength); CRYPTOPP_UNUSED(blocksRemainingInWord64); #ifdef __GNUC__ - word32 temp; + __asm__ __volatile__ ( - AS2( mov %%ebx, %0) - AS2( mov %1, %%ebx) + AS1( push %%ebx) + AS2( mov %0, %%ebx) INTEL_NOPREFIX #else #if defined(__INTEL_COMPILER) @@ -419,10 +417,11 @@ VMAC_Base::VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWord64, AS_POP_IF86( bp) AS1( emms) #ifdef __GNUC__ + AS1( pop %%ebx) ATT_PREFIX - AS2( mov %0, %%ebx) - : "=m" (temp) - : "m" (L1KeyLength), "c" (blocksRemainingInWord64), "S" (data), "D" (nhK+tagPart*2), "d" (m_isFirstBlock), "a" (polyS+tagPart*4) + : + : "m" (L1KeyLength), "c" (blocksRemainingInWord64), "S" (data), + "D" (nhK+tagPart*2), "d" (m_isFirstBlock), "a" (polyS+tagPart*4) : "memory", "cc" ); #endif diff --git a/vmac.h b/vmac.h index e229abc2..23ffef78 100644 --- a/vmac.h +++ b/vmac.h @@ -52,10 +52,10 @@ protected: void VHASH_Update_Template(const word64 *data, size_t blockRemainingInWord128); void VHASH_Update(const word64 *data, size_t blocksRemainingInWord128); - CRYPTOPP_BLOCK_1(polyState, word64, 4*(m_is128+1)) + CRYPTOPP_BLOCK_1(polyState, word64, (m_is128 ? 8 : 4)) CRYPTOPP_BLOCK_2(nhKey, word64, m_L1KeyLength/sizeof(word64) + 2*m_is128) CRYPTOPP_BLOCK_3(data, byte, m_L1KeyLength) - CRYPTOPP_BLOCK_4(l3Key, word64, 2*(m_is128+1)) + CRYPTOPP_BLOCK_4(l3Key, word64, (m_is128 ? 4 : 2)) CRYPTOPP_BLOCK_5(nonce, byte, IVSize()) CRYPTOPP_BLOCK_6(pad, byte, IVSize()) CRYPTOPP_BLOCKS_END(6)