tolerate broken CMS/PKCS7 implementations using signature OID instead of digest
[oweals/openssl.git] / crypto / bn / bn_ctx.c
index 5bd742a97c102f1789def58ef25d95460874c179..b3452f1a91e31081e18667e25c49790b5b5a876a 100644 (file)
@@ -230,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);
@@ -242,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);
@@ -257,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);