I have a routine that has worked for years on 32-bit systems, using crypto++ 5.2.1.
I just updated to crypto++ 5.6.0, compiled for 32-bits (Linux; g++ 4.2),
and it seems to work fine.
I then built the same code on a 64-bit system. crypto++ passes the
cryptest.exe tests just fine, BUT...
when I run my routine it seems to enter an infinite recursion and
eventually segfaults.
Looking under gdb, the recursion is between two lines in cryptlib.cpp:
lines 260 and 274.
The relevant portion of the file is:
----
void RandomNumberGenerator::GenerateBlock(byte *output, size_t size)
{
ArraySink s(output, size);
*LINE 260 GenerateIntoBufferedTransformation(s, DEFAULT_CHANNEL, size);
}
void RandomNumberGenerator::DiscardBytes(size_t n)
{
GenerateIntoBufferedTransformation(TheBitBucket(), DEFAULT_CHANNEL, n);
}
void
RandomNumberGenerator::GenerateIntoBufferedTransformation(BufferedTransformation
&target, const std::string &channel, lword length)
{
FixedSizeSecBlock<byte, 256> buffer;
while (length)
{
size_t len = UnsignedMin(buffer.size(), length);
*LINE 274 GenerateBlock(buffer, len);
target.ChannelPut(channel, buffer, len);
length -= len;
}
}
----
It seems quite clear (I think, although maybe I'm being blind somehow) how,
once one hits line 260, one can enter a state of infinite recursion,
flipping between line 260 and line 274.
My question is: how is this supposed to work without recursing infinitely?
Doc
--
Web: http://www.sff.net/people/N7DR
signature.asc
Description: OpenPGP digital signature
