Add randomness sampling from hil, sd and rd devices.

This commit is contained in:
he 2000-10-10 19:58:42 +00:00
parent 48052d04a3
commit 489b832f9b
6 changed files with 68 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hil.c,v 1.40 2000/06/26 04:55:39 simonb Exp $ */
/* $NetBSD: hil.c,v 1.41 2000/10/10 19:58:42 he Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,6 +43,7 @@
*/
#include "opt_compat_hpux.h"
#include "rnd.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -57,6 +58,10 @@
#include <sys/uio.h>
#include <sys/user.h>
#if NRND > 0
#include <sys/rnd.h>
#endif
#include <hp300/dev/hilreg.h>
#include <hp300/dev/hilioctl.h>
#include <hp300/dev/hilvar.h>
@ -825,6 +830,9 @@ hilint(unit)
stat = READHILSTAT(hildevice);
c = READHILDATA(hildevice); /* clears interrupt */
hil_process_int(hilp, stat, c);
#if NRND > 0
rnd_add_uint32(&hilp->rnd_source, (stat<<8)|c);
#endif
}
#include "ite.h"
@ -1338,6 +1346,17 @@ hilinfo(unit)
printf(" 0");
printf("\n");
}
#if NRND > 0
/*
* attach the device into the random source list
* except from ID module (no point)
*/
if (!id) {
char buf[10];
sprintf(buf, "hil%d", unit);
rnd_attach_source(&hilp->rnd_source, buf, RND_TYPE_TTY, 0);
}
#endif
}
#define HILAR1 0x3E

View File

@ -1,4 +1,4 @@
/* $NetBSD: hilvar.h,v 1.15 1998/06/25 23:57:35 thorpej Exp $ */
/* $NetBSD: hilvar.h,v 1.16 2000/10/10 19:58:43 he Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -111,6 +111,9 @@ struct hil_softc {
u_char hl_kbddev; /* keyboard device on loop */
u_char hl_kbdlang; /* keyboard language */
u_char hl_kbdflags; /* keyboard state */
#if NRND > 0
rndsource_element_t rnd_source;
#endif
};
/* hl_kbdflags */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rd.c,v 1.43 2000/05/27 04:52:28 thorpej Exp $ */
/* $NetBSD: rd.c,v 1.44 2000/10/10 19:58:43 he Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -82,6 +82,9 @@
* CS80/SS80 disk driver
*/
#include "opt_useleds.h"
#include "rnd.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
@ -94,13 +97,15 @@
#include <sys/proc.h>
#include <sys/stat.h>
#if NRND > 0
#include <sys/rnd.h>
#endif
#include <hp300/dev/hpibvar.h>
#include <hp300/dev/rdreg.h>
#include <hp300/dev/rdvar.h>
#include "opt_useleds.h"
#ifdef USELEDS
#include <hp300/hp300/leds.h>
#endif
@ -350,6 +355,13 @@ rdattach(parent, self, aux)
if (rddebug & RDB_ERROR)
rderrthresh = 0;
#endif
#if NRND > 0
/*
* attach the device into the random source list
*/
rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
RND_TYPE_DISK, 0);
#endif
}
int
@ -934,6 +946,9 @@ rdintr(arg)
}
if (rdfinish(rs, bp))
rdustart(rs);
#if NRND > 0
rnd_add_uint32(&rs->rnd_source, bp->b_blkno);
#endif
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: rdvar.h,v 1.9 2000/03/23 06:37:24 thorpej Exp $ */
/* $NetBSD: rdvar.h,v 1.10 2000/10/10 19:58:43 he Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -84,6 +84,9 @@ struct rd_softc {
int sc_active;
int sc_errcnt;
struct rdstats sc_stats;
#if NRND > 0
rndsource_element_t rnd_source;
#endif
};
/* sc_flags values */

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd.c,v 1.43 2000/07/17 06:51:18 scottr Exp $ */
/* $NetBSD: sd.c,v 1.44 2000/10/10 19:58:43 he Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -78,6 +78,9 @@
* SCSI CCS (Command Command Set) disk driver.
*/
#include "rnd.h"
#include "opt_useleds.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
@ -90,12 +93,14 @@
#include <sys/proc.h>
#include <sys/stat.h>
#if NRND > 0
#include <sys/rnd.h>
#endif
#include <hp300/dev/scsireg.h>
#include <hp300/dev/scsivar.h>
#include <hp300/dev/sdvar.h>
#include "opt_useleds.h"
#ifdef USELEDS
#include <hp300/hp300/leds.h>
#endif
@ -296,6 +301,13 @@ sdattach(parent, self, aux)
disk_attach(&sc->sc_dkdev);
sc->sc_flags |= SDF_ALIVE;
#if NRND > 0
/*
* attach the device into the random source list
*/
rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
RND_TYPE_DISK, 0);
#endif
}
void
@ -1008,6 +1020,9 @@ sdintr(arg, stat)
}
}
sdfinish(sc, bp);
#if NRND > 0
rnd_add_uint32(&sc->rnd_source, bp->b_blkno);
#endif
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: sdvar.h,v 1.8 2000/01/21 23:29:04 thorpej Exp $ */
/* $NetBSD: sdvar.h,v 1.9 2000/10/10 19:58:43 he Exp $ */
/*
* Copyright (c) 1990, 1993
@ -64,6 +64,9 @@ struct sd_softc {
struct sdstats sc_stats; /* debugging stats */
struct scsi_fmt_cdb sc_cmdstore;
struct scsi_fmt_sense sc_sensestore;
#if NRND > 0
rndsource_element_t rnd_source;
#endif
};
/* sc_flags values */