Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail on MinGW-32 #26

Closed
IlyaBizyaev opened this issue Aug 6, 2015 · 3 comments
Closed

Tests fail on MinGW-32 #26

IlyaBizyaev opened this issue Aug 6, 2015 · 3 comments
Labels
Bug gcc-5 GCC compiler version 5

Comments

@IlyaBizyaev
Copy link

On MinGW-32, the cryptest.exe v with CRYPTOPP_NO_UNALIGNED_ACCESS defined crashes with SIGSEGV:

Using seed: 1438287574


Testing Settings...

passed:  Your machine is little endian.
passed:  CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS is not defined. Will restrict to a
ligned data access.
passed:  sizeof(byte) == 1
passed:  sizeof(word16) == 2
passed:  sizeof(word32) == 4
passed:  sizeof(word64) == 8
passed:  sizeof(hword) == 2, sizeof(word) == 4, sizeof(dword) == 8

Testing rotate...

passed    left rotate
passed    right rotate

Testing conversions...

passed    signed char
passed    signed char overflow
passed    unsigned char
passed    unsigned char overflow
passed    signed short
passed    signed short overflow
passed    unsigned short
passed    unsigned short overflow
passed    signed int
passed    signed int overflow
passed    unsigned int
passed    unsigned int overflow
passed    signed long
passed    signed long overflow
passed    unsigned long
passed    unsigned long overflow
passed    signed long long
passed    unsigned long long
passed    ssize_t
passed    size_t

No operating system provided blocking random number generator, skipping test.

Testing operating system provided nonblocking random number generator...

passed:  100000 generated bytes compressed to 100020 bytes by DEFLATE

CRC-32 validation suite running...

passed   00000000   ""
passed   43beb7e8   "a"
passed   c2412435   "abc"
passed   7f9d1520   "message digest"
passed   bd50274c   "abcdefghijklmnopqrstuvwxyz"
passed   d2e6c21f   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456
789"
passed   724aa97c   "12345678901234567890123456789012345678901234567890123456789
012345678901234567890"
passed   2639f4cb   "123456789"

Adler-32 validation suite running...

passed   00000001   ""
passed   00620062   "a"
passed   024d0127   "abc"
passed   29750586   "message digest"
passed   90860b20   "abcdefghijklmnopqrstuvwxyz"
passed   8adb150c   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456
789"
passed   15d870f9   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaa" repeated 15625 times

MD2 validation suite running...

passed   8350e5a3e24c153df2275c9f80692773   ""
passed   32ec01ec4a6dac72c0ab96fb34c0b5d1   "a"
passed   da853b0d3f88d99b30283a69e6ded6bb   "abc"
passed   ab4f496bfb2a530b219ff33031fe06b0   "message digest"
passed   4e8ddff3650292ab5a4108c3aa47940b   "abcdefghijklmnopqrstuvwxyz"
passed   da33def2a42df13975352846c30338cd   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi
jklmnopqrstuvwxyz0123456789"
passed   d5976f79d83d3a0dc9806c3c66f3efd8   "12345678901234567890123456789012345
678901234567890123456789012345678901234567890"

MD5 validation suite running...

passed   d41d8cd98f00b204e9800998ecf8427e   ""
passed   0cc175b9c0f1b6a831c399e269772661   "a"
passed   900150983cd24fb0d6963f7d28e17f72   "abc"
passed   f96b697d7cb7938d525a2f31aaf161d0   "message digest"
passed   c3fcd3d76192e4007dfb496cca67e13b   "abcdefghijklmnopqrstuvwxyz"
passed   d174ab98d277d9f5a5611c2c9f419d9f   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi
jklmnopqrstuvwxyz0123456789"
passed   57edf4a22be3c955ac49da2e2107b67a   "12345678901234567890123456789012345
678901234567890123456789012345678901234567890"

SHA validation suite running...


Testing MessageDigest algorithm SHA-1.

