summaryrefslogtreecommitdiffstats
path: root/crypto/dsa
diff options
context:
space:
mode:
authorUlf Möller <ulf@openssl.org>2000-02-05 14:17:32 +0000
committerUlf Möller <ulf@openssl.org>2000-02-05 14:17:32 +0000
commit9b141126d4b6f0636bc047e81b846c193ae26611 (patch)
treec8786c99bfccc8b9899cad5c3aa30f29ada5e1b9 /crypto/dsa
parent7e708ebee066d0308a335579b546326220dc8317 (diff)
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/dsa')
-rw-r--r--crypto/dsa/dsa_gen.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/crypto/dsa/dsa_gen.c b/crypto/dsa/dsa_gen.c
index 65602dda77..2294a362d9 100644
--- a/crypto/dsa/dsa_gen.c
+++ b/crypto/dsa/dsa_gen.c
@@ -116,14 +116,15 @@ DSA *DSA_generate_parameters(int bits, unsigned char *seed_in, int seed_len,
if ((mont=BN_MONT_CTX_new()) == NULL) goto err;
- r0= &(ctx2->bn[0]);
- g= &(ctx2->bn[1]);
- W= &(ctx2->bn[2]);
- q= &(ctx2->bn[3]);
- X= &(ctx2->bn[4]);
- c= &(ctx2->bn[5]);
- p= &(ctx2->bn[6]);
- test= &(ctx2->bn[7]);
+ BN_CTX_start(ctx2);
+ r0 = BN_CTX_get(ctx2);
+ g = BN_CTX_get(ctx2);
+ W = BN_CTX_get(ctx2);
+ q = BN_CTX_get(ctx2);
+ X = BN_CTX_get(ctx2);
+ c = BN_CTX_get(ctx2);
+ p = BN_CTX_get(ctx2);
+ test = BN_CTX_get(ctx2);
BN_lshift(test,BN_value_one(),bits-1);
@@ -168,8 +169,6 @@ DSA *DSA_generate_parameters(int bits, unsigned char *seed_in, int seed_len,
/* step 4 */
r = BN_is_prime_fasttest(q, DSS_prime_checks, callback, ctx3, cb_arg, seed_is_random);
- if (ctx3->tos)
- goto err;
if (r > 0)
break;
if (r != 0)
@@ -283,7 +282,11 @@ err:
if (h_ret != NULL) *h_ret=h;
}
if (ctx != NULL) BN_CTX_free(ctx);
- if (ctx2 != NULL) BN_CTX_free(ctx2);
+ if (ctx2 != NULL)
+ {
+ BN_CTX_end(ctx2);
+ BN_CTX_free(ctx2);
+ }
if (ctx3 != NULL) BN_CTX_free(ctx3);
if (mont != NULL) BN_MONT_CTX_free(mont);
return(ok?ret:NULL);