X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fbn%2Fbn_ctx.c;h=f48055b268b9761ced40a9e8e274df64ef5adcc6;hp=9366ce6d7f2a8165bbbeabfd975bfbce6dda7398;hb=9e051bac139ce07f846d88b90f3ec514c39ea416;hpb=30fbcaa213866426c9f6b9dad01b9885ab760e31;ds=sidebyside diff --git a/crypto/bn/bn_ctx.c b/crypto/bn/bn_ctx.c index 9366ce6d7f..f48055b268 100644 --- a/crypto/bn/bn_ctx.c +++ b/crypto/bn/bn_ctx.c @@ -140,6 +140,7 @@ void BN_CTX_start(BN_CTX *ctx) BIGNUM *BN_CTX_get(BN_CTX *ctx) { + BIGNUM *ret; /* Note: If BN_CTX_get is ever changed to allocate BIGNUMs dynamically, * make sure that if BN_CTX_get fails once it will return NULL again * until BN_CTX_end is called. (This is so that callers have to check @@ -155,9 +156,10 @@ BIGNUM *BN_CTX_get(BN_CTX *ctx) } return NULL; } + ret = ctx->bn + (ctx->tos++); /* always return a 'zeroed' bignum */ - ctx->bn[ctx->tos].top = 0; - return (&(ctx->bn[ctx->tos++])); + BN_zero(ret); + return ret; } void BN_CTX_end(BN_CTX *ctx)