chiark / gitweb /
server/tests.at, t/keyring-*: New tests for key management.
[tripe] / server / tripe.h
index 217a88dfd00ab4c9760ca767640f9f351a68f135..b4eee1b37c780d58e9c69d7391beec7708a40253 100644 (file)
@@ -153,8 +153,6 @@ typedef struct algswitch {
   size_t cksz, mksz;                   /* Key lengths for @c@ and @m@ */
 } algswitch;
 
-extern algswitch algs;
-
 typedef struct kdata {
   unsigned ref;                                /* Reference counter */
   struct knode *kn;                    /* Pointer to cache entry */
@@ -277,12 +275,12 @@ typedef struct kxchal {
 
 typedef struct keyexch {
   struct peer *p;                      /* Pointer back to the peer */
+  kdata *kpriv;                                /* Private key and related info */
+  kdata *kpub;                         /* Peer's public key */
   keyset **ks;                         /* Peer's list of keysets */
   unsigned f;                          /* Various useful flags */
   unsigned s;                          /* Current state in exchange */
   sel_timer t;                         /* Timer for next exchange */
-  ge *kpub;                            /* Peer's public key */
-  time_t texp_kpub;                    /* Expiry time for public key */
   mp *alpha;                           /* My temporary secret */
   ge *c;                               /* My challenge */
   ge *rx;                              /* The expected response */
@@ -355,6 +353,7 @@ typedef struct stats {
 
 typedef struct peerspec {
   char *name;                          /* Peer's name */
+  char *privtag;                       /* Private key tag */
   char *tag;                           /* Public key tag */
   const tunnel_ops *tops;              /* Tunnel operations */
   unsigned long t_ka;                  /* Keep alive interval */
@@ -519,10 +518,6 @@ typedef struct admin {
 /*----- Global variables --------------------------------------------------*/
 
 extern sel_state sel;                  /* Global I/O event state */
-extern group *gg;                      /* The group we work in */
-extern size_t indexsz;                 /* Size of exponent for the group */
-extern mp *kpriv;                      /* Our private key */
-extern ge *kpub;                       /* Our public key */
 extern octet buf_i[PKBUFSZ], buf_o[PKBUFSZ], buf_t[PKBUFSZ], buf_u[PKBUFSZ];
 extern const tunnel_ops *tunnels[];    /* Table of tunnels (0-term) */
 extern const tunnel_ops *tun_default;  /* Default tunnel to use */
@@ -621,21 +616,6 @@ extern void km_unref(kdata */*kd*/);
 
 extern const char *km_tag(kdata */*kd*/);
 
-/* --- @km_getpubkey@ --- *
- *
- * Arguments:  @const char *tag@ = public key tag to load
- *             @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.
- *
- * Use:                Fetches a public key from the keyring.  (Temporary
- *             compatibility hack.)
- */
-
-extern int km_getpubkey(const char */*tag*/, ge */*kpub*/,
-                       time_t */*t_exp*/);
-
 /*----- Key exchange ------------------------------------------------------*/
 
 /* --- @kx_start@ --- *
@@ -1351,6 +1331,15 @@ extern const char *p_name(peer */*p*/);
 
 extern const char *p_tag(peer */*p*/);
 
+/* --- @p_privtag@ --- *
+ *
+ * Arguments:  @peer *p@ = pointer to a peer block
+ *
+ * Returns:    A pointer to the peer's private key tag.
+ */
+
+extern const char *p_privtag(peer */*p*/);
+
 /* --- @p_spec@ --- *
  *
  * Arguments:  @peer *p@ = pointer to a peer block