Add an internal-representation no-op function.
[u/mdw/catacomb] / dh.h
diff --git a/dh.h b/dh.h
index c2f2311..90fdaa3 100644 (file)
--- a/dh.h
+++ b/dh.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: dh.h,v 1.6 2000/07/29 10:01:16 mdw Exp $
+ * $Id: dh.h,v 1.7 2001/02/03 16:08:24 mdw Exp $
  *
  * Diffie-Hellman and related public-key systems
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: dh.h,v $
+ * Revision 1.7  2001/02/03 16:08:24  mdw
+ * Add consistency checking for public keys.
+ *
  * Revision 1.6  2000/07/29 10:01:16  mdw
  * Supply commentry for the Diffie-Hellman parameters.  Add Lim-Lee
  * parameter generation.
 #  include "key.h"
 #endif
 
+#ifndef CATACOMB_KEYCHECK_H
+#  include "keycheck.h"
+#endif
+
 #ifndef CATACOMB_PGEN_H
 #  include "pgen.h"
 #endif
 
 /*----- Data structures ---------------------------------------------------*/
 
-typedef struct dh_param {              /* Prime numbers %$p$% and %$q$% */
-  mp *p, *q;                           /* Generates order-%$q$% subgroup */
-  mp *g;
+typedef struct dh_param {
+  mp *p, *q;                           /* Prime numbers %$p$% and %$q$% */
+  mp *g;                               /* Generates order-%$q$% subgroup */
 } dh_param;
 
-typedef struct dh_pub {                        /* Shared parameters */
-  dh_param dp;                         /* Public key */
-  mp *y;
+typedef struct dh_pub {
+  dh_param dp;                         /* Shared parameters */         
+  mp *y;                               /* Public key */
 } dh_pub;
 
-typedef struct dh_priv {               /* Shared parameters */
-  dh_param dp;                         /* Private key */
-  mp *x;                               /* %$y \equiv g^x \pmod{p}$% */
-  mp *y;
+typedef struct dh_priv {
+  dh_param dp;                         /* Shared parameters */
+  mp *x;                               /* Private key */
+  mp *y;                               /* %$y \equiv g^x \pmod{p}$% */
 } dh_priv;
 
 /*----- Key fetching ------------------------------------------------------*/
@@ -175,6 +182,22 @@ extern int dh_limlee(dh_param */*dp*/, unsigned /*ql*/, unsigned /*pl*/,
                     pgen_proc */*oev*/, void */*oec*/, pgen_proc */*iev*/,
                     void */*iec*/, size_t */*nf*/, mp ***/*f*/);
 
+/* --- @dh_checkparam@ --- *
+ *
+ * Arguments:  @keycheck *kc@ = keycheck state
+ *             @const dh_param *dp@ = pointer to the parameter set
+ *             @mp **v@ = optional vector of factors
+ *             @size_t n@ = size of vector
+ *
+ * Returns:    Zero if all OK, or return status from function.
+ *
+ * Use:                Checks a set of Diffie-Hellman parameters for consistency and
+ *             security.
+ */
+
+extern int dh_checkparam(keycheck */*kc*/, const dh_param */*dp*/,
+                        mp **/*v*/, size_t /*n*/);
+
 /*----- That's all, folks -------------------------------------------------*/
 
 #ifdef __cplusplus