On Friday, 14 October 2016 11:33:53 UTC+1, Andrew Marlow wrote:
>
> Hello,
>
> I am sorry to report that cryptest.exe v still core dumps on solaris 11 
> when using the sun 12.4 compiler. The command I used to build cryptopp was: 
> CXX=/opt/solarisstudio12.4/bin/CC make -j20
>
> The error is:
>
> Testing MessageDigest algorithm SHA-384.
> ..signal BUS (invalid address alignment) in CryptoPP::SHA512::Transform at 
> line 34 in file "sha.cpp"
>    34   #define blk0(i) (W[i] = data[i])
>
> the stack trace is:
>
> (dbx) where
> =>[1] CryptoPP::SHA512::Transform(state = <value unavailable>, data = 
> <value unavailable>) (optimized), at 0x1006255a0 (line ~34) in "sha.cpp"
>   [2] CryptoPP::IteratedHashWithStaticTransform<unsigned 
> long,CryptoPP::EnumToType<CryptoPP::ByteOrder,1>,128U,64U,CryptoPP::SHA384,48U,false>::HashEndianCorrectedBlock(this
>  
> = 0x1010c18d0, data = 0xffffffff7fffc1b4) (optimized), at 0x1004c8120 (line 
> ~170) in "iterhash.h"
>   [3] CryptoPP::IteratedHashBase<unsigned 
> long,CryptoPP::HashTransformation>::HashMultipleBlocks(this = 0x1010c18d0, 
> input = 0xffffffff7fffc1b4, length = <value unavailable>) (optimized), at 
> 0x1005d834c (line ~91) in "iterhash.cpp"
>   [4] CryptoPP::IteratedHashBase<unsigned 
> long,CryptoPP::HashTransformation>::Update(this = 0x1010c18d0, input = 
> 0xffffffff7fffc1b4 "aaaaaaaaaaaaaaa [snip]
>   [5] CryptoPP::HashVerificationFilter::NextPutMultiple(this = 
> 0xffffffff7fffd550, inString = 0xffffffff7fffc15d "aaaaaaaaaaa [snip]
>   [6] CryptoPP::FilterWithBufferedInput::PutMaybeModifiable(this = 
> 0xffffffff7fffd550, inString = 0xffffffff7fffc15d 
> "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [snip]
>   [7] CryptoPP::FilterWithBufferedInput::Put2(this = 0xffffffff7fffd550, 
> inString = 0xffffffff7fffc15d 
> "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>   [8] CryptoPP::BufferedTransformation::ChannelPut2(this = 
> 0xffffffff7fffd550, channel = CLASS, begin = 0xffffffff7fffc15d 
> "aaaaaaaaaaaaaaaaaaaaaaaaaaa
>   [9] RandomizedTransfer(source = CLASS, target = CLASS, finish = <value 
> unavailable>, channel = CLASS) (optimized), at 0x1004e9e94 (line ~92) in 
> "datatest.cpp"
>   [10] PutDecodedDatumInto(data = CLASS, name = <value unavailable>, 
> target = CLASS) (optimized), at 0x1004ea41c (line ~138) in "datatest.cpp"
>   [11] TestDigestOrMAC(v = CLASS, testDigest = <value unavailable>) 
> (optimized), at 0x1004ef674 (line ~603) in "datatest.cpp"
>   [12] TestDataFile(filename = CLASS, overrideParameters = CLASS, 
> totalTests = 11U, failedTests = 0) (optimized), at 0x1004f0c44 (line ~802) 
> in "datatest.cpp"
>   [13] RunTestDataFile(filename = 0x100afec60 "TestVectors/sha.txt", 
> overrideParameters = CLASS, thorough = true) (optimized), at 0x1004f1168 
> (line ~243) in "string"
>   [14] ValidateSHA() (optimized), at 0x1004c9228 (line ~212) in 
> "validat3.cpp"
>   [15] ValidateAll(thorough = false) (optimized), at 0x1004339e8 (line 
> ~95) in "validat1.cpp"
>   [16] Validate(alg = <value unavailable>, thorough = false, seedInput = 
> <value unavailable>) (optimized), at 0x100380cdc (line ~899) in "test.cpp"
>   [17] main(argc = <value unavailable>, argv = 0xffffffff7ffff7d6) 
> (optimized), at 0x10037b690 (line ~364) in "test.cpp"
>
> The test program also crashes when the b (benchmark) option is used. 
> Interestingly, the crash is in the same place as my own test program 
> crashes, in CryptoPP::CountWords, due to a null pointer.
>
[snip]

I have spent some more time in the debugger and have some more information 
on this problem. Unfortunately I have no resolution at the moment.

The Integer copy ctor (integer.cpp:2903) is being given a bad integer to 
copy. The m_ptr is null, the m_size is 144. This integer is returned from 
RSAFunction::PreimageBound. The "this" pointer at this juncture seems to be 
bad. It turns out the pointer value is actually a pointer to char* rather 
than the object expected. The string is the value returned from 
GetThisObject. Single stepping in dbx I get to RSAFunction::AssignFrom. At 
this point the "this" ptr is ok. I step into RSAFunction::GetThisObject 
which calls GetValue which calls GetVoidValue. This is where it calls 
RSAFunction::PreboundImage with m_n equal to that empty, troublesome 
Integer. But there is no way that the function should even have been 
called. GetVoidValue is a pure virtual on the base class (NameValuePairs) 
so it should have done a virtual function dispatch to the relevant 
GetVoidValue function. It didn't . On landing in RSAFunction::PreboundImage 
the "this" pointer is equal to the name value in GetVoidValue, a string 
pointing to "ThisObject:CryptoPP::RSAFunction". What could be causing the 
vptr dispatch to go wrong?  I note that the base class, NameValuePairs, is 
decorated with the macro CRYPTOPP_NO_VTABLE. It seems quite a coincidence 
that I am having vptr trouble and there is this macro with a name like 
that. The macro is a no-op though unles the Microsoft compiler is being 
used (I am on solaris 11 sparc with the sunstudio 12.4 compiler). Can 
someone please explain what that macro is about?

So this kind of explains why the integer is bad but nothing can detect it 
and nothing assigns it this bad value. But what to do from here? I am stuck.



-- 
-- 
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.

Reply via email to