#include <openssl/x509.h>
#include <openssl/err.h>
-#ifdef OPENSSL_SYS_WINDOWS
-#include "../bio/bss_file.c"
-#endif
-
const int num0 = 100; /* number of tests */
const int num1 = 50; /* additional tests for some functions */
const int num2 = 5; /* number of tests for slow functions */
int rand_neg(void);
static int results=0;
-#ifdef OPENSSL_NO_STDIO
-#define APPS_WIN16
-#include "bss_file.c"
-#endif
-
static unsigned char lst[]="\xC6\x4F\x43\x04\x2A\xEA\xCA\x6E\x58\x36\x80\x5B\xE8\xC9"
"\x9B\x04\x5D\x48\x36\xC2\xFD\x16\xC9\x64\xF0";
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='*';
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;
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)
* 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);
int test_sqrt(BIO *bp, BN_CTX *ctx)
{
+ BN_GENCB cb;
BIGNUM *a,*p,*r;
int i, j;
int ret = 0;
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)
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();