diff options
author | Ulf Möller <ulf@openssl.org> | 2000-02-05 14:17:32 +0000 |
---|---|---|
committer | Ulf Möller <ulf@openssl.org> | 2000-02-05 14:17:32 +0000 |
commit | 9b141126d4b6f0636bc047e81b846c193ae26611 (patch) | |
tree | c8786c99bfccc8b9899cad5c3aa30f29ada5e1b9 /crypto/dh/dh_gen.c | |
parent | 7e708ebee066d0308a335579b546326220dc8317 (diff) | |
download | openssl-9b141126d4b6f0636bc047e81b846c193ae26611.tar.gz |
New functions BN_CTX_start(), BN_CTX_get(), BN_CTX_end() to access
temporary BIGNUMs. BN_CTX still uses a fixed number of BIGNUMs, but
the BN_CTX implementation could now easily be changed.
Diffstat (limited to 'crypto/dh/dh_gen.c')
-rw-r--r-- | crypto/dh/dh_gen.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/crypto/dh/dh_gen.c b/crypto/dh/dh_gen.c index f0ee43ed87..7a6a38fbb4 100644 --- a/crypto/dh/dh_gen.c +++ b/crypto/dh/dh_gen.c @@ -95,9 +95,10 @@ DH *DH_generate_parameters(int prime_len, int generator, if (ret == NULL) goto err; ctx=BN_CTX_new(); if (ctx == NULL) goto err; - t1= &(ctx->bn[0]); - t2= &(ctx->bn[1]); - ctx->tos=2; + BN_CTX_start(ctx); + t1 = BN_CTX_get(ctx); + t2 = BN_CTX_get(ctx); + if (t1 == NULL || t2 == NULL) goto err; if (generator == DH_GENERATOR_2) { @@ -138,7 +139,11 @@ err: ok=0; } - if (ctx != NULL) BN_CTX_free(ctx); + if (ctx != NULL) + { + BN_CTX_end(ctx); + BN_CTX_free(ctx); + } if (!ok && (ret != NULL)) { DH_free(ret); |