X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/a69a3efddbe1261f55e90d4ff477053ab80663a5..3688eb757240b2332f67ec827be8caf6f6abe924:/ec-info.c diff --git a/ec-info.c b/ec-info.c index ea584de..bf9607c 100644 --- a/ec-info.c +++ b/ec-info.c @@ -34,6 +34,7 @@ #include "gf.h" #include "pgen.h" #include "mprand.h" +#include "mpint.h" #include "rabin.h" /*----- Main code ---------------------------------------------------------*/ @@ -435,6 +436,13 @@ static const char *bincheck(const ec_info *ei, grand *gr) ec p; int rc; + /* --- Check that %$m$% is prime --- */ + + x = mp_fromuint(MP_NEW, f->nbits); + rc = pfilt_smallfactor(x); + mp_drop(x); + if (rc != PGEN_DONE) return ("degree not prime"); + /* --- Check that %$p$% is irreducible --- */ if (!gf_irreduciblep(f->m)) return ("p not irreducible"); @@ -551,20 +559,23 @@ int main(int argc, char *argv[]) } } } else { - fputs("checking standard curves: ", stdout); + fputs("checking standard curves...\n", stdout); for (ee = ectab; ee->name; ee++) { ec_info ei; + printf(" %s: ", ee->name); + fflush(stdout); getinfo(&ei, ee->data); e = ec_checkinfo(&ei, gr); ec_freeinfo(&ei); if (e) { - fprintf(stderr, "\n*** curve %s fails: %s\n", ee->name, e); + printf("fails: %s\n", e); ok = 0; - } - putchar('.'); + } else + fputs("ok\n", stdout); fflush(stdout); } - fputs(ok ? " ok\n" : " failed\n", stdout); + if (ok) + fputs("all ok\n", stdout); } gr->ops->destroy(gr); return (!ok);