Share data structures with Diffie-Hellman stuff.
authormdw <mdw>
Sat, 29 Jul 2000 09:59:44 +0000 (09:59 +0000)
committermdw <mdw>
Sat, 29 Jul 2000 09:59:44 +0000 (09:59 +0000)
dsa.h

diff --git a/dsa.h b/dsa.h
index 2b4949d..dfd04db 100644 (file)
--- a/dsa.h
+++ b/dsa.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: dsa.h,v 1.6 2000/07/01 11:20:51 mdw Exp $
+ * $Id: dsa.h,v 1.7 2000/07/29 09:59:44 mdw Exp $
  *
  * Digital Signature Algorithm
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: dsa.h,v $
+ * Revision 1.7  2000/07/29 09:59:44  mdw
+ * Share data structures with Diffie-Hellman stuff.
+ *
  * Revision 1.6  2000/07/01 11:20:51  mdw
  * New functions for freeing public and private keys.
  *
 
 /*----- Header files ------------------------------------------------------*/
 
+#ifndef CATACOMB_DH_H
+#  include "dh.h"
+#endif
+
 #ifndef CATACOMB_KEY_H
 #  include "key.h"
 #endif
 
 /*----- Data structures ---------------------------------------------------*/
 
-/* --- DSA parameter structure --- *
- *
- * These parameters can, and probably should, be shared among a group of
- * users.
- */
-
-typedef struct dsa_param {
-  mp *p, *q;                           /* Prime numbers %$p$% and %$q$% */
-  mp *g;                               /* Generates order-%$q$% subgroup */
-} dsa_param;
-
-typedef struct dsa_pub {
-  dsa_param dp;                                /* Shared parameters */
-  mp *y;                               /* Public key */
-} dsa_pub;
+/* --- The parameters and keys are the same as for Diffie-Hellman --- */
 
-typedef struct dsa_priv {
-  dsa_param dp;                                /* Shared parameters */
-  mp *x;                               /* Private key */
-  mp *y;                               /* %$y \equiv g^x \pmod{p}$% */
-} dsa_priv;
+typedef dh_param dsa_param;
+typedef dh_pub dsa_pub;
+typedef dh_priv dsa_priv;
 
 /* --- DSA signature structure --- *
  *
@@ -120,28 +111,17 @@ typedef struct dsa_sig {
 
 /*----- Key fetching ------------------------------------------------------*/
 
-extern const key_fetchdef dsa_paramfetch[];
-#define DSA_PARAMFETCHSZ 5
+#define dsa_paramfetch dh_paramfetch
+#define dsa_pubfetch dh_pubfetch
+#define dsa_privfetch dh_privfetch
 
-extern const key_fetchdef dsa_pubfetch[];
-#define DSA_PUBFETCHSZ 6
-
-extern const key_fetchdef dsa_privfetch[];
-#define DSA_PRIVFETCHSZ 9
-
-/* --- @dsa_paramfree@, @dsa_pubfree@, @dsa_privfree@ --- *
- *
- * Arguments:  @dsa_param *dp@, @dsa_pub *dp@, @dsa_priv *dp@ = pointer
- *                     to key block to free
- *
- * Returns:    ---
- *
- * Use:                Frees a DSA key block.
- */
+#define DSA_PARAMFETCHSZ DH_PARAMFETCHSZ
+#define DSA_PUBFETCHSZ DH_PUBFETCHSZ
+#define DSA_PRIVFETCHSZ DH_PRIVFETCHSZ
 
-extern void dsa_paramfree(dsa_param */*dp*/);
-extern void dsa_pubfree(dsa_pub */*dp*/);
-extern void dsa_privfree(dsa_priv */*dp*/);
+#define dsa_paramfree dh_paramfree
+#define dsa_pubfree dh_pubfree
+#define dsa_privfree dh_privfree
 
 /*----- DSA stepper -------------------------------------------------------*/
 
@@ -166,7 +146,7 @@ extern int dsa_step(int /*rq*/, pgen_event */*ev*/, void */*p*/);
 
 /*----- Functions provided ------------------------------------------------*/
 
-/* --- @dsa_seed@ --- *
+/* --- @dsa_gen@ --- *
  *
  * Arguments:  @dsa_param *dp@ = where to store parameters
  *             @unsigned ql@ = length of @q@ in bits
@@ -189,9 +169,9 @@ extern int dsa_step(int /*rq*/, pgen_event */*ev*/, void */*p*/);
  *             %$l$%.  Neither limitation applies to this implementation.
  */
 
-extern int dsa_seed(dsa_param */*dp*/, unsigned /*ql*/, unsigned /*pl*/,
-                   unsigned /*steps*/, const void */*k*/, size_t /*sz*/,
-                   pgen_proc */*event*/, void */*ectx*/);
+extern int dsa_gen(dsa_param */*dp*/, unsigned /*ql*/, unsigned /*pl*/,
+                  unsigned /*steps*/, const void */*k*/, size_t /*sz*/,
+                  pgen_proc */*event*/, void */*ectx*/);
 
 /* --- @dsa_mksig@ --- *
  *