From 9bdc5ba3c26a775a05bf99ceb22c3452700afd99 Mon Sep 17 00:00:00 2001 From: Michael Shalayeff Date: Mon, 25 Dec 2000 19:44:44 +0000 Subject: always read new byte from rng, then decide wheather to start a new cycle --- sys/arch/i386/pci/pchb.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'sys/arch/i386/pci/pchb.c') diff --git a/sys/arch/i386/pci/pchb.c b/sys/arch/i386/pci/pchb.c index bcab5f7bb48..b0ac4cfddfe 100644 --- a/sys/arch/i386/pci/pchb.c +++ b/sys/arch/i386/pci/pchb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pchb.c,v 1.24 2000/11/08 13:12:40 art Exp $ */ +/* $OpenBSD: pchb.c,v 1.25 2000/12/25 19:44:43 mickey Exp $ */ /* $NetBSD: pchb.c,v 1.6 1997/06/06 23:29:16 thorpej Exp $ */ /* @@ -370,23 +370,22 @@ pchb_rnd(v) void *v; { struct pchb_softc *sc = v; - int ret; /* * Don't wait for data to be ready. If it's not there, we'll check * next time. */ - if (!(bus_space_read_1(sc->bt, sc->bh, I82802_RNG_RNGST) & - I82802_RNG_RNGST_DATAV)) - goto out; - ret = bus_space_read_1(sc->bt, sc->bh, I82802_RNG_DATA); - - if (sc->i--) { - sc->ax = (sc->ax << 8) | ret; - } else { - sc->i = 4; - add_true_randomness(sc->ax); + if ((bus_space_read_1(sc->bt, sc->bh, I82802_RNG_RNGST) & + I82802_RNG_RNGST_DATAV)) { + + sc->ax = (sc->ax << 8) | + bus_space_read_1(sc->bt, sc->bh, I82802_RNG_DATA); + + if (!sc->i--) { + sc->i = 4; + add_true_randomness(sc->ax); + } } -out: + timeout_add(&sc->sc_tmo, 1); } -- cgit v1.2.3