[[EMAIL PROTECTED] - Tue Dec 24 21:58:41 2002]:

> Here's some code that worked fine before 0.9.7.  The BN_CTX_init() 
> isn't "right" per se, but then again it shouldn't cause a crash in 
> BN_copy, since that context isn't actually used in the copy!

When you compiled your source, didn't you get any warnings or errors at all?  Where 
did you get your definition of BN_CTX?

You see, there *has* been a change to BN_CTX all right.  First of all, one of it's 
members has changed size, and since that member is in the middle of the structure, 
some offsets have changed as well.  Second, since 0.9.7, BN_CTX is a typedef to an 
opaque structure.  This means you can't make it an automatic variable any more, you 
have to define a pointer to it, and you have to create the context with BN_CTX_new(), 
which incidently calls BN_CTX_init() for you on the allocated structure...

I suspect you included bn.h from 0.9.6, and then linked with the 0.9.7 libraries.  
Since the 0.9.7 BN_CTX is larger than the 0.9.6 one, and you allocated the 0.9.6 size 
on the stack, your call of BN_CTX_init() ended up overwriting not only c, but also 
whatever was above it on the stack, for example x and y.  And since you initialised c 
after you initialised x and y, the latter ones got screwed up bad...

This ticket is about user errors (mixing 0.9.6 headers with 0.9.7 libraries), which 
has now been explained.  I believe that resolves this ticket.

-- 
Richard Levitte
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to