[botan-devel] Cygwin failure creating initialization vector

Jack Lloyd lloyd at randombit.net
Mon Feb 21 13:23:26 EST 2011


Hi William,

Is it possible that somewhere between where your code runs and where
the library is initialized, the library is either shutdown, or the
internal state is corrupted somehow? That could explain why it works
from main but not in a later function call...

Perhaps in AutoSeeded_RNG::AutoSeeded_RNG
(src/rng/auto_rng/auto_rng.cpp) add debug output to ensure that the
constructor is actually running, and that the rng pointer is not being
modified?

Also: before calling rng.randomize, try writing to the buffer (eg
iv_val[0] = 0;) first; since it's not entirely clear from this
backtrace which pointer is invalid (though the rng certainly seems
like the likely candidate).

-Jack


On Mon, Feb 21, 2011 at 09:51:33AM -0800, William K. Foster wrote:
> Hi Jack,
> 
> I got the debugger working (issue was I was looking at wrong thread by
> default).
> 
> Now that I have the debugger working I see segv:
> 
> (gdb) s
> Botan::AutoSeeded_RNG::randomize (this=0x1270380, out=0x5841420 "", len=1)
>     at ../../src/Botan-1.8.11/build/include/botan/auto_rng.h:23
> (gdb) s
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x005d79ee in Botan::AutoSeeded_RNG::randomize (this=0x1270380,
>     out=0x5841420 "", len=1)
>     at ../../src/Botan-1.8.11/build/include/botan/auto_rng.h:23
> (gdb) p rng
> $7 = (class Botan::RandomNumberGenerator *) 0x5841324
> (gdb) p *this
> $8 = {<Botan::RandomNumberGenerator> = {
>     _vptr$RandomNumberGenerator = 0x11efc14}, rng = 0x5841324}
> 
> Thanks.
> 
> -William
> 
> On Mon, Feb 21, 2011 at 9:23 AM, William K. Foster <wkf at alum.mit.edu> wrote:
> 
> > Hello Jack,
> >
> > I lowered the size down to 16 and it still fails.
> >
> > I added a try catch block around the code, and no exception is caught.
> >
> > I changed the code to what you show below, and the failure occurs inside
> > the last line:
> >
> >
> >     _rng.randomize(&iv_val[0], size);
> >
> > I also tried size 1 and it also fails the same way.
> >
> > Finally, I moved the code to the beginning of main() and it works fine.  So
> > something is going wrong elsewhere that causes this to fail later.  How can
> > we track this down best?
> >
> > Thanks.
> >
> > -William
> >
> >



More information about the botan-devel mailing list