Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm26/ioc Act as an entropy source for rnd(4).



details:   https://anonhg.NetBSD.org/src/rev/1d0663fb7fec
branches:  trunk
changeset: 512014:1d0663fb7fec
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Mon Jul 02 23:49:17 2001 +0000

description:
Act as an entropy source for rnd(4).

diffstat:

 sys/arch/arm26/ioc/arckbd.c |  22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diffs (71 lines):

diff -r bd7f0f469ca1 -r 1d0663fb7fec sys/arch/arm26/ioc/arckbd.c
--- a/sys/arch/arm26/ioc/arckbd.c       Mon Jul 02 23:18:34 2001 +0000
+++ b/sys/arch/arm26/ioc/arckbd.c       Mon Jul 02 23:49:17 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arckbd.c,v 1.13 2001/06/12 15:17:17 wiz Exp $ */
+/* $NetBSD: arckbd.c,v 1.14 2001/07/02 23:49:17 bjh21 Exp $ */
 /*-
  * Copyright (c) 1998, 1999, 2000 Ben Harris
  * All rights reserved.
@@ -43,7 +43,7 @@
 
 #include <sys/param.h>
 
-__RCSID("$NetBSD: arckbd.c,v 1.13 2001/06/12 15:17:17 wiz Exp $");
+__RCSID("$NetBSD: arckbd.c,v 1.14 2001/07/02 23:49:17 bjh21 Exp $");
 
 #include <sys/device.h>
 #include <sys/errno.h>
@@ -70,6 +70,11 @@
 
 #include "locators.h"
 
+#include "rnd.h"
+#if NRND > 0
+#include <sys/rnd.h>
+#endif
+
 /* #define ARCKBD_DEBUG */
 
 enum arckbd_state {
@@ -138,6 +143,9 @@
        struct evcnt            sc_xev;
        struct irq_handler      *sc_rirq;
        struct evcnt            sc_rev;
+#if NRND > 0
+       rndsource_element_t     sc_rnd_source;
+#endif
 };
 
 #define AKF_WANTKBD    0x01
@@ -244,6 +252,10 @@
 
        printf("\n");
 
+#if NRND > 0
+       rnd_attach_source(&sc->sc_rnd_source, self->dv_xname, RND_TYPE_TTY, 0);
+#endif
+
        /* Attach the dummy drivers */
        aka.aka_wskbdargs.console = 1; /* XXX FIXME */
        aka.aka_wskbdargs.keymap = &sc->sc_mapdata;
@@ -528,6 +540,9 @@
        struct arckbd_softc *sc = (void *)self;
        int dx, dy;
 
+#if NRND > 0
+       rnd_add_uint32(&sc->sc_rnd_source, byte1);
+#endif
        if (sc->sc_wsmousedev != NULL) {
                /* deltas are 7-bit signed */
                dx = byte1 < 0x40 ? byte1 : byte1 - 0x80;
@@ -545,6 +560,9 @@
        u_int type;
        int value;
 
+#if NRND > 0
+       rnd_add_uint32(&sc->sc_rnd_source, byte1);
+#endif
        if ((byte1 & 0x0f) == 7) {
                /* Mouse button event */
                /*



Home | Main Index | Thread Index | Old Index