aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/bn/bntest.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2003-10-29 04:14:08 +0000
committerGeoff Thorpe <geoff@openssl.org>2003-10-29 04:14:08 +0000
commit2aaec9cced89edfdc8375b38a130fa1c35a98025 (patch)
tree8f9339b8dac8d23ae1b424216b769cdeef7f59f0 /crypto/bn/bntest.c
parent9d473aa2e4076beb959bc9701786a0860877ee12 (diff)
downloadopenssl-2aaec9cced89edfdc8375b38a130fa1c35a98025.tar.gz
Update any code that was using deprecated functions so that everything builds
and links with OPENSSL_NO_DEPRECATED defined.
Diffstat (limited to 'crypto/bn/bntest.c')
-rw-r--r--crypto/bn/bntest.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/crypto/bn/bntest.c b/crypto/bn/bntest.c
index fe057dc22f..0d37dcff4d 100644
--- a/crypto/bn/bntest.c
+++ b/crypto/bn/bntest.c
@@ -1502,7 +1502,7 @@ int test_gf2m_mod_solve_quad(BIO *bp,BN_CTX *ctx)
return ret;
}
-static void genprime_cb(int p, int n, void *arg)
+static int genprime_cb(int p, int n, BN_GENCB *arg)
{
char c='*';
@@ -1512,12 +1512,12 @@ static void genprime_cb(int p, int n, void *arg)
if (p == 3) c='\n';
putc(c, stderr);
fflush(stderr);
- (void)n;
- (void)arg;
+ return 1;
}
int test_kron(BIO *bp, BN_CTX *ctx)
{
+ BN_GENCB cb;
BIGNUM *a,*b,*r,*t;
int i;
int legendre, kronecker;
@@ -1528,6 +1528,8 @@ int test_kron(BIO *bp, BN_CTX *ctx)
r = BN_new();
t = BN_new();
if (a == NULL || b == NULL || r == NULL || t == NULL) goto err;
+
+ BN_GENCB_set(&cb, genprime_cb, NULL);
/* We test BN_kronecker(a, b, ctx) just for b odd (Jacobi symbol).
* In this case we know that if b is prime, then BN_kronecker(a, b, ctx)
@@ -1538,7 +1540,7 @@ int test_kron(BIO *bp, BN_CTX *ctx)
* don't want to test whether b is prime but whether BN_kronecker
* works.) */
- if (!BN_generate_prime(b, 512, 0, NULL, NULL, genprime_cb, NULL)) goto err;
+ if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb)) goto err;
b->neg = rand_neg();
putc('\n', stderr);
@@ -1606,6 +1608,7 @@ int test_kron(BIO *bp, BN_CTX *ctx)
int test_sqrt(BIO *bp, BN_CTX *ctx)
{
+ BN_GENCB cb;
BIGNUM *a,*p,*r;
int i, j;
int ret = 0;
@@ -1614,7 +1617,9 @@ int test_sqrt(BIO *bp, BN_CTX *ctx)
p = BN_new();
r = BN_new();
if (a == NULL || p == NULL || r == NULL) goto err;
-
+
+ BN_GENCB_set(&cb, genprime_cb, NULL);
+
for (i = 0; i < 16; i++)
{
if (i < 8)
@@ -1628,7 +1633,7 @@ int test_sqrt(BIO *bp, BN_CTX *ctx)
if (!BN_set_word(a, 32)) goto err;
if (!BN_set_word(r, 2*i + 1)) goto err;
- if (!BN_generate_prime(p, 256, 0, a, r, genprime_cb, NULL)) goto err;
+ if (!BN_generate_prime_ex(p, 256, 0, a, r, &cb)) goto err;
putc('\n', stderr);
}
p->neg = rand_neg();