prime generation: Deploy the new Baillie--PSW testers.
[catacomb] / math / strongprime.c
index 4ea6253..958cd28 100644 (file)
@@ -79,7 +79,6 @@ mp *strongprime_setup(const char *name, mp *d, pfilt *f, unsigned nbits,
   mp *rr = d;
   pgen_filterctx c;
   pgen_jumpctx j;
-  rabin rb;
 
   /* --- Figure out how large the smaller primes should be --- *
    *
@@ -116,13 +115,13 @@ mp *strongprime_setup(const char *name, mp *d, pfilt *f, unsigned nbits,
   rr = mprand(rr, nb, r, 1);
   DRESET(&dn); dstr_putf(&dn, "%s [s]", name);
   if ((s = pgen(dn.buf, MP_NEWSEC, rr, event, ectx, n, pgen_filter, &c,
-               rabin_iters(nb), pgen_test, &rb)) == 0)
+               PGEN_BAILLIEPSWNTESTS, pgen_bailliepswtest, 0)) == 0)
     goto fail_s;
 
   rr = mprand(rr, nb, r, 1);
   DRESET(&dn); dstr_putf(&dn, "%s [t]", name);
   if ((t = pgen(dn.buf, MP_NEWSEC, rr, event, ectx, n, pgen_filter, &c,
-               rabin_iters(nb), pgen_test, &rb)) == 0)
+               PGEN_BAILLIEPSWNTESTS, pgen_bailliepswtest, 0)) == 0)
     goto fail_t;
 
   /* --- Choose a suitable value for %$r = 2it + 1$% for some %$i$% --- *
@@ -137,7 +136,7 @@ mp *strongprime_setup(const char *name, mp *d, pfilt *f, unsigned nbits,
   DRESET(&dn); dstr_putf(&dn, "%s [r]", name);
   j.j = &c.f;
   q = pgen(dn.buf, MP_NEW, rr, event, ectx, n, pgen_jump, &j,
-          rabin_iters(nb + slop), pgen_test, &rb);
+          PGEN_BAILLIEPSWNTESTS, pgen_bailliepswtest, 0);
   pfilt_destroy(&c.f);
   if (!q)
     goto fail_r;
@@ -219,14 +218,13 @@ mp *strongprime(const char *name, mp *d, unsigned nbits, grand *r,
   mp *p;
   pfilt f;
   pgen_jumpctx j;
-  rabin rb;
 
   if (d) mp_copy(d);
   p = strongprime_setup(name, d, &f, nbits, r, n, event, ectx);
   if (!p) { mp_drop(d); return (0); }
   j.j = &f;
   p = pgen(name, p, p, event, ectx, n, pgen_jump, &j,
-          rabin_iters(nbits), pgen_test, &rb);
+          PGEN_BAILLIEPSWNTESTS, pgen_bailliepswtest, 0);
   if (mp_bits(p) != nbits) { mp_drop(p); return (0); }
   pfilt_destroy(&f);
   mp_drop(d);