From 8d0c7a83c244c03e5fbc675018ca29fe5ddb9966 Mon Sep 17 00:00:00 2001 Message-Id: <8d0c7a83c244c03e5fbc675018ca29fe5ddb9966.1714986534.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sat, 3 Feb 2001 22:40:29 +0000 Subject: [PATCH] Put timer information into the entropy pool when packets are received and on similar events. Reseed the generator on the interval timer. Organization: Straylight/Edgeware From: mdw --- admin.c | 8 +++++++- peer.c | 12 +++++++----- tripe.h | 10 +++++++++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/admin.c b/admin.c index 508976f2..766b3052 100644 --- 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 * @@ -29,6 +29,10 @@ /*----- 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 83123d1c..31aa1e28 100644 --- 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 * @@ -29,6 +29,10 @@ /*----- 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 171f23ab..40ad1c1e 100644 --- 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 * @@ -29,6 +29,10 @@ /*----- 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@ --- * -- [mdw]