server/{keyexch.c,keyset.c}: Move timing parameters to tripe.h.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 1 Feb 2012 20:59:31 +0000 (20:59 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 21 Mar 2012 16:11:48 +0000 (16:11 +0000)
Now everyone can use them.

server/keyexch.c
server/keyset.c
server/tripe.h

index 8eaf1e8..65dd037 100644 (file)
  *     Switch received.  Committed; send data; move to @KXS_SWITCH@.
  */
 
-/*----- Tunable parameters ------------------------------------------------*/
-
-#define T_VALID SEC(20)                        /* Challenge validity period */
-#define T_RETRY SEC(10)                        /* Challenge retransmit interval */
-
-#define VALIDP(kx, now) ((now) < (kx)->t_valid)
-
 /*----- Static tables -----------------------------------------------------*/
 
 static const char *const pkname[] = {
@@ -90,6 +83,17 @@ static const char *const pkname[] = {
 
 /*----- Various utilities -------------------------------------------------*/
 
+/* --- @VALIDP@ --- *
+ *
+ * Arguments:  @const keyexch *kx@ = key exchange state
+ *             @time_t now@ = current time in seconds
+ *
+ * Returns:    Whether the challenge in the key-exchange state is still
+ *             valid or should be regenerated.
+ */
+
+#define VALIDP(kx, now) ((now) < (kx)->t_valid)
+
 /* --- @hashge@ --- *
  *
  * Arguments:  @ghash *h@ = pointer to hash context
index 1f580ff..3053ca8 100644 (file)
 
 #include "tripe.h"
 
-/*----- Tunable parameters ------------------------------------------------*/
-
-#define T_EXP MIN(60)                  /* Expiry time for a key */
-#define T_REGEN MIN(45)                        /* Regeneration time for a key */
-
 /*----- Handy macros ------------------------------------------------------*/
 
 #define KEYOK(ks, now) ((ks)->sz_exp > 0 && (ks)->t_exp > now)
index 8a0be51..03704b2 100644 (file)
 #define MIN(n) (n##u * 60u)
 #define MEG(n) (n##ul * 1024ul * 1024ul)
 
+/* --- Timing parameters --- */
+
+#define T_EXP MIN(60)                  /* Expiry time for a key */
+#define T_REGEN MIN(40)                        /* Regeneration time for a key */
+
+#define T_VALID SEC(20)                        /* Challenge validity period */
+#define T_RETRY SEC(10)                        /* Challenge retransmit interval */
+
 /* --- Other things --- */
 
 #define PKBUFSZ 65536