factorial: Fix usage message to fit in with conventions.
[u/mdw/catacomb] / dh-fetch.c
index 7a7e18c..5f5c74d 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: dh-fetch.c,v 1.1 2000/06/17 10:41:45 mdw Exp $
+ * $Id: dh-fetch.c,v 1.3 2004/04/08 01:36:15 mdw Exp $
  *
  * Key fetching for Diffie-Hellman public and private keys
  *
  * MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------* 
- *
- * $Log: dh-fetch.c,v $
- * Revision 1.1  2000/06/17 10:41:45  mdw
- * Table for driving key data extraction.
- *
- */
-
 /*----- Header files ------------------------------------------------------*/
 
 #include "dh.h"
@@ -71,4 +63,38 @@ const key_fetchdef dh_privfetch[] = {
   { 0,         0,                              0,              0 }  
 };
 
+/* --- @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.
+ */
+
+void dh_paramfree(dh_param *dp)
+{
+  mp_drop(dp->p);
+  mp_drop(dp->q);
+  mp_drop(dp->g);
+}
+
+void dh_pubfree(dh_pub *dp)
+{
+  mp_drop(dp->dp.p);
+  mp_drop(dp->dp.q);
+  mp_drop(dp->dp.g);
+  mp_drop(dp->y);
+}
+
+void dh_privfree(dh_priv *dp)
+{
+  mp_drop(dp->dp.p);
+  mp_drop(dp->dp.q);
+  mp_drop(dp->dp.g);
+  mp_drop(dp->y);
+  mp_drop(dp->x);
+}
+
 /*----- That's all, folks -------------------------------------------------*/