Program received signal SIGSEGV, Segmentation fault.
0x004f8ebc in __chkstk_ms ()
(gdb) backtrace
#0  0x004f8ebc in __chkstk_ms ()
#1  0x00497c57 in CryptoPP::Rijndael::Enc::AdvancedProcessBlocks (
    this=this@entry=0x7b10d0 <s_globalRNG+48>,
    inBlocks=inBlocks@entry=0x2e92990 "1438287574",
    xorBlocks=xorBlocks@entry=0x0,
    outBlocks=outBlocks@entry=0x2e982e0 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<",
    length=length@entry=16, flags=flags@entry=0) at rijndael.cpp:1215
#2  0x004988ab in CryptoPP::Rijndael::Enc::ProcessAndXorBlock (
    this=0x7b10d0 <s_globalRNG+48>, inBlock=0x2e92990 "1438287574",
    xorBlock=0x0, outBlock=0x2e982e0 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<")
    at rijndael.cpp:365
#3  0x004a7f75 in ProcessBlock (
    outBlock=0x2e982e0 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<",
    inBlock=<optimized out>, this=<optimized out>) at cryptlib.h:470
#4  CryptoPP::OFB_ModePolicy::WriteKeystream (this=0x7b10a0 <s_globalRNG>,
    keystreamBuffer=0x2e982e0 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<",
    iterationCount=1) at modes.cpp:84
#5  0x0055d4b5 in CryptoPP::AdditiveCipherTemplate<CryptoPP::AbstractPolicyHolde
r<CryptoPP::AdditiveCipherAbstractPolicy, CryptoPP::OFB_ModePolicy> >::GenerateB
lock (this=0x7b10a0 <s_globalRNG>, outString=0x28def0 "", length=4)
    at strciphr.cpp:61
#6  0x0043ce87 in CryptoPP::RandomNumberGenerator::GenerateWord32 (
    this=0x7b10bc <s_globalRNG+28>, min=0, max=63) at cryptlib.cpp:263
#7  0x0042c440 in RandomizedTransfer (source=..., target=..., channel=...,
    finish=true) at datatest.cpp:69
#8  0x0042d704 in _fu94___ZNSs4_Rep20_S_empty_rep_storageE ()
    at datatest.cpp:123
#9  0x00430cac in _fu2426___ZTIi () at datatest.cpp:573
#10 0x00432bfb in _fu871___ZSt4cout () at datatest.cpp:716
#11 0x00432fa5 in RunTestDataFile (
    filename=filename@entry=0x64267f <ValidateBBS()::output1+1457> "TestVectors/
sha.txt", overrideParameters=..., thorough=thorough@entry=true)
    at datatest.cpp:755
#12 0x0042925c in _fu800___ZSt4cout () at validat3.cpp:173
#13 0x00419db5 in ValidateAll (thorough=thorough@entry=false)
    at validat1.cpp:61
#14 0x0040b61d in _fu523___ZSt4cout () at test.cpp:847
#15 0x00605f89 in _fu2814___ZSt3cin () at test.cpp:367

Dump file (if it helps)


cryptest.exe tv all crashes on Testing SymmetricCipher algorithm TEA/ECB. The problem seems to be the same.
Here is the call stack:

Testing FileList algorithm all.txt collection.

Testing SymmetricCipher algorithm TEA/ECB.

Program received signal SIGSEGV, Segmentation fault.
0x004f920c in __chkstk_ms ()
(gdb) backtrace
#0  0x004f920c in __chkstk_ms ()
#1  0x00497fa7 in CryptoPP::Rijndael::Enc::AdvancedProcessBlocks (
    this=this@entry=0x7b10d0 <GlobalRNG()::s_globalRNG+48>,
    inBlocks=inBlocks@entry=0x2ca7dd0 "1438330210",
    xorBlocks=xorBlocks@entry=0x0,
    outBlocks=outBlocks@entry=0x2ca8390 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<",
    length=length@entry=16, flags=flags@entry=0) at rijndael.cpp:1215
#2  0x00498bfb in CryptoPP::Rijndael::Enc::ProcessAndXorBlock (
    this=0x7b10d0 <GlobalRNG()::s_globalRNG+48>,
    inBlock=0x2ca7dd0 "1438330210", xorBlock=0x0,
    outBlock=0x2ca8390 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<") at rijndael.cpp:365
