Add rnd entropy gathering.

This commit is contained in:
mjl 2001-07-26 21:31:45 +00:00
parent bd21ec5d2e
commit ab94842af6
1 changed files with 17 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_gm.c,v 1.14 2001/07/22 11:29:46 wiz Exp $ */
/* $NetBSD: if_gm.c,v 1.15 2001/07/26 21:31:45 mjl Exp $ */
/*-
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
@ -28,6 +28,7 @@
#include "opt_inet.h"
#include "opt_ns.h"
#include "rnd.h"
#include "bpfilter.h"
#include <sys/param.h>
@ -39,6 +40,10 @@
#include <sys/systm.h>
#include <sys/callout.h>
#if NRND > 0
#include <sys/rnd.h>
#endif
#include <uvm/uvm_extern.h>
#include <net/if.h>
@ -81,6 +86,10 @@ struct gmac_softc {
struct mii_data sc_mii;
struct callout sc_tick_ch;
char sc_laddr[6];
#if NRND > 0
rndsource_element_t sc_rnd_source; /* random source */
#endif
};
#define sc_if sc_ethercom.ec_if
@ -246,6 +255,10 @@ gmac_attach(parent, self, aux)
if_attach(ifp);
ether_ifattach(ifp, laddr);
#if NRND > 0
rnd_attach_source(&sc->sc_rnd_source, sc->sc_dev.dv_xname,
RND_TYPE_NET, 0);
#endif
}
u_int
@ -338,6 +351,9 @@ gmac_intr(v)
if (status & GMAC_INT_TXEMPTY)
gmac_tint(sc);
#if NRND > 0
rnd_add_uint32(&sc->sc_rnd_source, status);
#endif
return 1;
}