chiark / gitweb /
Expunge revision histories in files.
[tripe] / tripe.h
diff --git a/tripe.h b/tripe.h
index 385c45a24ca07a5c4790a607777e0dc4899e7482..5138d110a03c8f8ce0e5accbb41910153977b7cc 100644 (file)
--- a/tripe.h
+++ b/tripe.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: tripe.h,v 1.17 2003/10/15 09:30:18 mdw Exp $
+ * $Id: tripe.h,v 1.19 2004/04/08 01:36:17 mdw Exp $
  *
  * Main header file for TrIPE
  *
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------* 
- *
- * $Log: tripe.h,v $
- * Revision 1.17  2003/10/15 09:30:18  mdw
- * Add support for Ethereal protocol analysis.
- *
- * Revision 1.16  2003/07/13 11:19:49  mdw
- * Incompatible protocol fix!  Include message type code under MAC tag to
- * prevent cut-and-paste from key-exchange messages to general packet
- * transport.
- *
- * Revision 1.15  2003/05/16 12:09:03  mdw
- * Allow binding to a chosen address.
- *
- * Revision 1.14  2003/04/06 10:36:33  mdw
- * Rearrange so as not to include Linux headers unless we need to.
- *
- * Revision 1.13  2003/04/06 10:26:35  mdw
- * Report peer name on decrypt errors.
- *
- * Revision 1.12  2003/04/06 10:25:17  mdw
- * Support Linux TUN/TAP device.  Fix some bugs.
- *
- * Revision 1.11  2002/01/13 14:57:42  mdw
- * Fix crap typo.
- *
- * Revision 1.10  2002/01/13 14:54:58  mdw
- * Provide MGF macros.
- *
- * Revision 1.9  2001/06/22 19:40:36  mdw
- * Support expiry of other peers' public keys.
- *
- * Revision 1.8  2001/06/19 22:10:57  mdw
- * Some more constants for the algorithms.  Document the packet format
- * change for non-malleability.  Moved @buf@ definitions to separate header
- * file.
- *
- * Revision 1.7  2001/03/03 12:07:08  mdw
- * Rename word get and put functions now that there's 16-bit support.
- *
- * Revision 1.6  2001/02/19 19:11:09  mdw
- * Output buffering on admin connections.
- *
- * Revision 1.5  2001/02/16 21:41:43  mdw
- * Major changes.  See source files for details.
- *
- * Revision 1.4  2001/02/05 19:56:37  mdw
- * Sequence number protection, and BSD tunnels.
- *
- * Revision 1.3  2001/02/04 01:17:55  mdw
- * Create a configuration header file to tidy up command lines.
- *
- * Revision 1.2  2001/02/03 22:40:29  mdw
- * Put timer information into the entropy pool when packets are received
- * and on similar events.  Reseed the generator on the interval timer.
- *
- * Revision 1.1  2001/02/03 20:26:37  mdw
- * Initial checkin.
- *
- */
-
 #ifndef TRIPE_H
 #define TRIPE_H
 
 #include <catacomb/rand.h>
 
 #include <catacomb/mp.h>
-#include <catacomb/mpmont.h>
 #include <catacomb/mprand.h>
 #include <catacomb/dh.h>
+#include <catacomb/ec.h>
+#include <catacomb/ec-keys.h>
+#include <catacomb/group.h>
 
 #include "tripe-protocol.h"
 #include "util.h"
@@ -278,8 +219,8 @@ typedef struct keyset {
 
 typedef struct kxchal {
   struct keyexch *kx;                  /* Pointer back to key exchange */
-  mp *c;                               /* Responder's challenge */
-  mp *r;                               /* My reply to the challenge */
+  ge *c;                               /* Responder's challenge */
+  ge *r;                               /* My reply to the challenge */
   keyset *ks;                          /* Pointer to temporary keyset */
   unsigned f;                          /* Various useful flags */
   sel_timer t;                         /* Response timer for challenge */
@@ -297,11 +238,11 @@ typedef struct keyexch {
   unsigned f;                          /* Various useful flags */
   unsigned s;                          /* Current state in exchange */
   sel_timer t;                         /* Timer for next exchange */
-  dh_pub kpub;                         /* Peer's public key */
+  ge *kpub;                            /* Peer's public key */
   time_t texp_kpub;                    /* Expiry time for public key */
   mp *alpha;                           /* My temporary secret */
-  mp *c;                               /* My challenge */
-  mp *rx;                              /* The expected response */
+  ge *c;                               /* My challenge */
+  ge *rx;                              /* The expected response */
   unsigned nr;                         /* Number of extant responses */
   time_t t_valid;                      /* When this exchange goes bad */
   octet hc[HASHSZ];                    /* Hash of my challenge */
@@ -415,8 +356,8 @@ typedef struct admin {
 /*----- Global variables --------------------------------------------------*/
 
 extern sel_state sel;                  /* Global I/O event state */
-extern dh_priv kpriv;                  /* Our private key */
-extern mpmont mg;                      /* Montgomery context for DH group */
+extern group *gg;                      /* The group we work in */
+extern mp *kpriv;                      /* Our private key */
 extern octet buf_i[PKBUFSZ], buf_o[PKBUFSZ], buf_t[PKBUFSZ];
 
 #ifndef NTRACE
@@ -458,7 +399,7 @@ extern void km_init(const char */*kr_priv*/, const char */*kr_pub*/,
 /* --- @km_getpubkey@ --- *
  *
  * Arguments:  @const char *tag@ = public key tag to load
- *             @dh_pub *kpub@ = where to put the public key
+ *             @ge *kpub@ = where to put the public key
  *             @time_t *t_exp@ = where to put the expiry time
  *
  * Returns:    Zero if OK, nonzero if it failed.
@@ -466,7 +407,7 @@ extern void km_init(const char */*kr_priv*/, const char */*kr_pub*/,
  * Use:                Fetches a public key from the keyring.
  */
 
-extern int km_getpubkey(const char */*tag*/, dh_pub */*kpub*/,
+extern int km_getpubkey(const char */*tag*/, ge */*kpub*/,
                        time_t */*t_exp*/);
 
 /*----- Key exchange ------------------------------------------------------*/
@@ -988,6 +929,19 @@ extern void tun_destroy(tunnel */*t*/);
 
 extern const char *mpstr(mp */*m*/);
 
+/* --- @gestr@ --- *
+ *
+ * Arguments:  @group *g@ = a group
+ *             @ge *x@ = a group element
+ *
+ * Returns:    A pointer to the element's textual representation.
+ *
+ * Use:                Converts a group element to a string.  Corrupts
+ *             @buf_t@.
+ */
+
+extern const char *gestr(group */*g*/, ge */*x*/);
+
 /* --- @timestr@ --- *
  *
  * Arguments:  @time_t t@ = a time to convert