aboutsummaryrefslogtreecommitdiff
path: root/crypto/bn/bn_ctx.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2004-03-13 22:10:15 +0000
committerGeoff Thorpe <geoff@openssl.org>2004-03-13 22:10:15 +0000
commit9e051bac139ce07f846d88b90f3ec514c39ea416 (patch)
tree234a4800454556d58354140cd9d1ced9a56f9478 /crypto/bn/bn_ctx.c
parent30fbcaa213866426c9f6b9dad01b9885ab760e31 (diff)
downloadopenssl-9e051bac139ce07f846d88b90f3ec514c39ea416.zip
openssl-9e051bac139ce07f846d88b90f3ec514c39ea416.tar.gz
openssl-9e051bac139ce07f846d88b90f3ec514c39ea416.tar.bz2
Document a change I'd already made, and at the same time, correct the
change to work properly; BN_zero() should set 'neg' to zero as well as 'top' to match the behaviour of BN_new().
Diffstat (limited to 'crypto/bn/bn_ctx.c')
-rw-r--r--crypto/bn/bn_ctx.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/bn/bn_ctx.c b/crypto/bn/bn_ctx.c
index 9366ce6..f48055b 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)