Clear Asan finding in VMAC under 32-bit inline ASM (GH #860)
This one has been nagging us for a while. Tested OK under i686 and x86_64.pull/867/head
parent
6bead34bd9
commit
f7986129df
21
vmac.cpp
21
vmac.cpp
|
|
@ -184,23 +184,21 @@ __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)
|
||||||
{
|
{
|
||||||
CRYPTOPP_ASSERT(IsAlignedOn(m_polyState(),GetAlignmentOf<word64>()));
|
|
||||||
CRYPTOPP_ASSERT(IsAlignedOn(m_nhKey(),GetAlignmentOf<word64>()));
|
|
||||||
|
|
||||||
const word64 *nhK = m_nhKey();
|
const word64 *nhK = m_nhKey();
|
||||||
word64 *polyS = (word64*)(void*)m_polyState();
|
word64 *polyS = (word64*)(void*)m_polyState();
|
||||||
word32 L1KeyLength = m_L1KeyLength;
|
word32 L1KeyLength = m_L1KeyLength;
|
||||||
|
|
||||||
// These are used in the ASM, but some analysis engines cnnot determine it.
|
// These are used in the ASM, but some analysis services miss it.
|
||||||
CRYPTOPP_UNUSED(data); CRYPTOPP_UNUSED(tagPart); CRYPTOPP_UNUSED(L1KeyLength);
|
CRYPTOPP_UNUSED(data); CRYPTOPP_UNUSED(tagPart);
|
||||||
|
CRYPTOPP_UNUSED(L1KeyLength);
|
||||||
CRYPTOPP_UNUSED(blocksRemainingInWord64);
|
CRYPTOPP_UNUSED(blocksRemainingInWord64);
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
word32 temp;
|
|
||||||
__asm__ __volatile__
|
__asm__ __volatile__
|
||||||
(
|
(
|
||||||
AS2( mov %%ebx, %0)
|
AS1( push %%ebx)
|
||||||
AS2( mov %1, %%ebx)
|
AS2( mov %0, %%ebx)
|
||||||
INTEL_NOPREFIX
|
INTEL_NOPREFIX
|
||||||
#else
|
#else
|
||||||
#if defined(__INTEL_COMPILER)
|
#if defined(__INTEL_COMPILER)
|
||||||
|
|
@ -419,10 +417,11 @@ VMAC_Base::VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWord64,
|
||||||
AS_POP_IF86( bp)
|
AS_POP_IF86( bp)
|
||||||
AS1( emms)
|
AS1( emms)
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
AS1( pop %%ebx)
|
||||||
ATT_PREFIX
|
ATT_PREFIX
|
||||||
AS2( mov %0, %%ebx)
|
:
|
||||||
: "=m" (temp)
|
: "m" (L1KeyLength), "c" (blocksRemainingInWord64), "S" (data),
|
||||||
: "m" (L1KeyLength), "c" (blocksRemainingInWord64), "S" (data), "D" (nhK+tagPart*2), "d" (m_isFirstBlock), "a" (polyS+tagPart*4)
|
"D" (nhK+tagPart*2), "d" (m_isFirstBlock), "a" (polyS+tagPart*4)
|
||||||
: "memory", "cc"
|
: "memory", "cc"
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
4
vmac.h
4
vmac.h
|
|
@ -52,10 +52,10 @@ protected:
|
||||||
void VHASH_Update_Template(const word64 *data, size_t blockRemainingInWord128);
|
void VHASH_Update_Template(const word64 *data, size_t blockRemainingInWord128);
|
||||||
void VHASH_Update(const word64 *data, size_t blocksRemainingInWord128);
|
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_2(nhKey, word64, m_L1KeyLength/sizeof(word64) + 2*m_is128)
|
||||||
CRYPTOPP_BLOCK_3(data, byte, m_L1KeyLength)
|
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_5(nonce, byte, IVSize())
|
||||||
CRYPTOPP_BLOCK_6(pad, byte, IVSize())
|
CRYPTOPP_BLOCK_6(pad, byte, IVSize())
|
||||||
CRYPTOPP_BLOCKS_END(6)
|
CRYPTOPP_BLOCKS_END(6)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue