Pollard's rho algorithm for computing discrete logs.
[u/mdw/catacomb] / dh.h
diff --git a/dh.h b/dh.h
index 465f59f..2ae710c 100644 (file)
--- a/dh.h
+++ b/dh.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: dh.h,v 1.3 2000/02/12 18:21:02 mdw Exp $
+ * $Id: dh.h,v 1.5 2000/07/01 11:20:51 mdw Exp $
  *
  * Diffie-Hellman and related public-key systems
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: dh.h,v $
+ * Revision 1.5  2000/07/01 11:20:51  mdw
+ * New functions for freeing public and private keys.
+ *
+ * Revision 1.4  2000/06/17 10:52:47  mdw
+ * Minor changes for key fetching.
+ *
  * Revision 1.3  2000/02/12 18:21:02  mdw
  * Overhaul of key management (again).
  *
 #  include "grand.h"
 #endif
 
+#ifndef CATACOMB_KEY_H
+#  include "key.h"
+#endif
+
 #ifndef CATACOMB_PGEN_H
 #  include "pgen.h"
 #endif
@@ -59,6 +69,42 @@ typedef struct dh_param {
   mp *g;
 } dh_param;
 
+typedef struct dh_pub {
+  dh_param dp;
+  mp *y;
+} dh_pub;
+
+typedef struct dh_priv {
+  dh_param dp;
+  mp *x;
+  mp *y;
+} dh_priv;
+
+/*----- Key fetching ------------------------------------------------------*/
+
+extern const key_fetchdef dh_paramfetch[];
+#define DH_PARAMFETCHSZ 5
+
+extern const key_fetchdef dh_pubfetch[];
+#define DH_PUBFETCHSZ 6
+
+extern const key_fetchdef dh_privfetch[];
+#define DH_PRIVFETCHSZ 9
+
+/* --- @dh_paramfree@, @dh_pubfree@, @dh_privfree@ --- *
+ *
+ * Arguments:  @dh_param *dp@, @dh_pub *dp@, @dh_priv *dp@ = pointer to
+ *                     key block to free
+ *
+ * Returns:    ---
+ *
+ * Use:                Frees a Diffie-Hellman key block.
+ */
+
+extern void dh_paramfree(dh_param */*dp*/);
+extern void dh_pubfree(dh_pub */*dp*/);
+extern void dh_privfree(dh_priv */*dp*/);
+
 /*----- Functions provided ------------------------------------------------*/
 
 /* --- @dh_gen@ --- *