X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fbn%2Fbn_ctx.c;h=b3452f1a91e31081e18667e25c49790b5b5a876a;hb=19398a175a7dc36b66f9494d5ebfb85d2e6ac1d6;hp=12d8a8cbf87f54371285bd2de3e72a34af3b7bd7;hpb=863d2b196f81f427993a0a408a3c0d4634bff971;p=oweals%2Fopenssl.git diff --git a/crypto/bn/bn_ctx.c b/crypto/bn/bn_ctx.c index 12d8a8cbf8..b3452f1a91 100644 --- a/crypto/bn/bn_ctx.c +++ b/crypto/bn/bn_ctx.c @@ -70,10 +70,7 @@ * * 1. Check a bunch of "(words+1)" type hacks in various bignum functions and * check they can be safely removed. - * - BN_bin2bn() looks pretty nasty with the miscellaneous +1 and +2 adjustments. - * Needs a full rubber-gloving, me thinks. * - Check +1 and other ugliness in BN_from_montgomery() - * - Aspects of BN_bn2dec() also look a bit arbitrary * * 2. Consider allowing a BN_new_ex() that, at least, lets you specify an * appropriate 'block' size that will be honoured by bn_expand_internal() to @@ -233,7 +230,10 @@ BN_CTX *BN_CTX_new(void) void BN_CTX_free(BN_CTX *ctx) { + if (ctx == NULL) + return; #ifdef BN_CTX_DEBUG + { BN_POOL_ITEM *pool = ctx->pool.head; fprintf(stderr,"BN_CTX_free, stack-size=%d, pool-bignums=%d\n", ctx->stack.size, ctx->pool.size); @@ -245,6 +245,7 @@ void BN_CTX_free(BN_CTX *ctx) pool = pool->next; } fprintf(stderr,"\n"); + } #endif BN_STACK_finish(&ctx->stack); BN_POOL_finish(&ctx->pool); @@ -260,8 +261,7 @@ void BN_CTX_start(BN_CTX *ctx) /* (Try to) get a new frame pointer */ else if(!BN_STACK_push(&ctx->stack, ctx->used)) { - /* I know this isn't BN_CTX_get, but ... */ - BNerr(BN_F_BN_CTX_GET,BN_R_TOO_MANY_TEMPORARY_VARIABLES); + BNerr(BN_F_BN_CTX_START,BN_R_TOO_MANY_TEMPORARY_VARIABLES); ctx->err_stack++; } CTXDBG_EXIT(ctx);