prime generation: Deploy the new Baillie--PSW testers.
[catacomb] / pub / dsa-gen.c
index 7c6c3ba..5505bea 100644 (file)
@@ -137,7 +137,6 @@ int dsa_gen(dsa_param *dp, unsigned ql, unsigned pl, unsigned steps,
   dsa_stepctx s;
   prim_ctx p;
   int i;
-  rabin r;
   mp *qc;
 
   /* --- Initialize the stepping context --- */
@@ -158,7 +157,7 @@ int dsa_gen(dsa_param *dp, unsigned ql, unsigned pl, unsigned steps,
     ds->p = s.seedbuf = xmalloc(sz);
   }
   if ((dp->q = pgen("q", MP_NEW, MP_NEW, event, ectx, steps, dsa_step, &s,
-                   rabin_iters(ql), pgen_test, &r)) == 0)
+                   PGEN_BAILLIEPSWNTESTS, pgen_bailliepswtest, 0)) == 0)
     goto fail_q;
 
   /* --- Find @p@ --- */
@@ -169,7 +168,7 @@ int dsa_gen(dsa_param *dp, unsigned ql, unsigned pl, unsigned steps,
   s.bits = pl;
   s.seedbuf = 0;
   if ((dp->p = pgen("p", MP_NEW, MP_NEW, event, ectx, 4096, dsa_step, &s,
-                   rabin_iters(pl), pgen_test, &r)) == 0)
+                   PGEN_BAILLIEPSWNTESTS, pgen_bailliepswtest, 0)) == 0)
     goto fail_p;
   mp_drop(s.q);
   if (ds)
@@ -215,6 +214,8 @@ fail_q:
 
 #ifdef TEST_RIG
 
+#include <mLib/macros.h>
+
 static int verify(dstr *v)
 {
   mp *q = *(mp **)v[4].buf;
@@ -231,7 +232,7 @@ static int verify(dstr *v)
 
   rc = dsa_gen(&dp, 160, l, 16, v[0].buf, v[0].len, &ds, pgen_evspin, 0);
   if (rc || ds.count != n || ds.sz != v[2].len ||
-      memcmp(ds.p, v[2].buf, v[2].len) != 0 ||
+      MEMCMP(ds.p, !=, v[2].buf, v[2].len) ||
       !MP_EQ(q, dp.q) || !MP_EQ(p, dp.p) || !MP_EQ(g, dp.g)) {
     fputs("\n*** gen failed", stderr);
     fputs("\nseed_in = ", stderr); type_hex.dump(&v[0], stderr);