On Fri, Jan 17, 2014 at 4:38 AM, Carl Young <carlyo...@keycomm.co.uk> wrote:
> ...
> I would say that BN_CTX_init() is deprecated and you should be using BN_CTX * 
> ctx = BN_CTX_new();
Yeah, it works with BN_CTX *. I was hoping to keep out of the memory
manager since it seems like a waste when it can be placed on the
stack.

> Indeed, https://www.openssl.org/docs/crypto/BN_CTX_new.html says
>
> BN_CTX_init() (deprecated) initializes an existing uninitialized BN_CTX. This 
> should not be used for new programs. Use BN_CTX_new() instead.
>
Odd its still being used in the source code.

Jeff

> ________________________________________
> From: owner-openssl-us...@openssl.org [owner-openssl-us...@openssl.org] on 
> behalf of Jeffrey Walton [noloa...@gmail.com]
> Sent: 16 January 2014 20:28
> To: OpenSSL Users List
> Subject: Declare BN_CTX on stack (not BN_CTX*)
>
> I'm trying to declare a BN_CTX on the stack (with a subsequent call to
> BN_CTX_init) to stay out of the memory manager.
>
> When I do, I get an error:
>
>     aggregate ‘BN_CTX’ has incomplete type and cannot be defined
>
> I've included <openssl/bn.h>, so I'm kind of surprised I can't
> compile. (<openssl/bn.h> has some typedefs and comments about
> definitions in ossl_typ.h).
>
> Grepping sources:
>
>     $ grep -R BN_CTX_init *
>     ...
>     crypto/bn/exp.c:    BN_CTX_init(&ctx);
>
> does not show me anything interesting because it looks like I'm doing
> what exp.c is doing:
>
>     BN_CTX ctx;
>     BIGNUM a,b,c,r,rr,t,l;
>     ...
>
>     BN_CTX_init(&ctx);
>
> How do I declare a BN_CTX on the stack?
>
> Thanks in advance.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to