#3  0x004a82c5 in ProcessBlock (
    outBlock=0x2ca8390 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<",
    inBlock=<optimized out>, this=<optimized out>) at cryptlib.h:470
#4  CryptoPP::OFB_ModePolicy::WriteKeystream (
    this=0x7b10a0 <GlobalRNG()::s_globalRNG>,
    keystreamBuffer=0x2ca8390 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<",
    iterationCount=1) at modes.cpp:84
#5  0x0055d805 in CryptoPP::AdditiveCipherTemplate<CryptoPP::AbstractPolicyHolde
r<CryptoPP::AdditiveCipherAbstractPolicy, CryptoPP::OFB_ModePolicy> >::GenerateB
lock (this=0x7b10a0 <GlobalRNG()::s_globalRNG>, outString=0x28dba0 "",
    length=4) at strciphr.cpp:61
#6  0x0043d1d7 in CryptoPP::RandomNumberGenerator::GenerateWord32 (
    this=0x7b10bc <GlobalRNG()::s_globalRNG+28>, min=0, max=63)
    at cryptlib.cpp:263
#7  0x0042c790 in RandomizedTransfer (source=..., target=..., channel=...,
    finish=true) at datatest.cpp:69
#8  0x0042da54 in _fu94___ZNSs4_Rep20_S_empty_rep_storageE ()
    at datatest.cpp:123
#9  0x0042e363 in _fu95___ZNSs4_Rep20_S_empty_rep_storageE ()
    at datatest.cpp:129
#10 0x0042e403 in TestSymmetricCipher (v=..., overrideParameters=...)
    at datatest.cpp:328
#11 0x00432cce in _fu870___ZSt4cout () at datatest.cpp:710
#12 0x004330c4 in _fu871___ZSt4cout () at datatest.cpp:720
#13 0x004332f5 in RunTestDataFile (filename=0x2ca849c "TestVectors/all.txt",
    overrideParameters=..., thorough=thorough@entry=true) at datatest.cpp:755
#14 0x00605473 in _fu2781___ZSt4cerr () at test.cpp:315

Steps to reproduce:

  1. Install MinGW-32 with GCC 4.8.1, as in my case. Seems to be the latest MinGW-32. Don't forget about MSYS.
  2. Run gdb --args ./cryptest.exe v or gdb --args ./cryptest.exe tv all in MSYS console
  3. Finally, execute run in GDB console. You'll see the program output till the crash and the crash information.
  4. Type backtrace to get the stack trace.
  5. After all, type kill and quit to stop debugging.

Or simply run cryptest.exe v to get Windows's crash message.


Environment information:
uname -a:

MINGW32_NT-6.1 ИЛЬЯ-ПК 1.0.18(0.48/3/2) 2012-11-21 22:34 i686 Msys

g++ -v:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=mingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto --enable-libssp --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gmp-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable-libgomp --enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)

To build the library, I simply uncomment the line with CRYPTOPP_NO_UNALLIGNED_ACCESS in config.h and then run make.

@noloader noloader added the Bug label Oct 31, 2015
@IlyaBizyaev IlyaBizyaev changed the title Tests fail on MinGW Tests fail on MinGW-32 Nov 5, 2015
@Zireael-N
Copy link
Contributor

@noloader

I guess this can be closed: "All MinGW builds are fine and pass tests!".

@noloader
Copy link
Collaborator

noloader commented Nov 6, 2015

I guess this can be closed: "All MinGW builds are fine and pass tests!".

OK, thanks. Done.

@noloader noloader closed this as completed Nov 6, 2015
@noloader noloader added the gcc-5 GCC compiler version 5 label Jan 4, 2016
@noloader
Copy link
Collaborator

noloader commented Jan 4, 2016

@IlyaBizyaev - I've been going through the past and present reports, and its pretty clear to me that GCC 5 has some non-trivial problems with optimizing and inlining. Its seems to be the cause of half a dozen or so issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug gcc-5 GCC compiler version 5
Projects
None yet
Development

No branches or pull requests

3 participants