Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/hil Add rnd(9) entropy source from hil(4) devices.



details:   https://anonhg.NetBSD.org/src/rev/b190d7b6874b
branches:  trunk
changeset: 368125:b190d7b6874b
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jun 25 02:36:27 2022 +0000

description:
Add rnd(9) entropy source from hil(4) devices.

diffstat:

 sys/dev/hil/hil.c    |  7 ++++++-
 sys/dev/hil/hilvar.h |  5 ++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diffs (54 lines):

diff -r 59eed02346f9 -r b190d7b6874b sys/dev/hil/hil.c
--- a/sys/dev/hil/hil.c Sat Jun 25 02:22:42 2022 +0000
+++ b/sys/dev/hil/hil.c Sat Jun 25 02:36:27 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hil.c,v 1.6 2021/12/10 20:36:03 andvar Exp $   */
+/*     $NetBSD: hil.c,v 1.7 2022/06/25 02:36:27 tsutsui Exp $  */
 /*     $OpenBSD: hil.c,v 1.24 2010/11/20 16:45:46 miod Exp $   */
 /*
  * Copyright (c) 2003, 2004, Miodrag Vallat.
@@ -139,6 +139,9 @@
 hil_attach(struct hil_softc *sc, int *hil_is_console)
 {
 
+       rnd_attach_source(&sc->sc_rndsource, device_xname(sc->sc_dev),
+           RND_TYPE_TTY, RND_FLAG_DEFAULT);
+
        aprint_normal("\n");
 
        /*
@@ -290,6 +293,8 @@
        if (sc->sc_status != HIL_STATUS_BUSY)
                hil_process_pending(sc);
 
+       rnd_add_uint32(&sc->sc_rndsource, (stat << 8) | c);
+
        return 1;
 }
 
diff -r 59eed02346f9 -r b190d7b6874b sys/dev/hil/hilvar.h
--- a/sys/dev/hil/hilvar.h      Sat Jun 25 02:22:42 2022 +0000
+++ b/sys/dev/hil/hilvar.h      Sat Jun 25 02:36:27 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hilvar.h,v 1.2 2011/02/15 11:05:51 tsutsui Exp $       */
+/*     $NetBSD: hilvar.h,v 1.3 2022/06/25 02:36:27 tsutsui Exp $       */
 /*     $OpenBSD: hilvar.h,v 1.10 2006/11/05 14:39:32 miod Exp $        */
 /*
  * Copyright (c) 2003, Miodrag Vallat.
@@ -65,6 +65,8 @@
  *     @(#)hilvar.h    8.1 (Berkeley) 6/10/93
  */
 
+#include <sys/rndsource.h>
+
 #define NHILD          8               /* 7 actual + loop pseudo (dev 0) */
 
 struct hildev_softc;
@@ -94,6 +96,7 @@
 #define        HIL_PENDING_UNPLUGGED   0x02
        u_int           sc_maxdev;      /* number of devices on loop */
        device_t        sc_devices[NHILD];      /* interrupt dispatcher */
+       krndsource_t    sc_rndsource;
 };
 
 #ifdef _KERNEL



Home | Main Index | Thread Index | Old Index