thanks Nils,
brian
--- Nils Larsch <[EMAIL PROTECTED]> wrote:
> b l wrote:
> > Hi,
> >
> > If i reuse a BIGNUM created with BN_new() without
> > freeing it first will i cause a memory leak?
>
> no
>
> > does the BIGNUM dynamically allocate memory each
> time
> > it is used by certain functions?
>
> yes (but only if it's required)
>
> >
> > for example
> > i create BIGNUM * tempBN=BN_new();
> >
> > i might make a call to
> > BN_bin2bn (char1,len,tempBN);
> >
> > i might make a similar call later
> > BN_bin2bn(char2,len2,tempBN);
> >
> > is this reuse of a big number like this going to
> cause
> > a memory leak??
>
> no
>
> > Is tempBN reusing the same memory or is it
> allocating
> > new memory. How is it working internally?
>
> if the current memory is sufficient to fulfil the
> task
> it's reused, otherwise it's increased via realloc
> etc.
>
> >
> > Is there a faq/sample code/tips on how to use the
> BN
> > library?
>
> crypto/{rsa|dsa|...} ;-)
>
> >
> > At the moment i allocate a lot of BIGNUM's using
> > BN_new() at the start of the program. I then reuse
> > these BIGNUM's over and over and over throughout
> > multiple runs of a long computation.
>
> alternative use BN_CTX (see for example 'man
> BN_CTX_new')
>
> >
> > I had thought that by creating them at the start
> of
> > the program and then just reusing them that i
> wouldn't
> > be repeatedly dynamically allocating memory and
> not
> > freeing it.
>
> that's true
>
> > but now i'm not so sure. Musn't the BIGNUM be
> > reallocating memory every time i use it otherwise
> how
> > does it know what size to make itself initially?
> > How should i do this type of thing properly?
>
> Nils
>
______________________________________________________________________
> OpenSSL Project
> http://www.openssl.org
> User Support Mailing List
> [EMAIL PROTECTED]
> Automated List Manager
> [EMAIL PROTECTED]
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]