summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1996-03-29 12:05:57 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1996-03-29 12:05:57 +0000
commit72b333c9f34a2f5219597c851ce3a073d815a7c1 (patch)
tree7b6068286f976d6b4d1adb9711f343f2880b32f4 /sys/arch
parent4c1fa6049e9c868752f93f032b22d56ff9abbbf3 (diff)
Initial commit of random source driver.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/conf.c5
-rw-r--r--sys/arch/i386/isa/pccons.c10
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_drv.c7
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_kbd.c7
4 files changed, 28 insertions, 1 deletions
diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c
index f94045cb83b..179a571219d 100644
--- a/sys/arch/i386/i386/conf.c
+++ b/sys/arch/i386/i386/conf.c
@@ -197,6 +197,8 @@ cdev_decl(svr4_net);
cdev_decl(ccd);
#include "joy.h"
cdev_decl(joy);
+#include "rnd.h"
+cdev_decl(rnd);
cdev_decl(ipl);
#ifdef IPFILTER
@@ -257,7 +259,8 @@ struct cdevsw cdevsw[] =
#else
cdev_notdef(), /* 43 */
#endif
- cdev_gen_ipf(NIPF,ipl), /* 44 */
+ cdev_gen_ipf(NIPF,ipl), /* 44 ip filtering */
+ cdev_rnd_init(NRND,rnd), /* 45 random data source */
};
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
diff --git a/sys/arch/i386/isa/pccons.c b/sys/arch/i386/isa/pccons.c
index cc952ed2adf..aefc27ac224 100644
--- a/sys/arch/i386/isa/pccons.c
+++ b/sys/arch/i386/isa/pccons.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: pccons.c,v 1.6 1996/03/29 12:05:39 mickey Exp $ */
/* $NetBSD: pccons.c,v 1.91 1995/12/24 02:30:25 mycroft Exp $ */
/*-
@@ -69,6 +70,11 @@
#include <i386/isa/isa_machdep.h>
#include <i386/isa/kbdreg.h>
+#include "rnd.h"
+#if NRND
+#include <dev/rndvar.h>
+#endif
+
#define XFREE86_BUG_COMPAT
#ifndef BEEP_FREQ
@@ -1421,6 +1427,10 @@ top:
goto loop;
}
+#if NRND
+ add_keyboard_randomness(dt);
+#endif
+
if (pc_xmode > 0) {
#if defined(DDB) && defined(XSERVER_DDB)
/* F12 enters the debugger while in X mode */
diff --git a/sys/arch/i386/isa/pcvt/pcvt_drv.c b/sys/arch/i386/isa/pcvt/pcvt_drv.c
index 0f71a01d6fd..9644eb909d9 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_drv.c
+++ b/sys/arch/i386/isa/pcvt/pcvt_drv.c
@@ -90,6 +90,10 @@
#define EXTERN /* allocate mem */
#include "pcvt_hdr.h" /* global include */
+#include "rnd.h"
+#if NRND
+#include <dev/rndvar.h>
+#endif
#ifdef NOTDEF
unsigned __debug = 0; /*0xffe */;
@@ -874,6 +878,9 @@ pcrint(void)
dt = inb(CONTROLLER_DATA); /* get it 8042 data */
+#if NRND
+ add_keyboard_randomness(dt);
+#endif
if (pcvt_kbd_count >= PCVT_KBD_FIFO_SZ) /* fifo overflow ? */
{
log (LOG_WARNING, "pcvt: keyboard buffer overflow\n");
diff --git a/sys/arch/i386/isa/pcvt/pcvt_kbd.c b/sys/arch/i386/isa/pcvt/pcvt_kbd.c
index d13008c230b..61773c803ba 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_kbd.c
+++ b/sys/arch/i386/isa/pcvt/pcvt_kbd.c
@@ -75,6 +75,10 @@
#if NVT > 0
#include "pcvt_hdr.h" /* global include */
+#include "rnd.h"
+#if NRND
+#include <dev/rndvar.h>
+#endif
static void fkey1(void), fkey2(void), fkey3(void), fkey4(void);
static void fkey5(void), fkey6(void), fkey7(void), fkey8(void);
@@ -999,6 +1003,9 @@ loop:
PCVT_KBD_DELAY(); /* 7 us delay */
dt = inb(CONTROLLER_DATA); /* yes, get data */
+#if NRND
+ add_keyboard_randomness(dt)
+#endif
#endif /* !PCVT_KBD_FIFO */
/*