Catcrypt tools: Roll out progress indicator stuff from hashsum.
[u/mdw/catacomb] / dsa-gen.c
index cd475bc..adb8d9a 100644 (file)
--- a/dsa-gen.c
+++ b/dsa-gen.c
@@ -1,13 +1,13 @@
 /* -*-c-*-
  *
- * $Id: dsa-gen.c,v 1.9 2001/02/03 16:09:29 mdw Exp $
+ * $Id: dsa-gen.c,v 1.10 2004/04/08 01:36:15 mdw Exp $
  *
  * Generate DSA shared parameters
  *
  * (c) 1999 Straylight/Edgeware
  */
 
-/*----- Licensing notice --------------------------------------------------* 
+/*----- Licensing notice --------------------------------------------------*
  *
  * This file is part of Catacomb.
  *
  * it under the terms of the GNU Library General Public License as
  * published by the Free Software Foundation; either version 2 of the
  * License, or (at your option) any later version.
- * 
+ *
  * Catacomb is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Library General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Library General Public
  * License along with Catacomb; if not, write to the Free
  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  * MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------* 
- *
- * $Log: dsa-gen.c,v $
- * Revision 1.9  2001/02/03 16:09:29  mdw
- * Allow the caller to fetch the parameter generation seed and counter.
- *
- * Revision 1.8  2000/10/08 12:12:47  mdw
- * Use @MP_EQ@ instead of @MP_CMP@.  Remove vestages of @primorial@.
- *
- * Revision 1.7  2000/08/15 21:45:05  mdw
- * Use the new trial division equipment in pfilt.  This gives a 10%
- * performance improvement in dsa-gen.t.
- *
- * Revision 1.6  2000/07/29 10:00:14  mdw
- * Rename `dsa_seed' to `dsa_gen' for consistency with other parameter-
- * generation interfaces.
- *
- * Revision 1.5  2000/02/12 18:21:02  mdw
- * Overhaul of key management (again).
- *
- * Revision 1.4  1999/12/22 15:52:44  mdw
- * Reworking for new prime-search system.
- *
- * Revision 1.3  1999/12/10 23:18:38  mdw
- * Change interface for suggested destinations.
- *
- * Revision 1.2  1999/11/20 22:23:48  mdw
- * Allow event handler to abort the search process.
- *
- * Revision 1.1  1999/11/19 19:28:00  mdw
- * Implementation of the Digital Signature Algorithm.
- *
- */
-
 /*----- Header files ------------------------------------------------------*/
 
 #include <stdio.h>
@@ -273,15 +239,15 @@ static int verify(dstr *v)
     fputs("\nseed_in = ", stderr); type_hex.dump(&v[0], stderr);
     fprintf(stderr, "\nl = %lu", l);
     fputs("\nseed_out = ", stderr); type_hex.dump(&v[2], stderr);
-    fprintf(stderr, "\ncount = %lu", n);    
-    fputs("\n   q = ", stderr); mp_writefile(q, stderr, 16);
-    fputs("\n   p = ", stderr); mp_writefile(p, stderr, 16);
-    fputs("\n   g = ", stderr); mp_writefile(g, stderr, 16);
+    fprintf(stderr, "\ncount = %lu", n);
+    fputs("\n  q = ", stderr); mp_writefile(q, stderr, 16);
+    fputs("\n  p = ", stderr); mp_writefile(p, stderr, 16);
+    fputs("\n  g = ", stderr); mp_writefile(g, stderr, 16);
     if (!rc) {
       dstr d;
       d.buf = ds.p; d.len = ds.sz;
       fputs("\nds.seed = ", stderr); type_hex.dump(&d, stderr);
-      fprintf(stderr, "\nds.count = %u", ds.count);    
+      fprintf(stderr, "\nds.count = %u", ds.count);
       fputs("\ndp.q = ", stderr); mp_writefile(dp.q, stderr, 16);
       fputs("\ndp.p = ", stderr); mp_writefile(dp.p, stderr, 16);
       fputs("\ndp.g = ", stderr); mp_writefile(dp.g, stderr, 16);
@@ -300,10 +266,10 @@ static int verify(dstr *v)
     fputs("\nseed_in = ", stderr); type_hex.dump(&v[0], stderr);
     fprintf(stderr, "\nl = %lu", l);
     fputs("\nseed_out = ", stderr); type_hex.dump(&v[2], stderr);
-    fprintf(stderr, "\ncount = %lu", n);    
-    fputs("\n   q = ", stderr); mp_writefile(q, stderr, 16);
-    fputs("\n   p = ", stderr); mp_writefile(p, stderr, 16);
-    fputs("\n   g = ", stderr); mp_writefile(g, stderr, 16);
+    fprintf(stderr, "\ncount = %lu", n);
+    fputs("\n  q = ", stderr); mp_writefile(q, stderr, 16);
+    fputs("\n  p = ", stderr); mp_writefile(p, stderr, 16);
+    fputs("\n  g = ", stderr); mp_writefile(g, stderr, 16);
     fputc('\n', stderr);
     ok = 0;
   }
@@ -319,7 +285,7 @@ static int verify(dstr *v)
 static test_chunk tests[] = {
   { "gen", verify,
     { &type_hex, &type_ulong, &type_hex, &type_ulong,
-      &type_mp, &type_mp, &type_mp, 0 }  },
+      &type_mp, &type_mp, &type_mp, 0 }         },
   { 0, 0, { 0 } }
 };