Add utility for computing conversion factors for ONBs. Fix up elliptic curve
[u/mdw/catacomb] / ec-info.c
index 6b5e08e..bf9607c 100644 (file)
--- 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");