At Frame 0:
#1 0x00497c57 in CryptoPP::Rijndael::Enc::AdvancedProcessBlocks (
this=this@entry=0x7b10d0 <s_globalRNG+48>,
inBlocks=inBlocks@entry=0x2e92990 "1438287574",
xorBlocks=xorBlocks@entry=0x0, ...
You are passing a NULL buffer into the function.
>From Frame 8:
#8 0x0042d704 in _fu94___ZNSs4_Rep20_S_empty_rep_storageE ()
at datatest.cpp:123
I'm guessing you have global variables, and they are not being initialized
in the order you expect them to be initialized in.
Switch to this pattern:
RandomNumberGenerator & GlobalRNG()
{
static OFB_Mode<AES>::Encryption s_globalRNG;
return s_globalRNG;
}
I'll fix the code in test.cpp so other's don't get into the bad habit...
Its a bad habit precisely because the C++ standard does not impose any
guarantees on the initialization of static objects in a translation unit.
Linux and Windows are pretty good about avoid this particular issue. The
problem gets worse on OS X.
Jeff
You are passing a NULL pointer into AdvancedProcessBlocks.
On Friday, July 31, 2015 at 3:11:53 AM UTC-4, Ilya Bizyaev wrote:
>
> Hello! :)
> __Sorry__ for tacking things to existing threads. Here is the new one,
> Jeffrey.
> 1) I have found a way of copying text from Windows Command Line, so here
> is the first unsolved problem.
> 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 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
>
> -----------------------------------------------------------------------------------------------
> 2) Second problem is with random generator. This code causes a
> segmentation fault:
> unsigned int result;
> GenerateBlock((byte*)&result, sizeof(unsigned int));
> Here is the call stack (image, as I cannot copy text from Code::Blocks
> call stack window.
>
>
> <https://lh3.googleusercontent.com/-c7nVZKuOvKM/Vbsfhu25CGI/AAAAAAAAA0M/5FpsWjZzEqQ/s1600/2015-07-25%2B17-45-31%2B%25D0%25A1%25D0%25BA%25D1%2580%25D0%25B8%25D0%25BD%25D1%2588%25D0%25BE%25D1%2582%2B%25D1%258D%25D0%25BA%25D1%2580%25D0%25B0%25D0%25BD%25D0%25B0.png>
>
> Hope someone reads this topic...
>
>
--
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.