chiark / gitweb /
Put timer information into the entropy pool when packets are received
authormdw <mdw>
Sat, 3 Feb 2001 22:40:29 +0000 (22:40 +0000)
committermdw <mdw>
Sat, 3 Feb 2001 22:40:29 +0000 (22:40 +0000)
and on similar events.  Reseed the generator on the interval timer.

admin.c
peer.c
tripe.h

diff --git a/admin.c b/admin.c
index 508976f21802652a52191c44c8c1971def0bbd05..766b30528e9170fb254baba6a5183d64d53e8124 100644 (file)
--- a/admin.c
+++ b/admin.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: admin.c,v 1.1 2001/02/03 20:26:37 mdw Exp $
+ * $Id: admin.c,v 1.2 2001/02/03 22:40:29 mdw Exp $
  *
  * Admin interface for configuration
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: admin.c,v $
+ * 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.
  *
@@ -227,6 +231,7 @@ static void a_resolve(struct hostent *h, void *v)
 {
   admin *a = v;
   T( trace(T_ADMIN, "admin: %u resolved", a->seq); )
+  TIMER;
   sel_rmtimer(&a->t);
   if (!h)
     a_write(a, "ERR couldn't resolve hostname `%s'\n", a->paddr);
@@ -548,6 +553,7 @@ static void a_line(char *p, void *vp)
   char *av[4];
   size_t ac;
 
+  TIMER;
   if (!p) {
     a_destroy(a);
     return;
diff --git a/peer.c b/peer.c
index 83123d1c41e0ff12ad784c957bd1b1d6fa04145f..31aa1e28a14e1bc34aa85590656cd25823a38bf7 100644 (file)
--- a/peer.c
+++ b/peer.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: peer.c,v 1.1 2001/02/03 20:26:37 mdw Exp $
+ * $Id: peer.c,v 1.2 2001/02/03 22:40:29 mdw Exp $
  *
  * Communication with the peer
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: peer.c,v $
+ * 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.
  *
@@ -67,6 +71,7 @@ static void p_read(int fd, unsigned mode, void *v)
 
   /* --- Read the data --- */
 
+  TIMER;
   sz = sizeof(addr);
   n = recvfrom(fd, buf_i, sizeof(buf_i), 0, &a.sa, &sz);
   if (n < 0) {
@@ -77,11 +82,7 @@ static void p_read(int fd, unsigned mode, void *v)
   /* --- Find the appropriate peer --- */
 
   assert(a.sa.sa_family == AF_INET);
-  T( trace(T_PEER, "packet from %s:%u", 
-          inet_ntoa(a.sin.sin_addr), (unsigned)ntohs(a.sin.sin_port)); )
   for (p = peers; p; p = p->next) {
-    T( trace(T_PEER, "trying %s:%u", 
-            inet_ntoa(p->peer.sin.sin_addr), (unsigned)ntohs(p->peer.sin.sin_port)); )
     if (p->peer.sin.sin_addr.s_addr == a.sin.sin_addr.s_addr &&
        p->peer.sin.sin_port == a.sin.sin_port)
       goto found;
@@ -181,6 +182,7 @@ void p_txend(peer *p)
 void p_tun(peer *p, buf *b)
 {
   buf *bb = p_txstart(p, MSG_PACKET);
+  TIMER;
   if (ks_encrypt(&p->ks, b, bb))
     kx_start(&p->kx);
   if (BCUR(bb) > BBASE(bb))
diff --git a/tripe.h b/tripe.h
index 171f23abe0b4e39f229297b8c95e1d50d055e62c..40ad1c1ef7e7cd6c4283221adf9a2c0c9e8d6e21 100644 (file)
--- a/tripe.h
+++ b/tripe.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: tripe.h,v 1.1 2001/02/03 20:26:37 mdw Exp $
+ * $Id: tripe.h,v 1.2 2001/02/03 22:40:29 mdw Exp $
  *
  * Main header file for TrIPE
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: tripe.h,v $
+ * 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.
  *
@@ -303,6 +307,10 @@ extern const trace_opt tr_opts[];  /* Trace options array */
 extern unsigned tr_flags;              /* Trace options flags */
 #endif
 
+/*----- Other macros ------------------------------------------------------*/
+
+#define TIMER noise_timer(RAND_GLOBAL)
+
 /*----- Key management ----------------------------------------------------*/
 
 /* --- @km_interval@ --- *