self test failure on 5.6 but not on 5.5.2 (winxp/msvc8sp1)

15 views
Skip to first unread message

Luca

unread,
Apr 30, 2009, 11:45:53 AM4/30/09
to Crypto++ Users
Hello,

I am using Windows XP SP2 with MSVC8 SP1, downloaded Cryptopp 5.6.0
and compiled it. Then when i run dll_output/release/dlltest.exe the
tests all go fine, but running dll_output/debug/dlltest.exe seems the
power-up self test is failing. Running it inside the IDE Debugger the
stack trace just shows some kernel32.dll entries, and some nt.dll
ones, and the popup message error is:

Unhandled exception at 0x7c9501c4 in dlltest.exe: 0xC0000029: An
invalid unwind target was encountered during an unwind operation.

The output window of the debugger contains:

First-chance exception at 0x1e13c4de in dlltest.exe: 0xC0000005:
Access violation reading location 0x1e13c4de.
First-chance exception at 0x7c9501c4 in dlltest.exe: 0xC0000029: An
invalid unwind target was encountered during an unwind operation.
Unhandled exception at 0x7c9501c4 in dlltest.exe: 0xC0000029: An
invalid unwind target was encountered during an unwind operation.

I tryed the executables on another computer to get the same results.

Instead the version 5.5.2 of Cryptopp (compiled with the same
compiler) pass perfectly the self test running dlltest.exe in any
flavor.

What could it be?

Greetings,
Luca

Roderick Ford

unread,
Apr 30, 2009, 6:09:22 PM4/30/09
to Luca, Crypto++ Users
You are probably going to have to try to get more out ot the stack trace...try to set breakpoints at suspicious locations (lots of them) and start it.  All the breakpoints that trigger are before the error, and all the ones after it are behind the problem.  So then you can track it down further, until you isolate the problem.  Good Luck!!

Luca Cappa

unread,
May 4, 2009, 10:08:57 AM5/4/09
to cryptop...@googlegroups.com
Yes, i would have liked it was so easy. The crash happens before
reaching the main function.

Luca

trungantran

unread,
May 9, 2009, 5:39:56 PM5/9/09
to Crypto++ Users
I also face the same problem with the same compiler as well.

Debugger told me dlltest failed because AutoSeededX917RNG<AES> commits
an access violation exception, which results in the crash of
X917RNG_KnownAnswerTest, inside its default constructor.

Further investigation shows that the actual problem comes from sse2-
asm code of the new implementation of CryptoPP::AES but I'm still
unable to figure out what's wrong.

So here are some workarounds you can consider until someone can
actually fix it:

a. Using another compiler to build CryptoPP (MSVC90 or even non-SP1
MSVC80 for example). I'm the one who think this may be a compiler bug
because: [1] release-shared variant still works well; [2] All DLLs I
built using gcc do not produce this problem with SSE2.

b. Building debug-shared CryptoPP library without SSE2. The easiest
way is to modify config.h as below:

#ifndef CRYPTOPP_CONFIG_H
#define CRYPTOPP_CONFIG_H
...
...
#ifdef CRYPTOPP_EXPORTS
# define CRYPTOPP_IS_DLL
# define CRYPTOPP_DLL __declspec(dllexport)
#elif defined(CRYPTOPP_IMPORTS)
# define CRYPTOPP_IS_DLL
# define CRYPTOPP_DLL __declspec(dllimport)
#else
# define CRYPTOPP_DLL
#endif

//Add the following lines to config.h
//Begin additional lines
#if (defined(_MSC_VER) && (_MSC_VER == 1400)) \ //MSVC80
&& defined(_DEBUG) \ //debug build
&& defined(CRYPTOPP_IS_DLL) \ //shared library
&& (CRYPTOPP_VERSION >= 560) //CryptoPP 5.5.2 and earlier doesnt
suffer from this problem

# ifndef CRYPTOPP_DISABLE_SSE2
# define CRYPTOPP_DISABLE_SSE2
# endif

# if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
# undef CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
# define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
# endif

# if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
# undef CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
# define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
# endif

#endif /* _MSC_VER == 1400 && _DEBUG && CRYPTOPP_IS_DLL &&
CRYPTOPP_VERSION >= 560 */
//End additional lines
...
...
#endif /* CRYPTOPP_CONFIG_H */

c. Try an alternative (OpenSSL for example).

Hope this will help.

Regards,
An


On May 4, 9:08 pm, Luca Cappa <lca...@gmail.com> wrote:
> Yes, i would have liked it was so easy. The crash happens before
> reaching the main function.
>
> Luca
>

Luca Cappa

unread,
May 20, 2009, 10:20:17 AM5/20/09
to Crypto++ Users
Hi,

thanks a lot, this would allow me to use the last version of Crypto++, thanks!
For now, i will stick with the version 5.5.2, but if needed this is
greatly helpful,
thanks again!

See you,
Luca
Reply all
Reply to author
Forward
0 new messages