summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_ctx.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2003-11-04 23:54:49 +0100
committerGeoff Thorpe <geoff@openssl.org>2003-11-04 23:54:49 +0100
commitd870740cd75dd4f0cb66fb8c32653a7d47369706 (patch)
tree0c6cb1ce0b1083c96419c432d1f05c3dff51320d /crypto/bn/bn_ctx.c
parentAvoid some shadowed variable names. (diff)
downloadopenssl-d870740cd75dd4f0cb66fb8c32653a7d47369706.tar.xz
openssl-d870740cd75dd4f0cb66fb8c32653a7d47369706.zip
Put the first stage of my bignum debugging adventures into CVS. This code
is itself experimental, and in addition may cause execution to break on existing openssl "bugs" that previously were harmless or at least invisible.
Diffstat (limited to 'crypto/bn/bn_ctx.c')
-rw-r--r--crypto/bn/bn_ctx.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/bn/bn_ctx.c b/crypto/bn/bn_ctx.c
index a0e7915fb9..7b5be7c435 100644
--- a/crypto/bn/bn_ctx.c
+++ b/crypto/bn/bn_ctx.c
@@ -121,8 +121,10 @@ void BN_CTX_free(BN_CTX *ctx)
if (ctx == NULL) return;
assert(ctx->depth == 0);
- for (i=0; i < BN_CTX_NUM; i++)
+ for (i=0; i < BN_CTX_NUM; i++) {
+ bn_check_top(&(ctx->bn[i]));
BN_clear_free(&(ctx->bn[i]));
+ }
if (ctx->flags & BN_FLG_MALLOCED)
OPENSSL_free(ctx);
}
@@ -152,6 +154,7 @@ BIGNUM *BN_CTX_get(BN_CTX *ctx)
}
return NULL;
}
+ bn_check_top(&(ctx->bn[ctx->tos]));
return (&(ctx->bn[ctx->tos++]));
}