Fix the crash in debug DLL on x86 (msvc2005sp1/CryptoPP 5.6.0)

12 views
Skip to first unread message

trungantran

unread,
May 22, 2009, 12:43:26 PM5/22/09
to Crypto++ Users
Open the file "rijndael.cpp" and change:

CRYPTOPP_NAKED void CRYPTOPP_FASTCALL
Rijndael_Enc_AdvancedProcessBlocks(void *locals, const word32 *k)
{
....
#if !defined(_MSC_VER) || (_MSC_VER < 1400)
AS_PUSH_IF86(bx)
#endif
....
#if !defined(_MSC_VER) || (_MSC_VER < 1400)
AS_POP_IF86(bx)
#endif
....
}

to:

CRYPTOPP_NAKED void CRYPTOPP_FASTCALL
Rijndael_Enc_AdvancedProcessBlocks(void *locals, const word32 *k)
{
....
#if !defined(_MSC_VER) || (_MSC_VER <= 1400) // Is this condition
needed ?
AS_PUSH_IF86(bx)
#endif
....
#if !defined(_MSC_VER) || (_MSC_VER <= 1400) // Is this condition
needed ?
AS_POP_IF86(bx)
#endif
....
}

BTW, is the condition "!defined(_MSC_VER) || (_MSC_VER <= 1400)"
really needed ? I think AS_PUSH_IF86(bx)/AS_POP_IF86(bx) should be on
unconditionally for correct prolog/epilog code, although I dont have
any compiler except gcc & msvc2005sp1 to test this.

Regards,
An

Wei Dai

unread,
May 22, 2009, 6:03:22 PM5/22/09
to trungantran, Crypto++ Users
Thanks for figuring out the fix.

> BTW, is the condition "!defined(_MSC_VER) || (_MSC_VER <= 1400)"
> really needed ? I think AS_PUSH_IF86(bx)/AS_POP_IF86(bx) should be on
> unconditionally for correct prolog/epilog code, although I dont have
> any compiler except gcc & msvc2005sp1 to test this.

I put in that check because I noticed that VC 2005 and 2008 were adding
their own push/pop for ebx, but apparently sometimes it doesn't happen.
Unless someone knows why, I'll just remove that check.

Reply all
Reply to author
Forward
0 new messages