diff options
author | Ulf Möller <ulf@openssl.org> | 2000-01-30 23:33:40 +0000 |
---|---|---|
committer | Ulf Möller <ulf@openssl.org> | 2000-01-30 23:33:40 +0000 |
commit | 51ca375e7e640c6f1441d74abcda731ef7306d0c (patch) | |
tree | 8b661d70f98b8d819edea5f777117ec7be03fab7 /crypto/bn/bn_prime.c | |
parent | 1749d8a039e637a6ab06f30cd0351605b44dc625 (diff) |
Seek out and destroy another evil cast.
Diffstat (limited to 'crypto/bn/bn_prime.c')
-rw-r--r-- | crypto/bn/bn_prime.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c index 39b99ea6c3..e2cfef3725 100644 --- a/crypto/bn/bn_prime.c +++ b/crypto/bn/bn_prime.c @@ -83,11 +83,13 @@ BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, BIGNUM *add, BIGNUM t; int found=0; int i,j,c1=0; - BN_CTX *ctx; + BN_CTX *ctx,*ctx2=NULL; int checks = BN_prime_checks_for_size(bits); ctx=BN_CTX_new(); if (ctx == NULL) goto err; + ctx2=BN_CTX_new(); + if (ctx2 == NULL) goto err; if (ret == NULL) { if ((rnd=BN_new()) == NULL) goto err; @@ -119,7 +121,7 @@ loop: if (!safe) { - i=BN_is_prime(rnd,checks,callback,ctx,cb_arg); + i=BN_is_prime_fasttest(rnd,checks,callback,ctx,ctx2,cb_arg,0); if (i == -1) goto err; if (i == 0) goto loop; } @@ -133,11 +135,11 @@ loop: for (i=0; i<checks; i++) { - j=BN_is_prime(rnd,1,callback,ctx,cb_arg); + j=BN_is_prime_fasttest(rnd,1,callback,ctx,ctx2,cb_arg,0); if (j == -1) goto err; if (j == 0) goto loop; - j=BN_is_prime(&t,1,callback,ctx,cb_arg); + j=BN_is_prime_fasttest(&t,1,callback,ctx,ctx2,cb_arg,0); if (j == -1) goto err; if (j == 0) goto loop; @@ -151,6 +153,7 @@ err: if (!found && (ret == NULL) && (rnd != NULL)) BN_free(rnd); BN_free(&t); if (ctx != NULL) BN_CTX_free(ctx); + if (ctx2 != NULL) BN_CTX_free(ctx2); return(found ? rnd : NULL); } |