Store the correct seed information and count for DSA keys now that it's
authormdw <mdw>
Sat, 3 Feb 2001 11:58:22 +0000 (11:58 +0000)
committermdw <mdw>
Sat, 3 Feb 2001 11:58:22 +0000 (11:58 +0000)
available.

keyutil.c

index fac8813..25be851 100644 (file)
--- a/keyutil.c
+++ b/keyutil.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: keyutil.c,v 1.11 2000/12/06 20:33:27 mdw Exp $
+ * $Id: keyutil.c,v 1.12 2001/02/03 11:58:22 mdw Exp $
  *
  * Simple key manager program
  *
  *
  * Simple key manager program
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: keyutil.c,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: keyutil.c,v $
+ * Revision 1.12  2001/02/03 11:58:22  mdw
+ * Store the correct seed information and count for DSA keys now that it's
+ * available.
+ *
  * Revision 1.11  2000/12/06 20:33:27  mdw
  * Make flags be macros rather than enumerations, to ensure that they're
  * unsigned.
  * Revision 1.11  2000/12/06 20:33:27  mdw
  * Make flags be macros rather than enumerations, to ensure that they're
  * unsigned.
@@ -467,6 +471,7 @@ static void alg_dsaparam(keyopts *k)
     dstr d = DSTR_INIT;
     base64_ctx c;
     key_data *kd = &k->k->k;
     dstr d = DSTR_INIT;
     base64_ctx c;
     key_data *kd = &k->k->k;
+    dsa_seed ds;
 
     /* --- Choose appropriate bit lengths if necessary --- */
 
 
     /* --- Choose appropriate bit lengths if necessary --- */
 
@@ -483,7 +488,7 @@ static void alg_dsaparam(keyopts *k)
 
     /* --- Allocate the parameters --- */
 
 
     /* --- Allocate the parameters --- */
 
-    if (dsa_gen(&dp, k->qbits, k->bits, 0, p, sz,
+    if (dsa_gen(&dp, k->qbits, k->bits, 0, p, sz, &ds,
                (k->f & f_quiet) ? 0 : pgen_ev, 0))
       die(EXIT_FAILURE, "DSA parameter generation failed");
 
                (k->f & f_quiet) ? 0 : pgen_ev, 0))
       die(EXIT_FAILURE, "DSA parameter generation failed");
 
@@ -502,9 +507,13 @@ static void alg_dsaparam(keyopts *k)
     base64_init(&c);
     c.maxline = 0;
     c.indent = "";
     base64_init(&c);
     c.maxline = 0;
     c.indent = "";
-    base64_encode(&c, p, sz, &d);
+    base64_encode(&c, ds.p, ds.sz, &d);
     base64_encode(&c, 0, 0, &d);
     key_putattr(k->kf, k->k, "seed", d.buf);
     base64_encode(&c, 0, 0, &d);
     key_putattr(k->kf, k->k, "seed", d.buf);
+    DRESET(&d);
+    dstr_putf(&d, "%u", ds.count);
+    key_putattr(k->kf, k->k, "count", d.buf);
+    xfree(ds.p);
     sub_free(p, sz);
     dstr_destroy(&d);
   }
     sub_free(p, sz);
     dstr_destroy(&d);
   }