tech-kern archive

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

Changes to make /dev/*random better sooner



Attached are the changes from the tls-earlyentropy branch, which tries
to make the output of /dev/random less predictable -- particularly for
an attacker outside the box -- earlier.

I intend to merge these soon.  Comment would be much appreciated.

The commit messages from this branch:

Log Message:
RNDVERBOSE kernel for testing.

Log Message:
LZF in the kernel.  As an entropy estimator for now but it's very small, and
we could use it for ipcomp, for hibernation, for paging, for core dumps, etc.

Log Message:
Entropy estimation changes:

1) Avoid wraparound problems with delta estimator by making estimation
   framework 64-bit.

2) Adjust rnd_counter to always return a 64-bit value, accordingly.

3) Make delta estimator generic and create two instances: delta-time and
   delta-value.

4) Add LZF estimator -- used mostly to protect us against injection of
   bulk data we think is random but is really constant.

5) Allow value and time estimation/collection to be controlled separately.

6) Expose estimator performance to userspace.

Log Message:
Get more entropy into the system early:

        1) Add device attach timings from autoconf.
        2) Accumulate the output of kernel printf (as well as the times
           when it's called) and add this periodically.  To avoid issues
           with recursion through diagnostic printfs, we use SHA512 to
           accumulate the printf output, then mix in its output.
        3) Add all sysctl settings -- mixes in the hostname and likely a
           bit more.

Log Message:
Increase unpredictability of early output: mix in the headers of the
first 100 Ethernet packets received by the system (if we are really
short of entropy, keep mixing them though we don't count any entropy from
them; such systems are particularly likely to have guessable outputs).

Log Message:
Update rndctl(8) to add the -v option, which gives us more robust information
on entropy collection and estimation.

Log Message:
Whups.  It'd help to check in the ioctl changes needed to support that
rndctl change just prior... ;-)

Log Message:
Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
   RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
   and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
   places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
   that had stubbed out code, other minor cleanups.

Log Message:
Fix t_subr_prf.c -- such as is possible.  I am not so sure about the idea of
tearing apart a source file with a script in order to "test" pieces of it...

Index: src/external/bsd/liblzf/dist/lzfP.h
diff -u src/external/bsd/liblzf/dist/lzfP.h:1.3 
src/external/bsd/liblzf/dist/lzfP.h:1.3.8.1
--- src/external/bsd/liblzf/dist/lzfP.h:1.3     Sun Sep 16 18:59:27 2012
+++ src/external/bsd/liblzf/dist/lzfP.h Mon Apr  7 01:10:55 2014
@@ -37,22 +37,21 @@
 #ifndef LZFP_h
 #define LZFP_h
 
-#define STANDALONE 1 /* at the moment, this is ok. */
-
-#ifndef STANDALONE
-# include "lzf.h"
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <sys/types.h>
+#include <inttypes.h>
 #endif
 
 /*
- * Size of hashtable is (1 << HLOG) * sizeof (char *)
+ * Size of hashtable is (1 << LZF_HLOG) * sizeof (char *)
  * decompression is independent of the hash table size
  * the difference between 15 and 14 is very small
  * for small blocks (and 14 is usually a bit faster).
- * For a low-memory/faster configuration, use HLOG == 13;
+ * For a low-memory/faster configuration, use LZF_HLOG == 13;
  * For best compression, use 15 or 16 (or more, up to 23).
  */
-#ifndef HLOG
-# define HLOG 16
+#ifndef LZF_HLOG
+# define LZF_HLOG 16
 #endif
 
 /*
@@ -77,9 +76,12 @@
 
 /*
  * Unconditionally aligning does not cost very much, so do it if unsure
+ *
+ * In fact, on modern x86 processors, strict alignment is faster whether
+ * in 32 or 64 bit mode.
  */
-#ifndef STRICT_ALIGN
-# define STRICT_ALIGN !(defined(__i386) || defined (__amd64))
+#ifndef STRICT_ALIGN   
+# define STRICT_ALIGN 1 /* !(defined(__i386) || defined (__amd64)) */
 #endif
 
 /*
@@ -124,21 +126,11 @@
 /*****************************************************************************/
 /* nothing should be changed below */
 
-typedef unsigned char u8;
-
-typedef const u8 *LZF_STATE[1 << (HLOG)];
+typedef uint8_t u8;
+typedef uint16_t u16;
 
-#if !STRICT_ALIGN
-/* for unaligned accesses we need a 16 bit datatype. */
-# include <limits.h>
-# if USHRT_MAX == 65535
-    typedef unsigned short u16;
-# elif UINT_MAX == 65535
-    typedef unsigned int u16;
-# else
-#  undef STRICT_ALIGN
-#  define STRICT_ALIGN 1
-# endif
+#if !defined(_KERNEL) && !defined(STANDALONE)
+typedef const u8 *LZF_STATE[1 << (LZF_HLOG)];
 #endif
 
 #if ULTRA_FAST
Index: src/external/bsd/liblzf/dist/lzf_c.c
diff -u src/external/bsd/liblzf/dist/lzf_c.c:1.4 
src/external/bsd/liblzf/dist/lzf_c.c:1.4.8.1
--- src/external/bsd/liblzf/dist/lzf_c.c:1.4    Sun Sep 16 18:59:27 2012
+++ src/external/bsd/liblzf/dist/lzf_c.c        Mon Apr  7 01:10:55 2014
@@ -34,9 +34,14 @@
  * either the BSD or the GPL.
  */
 
+#if defined(_KERNEL) || defined (_STANDALONE)
+#include <lib/libkern/libkern.h>
+#include "lzfP.h"
+#else
 #include "lzf.h"
+#endif
 
-#define HSIZE (1 << (HLOG))
+#define HSIZE (1 << (LZF_HLOG))
 
 /*
  * don't play with this unless you benchmark!
@@ -48,16 +53,16 @@
 # define FRST(p) (((p[0]) << 8) | p[1])
 # define NEXT(v,p) (((v) << 8) | p[2])
 # if ULTRA_FAST
-#  define IDX(h) ((( h             >> (3*8 - HLOG)) - h  ) & (HSIZE - 1))
+#  define IDX(h) ((( h             >> (3*8 - LZF_HLOG)) - h  ) & (HSIZE - 1))
 # elif VERY_FAST
-#  define IDX(h) ((( h             >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
+#  define IDX(h) ((( h             >> (3*8 - LZF_HLOG)) - h*5) & (HSIZE - 1))
 # else
-#  define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
+#  define IDX(h) ((((h ^ (h << 5)) >> (3*8 - LZF_HLOG)) - h*5) & (HSIZE - 1))
 # endif
 #endif
 /*
  * IDX works because it is very similar to a multiplicative hash, e.g.
- * ((h * 57321 >> (3*8 - HLOG)) & (HSIZE - 1))
+ * ((h * 57321 >> (3*8 - LZF_HLOG)) & (HSIZE - 1))
  * the latter is also quite fast on newer CPUs, and compresses similarly.
  *
  * the next one is also quite good, albeit slow ;)
@@ -147,7 +152,7 @@
 #endif
           && (off = ip - ref - 1) < MAX_OFF
           && ip + 4 < in_end
-          && ref > (u8 *)in_data
+          && ref > (const u8 *)in_data
 #if STRICT_ALIGN
           && ref[0] == ip[0]
           && ref[1] == ip[1]
Index: src/external/bsd/liblzf/dist/lzf_d.c
diff -u src/external/bsd/liblzf/dist/lzf_d.c:1.3 
src/external/bsd/liblzf/dist/lzf_d.c:1.3.22.1
--- src/external/bsd/liblzf/dist/lzf_d.c:1.3    Tue Apr  5 06:24:42 2011
+++ src/external/bsd/liblzf/dist/lzf_d.c        Mon Apr  7 01:10:55 2014
@@ -34,13 +34,23 @@
  * either the BSD or the GPL.
  */
 
+#if defined(_KERNEL) || defined (_STANDALONE)
+#include <lib/libkern/libkern.h>
+#include <sys/systm.h>
+#include "lzfP.h"
+#else
 #include "lzf.h"
+#endif
 
-#if AVOID_ERRNO
-# define SET_ERRNO(n)
+#ifdef _KERNEL
+# define SET_ERRNO(n) panic("lzf decompression failure: %s", #n)
 #else
-# include <errno.h>
-# define SET_ERRNO(n) errno = (n)
+# ifdef AVOID_ERRNO
+#  define SET_ERRNO(n)
+# else
+#  include <errno.h>
+#  define SET_ERRNO(n) errno = (n)
+# endif
 #endif
 
 #if (__i386 || __amd64) && __GNUC__ >= 3
Index: src/sbin/rndctl/rndctl.8
diff -u src/sbin/rndctl/rndctl.8:1.20 src/sbin/rndctl/rndctl.8:1.20.16.1
--- src/sbin/rndctl/rndctl.8:1.20       Wed Nov 23 12:15:30 2011
+++ src/sbin/rndctl/rndctl.8    Mon Apr  7 02:49:52 2014
@@ -1,4 +1,4 @@
-.\"    $NetBSD: rndctl.8,v 1.20 2011/11/23 12:15:30 wiz Exp $
+.\"    $NetBSD: rndctl.8,v 1.20.16.1 2014/04/07 02:49:52 tls Exp $
 .\"
 .\" Copyright (c) 1997 Michael Graff
 .\" All rights reserved.
@@ -39,6 +39,7 @@
 .Nm
 .Fl ls
 .Op Fl d Ar devname | Fl t Ar devtype
+.Op Fl v
 .Nm
 .Fl L Ar save-file
 .Nm
@@ -119,6 +120,8 @@
 .It Ic rng
 Random number generators.
 .El
+.It Fl v
+Verbose output: show entropy estimation statistics for each source.
 .El
 .Sh FILES
 .Bl -tag -width /dev/urandomx -compact
Index: src/sbin/rndctl/rndctl.c
diff -u src/sbin/rndctl/rndctl.c:1.27 src/sbin/rndctl/rndctl.c:1.27.2.1
--- src/sbin/rndctl/rndctl.c:1.27       Wed Jan 15 15:05:27 2014
+++ src/sbin/rndctl/rndctl.c    Mon Apr  7 02:49:52 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: rndctl.c,v 1.27 2014/01/15 15:05:27 apb Exp $  */
+/*     $NetBSD: rndctl.c,v 1.27.2.1 2014/04/07 02:49:52 tls Exp $      */
 
 /*-
  * Copyright (c) 1997 Michael Graff.
@@ -33,7 +33,7 @@
 #include <sha1.h>
 
 #ifndef lint
-__RCSID("$NetBSD: rndctl.c,v 1.27 2014/01/15 15:05:27 apb Exp $");
+__RCSID("$NetBSD: rndctl.c,v 1.27.2.1 2014/04/07 02:49:52 tls Exp $");
 #endif
 
 
@@ -78,6 +78,8 @@
 static void do_list(int, u_int32_t, char *);
 static void do_stats(void);
 
+static int vflag;
+
 static void
 usage(void)
 {
@@ -254,19 +256,28 @@
 {
        static char str[512];
 
-       str[0] = 0;
+       str[0] = '\0';
        if (fl & RND_FLAG_NO_ESTIMATE)
                ;
        else
-               strlcat(str, "estimate", sizeof(str));
+               strlcat(str, "estimate, ", sizeof(str));
 
        if (fl & RND_FLAG_NO_COLLECT)
                ;
-       else {
-               if (str[0])
-                       strlcat(str, ", ", sizeof(str));
-               strlcat(str, "collect", sizeof(str));
-       }
+       else
+               strlcat(str, "collect, ", sizeof(str));
+
+       if (fl & RND_FLAG_COLLECT_VALUE)
+               strlcat(str, "v, ", sizeof(str));
+       if (fl & RND_FLAG_COLLECT_TIME)
+               strlcat(str, "t, ", sizeof(str));
+       if (fl & RND_FLAG_ESTIMATE_VALUE)
+               strlcat(str, "dv, ", sizeof(str));
+       if (fl & RND_FLAG_ESTIMATE_TIME)
+               strlcat(str, "dt, ", sizeof(str));
+
+       if (str[strlen(str) - 2] == ',')
+               str[strlen(str) - 2] = '\0';
 
        return (str);
 }
@@ -276,8 +287,8 @@
 static void
 do_list(int all, u_int32_t type, char *name)
 {
-       rndstat_t rstat;
-       rndstat_name_t rstat_name;
+       rndstat_est_t rstat;
+       rndstat_est_name_t rstat_name;
        int fd;
        int res;
        uint32_t i;
@@ -289,15 +300,29 @@
 
        if (all == 0 && type == 0xff) {
                strncpy(rstat_name.name, name, sizeof(rstat_name.name));
-               res = ioctl(fd, RNDGETSRCNAME, &rstat_name);
+               res = ioctl(fd, RNDGETESTNAME, &rstat_name);
                if (res < 0)
-                       err(1, "ioctl(RNDGETSRCNAME)");
+                       err(1, "ioctl(RNDGETESTNAME)");
                printf(HEADER);
                printf("%-16s %10u %-4s %s\n",
-                   rstat_name.source.name,
-                   rstat_name.source.total,
-                   find_name(rstat_name.source.type),
-                   strflags(rstat_name.source.flags));
+                   rstat_name.source.rt.name,
+                   rstat_name.source.rt.total,
+                   find_name(rstat_name.source.rt.type),
+                   strflags(rstat_name.source.rt.flags));
+               if (vflag) {
+                       printf("\tDt samples = %d\n",
+                              rstat_name.source.dt_samples);
+                       printf("\tDt bits = %d\n",
+                              rstat_name.source.dt_total);
+                       printf("\tDv samples = %d\n",
+                               rstat_name.source.dv_samples);
+                       printf("\tDv bits = %d\n",
+                              rstat_name.source.dv_total);
+                       printf("\tLZ bytes in = %d\n",
+                              rstat_name.source.lzv_bytes);
+                       printf("\tLZ bits out = %d\n",
+                              rstat_name.source.lzv_total);
+               }
                close(fd);
                return;
        }
@@ -311,22 +336,36 @@
        for (;;) {
                rstat.count = RND_MAXSTATCOUNT;
                rstat.start = start;
-               res = ioctl(fd, RNDGETSRCNUM, &rstat);
+               res = ioctl(fd, RNDGETESTNUM, &rstat);
                if (res < 0)
-                       err(1, "ioctl(RNDGETSRCNUM)");
+                       err(1, "ioctl(RNDGETESTNUM)");
 
                if (rstat.count == 0)
                        break;
 
                for (i = 0; i < rstat.count; i++) {
                        if (all != 0 ||
-                           type == rstat.source[i].type)
+                           type == rstat.source[i].rt.type)
                                printf("%-16s %10u %-4s %s\n",
-                                   rstat.source[i].name,
-                                   rstat.source[i].total,
-                                   find_name(rstat.source[i].type),
-                                   strflags(rstat.source[i].flags));
-               }
+                                   rstat.source[i].rt.name,
+                                   rstat.source[i].rt.total,
+                                   find_name(rstat.source[i].rt.type),
+                                   strflags(rstat.source[i].rt.flags));
+                       if (vflag) {
+                               printf("\tDt samples = %d\n",
+                                      rstat.source[i].dt_samples);
+                               printf("\tDt bits = %d\n",
+                                      rstat.source[i].dt_total);
+                               printf("\tDv samples = %d\n",
+                                      rstat.source[i].dv_samples);
+                               printf("\tDv bits = %d\n",
+                                      rstat.source[i].dv_total);
+                               printf("\tLZ bytes in = %d\n",
+                                      rstat.source[i].lzv_bytes);
+                               printf("\tLZ bits out = %d\n",
+                                      rstat.source[i].lzv_total);
+                       }
+                }
                start += rstat.count;
        }
 
@@ -375,7 +414,7 @@
        sflag = 0;
        type = 0xff;
 
-       while ((ch = getopt(argc, argv, "CES:L:celt:d:s")) != -1) {
+       while ((ch = getopt(argc, argv, "CES:L:celt:d:sv")) != -1) {
                switch (ch) {
                case 'C':
                        rctl.flags |= RND_FLAG_NO_COLLECT;
@@ -430,6 +469,9 @@
                case 's':
                        sflag++;
                        break;
+               case 'v':
+                       vflag++;
+                       break;
                case '?':
                default:
                        usage();
Index: src/share/man/man9/rnd.9
diff -u src/share/man/man9/rnd.9:1.22 src/share/man/man9/rnd.9:1.22.8.1
--- src/share/man/man9/rnd.9:1.22       Thu Jul 12 00:07:36 2012
+++ src/share/man/man9/rnd.9    Mon Apr  7 03:37:29 2014
@@ -1,4 +1,4 @@
-.\"    $NetBSD: rnd.9,v 1.22 2012/07/12 00:07:36 pgoyette Exp $
+.\"    $NetBSD: rnd.9,v 1.22.8.1 2014/04/07 03:37:29 tls Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -100,15 +100,32 @@
 .Pp
 .Fa flags
 are the logical OR of
-.Dv RND_FLAG_NO_COLLECT
-(don't collect or estimate)
-.Dv RND_FLAG_NO_ESTIMATE
-(don't estimate)
-to control the default setting for collection and estimation.
+.Dv RND_FLAG_COLLECT_VALUE
+(mix data provided by this source into the pool)
+.Dv RND_FLAG_COLLECT_TIME
+(mix timestamps from this source into the pool)
+.Dv RND_FLAG_ESTIMATE_VALUE
+(use a delta estimator to count bits of entropy from this source's data towards
+the pool estimate)
+.Dv RND_FLAG_ESTIMATE_TIME
+(use a delta estimator to count bits of entropy from this source's timestamps
+towards the pool estimate).
+For many devices,
+.Dv RND_FLAG_DEFAULT
+(
+.Dv RND_FLAG_COLLECT_VALUE
+|
+.Dv RND_FLAG_COLLECT_TIME
+|
+.Dv RND_FLAG_ESTIMATE_TIME
+) is the best choice.
 Note that devices of type
 .Dv RND_TYPE_NET
 default to
-.Dv RND_FLAG_NO_ESTIMATE .
+.Dv RND_FLAG_COLLECT_VALUE
+|
+.Dv RND_FLAG_COLLECT_TIME
+(no entropy counted).
 .Pp
 .It Fn rnd_detach_source "krndsource_t *rnd_source"
 This function disconnects the device from entropy collection.
Index: src/sys/arch/acorn26/ioc/arckbd.c
diff -u src/sys/arch/acorn26/ioc/arckbd.c:1.22 
src/sys/arch/acorn26/ioc/arckbd.c:1.22.20.1
--- src/sys/arch/acorn26/ioc/arckbd.c:1.22      Thu Feb  2 19:42:57 2012
+++ src/sys/arch/acorn26/ioc/arckbd.c   Mon Apr  7 03:37:29 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: arckbd.c,v 1.22 2012/02/02 19:42:57 tls Exp $ */
+/* $NetBSD: arckbd.c,v 1.22.20.1 2014/04/07 03:37:29 tls Exp $ */
 /*-
  * Copyright (c) 1998, 1999, 2000 Ben Harris
  * All rights reserved.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arckbd.c,v 1.22 2012/02/02 19:42:57 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arckbd.c,v 1.22.20.1 2014/04/07 03:37:29 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -219,8 +219,10 @@
 
        aprint_normal("\n");
 
+       /* XXX We do not ESTIMATE_VALUE because we are feeding two
+          data streams (mouse, kbd) into the same source. XXX */
        rnd_attach_source(&sc->sc_rnd_source, device_xname(self),
-           RND_TYPE_TTY, 0);
+           RND_TYPE_TTY, RND_FLAG_DEFAULT);
 
        wskbdargs.console = 1; /* XXX FIXME */
        wskbdargs.keymap = &sc->sc_mapdata;
Index: src/sys/arch/amd64/conf/RNDVERBOSE
diff -u /dev/null src/sys/arch/amd64/conf/RNDVERBOSE:1.1.2.1
--- /dev/null   Tue Apr  8 03:15:58 2014
+++ src/sys/arch/amd64/conf/RNDVERBOSE  Sun Apr  6 15:59:42 2014
@@ -0,0 +1,24 @@
+# $NetBSD: RNDVERBOSE,v 1.1.2.1 2014/04/06 15:59:42 tls Exp $
+#
+# GENERIC machine description file
+#
+# This machine description file is used to generate the default NetBSD
+# kernel.  The generic kernel does not include all options, subsystems
+# and device drivers, but should be useful for most applications.
+#
+# The machine description file can be customised for your specific
+# machine to reduce the kernel size and improve its performance.
+#
+# For further information on compiling NetBSD kernels, see the config(8)
+# man page.
+#
+# For further information on hardware support for this architecture, see
+# the intro(4) man page.  For further information about kernel options
+# for this architecture, see the options(4) man page.  For an explanation
+# of each device driver in this file see the section 4 man page for the
+# device.
+
+include        "arch/amd64/conf/GENERIC"
+
+options        DEBUG,LOCKDEBUG,RND_VERBOSE
+makeoptions    DEBUG="-g"
Index: src/sys/arch/arm/at91/at91dbgu.c
diff -u src/sys/arch/arm/at91/at91dbgu.c:1.10 
src/sys/arch/arm/at91/at91dbgu.c:1.10.2.1
--- src/sys/arch/arm/at91/at91dbgu.c:1.10       Sun Mar 16 05:20:22 2014
+++ src/sys/arch/arm/at91/at91dbgu.c    Mon Apr  7 03:37:30 2014
@@ -1,5 +1,5 @@
-/*     $Id: at91dbgu.c,v 1.10 2014/03/16 05:20:22 dholland Exp $       */
-/*     $NetBSD: at91dbgu.c,v 1.10 2014/03/16 05:20:22 dholland Exp $ */
+/*     $Id: at91dbgu.c,v 1.10.2.1 2014/04/07 03:37:30 tls Exp $        */
+/*     $NetBSD: at91dbgu.c,v 1.10.2.1 2014/04/07 03:37:30 tls Exp $ */
 
 /*
  *
@@ -83,7 +83,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at91dbgu.c,v 1.10 2014/03/16 05:20:22 dholland Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: at91dbgu.c,v 1.10.2.1 2014/04/07 03:37:30 tls Exp 
$");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -288,7 +288,7 @@
 
 #ifdef RND_COM
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_TTY, 0);
+                         RND_TYPE_TTY, RND_FLAG_DEFAULT);
 #endif
 
        /* if there are no enable/disable functions, assume the device
Index: src/sys/arch/arm/at91/at91usart.c
diff -u src/sys/arch/arm/at91/at91usart.c:1.9 
src/sys/arch/arm/at91/at91usart.c:1.9.2.1
--- src/sys/arch/arm/at91/at91usart.c:1.9       Sun Mar 16 05:20:22 2014
+++ src/sys/arch/arm/at91/at91usart.c   Mon Apr  7 03:37:30 2014
@@ -1,5 +1,5 @@
-/*     $Id: at91usart.c,v 1.9 2014/03/16 05:20:22 dholland Exp $       */
-/*     $NetBSD: at91usart.c,v 1.9 2014/03/16 05:20:22 dholland Exp $ */
+/*     $Id: at91usart.c,v 1.9.2.1 2014/04/07 03:37:30 tls Exp $        */
+/*     $NetBSD: at91usart.c,v 1.9.2.1 2014/04/07 03:37:30 tls Exp $ */
 
 /*
  * Copyright (c) 2007 Embedtronics Oy. All rights reserved.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at91usart.c,v 1.9 2014/03/16 05:20:22 dholland Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: at91usart.c,v 1.9.2.1 2014/04/07 03:37:30 tls Exp 
$");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -314,7 +314,7 @@
 
 #ifdef RND_COM
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_TTY, 0);
+                         RND_TYPE_TTY, RND_FLAG_DEFAULT);
 #endif
 
        /* if there are no enable/disable functions, assume the device
Index: src/sys/arch/arm/broadcom/bcm2835_rng.c
diff -u src/sys/arch/arm/broadcom/bcm2835_rng.c:1.9 
src/sys/arch/arm/broadcom/bcm2835_rng.c:1.9.2.1
--- src/sys/arch/arm/broadcom/bcm2835_rng.c:1.9 Thu Aug 29 21:54:11 2013
+++ src/sys/arch/arm/broadcom/bcm2835_rng.c     Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_rng.c,v 1.9 2013/08/29 21:54:11 riastradh Exp $ */
+/*     $NetBSD: bcm2835_rng.c,v 1.9.2.1 2014/04/07 03:37:30 tls Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_rng.c,v 1.9 2013/08/29 21:54:11 riastradh 
Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_rng.c,v 1.9.2.1 2014/04/07 03:37:30 tls 
Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -129,7 +129,7 @@
        mutex_init(&sc->sc_rnd_lock, MUTEX_DEFAULT, IPL_SERIAL);
        rndsource_setcb(&sc->sc_rndsource, &bcmrng_get_cb, sc);
        rnd_attach_source(&sc->sc_rndsource, device_xname(self), RND_TYPE_RNG,
-           RND_FLAG_NO_ESTIMATE|RND_FLAG_HASCB);
+           RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
 
        /* get some initial entropy ASAP */
        bcmrng_get_cb(RND_POOLBITS / NBBY, sc);
Index: src/sys/arch/arm/broadcom/bcm53xx_rng.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_rng.c:1.6 
src/sys/arch/arm/broadcom/bcm53xx_rng.c:1.6.2.1
--- src/sys/arch/arm/broadcom/bcm53xx_rng.c:1.6 Wed Feb 19 22:21:16 2014
+++ src/sys/arch/arm/broadcom/bcm53xx_rng.c     Mon Apr  7 03:37:30 2014
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_rng.c,v 1.6 2014/02/19 22:21:16 matt Exp 
$");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_rng.c,v 1.6.2.1 2014/04/07 03:37:30 tls 
Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -143,7 +143,7 @@
        callout_init(&sc->sc_rnd_callout, CALLOUT_MPSAFE);
 
        rnd_attach_source(&sc->sc_rnd_source, device_xname(self), RND_TYPE_RNG,
-           RND_FLAG_NO_ESTIMATE);
+           RND_FLAG_COLLECT_VALUE);
 
 #ifdef RNG_USE_INTR
        sc->sc_ih = intr_establish(loc->loc_intrs[0], IPL_VM, IST_LEVEL,
Index: src/sys/arch/arm/clps711x/clpscom.c
diff -u src/sys/arch/arm/clps711x/clpscom.c:1.2 
src/sys/arch/arm/clps711x/clpscom.c:1.2.2.1
--- src/sys/arch/arm/clps711x/clpscom.c:1.2     Sun Mar 16 05:20:23 2014
+++ src/sys/arch/arm/clps711x/clpscom.c Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*      $NetBSD: clpscom.c,v 1.2 2014/03/16 05:20:23 dholland Exp $      */
+/*      $NetBSD: clpscom.c,v 1.2.2.1 2014/04/07 03:37:30 tls Exp $      */
 /*
  * Copyright (c) 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clpscom.c,v 1.2 2014/03/16 05:20:23 dholland Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: clpscom.c,v 1.2.2.1 2014/04/07 03:37:30 tls Exp 
$");
 
 #include "rnd.h"
 
@@ -247,7 +247,7 @@
 
 #ifdef RND_COM
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_TTY, 0);
+           RND_TYPE_TTY, RND_FLAG_DEFAULT);
 #endif
 
        SET(sc->sc_hwflags, COM_HW_DEV_OK);
Index: src/sys/arch/arm/ep93xx/epcom.c
diff -u src/sys/arch/arm/ep93xx/epcom.c:1.26 
src/sys/arch/arm/ep93xx/epcom.c:1.26.2.1
--- src/sys/arch/arm/ep93xx/epcom.c:1.26        Sun Mar 16 05:20:23 2014
+++ src/sys/arch/arm/ep93xx/epcom.c     Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: epcom.c,v 1.26 2014/03/16 05:20:23 dholland Exp $ */
+/*     $NetBSD: epcom.c,v 1.26.2.1 2014/04/07 03:37:30 tls Exp $ */
 /*
  * Copyright (c) 1998, 1999, 2001, 2002, 2004 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: epcom.c,v 1.26 2014/03/16 05:20:23 dholland Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: epcom.c,v 1.26.2.1 2014/04/07 03:37:30 tls Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -248,7 +248,7 @@
 
 #ifdef RND_COM
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_TTY, 0);
+                         RND_TYPE_TTY, RND_FLAG_DEFAULT);
 #endif
 
        /* if there are no enable/disable functions, assume the device
Index: src/sys/arch/arm/imx/imxuart.c
diff -u src/sys/arch/arm/imx/imxuart.c:1.11 
src/sys/arch/arm/imx/imxuart.c:1.11.2.1
--- src/sys/arch/arm/imx/imxuart.c:1.11 Sun Mar 16 05:20:23 2014
+++ src/sys/arch/arm/imx/imxuart.c      Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: imxuart.c,v 1.11 2014/03/16 05:20:23 dholland Exp $ */
+/* $NetBSD: imxuart.c,v 1.11.2.1 2014/04/07 03:37:30 tls Exp $ */
 
 /*
  * Copyright (c) 2009, 2010  Genetec Corporation.  All rights reserved.
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.11 2014/03/16 05:20:23 dholland Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.11.2.1 2014/04/07 03:37:30 tls Exp 
$");
 
 #include "opt_imxuart.h"
 #include "opt_ddb.h"
@@ -504,7 +504,8 @@
 
 #ifdef RND_COM
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_TTY, 0);
+                         RND_TYPE_TTY, RND_FLAG_COLLECT_TIME |
+                                       RND_FLAG_ESTIMATE_TIME);
 #endif
 
        /* if there are no enable/disable functions, assume the device
Index: src/sys/arch/arm/ixp12x0/ixp12x0_com.c
diff -u src/sys/arch/arm/ixp12x0/ixp12x0_com.c:1.43 
src/sys/arch/arm/ixp12x0/ixp12x0_com.c:1.43.2.1
--- src/sys/arch/arm/ixp12x0/ixp12x0_com.c:1.43 Sun Mar 16 05:20:23 2014
+++ src/sys/arch/arm/ixp12x0/ixp12x0_com.c      Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: ixp12x0_com.c,v 1.43 2014/03/16 05:20:23 dholland Exp $ */
+/*     $NetBSD: ixp12x0_com.c,v 1.43.2.1 2014/04/07 03:37:30 tls Exp $ */
 /*
  * Copyright (c) 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixp12x0_com.c,v 1.43 2014/03/16 05:20:23 dholland 
Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp12x0_com.c,v 1.43.2.1 2014/04/07 03:37:30 tls 
Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -247,7 +247,8 @@
 
 #ifdef RND_COM
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_TTY, 0);
+                         RND_TYPE_TTY, RND_FLAG_COLLECT_TIME|
+                                       RND_FLAG_ESTIMATE_TIME);
 #endif
 
        /* if there are no enable/disable functions, assume the device
Index: src/sys/arch/arm/s3c2xx0/sscom.c
diff -u src/sys/arch/arm/s3c2xx0/sscom.c:1.44 
src/sys/arch/arm/s3c2xx0/sscom.c:1.44.2.1
--- src/sys/arch/arm/s3c2xx0/sscom.c:1.44       Sun Mar 16 12:26:58 2014
+++ src/sys/arch/arm/s3c2xx0/sscom.c    Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: sscom.c,v 1.44 2014/03/16 12:26:58 reinoud Exp $ */
+/*     $NetBSD: sscom.c,v 1.44.2.1 2014/04/07 03:37:30 tls Exp $ */
 
 /*
  * Copyright (c) 2002, 2003 Fujitsu Component Limited
@@ -98,7 +98,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.44 2014/03/16 12:26:58 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.44.2.1 2014/04/07 03:37:30 tls Exp $");
 
 #include "opt_sscom.h"
 #include "opt_ddb.h"
@@ -509,7 +509,8 @@
 
 #ifdef RND_COM
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_TTY, 0);
+                         RND_TYPE_TTY, RND_FLAG_COLLECT_TIME|
+                                       RND_FLAG_ESTIMATE_TIME);
 #endif
 
        /* if there are no enable/disable functions, assume the device
Index: src/sys/arch/arm/sa11x0/sa1111_kbc.c
diff -u src/sys/arch/arm/sa11x0/sa1111_kbc.c:1.16 
src/sys/arch/arm/sa11x0/sa1111_kbc.c:1.16.10.1
--- src/sys/arch/arm/sa11x0/sa1111_kbc.c:1.16   Sat Oct 27 17:17:41 2012
+++ src/sys/arch/arm/sa11x0/sa1111_kbc.c        Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*      $NetBSD: sa1111_kbc.c,v 1.16 2012/10/27 17:17:41 chs Exp $ */
+/*      $NetBSD: sa1111_kbc.c,v 1.16.10.1 2014/04/07 03:37:30 tls Exp $ */
 
 /*
  * Copyright (c) 2004  Ben Harris.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sa1111_kbc.c,v 1.16 2012/10/27 17:17:41 chs Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: sa1111_kbc.c,v 1.16.10.1 2014/04/07 03:37:30 tls 
Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -276,7 +276,7 @@
                        continue;
                sc->slot = slot;
                rnd_attach_source(&sc->rnd_source, device_xname(child),
-                   RND_TYPE_TTY, 0);
+                   RND_TYPE_TTY, RND_FLAG_DEFAULT|RND_FLAG_ESTIMATE_VALUE);
                /* only one of KBD_SLOT or AUX_SLOT is used. */
                break;                  
        }
Index: src/sys/arch/arm/sa11x0/sa11x0_com.c
diff -u src/sys/arch/arm/sa11x0/sa11x0_com.c:1.51 
src/sys/arch/arm/sa11x0/sa11x0_com.c:1.51.2.1
--- src/sys/arch/arm/sa11x0/sa11x0_com.c:1.51   Sun Mar 16 05:20:23 2014
+++ src/sys/arch/arm/sa11x0/sa11x0_com.c        Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*      $NetBSD: sa11x0_com.c,v 1.51 2014/03/16 05:20:23 dholland Exp $        
*/
+/*      $NetBSD: sa11x0_com.c,v 1.51.2.1 2014/04/07 03:37:30 tls Exp $        
*/
 
 /*-
  * Copyright (c) 1998, 1999, 2001 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.51 2014/03/16 05:20:23 dholland 
Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.51.2.1 2014/04/07 03:37:30 tls 
Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -341,7 +341,8 @@
 
 #ifdef RND_COM
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_TTY, 0);
+                         RND_TYPE_TTY, RND_FLAG_COLLECT_TIME|
+                                       RND_FLAG_ESTIMATE_TIME);
 #endif
 
        /* if there are no enable/disable functions, assume the device
Index: src/sys/arch/arm/xscale/ixp425_if_npe.c
diff -u src/sys/arch/arm/xscale/ixp425_if_npe.c:1.25 
src/sys/arch/arm/xscale/ixp425_if_npe.c:1.25.2.1
--- src/sys/arch/arm/xscale/ixp425_if_npe.c:1.25        Thu Mar 20 06:48:54 2014
+++ src/sys/arch/arm/xscale/ixp425_if_npe.c     Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: ixp425_if_npe.c,v 1.25 2014/03/20 06:48:54 skrll Exp $ */
+/*     $NetBSD: ixp425_if_npe.c,v 1.25.2.1 2014/04/07 03:37:30 tls Exp $ */
 
 /*-
  * Copyright (c) 2006 Sam Leffler.  All rights reserved.
@@ -28,7 +28,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/if_npe.c,v 1.1 2006/11/19 
23:55:23 sam Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.25 2014/03/20 06:48:54 skrll 
Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.25.2.1 2014/04/07 03:37:30 tls 
Exp $");
 
 /*
  * Intel XScale NPE Ethernet driver.
@@ -334,7 +334,7 @@
        if_attach(ifp);
        ether_ifattach(ifp, sc->sc_enaddr);
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        /* callback function to reset MAC */
        isc->macresetcbfunc = npeinit_resetcb;
Index: src/sys/arch/emips/ebus/ace_ebus.c
diff -u src/sys/arch/emips/ebus/ace_ebus.c:1.10 
src/sys/arch/emips/ebus/ace_ebus.c:1.10.2.1
--- src/sys/arch/emips/ebus/ace_ebus.c:1.10     Sun Mar 16 05:20:23 2014
+++ src/sys/arch/emips/ebus/ace_ebus.c  Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: ace_ebus.c,v 1.10 2014/03/16 05:20:23 dholland Exp $   */
+/*     $NetBSD: ace_ebus.c,v 1.10.2.1 2014/04/07 03:37:30 tls Exp $    */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ace_ebus.c,v 1.10 2014/03/16 05:20:23 dholland Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: ace_ebus.c,v 1.10.2.1 2014/04/07 03:37:30 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1462,7 +1462,7 @@
  * Rest of code lifted with mods from the dev\ata\wd.c driver
  */
 
-/*     $NetBSD: ace_ebus.c,v 1.10 2014/03/16 05:20:23 dholland Exp $ */
+/*     $NetBSD: ace_ebus.c,v 1.10.2.1 2014/04/07 03:37:30 tls Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -1655,7 +1655,7 @@
        disk_attach(&ace->sc_dk);
 
        rnd_attach_source(&ace->rnd_source, device_xname(ace->sc_dev),
-                         RND_TYPE_DISK, 0);
+                         RND_TYPE_DISK, RND_FLAG_DEFAULT);
 
 }
 
Index: src/sys/arch/emips/ebus/flash_ebus.c
diff -u src/sys/arch/emips/ebus/flash_ebus.c:1.8 
src/sys/arch/emips/ebus/flash_ebus.c:1.8.2.1
--- src/sys/arch/emips/ebus/flash_ebus.c:1.8    Sun Mar 16 05:20:23 2014
+++ src/sys/arch/emips/ebus/flash_ebus.c        Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: flash_ebus.c,v 1.8 2014/03/16 05:20:23 dholland Exp $  */
+/*     $NetBSD: flash_ebus.c,v 1.8.2.1 2014/04/07 03:37:30 tls Exp $   */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: flash_ebus.c,v 1.8 2014/03/16 05:20:23 dholland 
Exp $");
+__KERNEL_RCSID(0, "$NetBSD: flash_ebus.c,v 1.8.2.1 2014/04/07 03:37:30 tls Exp 
$");
 
 /* Driver for the Intel 28F320/640/128 (J3A150) StrataFlash memory device
  * Extended to include the Intel JS28F256P30T95.
@@ -1302,7 +1302,7 @@
 /* Rest of code lifted with mods from the dev\ata\wd.c driver
  */
 
-/*     $NetBSD: flash_ebus.c,v 1.8 2014/03/16 05:20:23 dholland Exp $ */
+/*     $NetBSD: flash_ebus.c,v 1.8.2.1 2014/04/07 03:37:30 tls Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -1470,7 +1470,7 @@
        disk_attach(&sc->sc_dk);
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_DISK, 0);
+                         RND_TYPE_DISK, RND_FLAG_DEFAULT);
 
 }
 
Index: src/sys/arch/emips/ebus/if_le_ebus.c
diff -u src/sys/arch/emips/ebus/if_le_ebus.c:1.5 
src/sys/arch/emips/ebus/if_le_ebus.c:1.5.2.1
--- src/sys/arch/emips/ebus/if_le_ebus.c:1.5    Sun Nov 10 18:27:15 2013
+++ src/sys/arch/emips/ebus/if_le_ebus.c        Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_le_ebus.c,v 1.5 2013/11/10 18:27:15 christos Exp $  */
+/*     $NetBSD: if_le_ebus.c,v 1.5.2.1 2014/04/07 03:37:30 tls Exp $   */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.5 2013/11/10 18:27:15 christos 
Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.5.2.1 2014/04/07 03:37:30 tls Exp 
$");
 
 #include "opt_inet.h"
 
@@ -223,7 +223,7 @@
                panic("enic_attach: cannot establish shutdown hook");
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        ebus_intr_establish(parent, (void *)ia->ia_cookie, IPL_NET,
            enic_intr, sc);
Index: src/sys/arch/epoc32/windermere/wmcom.c
diff -u src/sys/arch/epoc32/windermere/wmcom.c:1.2 
src/sys/arch/epoc32/windermere/wmcom.c:1.2.2.1
--- src/sys/arch/epoc32/windermere/wmcom.c:1.2  Sun Mar 16 05:20:23 2014
+++ src/sys/arch/epoc32/windermere/wmcom.c      Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*      $NetBSD: wmcom.c,v 1.2 2014/03/16 05:20:23 dholland Exp $      */
+/*      $NetBSD: wmcom.c,v 1.2.2.1 2014/04/07 03:37:30 tls Exp $      */
 /*
  * Copyright (c) 2012 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wmcom.c,v 1.2 2014/03/16 05:20:23 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmcom.c,v 1.2.2.1 2014/04/07 03:37:30 tls Exp $");
 
 #include "rnd.h"
 
@@ -224,7 +224,7 @@
 
 #ifdef RND_COM
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_TTY, 0);
+           RND_TYPE_TTY, RND_FLAG_DEFAULT);
 #endif
 
        SET(sc->sc_hwflags, COM_HW_DEV_OK);
Index: src/sys/arch/evbarm/dev/plcom.c
diff -u src/sys/arch/evbarm/dev/plcom.c:1.48 
src/sys/arch/evbarm/dev/plcom.c:1.48.2.1
--- src/sys/arch/evbarm/dev/plcom.c:1.48        Sun Mar 16 05:20:23 2014
+++ src/sys/arch/evbarm/dev/plcom.c     Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: plcom.c,v 1.48 2014/03/16 05:20:23 dholland Exp $      */
+/*     $NetBSD: plcom.c,v 1.48.2.1 2014/04/07 03:37:30 tls Exp $       */
 
 /*-
  * Copyright (c) 2001 ARM Ltd
@@ -94,7 +94,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.48 2014/03/16 05:20:23 dholland Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.48.2.1 2014/04/07 03:37:30 tls Exp $");
 
 #include "opt_plcom.h"
 #include "opt_ddb.h"
@@ -561,7 +561,7 @@
 
 #ifdef RND_COM
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_TTY, 0);
+           RND_TYPE_TTY, RND_FLAG_DEFAULT);
 #endif
 
        /*
Index: src/sys/arch/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.95 src/sys/arch/hp300/dev/rd.c:1.95.2.1
--- src/sys/arch/hp300/dev/rd.c:1.95    Mon Mar 24 19:42:58 2014
+++ src/sys/arch/hp300/dev/rd.c Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: rd.c,v 1.95 2014/03/24 19:42:58 christos Exp $ */
+/*     $NetBSD: rd.c,v 1.95.2.1 2014/04/07 03:37:30 tls Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.95 2014/03/24 19:42:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.95.2.1 2014/04/07 03:37:30 tls Exp $");
 
 #include "opt_useleds.h"
 
@@ -374,7 +374,7 @@
         * attach the device into the random source list
         */
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_DISK, 0);
+           RND_TYPE_DISK, RND_FLAG_DEFAULT);
 }
 
 static int
Index: src/sys/arch/hppa/gsc/harmony.c
diff -u src/sys/arch/hppa/gsc/harmony.c:1.1 
src/sys/arch/hppa/gsc/harmony.c:1.1.2.1
--- src/sys/arch/hppa/gsc/harmony.c:1.1 Mon Feb 24 07:23:43 2014
+++ src/sys/arch/hppa/gsc/harmony.c     Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: harmony.c,v 1.1 2014/02/24 07:23:43 skrll Exp $        */
+/*     $NetBSD: harmony.c,v 1.1.2.1 2014/04/07 03:37:30 tls Exp $      */
 
 /*     $OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $     */
 
@@ -320,7 +320,7 @@
        audio_attach_mi(&harmony_sa_hw_if, sc, sc->sc_dv);
 
        rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dv),
-           RND_TYPE_UNKNOWN, 0);
+           RND_TYPE_UNKNOWN, RND_FLAG_DEFAULT);
 
        callout_init(&sc->sc_acc_tmo, 0);
        callout_setfunc(&sc->sc_acc_tmo, harmony_acc_tmo, sc);
Index: src/sys/arch/i386/pci/glxsb.c
diff -u src/sys/arch/i386/pci/glxsb.c:1.11 
src/sys/arch/i386/pci/glxsb.c:1.11.2.1
--- src/sys/arch/i386/pci/glxsb.c:1.11  Fri Apr  4 14:47:26 2014
+++ src/sys/arch/i386/pci/glxsb.c       Mon Apr  7 03:37:30 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: glxsb.c,v 1.11 2014/04/04 14:47:26 christos Exp $      */
+/*     $NetBSD: glxsb.c,v 1.11.2.1 2014/04/07 03:37:30 tls Exp $       */
 /* $OpenBSD: glxsb.c,v 1.7 2007/02/12 14:31:45 tom Exp $ */
 
 /*
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.11 2014/04/04 14:47:26 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.11.2.1 2014/04/07 03:37:30 tls Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -247,7 +247,7 @@
        wrmsr(SB_GLD_MSR_CTRL, msr);
 
        rnd_attach_source(&sc->sc_rnd_source, device_xname(self),
-                         RND_TYPE_RNG, RND_FLAG_NO_ESTIMATE);
+                         RND_TYPE_RNG, RND_FLAG_COLLECT_VALUE);
 
        /* Install a periodic collector for the "true" (AMD's word) RNG */
        callout_init(&sc->sc_co, 0);
@@ -279,7 +279,8 @@
        status = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SB_RANDOM_NUM_STATUS);
        if (status & SB_RNS_TRNG_VALID) {
                value = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SB_RANDOM_NUM);
-               rnd_add_uint32(&sc->sc_rnd_source, value);
+               rnd_add_data(&sc->sc_rnd_source, &value, sizeof(value),
+                            sizeof(value) * NBBY);
        }
 
        callout_schedule(&sc->sc_co, (hz > 100) ? (hz / 100) : 1);
Index: src/sys/arch/macppc/dev/if_gm.c
diff -u src/sys/arch/macppc/dev/if_gm.c:1.43 
src/sys/arch/macppc/dev/if_gm.c:1.43.2.1
--- src/sys/arch/macppc/dev/if_gm.c:1.43        Sat Mar 29 19:28:29 2014
+++ src/sys/arch/macppc/dev/if_gm.c     Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gm.c,v 1.43 2014/03/29 19:28:29 christos Exp $      */
+/*     $NetBSD: if_gm.c,v 1.43.2.1 2014/04/07 03:37:31 tls Exp $       */
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.43 2014/03/29 19:28:29 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.43.2.1 2014/04/07 03:37:31 tls Exp $");
 
 #include "opt_inet.h"
 
@@ -248,7 +248,8 @@
 
        if_attach(ifp);
        ether_ifattach(ifp, laddr);
-       rnd_attach_source(&sc->sc_rnd_source, xname, RND_TYPE_NET, 0); 
+       rnd_attach_source(&sc->sc_rnd_source, xname, RND_TYPE_NET,
+                         RND_FLAG_DEFAULT); 
 }
 
 u_int
Index: src/sys/arch/mips/alchemy/dev/if_aumac.c
diff -u src/sys/arch/mips/alchemy/dev/if_aumac.c:1.37 
src/sys/arch/mips/alchemy/dev/if_aumac.c:1.37.12.1
--- src/sys/arch/mips/alchemy/dev/if_aumac.c:1.37       Sun Jul 22 14:32:51 2012
+++ src/sys/arch/mips/alchemy/dev/if_aumac.c    Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aumac.c,v 1.37 2012/07/22 14:32:51 matt Exp $ */
+/* $NetBSD: if_aumac.c,v 1.37.12.1 2014/04/07 03:37:31 tls Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.37 2012/07/22 14:32:51 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.37.12.1 2014/04/07 03:37:31 tls Exp 
$");
 
 
 
@@ -341,7 +341,7 @@
        ether_ifattach(ifp, enaddr);
 
        rnd_attach_source(&sc->rnd_source, device_xname(self),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
 #ifdef AUMAC_EVENT_COUNTERS
        evcnt_attach_dynamic(&sc->sc_ev_txstall, EVCNT_TYPE_MISC,
Index: src/sys/arch/mips/atheros/dev/if_ae.c
diff -u src/sys/arch/mips/atheros/dev/if_ae.c:1.24 
src/sys/arch/mips/atheros/dev/if_ae.c:1.24.10.1
--- src/sys/arch/mips/atheros/dev/if_ae.c:1.24  Sat Oct 27 17:18:02 2012
+++ src/sys/arch/mips/atheros/dev/if_ae.c       Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/* $Id: if_ae.c,v 1.24 2012/10/27 17:18:02 chs Exp $ */
+/* $Id: if_ae.c,v 1.24.10.1 2014/04/07 03:37:31 tls Exp $ */
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
  * Copyright (c) 2006 Garrett D'Amore.
@@ -98,7 +98,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.24 2012/10/27 17:18:02 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.24.10.1 2014/04/07 03:37:31 tls Exp 
$");
 
 
 #include <sys/param.h>
@@ -387,7 +387,7 @@
        ether_set_ifflags_cb(&sc->sc_ethercom, ae_ifflags_cb);
 
        rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        /*
         * Make sure the interface is shutdown during reboot.
Index: src/sys/arch/mips/sibyte/dev/sbscn.c
diff -u src/sys/arch/mips/sibyte/dev/sbscn.c:1.38 
src/sys/arch/mips/sibyte/dev/sbscn.c:1.38.2.1
--- src/sys/arch/mips/sibyte/dev/sbscn.c:1.38   Sun Mar 16 05:20:25 2014
+++ src/sys/arch/mips/sibyte/dev/sbscn.c        Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: sbscn.c,v 1.38 2014/03/16 05:20:25 dholland Exp $ */
+/* $NetBSD: sbscn.c,v 1.38.2.1 2014/04/07 03:37:31 tls Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -109,7 +109,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.38 2014/03/16 05:20:25 dholland Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.38.2.1 2014/04/07 03:37:31 tls Exp $");
 
 #define        SBSCN_DEBUG
 
@@ -393,7 +393,8 @@
 
 #ifdef RND_SBSCN
        rnd_attach_source(&ch->ch_rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_TTY, 0);
+                         RND_TYPE_TTY, RND_FLAG_COLLECT_TIME|
+                                       RND_FLAG_ESTIMATE_TIME);
 #endif
 
        sbscn_config(ch);
Index: src/sys/arch/next68k/dev/mb8795.c
diff -u src/sys/arch/next68k/dev/mb8795.c:1.52 
src/sys/arch/next68k/dev/mb8795.c:1.52.2.1
--- src/sys/arch/next68k/dev/mb8795.c:1.52      Mon Mar 24 20:01:03 2014
+++ src/sys/arch/next68k/dev/mb8795.c   Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: mb8795.c,v 1.52 2014/03/24 20:01:03 christos Exp $     */
+/*     $NetBSD: mb8795.c,v 1.52.2.1 2014/04/07 03:37:31 tls Exp $      */
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.52 2014/03/24 20:01:03 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.52.2.1 2014/04/07 03:37:31 tls Exp 
$");
 
 #include "opt_inet.h"
 
@@ -138,7 +138,7 @@
     panic("mb8795_config: can't establish shutdownhook");
 
   rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                    RND_TYPE_NET, 0);
+                    RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        DPRINTF(("%s: leaving mb8795_config()\n",device_xname(sc->sc_dev)));
 }
Index: src/sys/arch/playstation2/dev/if_smap.c
diff -u src/sys/arch/playstation2/dev/if_smap.c:1.15 
src/sys/arch/playstation2/dev/if_smap.c:1.15.2.1
--- src/sys/arch/playstation2/dev/if_smap.c:1.15        Mon Mar 31 11:25:49 2014
+++ src/sys/arch/playstation2/dev/if_smap.c     Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_smap.c,v 1.15 2014/03/31 11:25:49 martin Exp $      */
+/*     $NetBSD: if_smap.c,v 1.15.2.1 2014/04/07 03:37:31 tls Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.15 2014/03/31 11:25:49 martin Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.15.2.1 2014/04/07 03:37:31 tls Exp 
$");
 
 #include "debug_playstation2.h"
 
@@ -263,7 +263,7 @@
 
 #if NRND > 0
        rnd_attach_source(&sc->rnd_source, DEVNAME,
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 #endif
 }
 
Index: src/sys/arch/sgimips/mace/if_mec.c
diff -u src/sys/arch/sgimips/mace/if_mec.c:1.49 
src/sys/arch/sgimips/mace/if_mec.c:1.49.12.1
--- src/sys/arch/sgimips/mace/if_mec.c:1.49     Sun Jul 22 14:32:53 2012
+++ src/sys/arch/sgimips/mace/if_mec.c  Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mec.c,v 1.49 2012/07/22 14:32:53 matt Exp $ */
+/* $NetBSD: if_mec.c,v 1.49.12.1 2014/04/07 03:37:31 tls Exp $ */
 
 /*-
  * Copyright (c) 2004, 2008 Izumi Tsutsui.  All rights reserved.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.49 2012/07/22 14:32:53 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.49.12.1 2014/04/07 03:37:31 tls Exp 
$");
 
 #include "opt_ddb.h"
 
@@ -620,7 +620,7 @@
        cpu_intr_establish(maa->maa_intr, maa->maa_intrmask, mec_intr, sc);
 
        rnd_attach_source(&sc->sc_rnd_source, device_xname(self),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
 #ifdef MEC_EVENT_COUNTERS
        evcnt_attach_dynamic(&sc->sc_ev_txpkts , EVCNT_TYPE_MISC,
Index: src/sys/arch/sun2/dev/if_ec.c
diff -u src/sys/arch/sun2/dev/if_ec.c:1.20 
src/sys/arch/sun2/dev/if_ec.c:1.20.20.1
--- src/sys/arch/sun2/dev/if_ec.c:1.20  Thu Feb  2 19:43:00 2012
+++ src/sys/arch/sun2/dev/if_ec.c       Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ec.c,v 1.20 2012/02/02 19:43:00 tls Exp $   */
+/*     $NetBSD: if_ec.c,v 1.20.20.1 2014/04/07 03:37:31 tls Exp $      */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.20 2012/02/02 19:43:00 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.20.20.1 2014/04/07 03:37:31 tls Exp 
$");
 
 #include "opt_inet.h"
 #include "opt_ns.h"
@@ -245,7 +245,7 @@
            ec_intr, sc);
 
        rnd_attach_source(&sc->rnd_source, device_xname(self),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 }
 
 /*
Index: src/sys/arch/x68k/dev/fd.c
diff -u src/sys/arch/x68k/dev/fd.c:1.108 src/sys/arch/x68k/dev/fd.c:1.108.2.1
--- src/sys/arch/x68k/dev/fd.c:1.108    Wed Mar 26 08:17:59 2014
+++ src/sys/arch/x68k/dev/fd.c  Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.108 2014/03/26 08:17:59 christos Exp $        */
+/*     $NetBSD: fd.c,v 1.108.2.1 2014/04/07 03:37:31 tls Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.108 2014/03/26 08:17:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.108.2.1 2014/04/07 03:37:31 tls Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m68k_arch.h"
@@ -660,7 +660,7 @@
        mountroothook_establish(fd_mountroot_hook, fd->sc_dev);
 
        rnd_attach_source(&fd->rnd_source, device_xname(fd->sc_dev),
-           RND_TYPE_DISK, 0);
+           RND_TYPE_DISK, RND_FLAG_DEFAULT);
 }
 
 struct fd_type *
Index: src/sys/arch/x86/pci/fwhrng.c
diff -u src/sys/arch/x86/pci/fwhrng.c:1.6 src/sys/arch/x86/pci/fwhrng.c:1.6.2.1
--- src/sys/arch/x86/pci/fwhrng.c:1.6   Thu Oct 17 21:12:24 2013
+++ src/sys/arch/x86/pci/fwhrng.c       Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: fwhrng.c,v 1.6 2013/10/17 21:12:24 christos Exp $      */
+/*     $NetBSD: fwhrng.c,v 1.6.2.1 2014/04/07 03:37:31 tls Exp $       */
 
 /*
  * Copyright (c) 2000 Michael Shalayeff
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fwhrng.c,v 1.6 2013/10/17 21:12:24 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: fwhrng.c,v 1.6.2.1 2014/04/07 03:37:31 tls Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -194,7 +194,7 @@
        callout_init(&sc->sc_rnd_ch, 0);
        /* FWH is polled for entropy, so no estimate is available. */
        rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_RNG, RND_FLAG_NO_ESTIMATE);
+           RND_TYPE_RNG, RND_FLAG_COLLECT_VALUE);
        sc->sc_rnd_i = sizeof(sc->sc_rnd_ax);
        fwhrng_callout(sc);
 
Index: src/sys/arch/x86/x86/ipmi.c
diff -u src/sys/arch/x86/x86/ipmi.c:1.56 src/sys/arch/x86/x86/ipmi.c:1.56.2.1
--- src/sys/arch/x86/x86/ipmi.c:1.56    Thu Oct 17 20:58:55 2013
+++ src/sys/arch/x86/x86/ipmi.c Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipmi.c,v 1.56 2013/10/17 20:58:55 christos Exp $ */
+/*     $NetBSD: ipmi.c,v 1.56.2.1 2014/04/07 03:37:31 tls Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.56 2013/10/17 20:58:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.56.2.1 2014/04/07 03:37:31 tls Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1511,10 +1511,6 @@
                val = 0;
                break;
        }
-       if (val != psensor->i_prevval) {
-               rnd_add_uint32(&psensor->i_rnd, val);
-               psensor->i_prevval = val;
-       }
        return val;
 }
 
@@ -1811,7 +1807,7 @@
        char                    *e;
        struct ipmi_sensor      *psensor;
        struct sdrtype1         *s1 = (struct sdrtype1 *)psdr;
-
+       
        typ = ipmi_sensor_type(sensor_type, ext_type, entity);
        if (typ == -1) {
                dbg_printf(5, "Unknown sensor type:%.2x et:%.2x sn:%.2x "
@@ -1868,22 +1864,6 @@
                                 ipmi_is_dupname(psensor->i_envdesc));
                }
 
-               /*
-                * Add entropy source.
-                */
-               switch (psensor->i_envtype) {
-                   case ENVSYS_STEMP:
-                   case ENVSYS_SFANRPM:
-                       rnd_attach_source(&psensor->i_rnd,
-                                         psensor->i_envdesc,
-                                         RND_TYPE_ENV, 0);
-                       break;
-                   default:    /* XXX intrusion sensors? */
-                       rnd_attach_source(&psensor->i_rnd,
-                                         psensor->i_envdesc,
-                                         RND_TYPE_POWER, 0);
-               }
-                   
                dbg_printf(5, "add sensor:%.4x %.2x:%d ent:%.2x:%.2x %s\n",
                    s1->sdrhdr.record_id, s1->sensor_type,
                    typ, s1->entity_id, s1->entity_instance,
@@ -2078,6 +2058,7 @@
                ipmi_s->i_envnum = -1;
                sc->sc_sensor[i].units = ipmi_s->i_envtype;
                sc->sc_sensor[i].state = ENVSYS_SINVALID;
+               sc->sc_sensor[i].flags |= ENVSYS_FHAS_ENTROPY;
                /*
                 * Monitor threshold limits in the sensors.
                 */
Index: src/sys/arch/x86/x86/via_padlock.c
diff -u src/sys/arch/x86/x86/via_padlock.c:1.21 
src/sys/arch/x86/x86/via_padlock.c:1.21.20.1
--- src/sys/arch/x86/x86/via_padlock.c:1.21     Thu Feb  2 19:43:01 2012
+++ src/sys/arch/x86/x86/via_padlock.c  Mon Apr  7 03:37:31 2014
@@ -1,5 +1,5 @@
 /*     $OpenBSD: via.c,v 1.8 2006/11/17 07:47:56 tom Exp $     */
-/*     $NetBSD: via_padlock.c,v 1.21 2012/02/02 19:43:01 tls Exp $ */
+/*     $NetBSD: via_padlock.c,v 1.21.20.1 2014/04/07 03:37:31 tls Exp $ */
 
 /*-
  * Copyright (c) 2003 Jason Wright
@@ -20,7 +20,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: via_padlock.c,v 1.21 2012/02/02 19:43:01 tls Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: via_padlock.c,v 1.21.20.1 2014/04/07 03:37:31 tls 
Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -124,9 +124,8 @@
        } else {
            sc->sc_rnd_hz = 10;
        }
-       /* See hifn7751.c re use of RND_FLAG_NO_ESTIMATE */
        rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_RNG, RND_FLAG_NO_ESTIMATE);
+                         RND_TYPE_RNG, RND_FLAG_COLLECT_VALUE);
        callout_init(&sc->sc_rnd_co, 0);
        /* Call once to prime the pool early and set callout. */
        via_c3_rnd(sc);
Index: src/sys/arch/x86/x86/viac7temp.c
diff -u src/sys/arch/x86/x86/viac7temp.c:1.7 
src/sys/arch/x86/x86/viac7temp.c:1.7.2.1
--- src/sys/arch/x86/x86/viac7temp.c:1.7        Fri Nov 15 08:47:55 2013
+++ src/sys/arch/x86/x86/viac7temp.c    Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: viac7temp.c,v 1.7 2013/11/15 08:47:55 msaitoh Exp $ */
+/* $NetBSD: viac7temp.c,v 1.7.2.1 2014/04/07 03:37:31 tls Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.7 2013/11/15 08:47:55 msaitoh Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.7.2.1 2014/04/07 03:37:31 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -96,7 +96,7 @@
        sc->sc_dev = self;
 
        sc->sc_sensor.units = ENVSYS_STEMP;
-       sc->sc_sensor.flags = ENVSYS_FMONLIMITS;
+       sc->sc_sensor.flags = ENVSYS_FMONLIMITS|ENVSYS_FHAS_ENTROPY;
        sc->sc_sensor.state = ENVSYS_SINVALID;
 
        (void)strlcpy(sc->sc_sensor.desc, "temperature",
Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.62 
src/sys/arch/xen/xen/if_xennet_xenbus.c:1.62.12.1
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.62        Sat Jun 30 23:36:20 2012
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c     Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/*      $NetBSD: if_xennet_xenbus.c,v 1.62 2012/06/30 23:36:20 jym Exp $      
*/
+/*      $NetBSD: if_xennet_xenbus.c,v 1.62.12.1 2014/04/07 03:37:31 tls Exp $  
    */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -85,7 +85,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.62 2012/06/30 23:36:20 jym 
Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.62.12.1 2014/04/07 03:37:31 
tls Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -401,7 +401,7 @@
        }
 
        rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        if (!pmf_device_register(self, xennet_xenbus_suspend,
            xennet_xenbus_resume))
Index: src/sys/arch/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.62 
src/sys/arch/xen/xen/xbd_xenbus.c:1.62.2.1
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.62      Sun Mar 16 05:20:26 2014
+++ src/sys/arch/xen/xen/xbd_xenbus.c   Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbd_xenbus.c,v 1.62 2014/03/16 05:20:26 dholland Exp $      */
+/*      $NetBSD: xbd_xenbus.c,v 1.62.2.1 2014/04/07 03:37:31 tls Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.62 2014/03/16 05:20:26 dholland 
Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.62.2.1 2014/04/07 03:37:31 tls 
Exp $");
 
 #include "opt_xen.h"
 
@@ -315,8 +315,8 @@
                return;
        }
 
-       rnd_attach_source(&sc->sc_rnd_source, device_xname(self),
-           RND_TYPE_DISK, RND_FLAG_NO_COLLECT | RND_FLAG_NO_ESTIMATE);
+       nnd_attach_source(&sc->sc_rnd_source, device_xname(self),
+           RND_TYPE_DISK);
 
        if (!pmf_device_register(self, xbd_xenbus_suspend, xbd_xenbus_resume))
                aprint_error_dev(self, "couldn't establish power handler\n");
Index: src/sys/dev/ld.c
diff -u src/sys/dev/ld.c:1.72 src/sys/dev/ld.c:1.72.2.1
--- src/sys/dev/ld.c:1.72       Sun Mar 16 05:20:26 2014
+++ src/sys/dev/ld.c    Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld.c,v 1.72 2014/03/16 05:20:26 dholland Exp $ */
+/*     $NetBSD: ld.c,v 1.72.2.1 2014/04/07 03:37:31 tls Exp $  */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.72 2014/03/16 05:20:26 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.72.2.1 2014/04/07 03:37:31 tls Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -162,7 +162,7 @@
 
        /* Attach the device into the rnd source list. */
        rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dv),
-           RND_TYPE_DISK, 0);
+           RND_TYPE_DISK, RND_FLAG_DEFAULT);
 
        /* Register with PMF */
        if (!pmf_device_register1(sc->sc_dv, ld_suspend, NULL, ld_shutdown))
Index: src/sys/dev/rndpseudo.c
diff -u src/sys/dev/rndpseudo.c:1.19 src/sys/dev/rndpseudo.c:1.19.2.1
--- src/sys/dev/rndpseudo.c:1.19        Sun Mar 16 05:20:26 2014
+++ src/sys/dev/rndpseudo.c     Mon Apr  7 02:54:53 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: rndpseudo.c,v 1.19 2014/03/16 05:20:26 dholland Exp $  */
+/*     $NetBSD: rndpseudo.c,v 1.19.2.1 2014/04/07 02:54:53 tls Exp $   */
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rndpseudo.c,v 1.19 2014/03/16 05:20:26 dholland 
Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rndpseudo.c,v 1.19.2.1 2014/04/07 02:54:53 tls Exp 
$");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -514,12 +514,27 @@
         r->flags = kr->flags;
 }
 
+static void
+krndsource_to_rndsource_est(krndsource_t *kr, rndsource_est_t *re)
+{
+       memset(re, 0, sizeof(*re));
+       krndsource_to_rndsource(kr, &re->rt);
+       re->dt_samples = kr->time_delta.insamples;
+       re->dt_total = kr->time_delta.outbits;
+       re->dv_samples = kr->value_delta.insamples;
+       re->dv_total = kr->value_delta.outbits;
+       re->lzv_bytes = kr->lz_v.inbytes;
+       re->lzv_total = kr->lz_v.outbits;
+}
+
 int
 rnd_ioctl(struct file *fp, u_long cmd, void *addr)
 {
        krndsource_t *kr;
        rndstat_t *rst;
        rndstat_name_t *rstnm;
+       rndstat_est_t *rset;
+       rndstat_est_name_t *rsetnm;
        rndctl_t *rctl;
        rnddata_t *rnddata;
        u_int32_t count, start;
@@ -535,6 +550,8 @@
        case RNDGETPOOLSTAT:
        case RNDGETSRCNUM:
        case RNDGETSRCNAME:
+       case RNDGETESTNUM:
+       case RNDGETESTNAME:
                ret = kauth_authorize_device(curlwp->l_cred,
                    KAUTH_DEVICE_RND_GETPRIV, NULL, NULL, NULL, NULL);
                if (ret)
@@ -623,6 +640,41 @@
                mutex_spin_exit(&rndpool_mtx);
                break;
 
+       case RNDGETESTNUM:
+               rset = (rndstat_est_t *)addr;
+
+               if (rset->count == 0)
+                       break;
+
+               if (rset->count > RND_MAXSTATCOUNT)
+                       return (EINVAL);
+
+               mutex_spin_enter(&rndpool_mtx);
+               /*
+                * Find the starting source by running through the
+                * list of sources.
+                */
+               kr = rnd_sources.lh_first;
+               start = rset->start;
+               while (kr != NULL && start > 1) {
+                       kr = kr->list.le_next;
+                       start--;
+               }
+
+               /* Return up to as many structures as the user asked
+                * for.  If we run out of sources, a count of zero
+                * will be returned, without an error.
+                */
+               for (count = 0; count < rset->count && kr != NULL; count++) {
+                       krndsource_to_rndsource_est(kr, &rset->source[count]);
+                       kr = kr->list.le_next;
+               }
+
+               rset->count = count;
+
+               mutex_spin_exit(&rndpool_mtx);
+               break;
+
        case RNDGETSRCNAME:
                /*
                 * Scan through the list, trying to find the name.
@@ -633,7 +685,7 @@
                while (kr != NULL) {
                        if (strncmp(kr->name, rstnm->name,
                                    MIN(sizeof(kr->name),
-                                       sizeof(*rstnm))) == 0) {
+                                       sizeof(rstnm->name))) == 0) {
                                krndsource_to_rndsource(kr, &rstnm->source);
                                mutex_spin_exit(&rndpool_mtx);
                                return (0);
@@ -646,6 +698,30 @@
 
                break;
 
+       case RNDGETESTNAME:
+               /*
+                * Scan through the list, trying to find the name.
+                */
+               mutex_spin_enter(&rndpool_mtx);
+               rsetnm = (rndstat_est_name_t *)addr;
+               kr = rnd_sources.lh_first;
+               while (kr != NULL) {
+                       if (strncmp(kr->name, rsetnm->name,
+                                   MIN(sizeof(kr->name),
+                                       sizeof(rsetnm->name))) == 0) {
+                               krndsource_to_rndsource_est(kr,
+                                                           &rsetnm->source);
+                               mutex_spin_exit(&rndpool_mtx);
+                               return (0);
+                       }
+                       kr = kr->list.le_next;
+               }
+               mutex_spin_exit(&rndpool_mtx);
+
+               ret = ENOENT;           /* name not found */
+
+               break;
+
        case RNDCTL:
                /*
                 * Set flags to enable/disable entropy counting and/or
@@ -662,9 +738,11 @@
                        while (kr != NULL) {
                                if (kr->type == rctl->type) {
                                        kr->flags &= ~rctl->mask;
+
                                        kr->flags |=
                                            (rctl->flags & rctl->mask);
                                }
+
                                kr = kr->list.le_next;
                        }
                        mutex_spin_exit(&rndpool_mtx);
@@ -680,7 +758,7 @@
                                         sizeof(rctl->name))) == 0) {
                                kr->flags &= ~rctl->mask;
                                kr->flags |= (rctl->flags & rctl->mask);
-                               
+
                                mutex_spin_exit(&rndpool_mtx);
                                return (0);
                        }
Index: src/sys/dev/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.407 src/sys/dev/ata/wd.c:1.407.2.1
--- src/sys/dev/ata/wd.c:1.407  Sun Mar 16 05:20:27 2014
+++ src/sys/dev/ata/wd.c        Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.407 2014/03/16 05:20:27 dholland Exp $ */
+/*     $NetBSD: wd.c,v 1.407.2.1 2014/04/07 03:37:31 tls Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.407 2014/03/16 05:20:27 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.407.2.1 2014/04/07 03:37:31 tls Exp $");
 
 #include "opt_ata.h"
 
@@ -406,7 +406,7 @@
        disk_attach(&wd->sc_dk);
        wd->sc_wdc_bio.lp = wd->sc_dk.dk_label;
        rnd_attach_source(&wd->rnd_source, device_xname(wd->sc_dev),
-                         RND_TYPE_DISK, 0);
+                         RND_TYPE_DISK, RND_FLAG_DEFAULT);
 
        /* Discover wedges on this disk. */
        dkwedge_discover(&wd->sc_dk);
Index: src/sys/dev/gpib/rd.c
diff -u src/sys/dev/gpib/rd.c:1.33 src/sys/dev/gpib/rd.c:1.33.2.1
--- src/sys/dev/gpib/rd.c:1.33  Sun Mar 23 03:41:10 2014
+++ src/sys/dev/gpib/rd.c       Mon Apr  7 03:37:31 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: rd.c,v 1.33 2014/03/23 03:41:10 christos Exp $ */
+/*     $NetBSD: rd.c,v 1.33.2.1 2014/04/07 03:37:31 tls Exp $ */
 
 /*-
  * Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.33 2014/03/23 03:41:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.33.2.1 2014/04/07 03:37:31 tls Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -426,7 +426,7 @@
         * attach the device into the random source list
         */
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_DISK, 0);
+                         RND_TYPE_DISK, RND_FLAG_DEFAULT);
 }
 
 /*
Index: src/sys/dev/i2c/dbcool.c
diff -u src/sys/dev/i2c/dbcool.c:1.40 src/sys/dev/i2c/dbcool.c:1.40.2.1
--- src/sys/dev/i2c/dbcool.c:1.40       Tue Feb 25 18:30:09 2014
+++ src/sys/dev/i2c/dbcool.c    Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: dbcool.c,v 1.40 2014/02/25 18:30:09 pooka Exp $ */
+/*     $NetBSD: dbcool.c,v 1.40.2.1 2014/04/07 03:37:32 tls Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.40 2014/02/25 18:30:09 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.40.2.1 2014/04/07 03:37:32 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1606,6 +1606,7 @@
                        sc->sc_sensor[i].units = ENVSYS_STEMP;
                        sc->sc_sensor[i].state = ENVSYS_SINVALID;
                        sc->sc_sensor[i].flags |= ENVSYS_FMONLIMITS;
+                       sc->sc_sensor[i].flags |= ENVSYS_FHAS_ENTROPY;
                        error = dbcool_attach_sensor(sc, i);
                        break;
                case DBC_VOLT:
@@ -1622,12 +1623,14 @@
                        sc->sc_sensor[i].units = ENVSYS_SVOLTS_DC;
                        sc->sc_sensor[i].state = ENVSYS_SINVALID;
                        sc->sc_sensor[i].flags |= ENVSYS_FMONLIMITS;
+                       sc->sc_sensor[i].flags |= ENVSYS_FHAS_ENTROPY;
                        error = dbcool_attach_sensor(sc, i);
                        break;
                case DBC_FAN:
                        sc->sc_sensor[i].units = ENVSYS_SFANRPM;
                        sc->sc_sensor[i].state = ENVSYS_SINVALID;
                        sc->sc_sensor[i].flags |= ENVSYS_FMONLIMITS;
+                       sc->sc_sensor[i].flags |= ENVSYS_FHAS_ENTROPY;
                        error = dbcool_attach_sensor(sc, i);
                        break;
                case DBC_VID:
Index: src/sys/dev/ic/com.c
diff -u src/sys/dev/ic/com.c:1.323 src/sys/dev/ic/com.c:1.323.2.1
--- src/sys/dev/ic/com.c:1.323  Sun Mar 16 05:20:27 2014
+++ src/sys/dev/ic/com.c        Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.323 2014/03/16 05:20:27 dholland Exp $ */
+/* $NetBSD: com.c,v 1.323.2.1 2014/04/07 03:37:32 tls Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.323 2014/03/16 05:20:27 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.323.2.1 2014/04/07 03:37:32 tls Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -627,7 +627,7 @@
 
 #ifdef RND_COM
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_TTY, 0);
+                         RND_TYPE_TTY, RND_FLAG_DEFAULT);
 #endif
 
        /* if there are no enable/disable functions, assume the device
Index: src/sys/dev/ic/cs89x0.c
diff -u src/sys/dev/ic/cs89x0.c:1.33 src/sys/dev/ic/cs89x0.c:1.33.20.1
--- src/sys/dev/ic/cs89x0.c:1.33        Thu Feb  2 19:43:03 2012
+++ src/sys/dev/ic/cs89x0.c     Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: cs89x0.c,v 1.33 2012/02/02 19:43:03 tls Exp $  */
+/*     $NetBSD: cs89x0.c,v 1.33.20.1 2014/04/07 03:37:32 tls Exp $     */
 
 /*
  * Copyright (c) 2004 Christopher Gilbert
@@ -212,7 +212,7 @@
 */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cs89x0.c,v 1.33 2012/02/02 19:43:03 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs89x0.c,v 1.33.20.1 2014/04/07 03:37:32 tls Exp 
$");
 
 #include "opt_inet.h"
 
@@ -489,7 +489,7 @@
        ether_ifattach(ifp, sc->sc_enaddr);
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
        sc->sc_cfgflags |= CFGFLG_ATTACHED;
 
        if (pmf_device_register1(sc->sc_dev, NULL, NULL, cs_shutdown))
Index: src/sys/dev/ic/dp8390.c
diff -u src/sys/dev/ic/dp8390.c:1.80 src/sys/dev/ic/dp8390.c:1.80.20.1
--- src/sys/dev/ic/dp8390.c:1.80        Thu Feb  2 19:43:03 2012
+++ src/sys/dev/ic/dp8390.c     Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: dp8390.c,v 1.80 2012/02/02 19:43:03 tls Exp $  */
+/*     $NetBSD: dp8390.c,v 1.80.20.1 2014/04/07 03:37:32 tls Exp $     */
 
 /*
  * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -14,7 +14,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.80 2012/02/02 19:43:03 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.80.20.1 2014/04/07 03:37:32 tls Exp 
$");
 
 #include "opt_ipkdb.h"
 #include "opt_inet.h"
@@ -154,7 +154,7 @@
        ether_ifattach(ifp, sc->sc_enaddr);
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        /* The attach is successful. */
        sc->sc_flags |= DP8390_ATTACHED;
Index: src/sys/dev/ic/elink3.c
diff -u src/sys/dev/ic/elink3.c:1.134 src/sys/dev/ic/elink3.c:1.134.10.1
--- src/sys/dev/ic/elink3.c:1.134       Sat Oct 27 17:18:20 2012
+++ src/sys/dev/ic/elink3.c     Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: elink3.c,v 1.134 2012/10/27 17:18:20 chs Exp $ */
+/*     $NetBSD: elink3.c,v 1.134.10.1 2014/04/07 03:37:32 tls Exp $    */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.134 2012/10/27 17:18:20 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.134.10.1 2014/04/07 03:37:32 tls Exp 
$");
 
 #include "opt_inet.h"
 
@@ -488,7 +488,7 @@
        GO_WINDOW(1);           /* Window 1 is operating window */
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        sc->tx_start_thresh = 20;       /* probably a good starting point. */
 
Index: src/sys/dev/ic/elinkxl.c
diff -u src/sys/dev/ic/elinkxl.c:1.115 src/sys/dev/ic/elinkxl.c:1.115.12.1
--- src/sys/dev/ic/elinkxl.c:1.115      Sun Jul 22 14:32:57 2012
+++ src/sys/dev/ic/elinkxl.c    Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: elinkxl.c,v 1.115 2012/07/22 14:32:57 matt Exp $       */
+/*     $NetBSD: elinkxl.c,v 1.115.12.1 2014/04/07 03:37:32 tls Exp $   */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.115 2012/07/22 14:32:57 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.115.12.1 2014/04/07 03:37:32 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -437,7 +437,7 @@
        /* TODO: set queues to 0 */
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        if (pmf_device_register1(sc->sc_dev, NULL, NULL, ex_shutdown))
                pmf_class_network_register(sc->sc_dev, &sc->sc_ethercom.ec_if);
Index: src/sys/dev/ic/gem.c
diff -u src/sys/dev/ic/gem.c:1.101 src/sys/dev/ic/gem.c:1.101.10.1
--- src/sys/dev/ic/gem.c:1.101  Mon Feb  4 18:29:55 2013
+++ src/sys/dev/ic/gem.c        Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: gem.c,v 1.101 2013/02/04 18:29:55 jdc Exp $ */
+/*     $NetBSD: gem.c,v 1.101.10.1 2014/04/07 03:37:32 tls Exp $ */
 
 /*
  *
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.101 2013/02/04 18:29:55 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.101.10.1 2014/04/07 03:37:32 tls Exp $");
 
 #include "opt_inet.h"
 
@@ -581,7 +581,7 @@
        ether_set_ifflags_cb(&sc->sc_ethercom, gem_ifflags_cb);
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        evcnt_attach_dynamic(&sc->sc_ev_intr, EVCNT_TYPE_INTR,
            NULL, device_xname(sc->sc_dev), "interrupts");
Index: src/sys/dev/ic/hme.c
diff -u src/sys/dev/ic/hme.c:1.89 src/sys/dev/ic/hme.c:1.89.12.1
--- src/sys/dev/ic/hme.c:1.89   Sun Jul 22 14:32:57 2012
+++ src/sys/dev/ic/hme.c        Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: hme.c,v 1.89 2012/07/22 14:32:57 matt Exp $    */
+/*     $NetBSD: hme.c,v 1.89.12.1 2014/04/07 03:37:32 tls Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.89 2012/07/22 14:32:57 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.89.12.1 2014/04/07 03:37:32 tls Exp $");
 
 /* #define HMEDEBUG */
 
@@ -315,7 +315,7 @@
                    "couldn't establish power handler\n");
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        callout_init(&sc->sc_tick_ch, 0);
 }
Index: src/sys/dev/ic/i82557.c
diff -u src/sys/dev/ic/i82557.c:1.141 src/sys/dev/ic/i82557.c:1.141.2.1
--- src/sys/dev/ic/i82557.c:1.141       Thu Sep 12 20:40:46 2013
+++ src/sys/dev/ic/i82557.c     Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82557.c,v 1.141 2013/09/12 20:40:46 martin Exp $      */
+/*     $NetBSD: i82557.c,v 1.141.2.1 2014/04/07 03:37:32 tls Exp $     */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.141 2013/09/12 20:40:46 martin Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.141.2.1 2014/04/07 03:37:32 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -409,7 +409,7 @@
        if_attach(ifp);
        ether_ifattach(ifp, enaddr);
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
 #ifdef FXP_EVENT_COUNTERS
        evcnt_attach_dynamic(&sc->sc_ev_txstall, EVCNT_TYPE_MISC,
Index: src/sys/dev/ic/lan9118.c
diff -u src/sys/dev/ic/lan9118.c:1.16 src/sys/dev/ic/lan9118.c:1.16.12.1
--- src/sys/dev/ic/lan9118.c:1.16       Sun Jul 22 14:32:57 2012
+++ src/sys/dev/ic/lan9118.c    Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: lan9118.c,v 1.16 2012/07/22 14:32:57 matt Exp $        */
+/*     $NetBSD: lan9118.c,v 1.16.12.1 2014/04/07 03:37:32 tls Exp $    */
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.16 2012/07/22 14:32:57 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.16.12.1 2014/04/07 03:37:32 tls Exp 
$");
 
 /*
  * The LAN9118 Family
@@ -279,7 +279,7 @@
        callout_init(&sc->sc_tick, 0);
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
        return 0;
 }
 
Index: src/sys/dev/ic/lance.c
diff -u src/sys/dev/ic/lance.c:1.46 src/sys/dev/ic/lance.c:1.46.20.1
--- src/sys/dev/ic/lance.c:1.46 Thu Feb  2 19:43:03 2012
+++ src/sys/dev/ic/lance.c      Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: lance.c,v 1.46 2012/02/02 19:43:03 tls Exp $   */
+/*     $NetBSD: lance.c,v 1.46.20.1 2014/04/07 03:37:32 tls Exp $      */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.46 2012/02/02 19:43:03 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.46.20.1 2014/04/07 03:37:32 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -255,7 +255,7 @@
                                        M_WAITOK);
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
 }
 
 void
Index: src/sys/dev/ic/lemac.c
diff -u src/sys/dev/ic/lemac.c:1.41 src/sys/dev/ic/lemac.c:1.41.10.1
--- src/sys/dev/ic/lemac.c:1.41 Sat Oct 27 17:18:21 2012
+++ src/sys/dev/ic/lemac.c      Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: lemac.c,v 1.41 2012/10/27 17:18:21 chs Exp $ */
+/* $NetBSD: lemac.c,v 1.41.10.1 2014/04/07 03:37:32 tls Exp $ */
 
 /*-
  * Copyright (c) 1994, 1995, 1997 Matt Thomas <matt%3am-software.com@localhost>
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lemac.c,v 1.41 2012/10/27 17:18:21 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lemac.c,v 1.41.10.1 2014/04/07 03:37:32 tls Exp 
$");
 
 #include "opt_inet.h"
 
@@ -1012,7 +1012,7 @@
        ether_ifattach(ifp, sc->sc_enaddr);
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        ifmedia_init(&sc->sc_ifmedia, 0,
                     lemac_ifmedia_change,
Index: src/sys/dev/ic/mb86950.c
diff -u src/sys/dev/ic/mb86950.c:1.20 src/sys/dev/ic/mb86950.c:1.20.10.1
--- src/sys/dev/ic/mb86950.c:1.20       Sat Oct 27 17:18:21 2012
+++ src/sys/dev/ic/mb86950.c    Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: mb86950.c,v 1.20 2012/10/27 17:18:21 chs Exp $ */
+/*     $NetBSD: mb86950.c,v 1.20.10.1 2014/04/07 03:37:32 tls Exp $    */
 
 /*
  * All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@@ -67,7 +67,7 @@
   */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.20 2012/10/27 17:18:21 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.20.10.1 2014/04/07 03:37:32 tls Exp 
$");
 
 /*
  * Device driver for Fujitsu mb86950 based Ethernet cards.
@@ -294,7 +294,7 @@
        ether_ifattach(ifp, sc->sc_enaddr);
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
 /* XXX No! This doesn't work - DLCR6 of the mb86950 is different
 
Index: src/sys/dev/ic/mb86960.c
diff -u src/sys/dev/ic/mb86960.c:1.79 src/sys/dev/ic/mb86960.c:1.79.6.1
--- src/sys/dev/ic/mb86960.c:1.79       Fri May 17 10:48:54 2013
+++ src/sys/dev/ic/mb86960.c    Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: mb86960.c,v 1.79 2013/05/17 10:48:54 mbalmer Exp $     */
+/*     $NetBSD: mb86960.c,v 1.79.6.1 2014/04/07 03:37:32 tls Exp $     */
 
 /*
  * All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.79 2013/05/17 10:48:54 mbalmer Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.79.6.1 2014/04/07 03:37:32 tls Exp 
$");
 
 /*
  * Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards.
@@ -250,7 +250,7 @@
        ether_ifattach(ifp, sc->sc_enaddr);
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        /* Print additional info when attached. */
        aprint_normal_dev(sc->sc_dev, "Ethernet address %s\n",
Index: src/sys/dev/ic/mtd803.c
diff -u src/sys/dev/ic/mtd803.c:1.28 src/sys/dev/ic/mtd803.c:1.28.2.1
--- src/sys/dev/ic/mtd803.c:1.28        Thu Oct 17 21:24:24 2013
+++ src/sys/dev/ic/mtd803.c     Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: mtd803.c,v 1.28 2013/10/17 21:24:24 christos Exp $ */
+/* $NetBSD: mtd803.c,v 1.28.2.1 2014/04/07 03:37:32 tls Exp $ */
 
 /*-
  *
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.28 2013/10/17 21:24:24 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.28.2.1 2014/04/07 03:37:32 tls Exp 
$");
 
 
 #include <sys/param.h>
@@ -177,7 +177,7 @@
 
        /* Initialise random source */
        rnd_attach_source(&sc->rnd_src, device_xname(sc->dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        /* Add shutdown hook to reset card when we reboot */
        sc->sd_hook = shutdownhook_establish(mtd_shutdown, sc);
Index: src/sys/dev/ic/pckbc.c
diff -u src/sys/dev/ic/pckbc.c:1.56 src/sys/dev/ic/pckbc.c:1.56.2.1
--- src/sys/dev/ic/pckbc.c:1.56 Sat Jan 11 20:17:56 2014
+++ src/sys/dev/ic/pckbc.c      Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: pckbc.c,v 1.56 2014/01/11 20:17:56 jakllsch Exp $ */
+/* $NetBSD: pckbc.c,v 1.56.2.1 2014/04/07 03:37:32 tls Exp $ */
 
 /*
  * Copyright (c) 2004 Ben Harris.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.56 2014/01/11 20:17:56 jakllsch Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.56.2.1 2014/04/07 03:37:32 tls Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -268,7 +268,7 @@
 
        if (child != NULL && t->t_slotdata[slot] != NULL)
                rnd_attach_source(&t->t_slotdata[slot]->rnd_source,
-                   device_xname(child), RND_TYPE_TTY, 0);
+                   device_xname(child), RND_TYPE_TTY, RND_FLAG_DEFAULT);
 
        return child != NULL;
 }
Index: src/sys/dev/ic/rtl8169.c
diff -u src/sys/dev/ic/rtl8169.c:1.139 src/sys/dev/ic/rtl8169.c:1.139.6.1
--- src/sys/dev/ic/rtl8169.c:1.139      Fri May 10 14:55:08 2013
+++ src/sys/dev/ic/rtl8169.c    Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtl8169.c,v 1.139 2013/05/10 14:55:08 tsutsui Exp $    */
+/*     $NetBSD: rtl8169.c,v 1.139.6.1 2014/04/07 03:37:32 tls Exp $    */
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.139 2013/05/10 14:55:08 tsutsui Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.139.6.1 2014/04/07 03:37:32 tls Exp 
$");
 /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 
ru Exp $ */
 
 /*
@@ -862,7 +862,7 @@
        ether_ifattach(ifp, eaddr);
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        if (pmf_device_register(sc->sc_dev, NULL, NULL))
                pmf_class_network_register(sc->sc_dev, ifp);
Index: src/sys/dev/ic/rtl81x9.c
diff -u src/sys/dev/ic/rtl81x9.c:1.94 src/sys/dev/ic/rtl81x9.c:1.94.12.1
--- src/sys/dev/ic/rtl81x9.c:1.94       Sun Jul 22 14:32:58 2012
+++ src/sys/dev/ic/rtl81x9.c    Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtl81x9.c,v 1.94 2012/07/22 14:32:58 matt Exp $        */
+/*     $NetBSD: rtl81x9.c,v 1.94.12.1 2014/04/07 03:37:32 tls Exp $    */
 
 /*
  * Copyright (c) 1997, 1998
@@ -86,7 +86,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.94 2012/07/22 14:32:58 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.94.12.1 2014/04/07 03:37:32 tls Exp 
$");
 
 
 #include <sys/param.h>
@@ -740,7 +740,7 @@
        ether_ifattach(ifp, eaddr);
 
        rnd_attach_source(&sc->rnd_source, device_xname(self),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        return;
  fail_4:
Index: src/sys/dev/ic/seeq8005.c
diff -u src/sys/dev/ic/seeq8005.c:1.51 src/sys/dev/ic/seeq8005.c:1.51.10.1
--- src/sys/dev/ic/seeq8005.c:1.51      Wed Oct 10 22:40:33 2012
+++ src/sys/dev/ic/seeq8005.c   Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: seeq8005.c,v 1.51 2012/10/10 22:40:33 skrll Exp $ */
+/* $NetBSD: seeq8005.c,v 1.51.10.1 2014/04/07 03:37:32 tls Exp $ */
 
 /*
  * Copyright (c) 2000, 2001 Ben Harris
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.51 2012/10/10 22:40:33 skrll Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.51.10.1 2014/04/07 03:37:32 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -293,7 +293,7 @@
 
        /* After \n because it can print a line of its own. */
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 }
 
 /*
Index: src/sys/dev/ic/smc91cxx.c
diff -u src/sys/dev/ic/smc91cxx.c:1.86 src/sys/dev/ic/smc91cxx.c:1.86.2.1
--- src/sys/dev/ic/smc91cxx.c:1.86      Sun Sep  8 14:27:39 2013
+++ src/sys/dev/ic/smc91cxx.c   Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: smc91cxx.c,v 1.86 2013/09/08 14:27:39 chs Exp $        */
+/*     $NetBSD: smc91cxx.c,v 1.86.2.1 2014/04/07 03:37:32 tls Exp $    */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smc91cxx.c,v 1.86 2013/09/08 14:27:39 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smc91cxx.c,v 1.86.2.1 2014/04/07 03:37:32 tls Exp 
$");
 
 #include "opt_inet.h"
 
@@ -376,7 +376,7 @@
        }
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        callout_init(&sc->sc_mii_callout, 0);
 
Index: src/sys/dev/ic/tulip.c
diff -u src/sys/dev/ic/tulip.c:1.183 src/sys/dev/ic/tulip.c:1.183.2.1
--- src/sys/dev/ic/tulip.c:1.183        Sun Sep 15 14:58:32 2013
+++ src/sys/dev/ic/tulip.c      Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: tulip.c,v 1.183 2013/09/15 14:58:32 martin Exp $       */
+/*     $NetBSD: tulip.c,v 1.183.2.1 2014/04/07 03:37:32 tls Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.183 2013/09/15 14:58:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.183.2.1 2014/04/07 03:37:32 tls Exp 
$");
 
 
 #include <sys/param.h>
@@ -524,7 +524,7 @@
        ether_set_ifflags_cb(&sc->sc_ethercom, tlp_ifflags_cb);
 
        rnd_attach_source(&sc->sc_rnd_source, device_xname(self),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        if (pmf_device_register(self, NULL, NULL))
                pmf_class_network_register(self, ifp);
Index: src/sys/dev/isa/fd.c
diff -u src/sys/dev/isa/fd.c:1.102 src/sys/dev/isa/fd.c:1.102.2.1
--- src/sys/dev/isa/fd.c:1.102  Sun Mar 16 05:20:28 2014
+++ src/sys/dev/isa/fd.c        Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.102 2014/03/16 05:20:28 dholland Exp $        */
+/*     $NetBSD: fd.c,v 1.102.2.1 2014/04/07 03:37:32 tls Exp $ */
 
 /*-
  * Copyright (c) 1998, 2003, 2008 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.102 2014/03/16 05:20:28 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.102.2.1 2014/04/07 03:37:32 tls Exp $");
 
 #include "opt_ddb.h"
 
@@ -585,7 +585,7 @@
            mountroothook_establish(fd_mountroot_hook, fd->sc_dev);
 
        rnd_attach_source(&fd->rnd_source, device_xname(fd->sc_dev),
-                         RND_TYPE_DISK, 0);
+                         RND_TYPE_DISK, RND_FLAG_DEFAULT);
 
        fd_set_geometry(fd);
 
Index: src/sys/dev/isa/if_eg.c
diff -u src/sys/dev/isa/if_eg.c:1.86 src/sys/dev/isa/if_eg.c:1.86.2.1
--- src/sys/dev/isa/if_eg.c:1.86        Fri Oct 18 08:09:37 2013
+++ src/sys/dev/isa/if_eg.c     Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_eg.c,v 1.86 2013/10/18 08:09:37 apb Exp $   */
+/*     $NetBSD: if_eg.c,v 1.86.2.1 2014/04/07 03:37:32 tls Exp $       */
 
 /*
  * Copyright (c) 1993 Dean Huxley <dean%fsa.ca@localhost>
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.86 2013/10/18 08:09:37 apb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.86.2.1 2014/04/07 03:37:32 tls Exp $");
 
 #include "opt_inet.h"
 
@@ -465,7 +465,7 @@
            IST_EDGE, IPL_NET, egintr, sc);
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
 }
 
 void
Index: src/sys/dev/isa/if_el.c
diff -u src/sys/dev/isa/if_el.c:1.89 src/sys/dev/isa/if_el.c:1.89.10.1
--- src/sys/dev/isa/if_el.c:1.89        Sat Oct 27 17:18:24 2012
+++ src/sys/dev/isa/if_el.c     Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_el.c,v 1.89 2012/10/27 17:18:24 chs Exp $   */
+/*     $NetBSD: if_el.c,v 1.89.10.1 2014/04/07 03:37:32 tls Exp $      */
 
 /*
  * Copyright (c) 1994, Matthew E. Kimmel.  Permission is hereby granted
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.89 2012/10/27 17:18:24 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.89.10.1 2014/04/07 03:37:32 tls Exp 
$");
 
 #include "opt_inet.h"
 
@@ -255,7 +255,7 @@
 
        DPRINTF(("Attaching to random...\n"));
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        DPRINTF(("elattach() finished.\n"));
 }
Index: src/sys/dev/isa/if_iy.c
diff -u src/sys/dev/isa/if_iy.c:1.92 src/sys/dev/isa/if_iy.c:1.92.2.1
--- src/sys/dev/isa/if_iy.c:1.92        Fri Nov  8 03:12:17 2013
+++ src/sys/dev/isa/if_iy.c     Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_iy.c,v 1.92 2013/11/08 03:12:17 christos Exp $      */
+/*     $NetBSD: if_iy.c,v 1.92.2.1 2014/04/07 03:37:32 tls Exp $       */
 /* #define IYDEBUG */
 /* #define IYMEMDEBUG */
 
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.92 2013/11/08 03:12:17 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.92.2.1 2014/04/07 03:37:32 tls Exp $");
 
 #include "opt_inet.h"
 
@@ -363,7 +363,7 @@
            IST_EDGE, IPL_NET, iyintr, sc);
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        temp = bus_space_read_1(iot, ioh, INT_NO_REG);
        bus_space_write_1(iot, ioh, INT_NO_REG, (temp & 0xf8) | sc->mappedirq);
Index: src/sys/dev/marvell/if_gfe.c
diff -u src/sys/dev/marvell/if_gfe.c:1.41 src/sys/dev/marvell/if_gfe.c:1.41.12.1
--- src/sys/dev/marvell/if_gfe.c:1.41   Sun Jul 22 14:32:59 2012
+++ src/sys/dev/marvell/if_gfe.c        Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gfe.c,v 1.41 2012/07/22 14:32:59 matt Exp $ */
+/*     $NetBSD: if_gfe.c,v 1.41.12.1 2014/04/07 03:37:32 tls Exp $     */
 
 /*
  * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.41 2012/07/22 14:32:59 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.41.12.1 2014/04/07 03:37:32 tls Exp 
$");
 
 #include "opt_inet.h"
 
@@ -537,7 +537,7 @@
        ether_ifattach(ifp, enaddr);
        bpf_attach(ifp, DLT_EN10MB, sizeof(struct ether_header));
        rnd_attach_source(&sc->sc_rnd_source, device_xname(self), RND_TYPE_NET,
-           0);
+           RND_FLAG_DEFAULT);
        marvell_intr_establish(mva->mva_irq, IPL_NET, gfe_intr, sc);
 }
 
Index: src/sys/dev/marvell/if_mvgbe.c
diff -u src/sys/dev/marvell/if_mvgbe.c:1.38 
src/sys/dev/marvell/if_mvgbe.c:1.38.2.1
--- src/sys/dev/marvell/if_mvgbe.c:1.38 Sat Mar 15 13:33:48 2014
+++ src/sys/dev/marvell/if_mvgbe.c      Mon Apr  7 03:37:32 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mvgbe.c,v 1.38 2014/03/15 13:33:48 kiyohara Exp $   */
+/*     $NetBSD: if_mvgbe.c,v 1.38.2.1 2014/04/07 03:37:32 tls Exp $    */
 /*
  * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.38 2014/03/15 13:33:48 kiyohara Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.38.2.1 2014/04/07 03:37:32 tls Exp 
$");
 
 #include "opt_multiprocessor.h"
 
@@ -894,7 +894,7 @@
            NULL, device_xname(sc->sc_dev), "wdogsoft");
 #endif
        rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        return;
 
Index: src/sys/dev/mca/ed_mca.c
diff -u src/sys/dev/mca/ed_mca.c:1.55 src/sys/dev/mca/ed_mca.c:1.55.2.1
--- src/sys/dev/mca/ed_mca.c:1.55       Thu Mar 20 06:48:54 2014
+++ src/sys/dev/mca/ed_mca.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: ed_mca.c,v 1.55 2014/03/20 06:48:54 skrll Exp $        */
+/*     $NetBSD: ed_mca.c,v 1.55.2.1 2014/04/07 03:37:33 tls Exp $      */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.55 2014/03/20 06:48:54 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.55.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -187,7 +187,7 @@
        disk_init(&ed->sc_dk, device_xname(ed->sc_dev), &eddkdriver);
        disk_attach(&ed->sc_dk);
        rnd_attach_source(&ed->rnd_source, device_xname(ed->sc_dev),
-                         RND_TYPE_DISK, 0);
+                         RND_TYPE_DISK, RND_FLAG_DEFAULT);
 
        ed->sc_flags |= EDF_INIT;
 
Index: src/sys/dev/pci/amdpm.c
diff -u src/sys/dev/pci/amdpm.c:1.37 src/sys/dev/pci/amdpm.c:1.37.6.1
--- src/sys/dev/pci/amdpm.c:1.37        Thu Jun 13 00:55:01 2013
+++ src/sys/dev/pci/amdpm.c     Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdpm.c,v 1.37 2013/06/13 00:55:01 tls Exp $   */
+/*     $NetBSD: amdpm.c,v 1.37.6.1 2014/04/07 03:37:33 tls Exp $       */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdpm.c,v 1.37 2013/06/13 00:55:01 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdpm.c,v 1.37.6.1 2014/04/07 03:37:33 tls Exp $");
 
 #include "opt_amdpm.h"
 
@@ -194,18 +194,7 @@
                                        amdpm_rnd_get, sc);
                        rnd_attach_source(&sc->sc_rnd_source,
                            device_xname(self), RND_TYPE_RNG,
-                           /*
-                            * XXX Careful!  The use of RND_FLAG_NO_ESTIMATE
-                            * XXX here is unobvious: we later feed raw bits
-                            * XXX into the "entropy pool" with rnd_add_data,
-                            * XXX explicitly supplying an entropy estimate.
-                            * XXX In this context, NO_ESTIMATE serves only
-                            * XXX to prevent rnd_add_data from trying to
-                            * XXX use the *time at which we added the data*
-                            * XXX as entropy, which is not a good idea since
-                            * XXX we add data periodically from a callout.
-                            */
-                           RND_FLAG_NO_ESTIMATE|RND_FLAG_HASCB);
+                           RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
 #ifdef AMDPM_RND_COUNTERS
                        evcnt_attach_dynamic(&sc->sc_rnd_hits, EVCNT_TYPE_MISC,
                            NULL, device_xname(self), "rnd hits");
Index: src/sys/dev/pci/auich.c
diff -u src/sys/dev/pci/auich.c:1.143 src/sys/dev/pci/auich.c:1.143.2.1
--- src/sys/dev/pci/auich.c:1.143       Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/auich.c     Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: auich.c,v 1.143 2014/03/29 19:28:24 christos Exp $     */
+/*     $NetBSD: auich.c,v 1.143.2.1 2014/04/07 03:37:33 tls Exp $      */
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2008 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.143 2014/03/29 19:28:24 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.143.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -123,6 +123,7 @@
 #include <sys/sysctl.h>
 #include <sys/audioio.h>
 #include <sys/bus.h>
+#include <sys/rnd.h>
 
 #include <dev/pci/pcidevs.h>
 #include <dev/pci/pcivar.h>
@@ -1701,6 +1702,8 @@
                return;
        }
 
+       rnd_add_data(NULL, &wait_us, sizeof(wait_us), 1);
+
        actual_48k_rate = (bytes * UINT64_C(250000)) / wait_us;
 
        if (actual_48k_rate < 50000)
Index: src/sys/dev/pci/hifn7751.c
diff -u src/sys/dev/pci/hifn7751.c:1.54 src/sys/dev/pci/hifn7751.c:1.54.2.1
--- src/sys/dev/pci/hifn7751.c:1.54     Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/hifn7751.c  Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: hifn7751.c,v 1.54 2014/03/29 19:28:24 christos Exp $   */
+/*     $NetBSD: hifn7751.c,v 1.54.2.1 2014/04/07 03:37:33 tls Exp $    */
 /*     $FreeBSD: hifn7751.c,v 1.5.2.7 2003/10/08 23:52:00 sam Exp $ */
 /*     $OpenBSD: hifn7751.c,v 1.140 2003/08/01 17:55:54 deraadt Exp $  */
 
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.54 2014/03/29 19:28:24 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.54.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -595,20 +595,9 @@
 
 #ifdef __NetBSD__
                rndsource_setcb(&sc->sc_rnd_source, hifn_rng_get, sc);
-               /*
-                * XXX Careful!  The use of RND_FLAG_NO_ESTIMATE
-                * XXX here is unobvious: we later feed raw bits
-                * XXX into the "entropy pool" with rnd_add_data,
-                * XXX explicitly supplying an entropy estimate.
-                * XXX In this context, NO_ESTIMATE serves only
-                * XXX to prevent rnd_add_data from trying to
-                * XXX use the *time at which we added the data*
-                * XXX as entropy, which is not a good idea since
-                * XXX we add data periodically from a callout.
-                */
                rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dv),
                                  RND_TYPE_RNG,
-                                 RND_FLAG_NO_ESTIMATE|RND_FLAG_HASCB);
+                                 RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
 #endif
 
                if (hz >= 100)
Index: src/sys/dev/pci/if_bce.c
diff -u src/sys/dev/pci/if_bce.c:1.38 src/sys/dev/pci/if_bce.c:1.38.2.1
--- src/sys/dev/pci/if_bce.c:1.38       Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/if_bce.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bce.c,v 1.38 2014/03/29 19:28:24 christos Exp $  */
+/* $NetBSD: if_bce.c,v 1.38.2.1 2014/04/07 03:37:33 tls Exp $   */
 
 /*
  * Copyright (c) 2003 Clifford Wright. All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.38 2014/03/29 19:28:24 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.38.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #include "vlan.h"
 
@@ -461,7 +461,7 @@
            ether_sprintf(sc->enaddr));
        ether_ifattach(ifp, sc->enaddr);
        rnd_attach_source(&sc->rnd_source, device_xname(self),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
        callout_init(&sc->bce_timeout, 0);
 
        if (pmf_device_register(self, NULL, bce_resume))
Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.266 src/sys/dev/pci/if_bge.c:1.266.2.1
--- src/sys/dev/pci/if_bge.c:1.266      Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/if_bge.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.266 2014/03/29 19:28:24 christos Exp $    */
+/*     $NetBSD: if_bge.c,v 1.266.2.1 2014/04/07 03:37:33 tls Exp $     */
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.266 2014/03/29 19:28:24 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.266.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -3929,7 +3929,7 @@
        ether_ifattach(ifp, eaddr);
        ether_set_ifflags_cb(&sc->ethercom, bge_ifflags_cb);
        rnd_attach_source(&sc->rnd_source, device_xname(sc->bge_dev),
-               RND_TYPE_NET, 0);
+               RND_TYPE_NET, RND_FLAG_DEFAULT);
 #ifdef BGE_EVENT_COUNTERS
        /*
         * Attach event counters.
Index: src/sys/dev/pci/if_cas.c
diff -u src/sys/dev/pci/if_cas.c:1.21 src/sys/dev/pci/if_cas.c:1.21.2.1
--- src/sys/dev/pci/if_cas.c:1.21       Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/if_cas.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cas.c,v 1.21 2014/03/29 19:28:24 christos Exp $     */
+/*     $NetBSD: if_cas.c,v 1.21.2.1 2014/04/07 03:37:33 tls Exp $      */
 /*     $OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $    */
 
 /*
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.21 2014/03/29 19:28:24 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.21.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #ifndef _MODULE
 #include "opt_inet.h"
@@ -612,7 +612,7 @@
        ether_ifattach(ifp, enaddr);
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        evcnt_attach_dynamic(&sc->sc_ev_intr, EVCNT_TYPE_INTR,
            NULL, device_xname(sc->sc_dev), "interrupts");
Index: src/sys/dev/pci/if_de.c
diff -u src/sys/dev/pci/if_de.c:1.142 src/sys/dev/pci/if_de.c:1.142.2.1
--- src/sys/dev/pci/if_de.c:1.142       Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/if_de.c     Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_de.c,v 1.142 2014/03/29 19:28:24 christos Exp $     */
+/*     $NetBSD: if_de.c,v 1.142.2.1 2014/04/07 03:37:33 tls Exp $      */
        char intrbuf[PCI_INTRSTR_LEN];
 
 /*-
@@ -38,7 +38,7 @@
  *   board which support 21040, 21041, or 21140 (mostly).
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.142 2014/03/29 19:28:24 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.142.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #define        TULIP_HDR_DATA
 
@@ -5144,7 +5144,7 @@
 
 #if defined(__NetBSD__)
     rnd_attach_source(&sc->tulip_rndsource, device_xname(sc->tulip_dev),
-                     RND_TYPE_NET, 0);
+                     RND_TYPE_NET, RND_FLAG_DEFAULT);
 #endif
 }
 
Index: src/sys/dev/pci/if_dge.c
diff -u src/sys/dev/pci/if_dge.c:1.37 src/sys/dev/pci/if_dge.c:1.37.2.1
--- src/sys/dev/pci/if_dge.c:1.37       Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/if_dge.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_dge.c,v 1.37 2014/03/29 19:28:24 christos Exp $ */
+/*     $NetBSD: if_dge.c,v 1.37.2.1 2014/04/07 03:37:33 tls Exp $ */
 
 /*
  * Copyright (c) 2004, SUNET, Swedish University Computer Network.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.37 2014/03/29 19:28:24 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.37.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 
 
@@ -895,7 +895,7 @@
        if_attach(ifp);
        ether_ifattach(ifp, enaddr);
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
 #ifdef DGE_EVENT_COUNTERS
        /* Fix segment event naming */
Index: src/sys/dev/pci/if_jme.c
diff -u src/sys/dev/pci/if_jme.c:1.25 src/sys/dev/pci/if_jme.c:1.25.2.1
--- src/sys/dev/pci/if_jme.c:1.25       Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/if_jme.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_jme.c,v 1.25 2014/03/29 19:28:24 christos Exp $     */
+/*     $NetBSD: if_jme.c,v 1.25.2.1 2014/04/07 03:37:33 tls Exp $      */
 
 /*
  * Copyright (c) 2008 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.25 2014/03/29 19:28:24 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.25.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 
 #include <sys/param.h>
@@ -510,7 +510,7 @@
                aprint_error_dev(self, "couldn't establish power handler\n");
 
        rnd_attach_source(&sc->rnd_source, device_xname(self),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        sc->jme_intrxto = PCCRX_COAL_TO_DEFAULT;
        sc->jme_intrxct = PCCRX_COAL_PKT_DEFAULT;
Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.45 src/sys/dev/pci/if_msk.c:1.45.2.1
--- src/sys/dev/pci/if_msk.c:1.45       Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/if_msk.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.45 2014/03/29 19:28:25 christos Exp $ */
+/* $NetBSD: if_msk.c,v 1.45.2.1 2014/04/07 03:37:33 tls Exp $ */
 /*     $OpenBSD: if_msk.c,v 1.42 2007/01/17 02:43:02 krw Exp $ */
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.45 2014/03/29 19:28:25 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.45.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1117,7 +1117,7 @@
                aprint_error_dev(self, "couldn't establish power handler\n");
 
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sk_dev),
-               RND_TYPE_NET, 0);
+               RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        DPRINTFN(2, ("msk_attach: end\n"));
        return;
Index: src/sys/dev/pci/if_pcn.c
diff -u src/sys/dev/pci/if_pcn.c:1.57 src/sys/dev/pci/if_pcn.c:1.57.2.1
--- src/sys/dev/pci/if_pcn.c:1.57       Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/if_pcn.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_pcn.c,v 1.57 2014/03/29 19:28:25 christos Exp $     */
+/*     $NetBSD: if_pcn.c,v 1.57.2.1 2014/04/07 03:37:33 tls Exp $      */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.57 2014/03/29 19:28:25 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.57.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -814,7 +814,7 @@
        if_attach(ifp);
        ether_ifattach(ifp, enaddr);
        rnd_attach_source(&sc->rnd_source, device_xname(self),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
 #ifdef PCN_EVENT_COUNTERS
        /* Attach event counters. */
Index: src/sys/dev/pci/if_sip.c
diff -u src/sys/dev/pci/if_sip.c:1.157 src/sys/dev/pci/if_sip.c:1.157.2.1
--- src/sys/dev/pci/if_sip.c:1.157      Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/if_sip.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sip.c,v 1.157 2014/03/29 19:28:25 christos Exp $    */
+/*     $NetBSD: if_sip.c,v 1.157.2.1 2014/04/07 03:37:33 tls Exp $     */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.157 2014/03/29 19:28:25 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.157.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 
 
@@ -1290,7 +1290,7 @@
        sc->sc_prev.is_vlan = VLAN_ATTACHED(&(sc)->sc_ethercom);
        sc->sc_prev.if_capenable = ifp->if_capenable;
        rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        /*
         * The number of bytes that must be available in
Index: src/sys/dev/pci/if_sk.c
diff -u src/sys/dev/pci/if_sk.c:1.77 src/sys/dev/pci/if_sk.c:1.77.2.1
--- src/sys/dev/pci/if_sk.c:1.77        Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/if_sk.c     Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sk.c,v 1.77 2014/03/29 19:28:25 christos Exp $      */
+/*     $NetBSD: if_sk.c,v 1.77.2.1 2014/04/07 03:37:33 tls Exp $       */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -115,7 +115,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.77 2014/03/29 19:28:25 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.77.2.1 2014/04/07 03:37:33 tls Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1462,7 +1462,7 @@
        ether_ifattach(ifp, sc_if->sk_enaddr);
 
         rnd_attach_source(&sc->rnd_source, device_xname(sc->sk_dev),
-            RND_TYPE_NET, 0);
+            RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        if (pmf_device_register(self, NULL, sk_resume))
                pmf_class_network_register(self, ifp);
Index: src/sys/dev/pci/if_tl.c
diff -u src/sys/dev/pci/if_tl.c:1.100 src/sys/dev/pci/if_tl.c:1.100.2.1
--- src/sys/dev/pci/if_tl.c:1.100       Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/if_tl.c     Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_tl.c,v 1.100 2014/03/29 19:28:25 christos Exp $     */
+/*     $NetBSD: if_tl.c,v 1.100.2.1 2014/04/07 03:37:33 tls Exp $      */
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.100 2014/03/29 19:28:25 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.100.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #undef TLDEBUG
 #define TL_PRIV_STATS
@@ -470,7 +470,7 @@
                aprint_error_dev(self, "couldn't establish power handler\n");
 
        rnd_attach_source(&sc->rnd_source, device_xname(self),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 }
 
 static void
Index: src/sys/dev/pci/if_vr.c
diff -u src/sys/dev/pci/if_vr.c:1.113 src/sys/dev/pci/if_vr.c:1.113.2.1
--- src/sys/dev/pci/if_vr.c:1.113       Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/if_vr.c     Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vr.c,v 1.113 2014/03/29 19:28:25 christos Exp $     */
+/*     $NetBSD: if_vr.c,v 1.113.2.1 2014/04/07 03:37:33 tls Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.113 2014/03/29 19:28:25 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.113.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 
 
@@ -1742,7 +1742,7 @@
        ether_ifattach(ifp, sc->vr_enaddr);
 
        rnd_attach_source(&sc->rnd_source, device_xname(self),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        if (pmf_device_register1(self, NULL, vr_resume, vr_shutdown))
                pmf_class_network_register(self, ifp);
Index: src/sys/dev/pci/if_vte.c
diff -u src/sys/dev/pci/if_vte.c:1.10 src/sys/dev/pci/if_vte.c:1.10.2.1
--- src/sys/dev/pci/if_vte.c:1.10       Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/if_vte.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vte.c,v 1.10 2014/03/29 19:28:25 christos Exp $     */
+/*     $NetBSD: if_vte.c,v 1.10.2.1 2014/04/07 03:37:33 tls Exp $      */
 
 /*
  * Copyright (c) 2011 Manuel Bouyer.  All rights reserved.
@@ -55,7 +55,7 @@
 /* Driver for DM&P Electronics, Inc, Vortex86 RDC R6040 FastEthernet. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.10 2014/03/29 19:28:25 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.10.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -276,7 +276,7 @@
                aprint_error_dev(self, "couldn't establish power handler\n");
 
         rnd_attach_source(&sc->rnd_source, device_xname(self),
-            RND_TYPE_NET, 0);
+            RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        if (sysctl_createv(&sc->vte_clog, 0, NULL, &node,
            0, CTLTYPE_NODE, device_xname(sc->vte_dev),
Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.268 src/sys/dev/pci/if_wm.c:1.268.2.1
--- src/sys/dev/pci/if_wm.c:1.268       Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/if_wm.c     Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.268 2014/03/29 19:28:25 christos Exp $     */
+/*     $NetBSD: if_wm.c,v 1.268.2.1 2014/04/07 03:37:33 tls Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.268 2014/03/29 19:28:25 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.268.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2057,7 +2057,8 @@
        if_attach(ifp);
        ether_ifattach(ifp, enaddr);
        ether_set_ifflags_cb(&sc->sc_ethercom, wm_ifflags_cb);
-       rnd_attach_source(&sc->rnd_source, xname, RND_TYPE_NET, 0);
+       rnd_attach_source(&sc->rnd_source, xname, RND_TYPE_NET,
+                         RND_FLAG_DEFAULT);
 
 #ifdef WM_EVENT_COUNTERS
        /* Attach event counters. */
Index: src/sys/dev/pci/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.38 src/sys/dev/pci/ubsec.c:1.38.2.1
--- src/sys/dev/pci/ubsec.c:1.38        Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/ubsec.c     Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: ubsec.c,v 1.38 2014/03/29 19:28:25 christos Exp $      */
+/*     $NetBSD: ubsec.c,v 1.38.2.1 2014/04/07 03:37:33 tls Exp $       */
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ 
*/
 /*     $OpenBSD: ubsec.c,v 1.127 2003/06/04 14:04:58 jason Exp $       */
 
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.38 2014/03/29 19:28:25 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.38.2.1 2014/04/07 03:37:33 tls Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -506,7 +506,7 @@
                rndsource_setcb(&sc->sc_rnd_source, ubsec_rng_get, sc);
                rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev),
                                  RND_TYPE_RNG,
-                                 RND_FLAG_NO_ESTIMATE|RND_FLAG_HASCB);
+                                 RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
                if (hz >= 100)
                        sc->sc_rnghz = hz / 100;
                else
Index: src/sys/dev/pci/viaenv.c
diff -u src/sys/dev/pci/viaenv.c:1.31 src/sys/dev/pci/viaenv.c:1.31.26.1
--- src/sys/dev/pci/viaenv.c:1.31       Mon Jun 20 17:29:06 2011
+++ src/sys/dev/pci/viaenv.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: viaenv.c,v 1.31 2011/06/20 17:29:06 pgoyette Exp $     */
+/*     $NetBSD: viaenv.c,v 1.31.26.1 2014/04/07 03:37:33 tls Exp $     */
 
 /*
  * Copyright (c) 2000 Johan Danielsson
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: viaenv.c,v 1.31 2011/06/20 17:29:06 pgoyette Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: viaenv.c,v 1.31.26.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -345,6 +345,7 @@
 
        for (i = 0; i < 10; i++)
                sc->sc_sensor[i].state = ENVSYS_SINVALID;
+               sc->sc_sensor[i].flags |= ENVSYS_FHAS_ENTROPY;
 
        sc->sc_sme = sysmon_envsys_create();
 
Index: src/sys/dev/pcmcia/if_xi.c
diff -u src/sys/dev/pcmcia/if_xi.c:1.73 src/sys/dev/pcmcia/if_xi.c:1.73.12.1
--- src/sys/dev/pcmcia/if_xi.c:1.73     Sun Jul 22 14:33:05 2012
+++ src/sys/dev/pcmcia/if_xi.c  Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_xi.c,v 1.73 2012/07/22 14:33:05 matt Exp $ */
+/*     $NetBSD: if_xi.c,v 1.73.12.1 2014/04/07 03:37:33 tls Exp $ */
 /*     OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp   */
 
 /*
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.73 2012/07/22 14:33:05 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.73.12.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #include "opt_inet.h"
 #include "opt_ipx.h"
@@ -249,7 +249,7 @@
        ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER | IFM_AUTO);
 
        rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev),
-                         RND_TYPE_NET, 0);
+                         RND_TYPE_NET, RND_FLAG_DEFAULT);
 }
 
 int
Index: src/sys/dev/scsipi/cd.c
diff -u src/sys/dev/scsipi/cd.c:1.318 src/sys/dev/scsipi/cd.c:1.318.2.1
--- src/sys/dev/scsipi/cd.c:1.318       Wed Mar 19 15:48:23 2014
+++ src/sys/dev/scsipi/cd.c     Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd.c,v 1.318 2014/03/19 15:48:23 martin Exp $  */
+/*     $NetBSD: cd.c,v 1.318.2.1 2014/04/07 03:37:33 tls Exp $ */
 
 /*-
  * Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.318 2014/03/19 15:48:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.318.2.1 2014/04/07 03:37:33 tls Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -301,7 +301,7 @@
        aprint_naive("\n");
 
        rnd_attach_source(&cd->rnd_source, device_xname(cd->sc_dev),
-                         RND_TYPE_DISK, 0);
+                         RND_TYPE_DISK, RND_FLAG_DEFAULT);
 
        if (!pmf_device_register(self, NULL, NULL))
                aprint_error_dev(self, "couldn't establish power handler\n");
Index: src/sys/dev/scsipi/sd.c
diff -u src/sys/dev/scsipi/sd.c:1.305 src/sys/dev/scsipi/sd.c:1.305.2.1
--- src/sys/dev/scsipi/sd.c:1.305       Sun Mar 16 05:20:29 2014
+++ src/sys/dev/scsipi/sd.c     Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: sd.c,v 1.305 2014/03/16 05:20:29 dholland Exp $        */
+/*     $NetBSD: sd.c,v 1.305.2.1 2014/04/07 03:37:33 tls Exp $ */
 
 /*-
  * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.305 2014/03/16 05:20:29 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.305.2.1 2014/04/07 03:37:33 tls Exp $");
 
 #include "opt_scsi.h"
 
@@ -332,7 +332,7 @@
         * attach the device into the random source list
         */
        rnd_attach_source(&sd->rnd_source, device_xname(sd->sc_dev),
-                         RND_TYPE_DISK, 0);
+                         RND_TYPE_DISK, RND_FLAG_DEFAULT);
 
        /* Discover wedges on this disk. */
        dkwedge_discover(&sd->sc_dk);
Index: src/sys/dev/scsipi/st.c
diff -u src/sys/dev/scsipi/st.c:1.223 src/sys/dev/scsipi/st.c:1.223.2.1
--- src/sys/dev/scsipi/st.c:1.223       Sun Mar 16 05:20:29 2014
+++ src/sys/dev/scsipi/st.c     Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: st.c,v 1.223 2014/03/16 05:20:29 dholland Exp $ */
+/*     $NetBSD: st.c,v 1.223.2.1 2014/04/07 03:37:33 tls Exp $ */
 
 /*-
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.223 2014/03/16 05:20:29 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.223.2.1 2014/04/07 03:37:33 tls Exp $");
 
 #include "opt_scsi.h"
 
@@ -420,7 +420,7 @@
            device_xname(st->sc_dev));
 
        rnd_attach_source(&st->rnd_source, device_xname(st->sc_dev),
-           RND_TYPE_TAPE, 0);
+           RND_TYPE_TAPE, RND_FLAG_DEFAULT);
 }
 
 int
Index: src/sys/dev/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.126 
src/sys/dev/sysmon/sysmon_envsys.c:1.126.10.1
--- src/sys/dev/sysmon/sysmon_envsys.c:1.126    Thu Nov 29 10:29:45 2012
+++ src/sys/dev/sysmon/sysmon_envsys.c  Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysmon_envsys.c,v 1.126 2012/11/29 10:29:45 msaitoh Exp $      
*/
+/*     $NetBSD: sysmon_envsys.c,v 1.126.10.1 2014/04/07 03:37:33 tls Exp $     
*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.126 2012/11/29 10:29:45 
msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.126.10.1 2014/04/07 03:37:33 
tls Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -778,6 +778,7 @@
                 */
                TAILQ_FOREACH(edata, &sme->sme_sensors_list, sensors_head) {
                        if (edata->flags & ENVSYS_FHAS_ENTROPY) {
+                               uint32_t rnd_type, rnd_flag = 0;
                                size_t n;
                                int tail = 1;
 
@@ -797,8 +798,34 @@
                                        } else
                                                tail = 0;
                                }
+                               rnd_flag |= RND_FLAG_COLLECT_TIME;
+                               rnd_flag |= RND_FLAG_ESTIMATE_TIME;
+
+                               switch (edata->units) {
+                                   case ENVSYS_STEMP:
+                                   case ENVSYS_SFANRPM:
+                                   case ENVSYS_INTEGER:
+                                       rnd_type = RND_TYPE_ENV;
+                                       rnd_flag |= RND_FLAG_COLLECT_VALUE;
+                                       rnd_flag |= RND_FLAG_ESTIMATE_VALUE;
+                                       break;
+                                   case ENVSYS_SVOLTS_AC:
+                                   case ENVSYS_SVOLTS_DC:
+                                   case ENVSYS_SOHMS:
+                                   case ENVSYS_SWATTS:
+                                   case ENVSYS_SAMPS:
+                                   case ENVSYS_SWATTHOUR:
+                                   case ENVSYS_SAMPHOUR:
+                                       rnd_type = RND_TYPE_POWER;
+                                       rnd_flag |= RND_FLAG_COLLECT_VALUE;
+                                       rnd_flag |= RND_FLAG_ESTIMATE_VALUE;
+                                       break;
+                                   default:
+                                       rnd_type = RND_TYPE_UNKNOWN;
+                                       break;
+                               }
                                rnd_attach_source(&edata->rnd_src, rnd_name,
-                                   RND_TYPE_ENV, 0);
+                                   rnd_type, rnd_flag);
                        }
                }
                DPRINTF(("%s: driver '%s' registered (nsens=%d nevent=%d)\n",
@@ -1206,7 +1233,10 @@
                                snprintf(rnd_name, sizeof(rnd_name), "%s-%s",
                                    sme->sme_name, edata->desc);
                                rnd_attach_source(&edata->rnd_src, rnd_name,
-                                   RND_TYPE_ENV, 0);
+                                   RND_TYPE_ENV, RND_FLAG_COLLECT_VALUE|
+                                                 RND_FLAG_COLLECT_TIME|
+                                                 RND_FLAG_ESTIMATE_VALUE|
+                                                 RND_FLAG_ESTIMATE_TIME);
                        }
                }
 
Index: src/sys/dev/sysmon/sysmon_power.c
diff -u src/sys/dev/sysmon/sysmon_power.c:1.46 
src/sys/dev/sysmon/sysmon_power.c:1.46.20.1
--- src/sys/dev/sysmon/sysmon_power.c:1.46      Thu Feb  2 19:43:07 2012
+++ src/sys/dev/sysmon/sysmon_power.c   Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysmon_power.c,v 1.46 2012/02/02 19:43:07 tls Exp $    */
+/*     $NetBSD: sysmon_power.c,v 1.46.20.1 2014/04/07 03:37:33 tls Exp $       
*/
 
 /*-
  * Copyright (c) 2007 Juan Romero Pardines.
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.46 2012/02/02 19:43:07 tls Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.46.20.1 2014/04/07 03:37:33 tls 
Exp $");
 
 #include "opt_compat_netbsd.h"
 #include <sys/param.h>
@@ -201,7 +201,7 @@
        selinit(&sysmon_power_event_queue_selinfo);
 
        rnd_attach_source(&sysmon_rndsource, "system-power",
-                         RND_TYPE_POWER, 0);
+                         RND_TYPE_POWER, RND_FLAG_DEFAULT);
 
 }
 
Index: src/sys/dev/usb/if_aue.c
diff -u src/sys/dev/usb/if_aue.c:1.131 src/sys/dev/usb/if_aue.c:1.131.8.1
--- src/sys/dev/usb/if_aue.c:1.131      Sat Apr 27 15:57:41 2013
+++ src/sys/dev/usb/if_aue.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_aue.c,v 1.131 2013/04/27 15:57:41 tsutsui Exp $     */
+/*     $NetBSD: if_aue.c,v 1.131.8.1 2014/04/07 03:37:33 tls Exp $     */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.131 2013/04/27 15:57:41 tsutsui Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.131.8.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -859,7 +859,7 @@
        if_attach(ifp);
        ether_ifattach(ifp, eaddr);
        rnd_attach_source(&sc->rnd_source, device_xname(sc->aue_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        callout_init(&(sc->aue_stat_ch), 0);
 
Index: src/sys/dev/usb/if_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.66 src/sys/dev/usb/if_axe.c:1.66.2.1
--- src/sys/dev/usb/if_axe.c:1.66       Fri Nov  8 17:46:35 2013
+++ src/sys/dev/usb/if_axe.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axe.c,v 1.66 2013/11/08 17:46:35 roy Exp $  */
+/*     $NetBSD: if_axe.c,v 1.66.2.1 2014/04/07 03:37:33 tls Exp $      */
 /*     $OpenBSD: if_axe.c,v 1.96 2010/01/09 05:33:08 jsg Exp $ */
 
 /*
@@ -89,7 +89,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.66 2013/11/08 17:46:35 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.66.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -843,7 +843,7 @@
        if_attach(ifp);
        ether_ifattach(ifp, eaddr);
        rnd_attach_source(&sc->rnd_source, device_xname(sc->axe_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        callout_init(&sc->axe_stat_ch, 0);
        callout_setfunc(&sc->axe_stat_ch, axe_tick, sc);
Index: src/sys/dev/usb/if_axen.c
diff -u src/sys/dev/usb/if_axen.c:1.2 src/sys/dev/usb/if_axen.c:1.2.2.1
--- src/sys/dev/usb/if_axen.c:1.2       Tue Oct 29 16:10:49 2013
+++ src/sys/dev/usb/if_axen.c   Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axen.c,v 1.2 2013/10/29 16:10:49 joerg Exp $        */
+/*     $NetBSD: if_axen.c,v 1.2.2.1 2014/04/07 03:37:33 tls Exp $      */
 /*     $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.2 2013/10/29 16:10:49 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.2.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -786,7 +786,7 @@
        if_attach(ifp);
        ether_ifattach(ifp, eaddr);
        rnd_attach_source(&sc->rnd_source, device_xname(sc->axen_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        callout_init(&sc->axen_stat_ch, 0);
        callout_setfunc(&sc->axen_stat_ch, axen_tick, sc);
Index: src/sys/dev/usb/if_cue.c
diff -u src/sys/dev/usb/if_cue.c:1.67 src/sys/dev/usb/if_cue.c:1.67.10.1
--- src/sys/dev/usb/if_cue.c:1.67       Tue Jan 22 14:03:19 2013
+++ src/sys/dev/usb/if_cue.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cue.c,v 1.67 2013/01/22 14:03:19 jmcneill Exp $     */
+/*     $NetBSD: if_cue.c,v 1.67.10.1 2014/04/07 03:37:33 tls Exp $     */
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
  *     Bill Paul <wpaul%ee.columbia.edu@localhost>.  All rights reserved.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.67 2013/01/22 14:03:19 jmcneill Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.67.10.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -551,7 +551,7 @@
        if_attach(ifp);
        ether_ifattach(ifp, eaddr);
        rnd_attach_source(&sc->rnd_source, device_xname(sc->cue_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        callout_init(&(sc->cue_stat_ch), 0);
 
Index: src/sys/dev/usb/if_kue.c
diff -u src/sys/dev/usb/if_kue.c:1.80 src/sys/dev/usb/if_kue.c:1.80.2.1
--- src/sys/dev/usb/if_kue.c:1.80       Wed Oct 16 07:34:20 2013
+++ src/sys/dev/usb/if_kue.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_kue.c,v 1.80 2013/10/16 07:34:20 skrll Exp $        */
+/*     $NetBSD: if_kue.c,v 1.80.2.1 2014/04/07 03:37:33 tls Exp $      */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.80 2013/10/16 07:34:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.80.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -507,7 +507,7 @@
        if_attach(ifp);
        ether_ifattach(ifp, sc->kue_desc.kue_macaddr);
        rnd_attach_source(&sc->rnd_source, device_xname(sc->kue_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        sc->kue_attached = true;
        splx(s);
Index: src/sys/dev/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.12 src/sys/dev/usb/if_smsc.c:1.12.2.1
--- src/sys/dev/usb/if_smsc.c:1.12      Fri Nov  1 14:24:03 2013
+++ src/sys/dev/usb/if_smsc.c   Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_smsc.c,v 1.12 2013/11/01 14:24:03 skrll Exp $       */
+/*     $NetBSD: if_smsc.c,v 1.12.2.1 2014/04/07 03:37:33 tls Exp $     */
 
 /*     $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */
 /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp 
$ */
@@ -1100,7 +1100,7 @@
        ether_ifattach(ifp, sc->sc_enaddr);
 
        rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        callout_init(&sc->sc_stat_ch, 0);
 
Index: src/sys/dev/usb/if_udav.c
diff -u src/sys/dev/usb/if_udav.c:1.42 src/sys/dev/usb/if_udav.c:1.42.2.1
--- src/sys/dev/usb/if_udav.c:1.42      Fri Dec 20 01:17:54 2013
+++ src/sys/dev/usb/if_udav.c   Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_udav.c,v 1.42 2013/12/20 01:17:54 jakllsch Exp $    */
+/*     $NetBSD: if_udav.c,v 1.42.2.1 2014/04/07 03:37:33 tls Exp $     */
 /*     $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $   */
 
 /*
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.42 2013/12/20 01:17:54 jakllsch Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.42.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -319,7 +319,7 @@
        ether_ifattach(ifp, eaddr);
 
        rnd_attach_source(&sc->rnd_source, device_xname(self),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        callout_init(&sc->sc_stat_ch, 0);
        sc->sc_attached = 1;
Index: src/sys/dev/usb/if_upl.c
diff -u src/sys/dev/usb/if_upl.c:1.44 src/sys/dev/usb/if_upl.c:1.44.10.1
--- src/sys/dev/usb/if_upl.c:1.44       Sat Jan  5 01:30:16 2013
+++ src/sys/dev/usb/if_upl.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_upl.c,v 1.44 2013/01/05 01:30:16 christos Exp $     */
+/*     $NetBSD: if_upl.c,v 1.44.10.1 2014/04/07 03:37:33 tls Exp $     */
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.44 2013/01/05 01:30:16 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.44.10.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -311,7 +311,7 @@
 
        bpf_attach(ifp, DLT_RAW, 0);
        rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        sc->sc_attached = 1;
        splx(s);
Index: src/sys/dev/usb/if_url.c
diff -u src/sys/dev/usb/if_url.c:1.47 src/sys/dev/usb/if_url.c:1.47.10.1
--- src/sys/dev/usb/if_url.c:1.47       Tue Jan 22 12:40:43 2013
+++ src/sys/dev/usb/if_url.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_url.c,v 1.47 2013/01/22 12:40:43 jmcneill Exp $     */
+/*     $NetBSD: if_url.c,v 1.47.10.1 2014/04/07 03:37:33 tls Exp $     */
 
 /*
  * Copyright (c) 2001, 2002
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.47 2013/01/22 12:40:43 jmcneill Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.47.10.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -315,7 +315,7 @@
        ether_ifattach(ifp, eaddr);
 
        rnd_attach_source(&sc->rnd_source, device_xname(self),
-           RND_TYPE_NET, 0);
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        callout_init(&sc->sc_stat_ch, 0);
        sc->sc_attached = 1;
Index: src/sys/dev/usb/ucom.c
diff -u src/sys/dev/usb/ucom.c:1.103 src/sys/dev/usb/ucom.c:1.103.2.1
--- src/sys/dev/usb/ucom.c:1.103        Sun Mar 16 05:20:29 2014
+++ src/sys/dev/usb/ucom.c      Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: ucom.c,v 1.103 2014/03/16 05:20:29 dholland Exp $      */
+/*     $NetBSD: ucom.c,v 1.103.2.1 2014/04/07 03:37:33 tls Exp $       */
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.103 2014/03/16 05:20:29 dholland Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.103.2.1 2014/04/07 03:37:33 tls Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -249,7 +249,7 @@
        tty_attach(tp);
 
        rnd_attach_source(&sc->sc_rndsource, device_xname(sc->sc_dev),
-                         RND_TYPE_TTY, 0);
+                         RND_TYPE_TTY, RND_FLAG_DEFAULT);
 
        if (!pmf_device_register(self, NULL, NULL))
                aprint_error_dev(self, "couldn't establish power handler\n");
Index: src/sys/dev/usb/uhidev.c
diff -u src/sys/dev/usb/uhidev.c:1.59 src/sys/dev/usb/uhidev.c:1.59.2.1
--- src/sys/dev/usb/uhidev.c:1.59       Thu Dec 26 15:32:48 2013
+++ src/sys/dev/usb/uhidev.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhidev.c,v 1.59 2013/12/26 15:32:48 christos Exp $     */
+/*     $NetBSD: uhidev.c,v 1.59.2.1 2014/04/07 03:37:33 tls Exp $      */
 
 /*
  * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.59 2013/12/26 15:32:48 christos Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.59.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -358,7 +358,8 @@
 #endif
                                rnd_attach_source(&csc->rnd_source,
                                                  device_xname(dev),
-                                                 RND_TYPE_TTY, 0);
+                                                 RND_TYPE_TTY,
+                                                 RND_FLAG_DEFAULT);
                        }
                }
        }
Index: src/sys/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.454 src/sys/kern/init_main.c:1.454.2.1
--- src/sys/kern/init_main.c:1.454      Wed Oct  2 21:38:55 2013
+++ src/sys/kern/init_main.c    Mon Apr  7 02:20:00 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_main.c,v 1.454 2013/10/02 21:38:55 apb Exp $      */
+/*     $NetBSD: init_main.c,v 1.454.2.1 2014/04/07 02:20:00 tls Exp $  */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.454 2013/10/02 21:38:55 apb Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.454.2.1 2014/04/07 02:20:00 tls 
Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ipsec.h"
@@ -522,6 +522,9 @@
        /* Enable deferred processing of RNG samples */
        rnd_init_softint();
 
+       /* Enable periodic injection of console output into entropy pool */
+       kprintf_init_callout();
+
 #ifdef SYSVSHM
        /* Initialize System V style shared memory. */
        shminit();
Index: src/sys/kern/kern_rndpool.c
diff -u src/sys/kern/kern_rndpool.c:1.5 src/sys/kern/kern_rndpool.c:1.5.2.1
--- src/sys/kern/kern_rndpool.c:1.5     Thu Aug 29 01:04:49 2013
+++ src/sys/kern/kern_rndpool.c Mon Apr  7 02:00:00 2014
@@ -1,4 +1,4 @@
-/*      $NetBSD: kern_rndpool.c,v 1.5 2013/08/29 01:04:49 tls Exp $        */
+/*      $NetBSD: kern_rndpool.c,v 1.5.2.1 2014/04/07 02:00:00 tls Exp $        
*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rndpool.c,v 1.5 2013/08/29 01:04:49 tls Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndpool.c,v 1.5.2.1 2014/04/07 02:00:00 tls 
Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -85,6 +85,12 @@
        return (rp->stats.curentropy);
 }
 
+void
+rndpool_set_entropy_count(rndpool_t *rp, u_int32_t count)
+{
+       rp->stats.curentropy = count;
+}
+
 void rndpool_get_stats(rndpool_t *rp, void *rsp, int size)
 {
 
Index: src/sys/kern/kern_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.23 src/sys/kern/kern_rndq.c:1.23.2.2
--- src/sys/kern/kern_rndq.c:1.23       Tue Mar 11 20:26:08 2014
+++ src/sys/kern/kern_rndq.c    Mon Apr  7 02:20:00 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_rndq.c,v 1.23 2014/03/11 20:26:08 pooka Exp $     */
+/*     $NetBSD: kern_rndq.c,v 1.23.2.2 2014/04/07 02:20:00 tls Exp $   */
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.23 2014/03/11 20:26:08 pooka Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.23.2.2 2014/04/07 02:20:00 tls Exp 
$");
 
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -63,7 +63,7 @@
 #endif
 
 #ifdef RND_DEBUG
-#define        DPRINTF(l,x)      if (rnd_debug & (l)) printf x
+#define        DPRINTF(l,x)      if (rnd_debug & (l)) rnd_printf x
 int    rnd_debug = 0;
 #else
 #define        DPRINTF(l,x)
@@ -81,6 +81,10 @@
 #define        RND_VERBOSE
 #endif
 
+#ifdef RND_VERBOSE
+static unsigned int deltacnt;
+#endif
+
 /*
  * This is a little bit of state information attached to each device that we
  * collect entropy from.  This is simply a collection buffer, and when it
@@ -93,7 +97,7 @@
        krndsource_t    *source;
        int             cursor;
        int             entropy;
-       u_int32_t       ts[RND_SAMPLE_COUNT];
+       uint64_t        ts[RND_SAMPLE_COUNT];
        u_int32_t       values[RND_SAMPLE_COUNT];
 } rnd_sample_t;
 
@@ -129,31 +133,47 @@
        /* LIST_ENTRY list */
        .name = { 'N', 'o', 'C', 'o', 'l', 'l', 'e', 'c', 't',
                   0, 0, 0, 0, 0, 0, 0 },
-       .last_time = 0, .last_delta = 0, .last_delta2 = 0, .total = 0,
+       .total = 0,
        .type = RND_TYPE_UNKNOWN,
        .flags = (RND_FLAG_NO_COLLECT |
-                 RND_FLAG_NO_ESTIMATE |
-                 RND_TYPE_UNKNOWN),
+                 RND_FLAG_NO_ESTIMATE),
+       .state = NULL,
+       .test_cnt = 0,
+       .test = NULL
+};
+
+static krndsource_t rnd_source_anonymous = {
+       /* LIST_ENTRY list */
+       .name = { 'A', 'n', 'o', 'n', 'y', 'm', 'o', 'u', 's',
+                 0, 0, 0, 0, 0, 0, 0 },
+       .total = 0,
+       .type = RND_TYPE_UNKNOWN,
+        .flags = (RND_FLAG_COLLECT_TIME|
+                 RND_FLAG_COLLECT_VALUE|
+                 RND_FLAG_ESTIMATE_TIME),
        .state = NULL,
        .test_cnt = 0,
        .test = NULL
 };
+
+krndsource_t rnd_printf_source, rnd_autoconf_source;
+
 void *rnd_process, *rnd_wakeup;
 struct callout skew_callout;
 
-void         rnd_wakeup_readers(void);
-static inline u_int32_t rnd_estimate_entropy(krndsource_t *, u_int32_t);
-static inline u_int32_t rnd_counter(void);
+void                   rnd_wakeup_readers(void);
+static inline uint64_t rnd_counter(void);
 static        void     rnd_intr(void *);
 static       void      rnd_wake(void *);
 static       void      rnd_process_events(void);
 u_int32_t     rnd_extract_data_locked(void *, u_int32_t, u_int32_t); /* XXX */
 static       void      rnd_add_data_ts(krndsource_t *, const void *const,
-                                       uint32_t, uint32_t, uint32_t);
+                                       uint32_t, uint32_t, uint64_t);
 static inline void     rnd_schedule_process(void);
 
 int                    rnd_ready = 0;
 int                    rnd_initial_entropy = 0;
+int                    rnd_printing = 0;
 
 #ifdef DIAGNOSTIC
 static int             rnd_tested = 0;
@@ -165,6 +185,23 @@
 
 rndsave_t              *boot_rsp;
 
+static inline void
+rnd_printf(const char *fmt, ...)
+{
+       va_list ap;
+
+       membar_consumer();
+       if (rnd_printing) {
+               return;
+       }
+       rnd_printing = 1;
+       membar_producer();
+       va_start(ap, fmt);
+       vprintf(fmt, ap);
+       va_end(ap);
+       rnd_printing = 0;
+}
+
 void
 rnd_init_softint(void) {
        rnd_process = softint_establish(SOFTINT_SERIAL|SOFTINT_MPSAFE,
@@ -175,21 +212,25 @@
 }
 
 /*
- * Generate a 32-bit counter.  This should be more machine dependent,
- * using cycle counters and the like when possible.
+ * Generate a 64-bit counter.
  */
-static inline u_int32_t
+static inline uint64_t
 rnd_counter(void)
 {
-       struct timeval tv;
+       struct timespec ts;
+       uint64_t ret;
 
 #if defined(__HAVE_CPU_COUNTER)
-       if (cpu_hascounter())
-               return (cpu_counter32());
+       if (cpu_hascounter() && sizeof(cpu_counter() == sizeof(uint64_t))) {
+               return (cpu_counter());
+       }
 #endif
        if (rnd_ready) {
-               microtime(&tv);
-               return (tv.tv_sec * 1000000 + tv.tv_usec);
+               nanouptime(&ts);
+               ret = ts.tv_sec;
+               ret *= (uint64_t)1000000000;
+               ret += ts.tv_nsec;
+               return ret;
        }
        /* when called from rnd_init, its too early to call microtime safely */
        return (0);
@@ -243,7 +284,7 @@
                        KASSERT(rs->getarg != NULL);
                        rs->get(byteswanted, rs->getarg);
 #ifdef RND_VERBOSE
-                       printf("rnd: asking source %s for %zu bytes\n",
+                       rnd_printf("rnd: asking source %s for %zu bytes\n",
                               rs->name, byteswanted);
 #endif
                }    
@@ -271,7 +312,7 @@
        } else {
 #ifdef RND_VERBOSE
                if (__predict_false(!rnd_initial_entropy))
-                       printf("rnd: have initial entropy (%zu)\n",
+                       rnd_printf("rnd: have initial entropy (%zu)\n",
                            entropy_count);
 #endif
                rnd_empty = 0;
@@ -282,42 +323,85 @@
        rndsinks_distribute();
 }
 
+static uint32_t
+rnd_lz_estimate(krndsource_t *rs, rnd_lz_t *const est,
+               const void *const data, uint32_t len)
+{
+       const uint8_t *const cdata = data;
+       size_t c = 0, wherein = 0, cursor = est->cursor;
+       size_t isz = sizeof(est->in), osz = sizeof(est->out);
+       LZF_STATE *state = &est->state;
+       uint8_t *in = est->in, *out = est->out;
+       uint32_t total = 0;
+
+       KASSERT(rs != NULL);
+       KASSERT(cursor < isz);
+       KASSERT(cursor < osz);
+
+       /* We don't loop, so the maximum estimate we will
+          ever return is one internal-buffer-size worth of bits. */
+
+       if (cursor + len - wherein >= isz) {
+               c = lzf_compress_r(in, cursor, out,
+                                  cursor, *state);
+               memset(out, 0, osz);
+               memset(in, 0, isz);
+               if (c == 0) {
+                       c = cursor;
+               }
+               total += c;
+               wherein += cursor;
+               cursor = 0;
+       } else {
+               memcpy(in + cursor, cdata + wherein, len - wherein);
+               cursor += len - wherein;
+               wherein += len - wherein;
+       }
+
+       total *= NBBY;
+
+       /*
+        * Compressing a stream of zeroes gives us 144 output
+        * bits per input kilobyte -- pure overhead, not entropy.
+        */
+       total = total > 144 ? total - 144 : 0;
+
+       /* LZF is not a very good LZ compressor! */
+       total /= 2;
+       
+       est->cursor = cursor;
+       est->inbytes += len;
+       est->outbits += total;
+
+       return est->outbits > rs->total ?  est->outbits - rs->total : 0;
+}
+
 /*
- * Use the timing of the event to estimate the entropy gathered.
+ * Use the timing/value of the event to estimate the entropy gathered.
  * If all the differentials (first, second, and third) are non-zero, return
  * non-zero.  If any of these are zero, return zero.
  */
-static inline u_int32_t
-rnd_estimate_entropy(krndsource_t *rs, u_int32_t t)
+static inline uint32_t
+rnd_delta_estimate(rnd_delta_t *d, uint64_t v, int64_t delta)
 {
-       int32_t delta, delta2, delta3;
-
-       /*
-        * If the time counter has overflowed, calculate the real difference.
-        * If it has not, it is simplier.
-        */
-       if (t < rs->last_time)
-               delta = UINT_MAX - rs->last_time + t;
-       else
-               delta = rs->last_time - t;
+       int64_t delta2, delta3;
 
-       if (delta < 0)
-               delta = -delta;
+       d->insamples++;
 
        /*
         * Calculate the second and third order differentials
         */
-       delta2 = rs->last_delta - delta;
+       delta2 = d->dx - delta;
        if (delta2 < 0)
                delta2 = -delta2;
 
-       delta3 = rs->last_delta2 - delta2;
+       delta3 = d->d2x - delta2;
        if (delta3 < 0)
                delta3 = -delta3;
 
-       rs->last_time = t;
-       rs->last_delta = delta;
-       rs->last_delta2 = delta2;
+       d->x = v;
+       d->dx = delta;
+       d->d2x = delta2;
 
        /*
         * If any delta is 0, we got no entropy.  If all are non-zero, we
@@ -326,10 +410,77 @@
        if (delta == 0 || delta2 == 0 || delta3 == 0)
                return (0);
 
+       d->outbits++;
        return (1);
 }
 
-#if defined(__HAVE_CPU_COUNTER)
+/*
+ * Delta estimator for 64-bit timeestamps.  Must handle wrap.
+ */
+static inline uint32_t
+rnd_dt_estimate(krndsource_t *rs, uint32_t t)
+{
+       int64_t delta;
+       uint64_t ret;
+       rnd_delta_t *d = &rs->time_delta;
+
+       if (t < d->x) {
+               delta = UINT64_MAX - d->x + t;
+       } else {
+               delta = d->x - t;
+       }
+
+       if (delta < 0) {
+               delta = -delta;
+       }
+
+       ret = rnd_delta_estimate(d, t, delta);
+
+       KASSERT(d->x == t);
+       KASSERT(d->dx == delta);
+#ifdef RND_VERBOSE
+       if (deltacnt++ % 1151 == 0) {
+               rnd_printf("rnd_dt_estimate: %s x = %lld, dx = %lld, "
+                      "d2x = %lld\n", rs->name,
+                      (long long int)d->x,
+                      (long long int)d->dx,
+                      (long long int)d->d2x);
+       }
+#endif
+       return ret;
+}
+
+/*
+ * Delta estimator for 32 or 64 bit values.  "Wrap" isn't.
+ */
+static inline uint32_t
+rnd_dv_estimate(krndsource_t *rs, uint64_t v)
+{
+       int64_t delta;
+       uint32_t ret;
+       rnd_delta_t *d = &rs->value_delta;
+
+       delta = d->x - v;
+
+       if (delta < 0) {
+               delta = -delta;
+       }
+       ret = rnd_delta_estimate(d, v, (uint64_t)delta);
+
+       KASSERT(d->x == v);
+       KASSERT(d->dx == delta);
+#ifdef RND_VERBOSE
+       if (deltacnt++ % 1151 == 0) {
+               rnd_printf("rnd_dv_estimate: %s x = %lld, dx = %lld, "
+                      " d2x = %lld\n", rs->name,
+                      (long long int)d->x,
+                      (long long int)d->dx,
+                      (long long int)d->d2x);
+       }
+#endif
+       return ret;
+}
+
 static void
 rnd_skew(void *arg)
 {
@@ -344,27 +495,28 @@
 
        /*
         * Even on systems with seemingly stable clocks, the
-        * entropy estimator seems to think we get 1 bit here
-        * about every 2 calls.  That seems like too much.  Set
-        * NO_ESTIMATE on this source until we can better analyze
-        * the entropy of its output.
+        * delta-time entropy estimator seems to think we get 1 bit here
+        * about every 2 calls.  That seems like too much.  Instead,
+        * we feed the rnd_counter() value to the value estimator as well,
+        * to take advantage of the additional LZ test on estimated values.
+        *
         */
        if (__predict_false(!live)) {
                rnd_attach_source(&skewsrc, "callout", RND_TYPE_SKEW,
-                                 RND_FLAG_NO_ESTIMATE);
+                                 RND_FLAG_COLLECT_VALUE|
+                                 RND_FLAG_ESTIMATE_VALUE);
                live = 1;
        }
 
        flipflop = !flipflop;
 
        if (flipflop) {
-               rnd_add_uint32(&skewsrc, rnd_counter());
-               callout_schedule(&skew_callout, hz);
+               rnd_add_uint64(&skewsrc, rnd_counter());
+               callout_schedule(&skew_callout, hz / 10);
        } else {
                callout_schedule(&skew_callout, 1);
        }
 }
-#endif
 
 /*
  * initialize the global random pool for our use.
@@ -374,7 +526,7 @@
 void
 rnd_init(void)
 {
-       u_int32_t c;
+       uint64_t c;
 
        if (rnd_ready)
                return;
@@ -421,16 +573,11 @@
                mutex_spin_exit(&rndpool_mtx);
        }
 
-       rnd_ready = 1;
-
        /*
         * If we have a cycle counter, take its error with respect
         * to the callout mechanism as a source of entropy, ala
         * TrueRand.
         *
-        * XXX This will do little when the cycle counter *is* what's
-        * XXX clocking the callout mechanism.  How to get this right
-        * XXX without unsightly spelunking in the timecounter code?
         */
 #if defined(__HAVE_CPU_COUNTER)
        callout_init(&skew_callout, CALLOUT_MPSAFE);
@@ -439,7 +586,7 @@
 #endif
 
 #ifdef RND_VERBOSE
-       printf("rnd: initialised (%u)%s", RND_POOLBITS,
+       rnd_printf("rnd: initialised (%u)%s", RND_POOLBITS,
               c ? " with counter\n" : "\n");
 #endif
        if (boot_rsp != NULL) {
@@ -454,11 +601,21 @@
                }
                 mutex_spin_exit(&rndpool_mtx);
 #ifdef RND_VERBOSE
-               printf("rnd: seeded with %d bits\n",
+               rnd_printf("rnd: seeded with %d bits\n",
                       MIN(boot_rsp->entropy, RND_POOLBITS / 2));
 #endif
                memset(boot_rsp, 0, sizeof(*boot_rsp));
        }
+       rnd_attach_source(&rnd_source_anonymous, "Anonymous",
+                         RND_TYPE_UNKNOWN,
+                         RND_FLAG_COLLECT_TIME|RND_FLAG_COLLECT_VALUE|
+                         RND_FLAG_ESTIMATE_TIME);
+       rnd_attach_source(&rnd_printf_source, "printf", RND_TYPE_UNKNOWN,
+                         RND_FLAG_NO_ESTIMATE);
+       rnd_attach_source(&rnd_autoconf_source, "autoconf",
+                         RND_TYPE_UNKNOWN,
+                         RND_FLAG_COLLECT_TIME|RND_FLAG_ESTIMATE_TIME);
+       rnd_ready = 1;
 }
 
 static rnd_sample_t *
@@ -507,17 +664,18 @@
  * Add a source to our list of sources.
  */
 void
-rnd_attach_source(krndsource_t *rs, const char *name, u_int32_t type,
-    u_int32_t flags)
+rnd_attach_source(krndsource_t *rs, const char *name, uint32_t type,
+    uint32_t flags)
 {
-       u_int32_t ts;
+       uint64_t ts;
 
        ts = rnd_counter();
 
        strlcpy(rs->name, name, sizeof(rs->name));
-       rs->last_time = ts;
-       rs->last_delta = 0;
-       rs->last_delta2 = 0;
+       memset(&rs->time_delta, 0, sizeof(rs->time_delta));
+       rs->time_delta.x = ts;
+       memset(&rs->value_delta, 0, sizeof(rs->value_delta));
+       memset(&rs->lz_v, 0, sizeof(rs->lz_v));
        rs->total = 0;
 
        /*
@@ -526,6 +684,10 @@
        rs->test = NULL;
        rs->test_cnt = -1;
 
+       if (flags == 0) {
+               flags = RND_FLAG_DEFAULT;
+       }
+
        switch (type) {
            case RND_TYPE_NET:          /* Don't collect by default */
                flags |= (RND_FLAG_NO_COLLECT | RND_FLAG_NO_ESTIMATE);
@@ -550,22 +712,24 @@
        LIST_INSERT_HEAD(&rnd_sources, rs, list);
 
 #ifdef RND_VERBOSE
-       printf("rnd: %s attached as an entropy source (", rs->name);
+       rnd_printf("rnd: %s attached as an entropy source (", rs->name);
        if (!(flags & RND_FLAG_NO_COLLECT)) {
-               printf("collecting");
+               rnd_printf("collecting");
                if (flags & RND_FLAG_NO_ESTIMATE)
-                       printf(" without estimation");
+                       rnd_printf(" without estimation");
        }
        else
-               printf("off");
-       printf(")\n");
+               rnd_printf("off");
+       rnd_printf(")\n");
 #endif
 
        /*
         * Again, put some more initial junk in the pool.
-        * XXX Bogus, but harder to guess than zeros.
+        * FreeBSD claim to have an analysis that show 4 bits of
+        * entropy per source-attach timestamp.  I am skeptical,
+        * but we count 1 bit per source here.
         */
-       rndpool_add_data(&rnd_pool, &ts, sizeof(u_int32_t), 1);
+       rndpool_add_data(&rnd_pool, &ts, sizeof(ts), 1);
        mutex_spin_exit(&rndpool_mtx);
 }
 
@@ -607,19 +771,41 @@
        }
 
 #ifdef RND_VERBOSE
-       printf("rnd: %s detached as an entropy source\n", source->name);
+       rnd_printf("rnd: %s detached as an entropy source\n", source->name);
 #endif
 }
 
+static inline uint32_t
+rnd_estimate(krndsource_t *rs, uint64_t ts, uint64_t val)
+{
+       uint32_t entropy = 0, dt_est, dv_est, lz_est;
+
+       dt_est = rnd_dt_estimate(rs, ts);
+       dv_est = rnd_dv_estimate(rs, val);
+       lz_est = rnd_lz_estimate(rs, &rs->lz_v, &val, sizeof(val));
+
+       if (!(rs->flags & RND_FLAG_NO_ESTIMATE)) {
+               if (rs->flags & RND_FLAG_ESTIMATE_TIME) {
+                       entropy += dt_est;
+               }
+
+                if (rs->flags & RND_FLAG_ESTIMATE_VALUE) {
+                       entropy += MIN(lz_est, dv_est);
+               }
+
+       }
+       return entropy;
+}
+
 /*
  * Add a 32-bit value to the entropy pool.  The rs parameter should point to
  * the source-specific source structure.
  */
 void
-_rnd_add_uint32(krndsource_t *rs, u_int32_t val)
+_rnd_add_uint32(krndsource_t *rs, uint32_t val)
 {
-       u_int32_t ts;
-       u_int32_t entropy = 0;
+       uint64_t ts;    
+       uint32_t entropy = 0;
 
        if (rs->flags & RND_FLAG_NO_COLLECT)
                return;
@@ -631,13 +817,34 @@
        ts = rnd_counter();
 
        /*
-        * If we are estimating entropy on this source,
-        * calculate differentials.
+        * Calculate estimates - we may not use them, but if we do
+        * not calculate them, the estimators' history becomes invalid.
         */
+       entropy = rnd_estimate(rs, ts, (uint64_t)val);
 
-       if ((rs->flags & RND_FLAG_NO_ESTIMATE) == 0) {
-               entropy = rnd_estimate_entropy(rs, ts);
-       }
+       rnd_add_data_ts(rs, &val, sizeof(val), entropy, ts);
+}
+
+void
+_rnd_add_uint64(krndsource_t *rs, uint64_t val)
+{
+       uint64_t ts;   
+       uint32_t entropy = 0;
+
+       if (rs->flags & RND_FLAG_NO_COLLECT)
+                return;
+
+       /*
+        * Sample the counter as soon as possible to avoid
+        * entropy overestimation.
+        */
+       ts = rnd_counter();
+
+       /*
+        * Calculate estimates - we may not use them, but if we do
+        * not calculate them, the estimators' history becomes invalid.
+        */
+       entropy = rnd_estimate(rs, ts, val);
 
        rnd_add_data_ts(rs, &val, sizeof(val), entropy, ts);
 }
@@ -651,18 +858,18 @@
         * itself, random.  Don't estimate entropy based on
         * timestamp, just directly add the data.
         */
+       mutex_spin_enter(&rndpool_mtx);
        if (__predict_false(rs == NULL)) {
-               mutex_spin_enter(&rndpool_mtx);
-               rndpool_add_data(&rnd_pool, data, len, entropy);
-               mutex_spin_exit(&rndpool_mtx);
-       } else {
-               rnd_add_data_ts(rs, data, len, entropy, rnd_counter());
+               rs = &rnd_source_anonymous;
        }
+       entropy = MIN(entropy, rnd_lz_estimate(rs, &rs->lz_v, data, len));
+       rndpool_add_data(&rnd_pool, data, len, entropy);
+       mutex_spin_exit(&rndpool_mtx);
 }
 
 static void
 rnd_add_data_ts(krndsource_t *rs, const void *const data, u_int32_t len,
-               u_int32_t entropy, uint32_t ts)
+               u_int32_t entropy, uint64_t ts)
 {
        rnd_sample_t *state = NULL;
        const uint32_t *dint = data;
@@ -671,10 +878,12 @@
        SIMPLEQ_HEAD(, _rnd_sample_t) tmp_samples =
                        SIMPLEQ_HEAD_INITIALIZER(tmp_samples);
 
-       if (rs->flags & RND_FLAG_NO_COLLECT) {
+       if (rs && (rs->flags & RND_FLAG_NO_COLLECT ||
+           __predict_false(!(rs->flags & 
+                            (RND_FLAG_COLLECT_TIME|
+                            RND_FLAG_COLLECT_VALUE))))) {
                return;
        }
-
        todo = len / sizeof(*dint);
        /*
         * Let's try to be efficient: if we are warm, and a source
@@ -689,12 +898,12 @@
 
                        getmicrouptime(&upt);
                        if ((todo >= RND_SAMPLE_COUNT) ||
-                           (rs->total > upt.tv_sec * 10) ||
+                           (upt.tv_sec > 0  && rs->total > upt.tv_sec * 10) ||
                            (upt.tv_sec > 10 && rs->total > upt.tv_sec) ||
                            (upt.tv_sec > 100 &&
                              rs->total > upt.tv_sec / 10)) {
 #ifdef RND_VERBOSE
-                               printf("rnd: source %s is fast (%d samples "
+                               rnd_printf("rnd: source %s is fast (%d samples "
                                       "at once, %d bits in %lld seconds), "
                                       "processing samples in bulk.\n",
                                       rs->name, todo, rs->total,
@@ -790,7 +999,7 @@
        v2 = (uint8_t *)sample->values + cmplen;
 
        if (__predict_false(!memcmp(v1, v2, cmplen))) {
-               printf("rnd: source \"%s\" failed continuous-output test.\n",
+               rnd_printf("rnd: source \"%s\" failed continuous-output 
test.\n",
                       source->name);
                return 1;
        }
@@ -811,7 +1020,7 @@
                strlcpy(source->test->rt_name, source->name,
                        sizeof(source->test->rt_name));
                if (rngtest(source->test)) {
-                       printf("rnd: source \"%s\" failed statistical test.",
+                       rnd_printf("rnd: source \"%s\" failed statistical 
test.",
                               source->name);
                        return 1;
                }
@@ -855,8 +1064,9 @@
                 * the source was disabled before we were called, but
                 * after the entry was queued.
                 */
-               if (__predict_false(sample->source->flags
-                                   & RND_FLAG_NO_COLLECT)) {
+               if (__predict_false(!(sample->source->flags &
+                                   (RND_FLAG_COLLECT_TIME|
+                                    RND_FLAG_COLLECT_VALUE)))) {
                        SIMPLEQ_INSERT_TAIL(&df_samples, sample, next);
                } else {
                        SIMPLEQ_INSERT_TAIL(&dq_samples, sample, next);
@@ -868,21 +1078,14 @@
        mutex_spin_enter(&rndpool_mtx);
 
        pool_entropy = rndpool_get_entropy_count(&rnd_pool);
-       if (pool_entropy > RND_ENTROPY_THRESHOLD * NBBY) {
-               wake++;
-       } else {
-               rnd_empty = 1;
-               rnd_getmore(howmany((RND_POOLBITS - pool_entropy), NBBY));
-#ifdef RND_VERBOSE
-               printf("rnd: empty, asking for %zu bytes\n",
-                      howmany((RND_POOLBITS - pool_entropy), NBBY));
-#endif
-       }
 
        while ((sample = SIMPLEQ_FIRST(&dq_samples))) {
+               int sample_count;
+
                SIMPLEQ_REMOVE_HEAD(&dq_samples, next);
                source = sample->source;
                entropy = sample->entropy;
+               sample_count = sample->cursor + 1;
 
                /*
                 * Don't provide a side channel for timing attacks on
@@ -906,20 +1109,40 @@
                                 * Detach the bad source.  See below.
                                 */
                                badsource = source;
-                               printf("rnd: detaching source \"%s\".",
+                               rnd_printf("rnd: detaching source \"%s\".",
                                       badsource->name);
                                break;
                        }
                }
-               rndpool_add_data(&rnd_pool, sample->values,
-                   RND_SAMPLE_COUNT * 4, 0);
 
-               rndpool_add_data(&rnd_pool, sample->ts,
-                   RND_SAMPLE_COUNT * 4, entropy);
+               if (source->flags & RND_FLAG_COLLECT_VALUE) {
+                       rndpool_add_data(&rnd_pool, sample->values,
+                                        sample_count *
+                                            sizeof(sample->values[1]),
+                                        0);
+               }
+               if (source->flags & RND_FLAG_COLLECT_TIME) {
+                       rndpool_add_data(&rnd_pool, sample->ts,
+                                        sample_count *
+                                            sizeof(sample->ts[1]),
+                                        0);
+               }
 
+               pool_entropy += entropy;
                source->total += sample->entropy;
                SIMPLEQ_INSERT_TAIL(&df_samples, sample, next);
        }
+       rndpool_set_entropy_count(&rnd_pool, pool_entropy);
+       if (pool_entropy > RND_ENTROPY_THRESHOLD * 8) {
+               wake++;
+       } else {
+               rnd_empty = 1;
+               rnd_getmore((RND_POOLBITS - pool_entropy) / 8);
+#ifdef RND_VERBOSE
+               rnd_printf("rnd: empty, asking for %d bits\n",
+                      (int)((RND_POOLBITS - pool_entropy) / 8));
+#endif
+       }
        mutex_spin_exit(&rndpool_mtx);
 
        /* Now we hold no locks: clean up. */
@@ -941,7 +1164,6 @@
                rnd_sample_free(sample);
        }
 
-       
        /*
         * Wake up any potential readers waiting.
         */
@@ -977,22 +1199,22 @@
                timed_in++;
        }
        if (__predict_false(!rnd_initial_entropy)) {
-               u_int32_t c;
+               uint64_t c;
 
 #ifdef RND_VERBOSE
-               printf("rnd: WARNING! initial entropy low (%u).\n",
+               rnd_printf("rnd: WARNING! initial entropy low (%u).\n",
                       rndpool_get_entropy_count(&rnd_pool));
 #endif
                /* Try once again to put something in the pool */
                c = rnd_counter();
-               rndpool_add_data(&rnd_pool, &c, sizeof(u_int32_t), 1);
+               rndpool_add_data(&rnd_pool, &c, sizeof(c), 1);
        }
 
 #ifdef DIAGNOSTIC
        while (!rnd_tested) {
                entropy_count = rndpool_get_entropy_count(&rnd_pool);
 #ifdef RND_VERBOSE
-               printf("rnd: starting statistical RNG test, entropy = %d.\n",
+               rnd_printf("rnd: starting statistical RNG test, entropy = 
%d.\n",
                        entropy_count);
 #endif
                if (rndpool_extract_data(&rnd_pool, rnd_rt.rt_b,
@@ -1016,7 +1238,7 @@
                         * The relevant standard says to reset the module,
                         * but developers objected...
                         */
-                       printf("rnd: WARNING, ENTROPY POOL FAILED "
+                       rnd_printf("rnd: WARNING, ENTROPY POOL FAILED "
                               "STATISTICAL TEST!\n");
                        continue;
                }
@@ -1025,7 +1247,7 @@
                                 entropy_count);
                memset(rnd_testbits, 0, sizeof(rnd_testbits));
 #ifdef RND_VERBOSE
-               printf("rnd: statistical RNG test done, entropy = %d.\n",
+               rnd_printf("rnd: statistical RNG test done, entropy = %d.\n",
                       rndpool_get_entropy_count(&rnd_pool));
 #endif
                rnd_tested++;
@@ -1056,7 +1278,7 @@
        uint8_t digest[SHA1_DIGEST_LENGTH];
 
        if (len != sizeof(*boot_rsp)) {
-               aprint_error("rnd: bad seed length %d\n", (int)len);
+               rnd_printf("rnd: bad seed length %d\n", (int)len);
                return;
        }
 
@@ -1068,7 +1290,7 @@
        SHA1Final(digest, &s);
 
        if (memcmp(digest, boot_rsp->digest, sizeof(digest))) {
-               aprint_error("rnd: bad seed checksum\n");
+               rnd_printf("rnd: bad seed checksum\n");
                return;
        }
 
@@ -1078,7 +1300,7 @@
         */
        if (rnd_ready) {
 #ifdef RND_VERBOSE
-               printf("rnd: ready, feeding in seed data directly.\n");
+               rnd_printf("rnd: ready, feeding in seed data directly.\n");
 #endif
                mutex_spin_enter(&rndpool_mtx);
                rndpool_add_data(&rnd_pool, boot_rsp->data,
@@ -1088,7 +1310,7 @@
                mutex_spin_exit(&rndpool_mtx);
        } else {
 #ifdef RND_VERBOSE
-               printf("rnd: not ready, deferring seed feed.\n");
+               rnd_printf("rnd: not ready, deferring seed feed.\n");
 #endif
        }
 }
Index: src/sys/kern/kern_sysctl.c
diff -u src/sys/kern/kern_sysctl.c:1.249 src/sys/kern/kern_sysctl.c:1.249.2.1
--- src/sys/kern/kern_sysctl.c:1.249    Thu Mar 27 21:09:33 2014
+++ src/sys/kern/kern_sysctl.c  Mon Apr  7 02:20:00 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sysctl.c,v 1.249 2014/03/27 21:09:33 christos Exp $       
*/
+/*     $NetBSD: kern_sysctl.c,v 1.249.2.1 2014/04/07 02:20:00 tls Exp $        
*/
 
 /*-
  * Copyright (c) 2003, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.249 2014/03/27 21:09:33 christos 
Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.249.2.1 2014/04/07 02:20:00 tls 
Exp $");
 
 #include "opt_defcorename.h"
 #include "ksyms.h"
@@ -84,6 +84,7 @@
 #include <sys/syscallargs.h>
 #include <sys/kauth.h>
 #include <sys/ktrace.h>
+#include <sys/rnd.h>
 
 #define        MAXDESCLEN      1024
 MALLOC_DEFINE(M_SYSCTLNODE, "sysctlnode", "sysctl node structures");
@@ -1610,6 +1611,7 @@
                if (newlen != sz)
                        goto bad_size;
                error = sysctl_copyin(l, newp, d, sz);
+               rnd_add_data(NULL, d, sz, 0);
                break;
        case CTLTYPE_STRING: {
                /*
@@ -1653,8 +1655,10 @@
                /*
                 * looks good, so pop it into place and zero the rest.
                 */
-               if (len > 0)
+               if (len > 0) {
                        memcpy(d, newbuf, len);
+                       rnd_add_data(NULL, d, len, 0);
+               }
                if (sz != len)
                        memset((char*)d + len, 0, sz - len);
                free(newbuf, M_SYSCTLDATA);
Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.230 
src/sys/kern/subr_autoconf.c:1.230.2.1
--- src/sys/kern/subr_autoconf.c:1.230  Tue Feb 25 18:30:11 2014
+++ src/sys/kern/subr_autoconf.c        Mon Apr  7 02:20:00 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.230 2014/02/25 18:30:11 pooka Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.230.2.1 2014/04/07 02:20:00 tls Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.230 2014/02/25 18:30:11 pooka 
Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.230.2.1 2014/04/07 02:20:00 
tls Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -110,6 +110,8 @@
 
 #include <sys/disk.h>
 
+#include <sys/rnd.h>
+
 #include <machine/limits.h>
 
 /*
@@ -117,6 +119,11 @@
  */
 
 /*
+ * Device autoconfiguration timings are mixed into the entropy pool.
+ */
+extern krndsource_t rnd_autoconf_source;
+
+/*
  * ioconf.c exports exactly two names: cfdata and cfroots.  All system
  * devices and drivers are found via these tables.
  */
@@ -1051,6 +1058,14 @@
                aprint_normal("%s", msgs[(*print)(aux, device_xname(parent))]);
        }
 
+       /*
+        * This has the effect of mixing in a single timestamp to the
+        * entropy pool.  Experiments indicate the estimator will almost
+        * always attribute one bit of entropy to this sample; analysis
+        * of device attach/detach timestamps on FreeBSD indicates 4
+        * bits of entropy/sample so this seems appropriately conservative.
+        */
+       rnd_add_uint32(&rnd_autoconf_source, 0);
        return NULL;
 }
 
Index: src/sys/kern/subr_prf.c
diff -u src/sys/kern/subr_prf.c:1.153 src/sys/kern/subr_prf.c:1.153.2.1
--- src/sys/kern/subr_prf.c:1.153       Wed Mar 26 18:03:47 2014
+++ src/sys/kern/subr_prf.c     Mon Apr  7 02:20:00 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_prf.c,v 1.153 2014/03/26 18:03:47 christos Exp $  */
+/*     $NetBSD: subr_prf.c,v 1.153.2.1 2014/04/07 02:20:00 tls Exp $   */
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.153 2014/03/26 18:03:47 christos 
Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.153.2.1 2014/04/07 02:20:00 tls Exp 
$");
 
 #include "opt_ddb.h"
 #include "opt_ipkdb.h"
@@ -63,6 +63,8 @@
 #include <sys/atomic.h>
 #include <sys/kernel.h>
 #include <sys/cpu.h>
+#include <sys/sha2.h>
+#include <sys/rnd.h>
 
 #include <dev/cons.h>
 
@@ -73,7 +75,7 @@
 #endif
 
 static kmutex_t kprintf_mtx;
-static bool kprintf_inited = false;
+static bool kprintf_inited = false, kprintf_inited_callout = false;
 
 #ifdef KGDB
 #include <sys/kgdb.h>
@@ -103,6 +105,7 @@
 
 extern struct tty *constty;    /* pointer to console "window" tty */
 extern int log_open;   /* subr_log: is /dev/klog open? */
+extern krndsource_t    rnd_printf_source;
 const  char *panicstr; /* arg to first call to panic (used as a flag
                           to indicate that panic has already been called). */
 struct cpu_info *paniccpu;     /* cpu that first paniced */
@@ -110,6 +113,12 @@
                                   end of the formatted panicstr. */
 int    doing_shutdown; /* set to indicate shutdown in progress */
 
+static SHA512_CTX kprnd_sha;
+static uint8_t kprnd_accum[SHA512_DIGEST_LENGTH];
+static int kprnd_added;
+
+static struct callout kprnd_callout;
+
 #ifndef        DUMP_ON_PANIC
 #define        DUMP_ON_PANIC   1
 #endif
@@ -133,6 +142,30 @@
  * functions
  */
 
+static void kprintf_rnd_get(size_t bytes, void *priv)
+{
+       if (mutex_tryenter(&kprintf_mtx)) {
+               if (kprnd_added) {
+                       SHA512_Final(kprnd_accum, &kprnd_sha);
+                       rnd_add_data(&rnd_printf_source,
+                                    kprnd_accum, sizeof(kprnd_accum), 0);
+                       kprnd_added = 0;
+                       /* This, we must do, since we called _Final. */
+                       SHA512_Init(&kprnd_sha);
+                       /* This is optional but seems useful. */
+                       SHA512_Update(&kprnd_sha, kprnd_accum,
+                                     sizeof(kprnd_accum));
+               }
+               mutex_exit(&kprintf_mtx);
+       }
+}
+
+static void kprintf_rnd_callout(void *arg)
+{
+       kprintf_rnd_get(0, NULL);
+       callout_schedule(&kprnd_callout, hz);
+}
+
 /*
  * Locking is inited fairly early in MI bootstrap.  Before that
  * prints are done unlocked.  But that doesn't really matter,
@@ -143,11 +176,22 @@
 {
 
        KASSERT(!kprintf_inited && cold); /* not foolproof, but ... */
+       SHA512_Init(&kprnd_sha);
        mutex_init(&kprintf_mtx, MUTEX_DEFAULT, IPL_HIGH);
        kprintf_inited = true;
 }
 
 void
+kprintf_init_callout(void)
+{
+       KASSERT(!kprintf_inited_callout);
+       callout_init(&kprnd_callout, CALLOUT_MPSAFE);
+       callout_setfunc(&kprnd_callout, kprintf_rnd_callout, NULL);
+       callout_schedule(&kprnd_callout, hz);
+       kprintf_inited_callout = true;
+}
+
+void
 kprintf_lock(void)
 {
 
@@ -405,6 +449,8 @@
 static void
 putchar(int c, int flags, struct tty *tp)
 {
+       uint8_t rbuf[SHA512_BLOCK_LENGTH];
+       static int cursor;
 
        if (panicstr)
                constty = NULL;
@@ -422,9 +468,20 @@
        if ((flags & TOCONS) && constty == NULL && c != '\0')
                (*v_putc)(c);
 #ifdef DDB
-       if (flags & TODDB)
+       if (flags & TODDB) {
                db_putchar(c);
+               return;
+       }
 #endif
+
+       rbuf[cursor] = c;
+       if (cursor == sizeof(rbuf) - 1) {
+               SHA512_Update(&kprnd_sha, rbuf, sizeof(rbuf));
+               kprnd_added++;
+               cursor = 0;
+       } else {
+               cursor++;
+       }
 }
 
 /*
@@ -773,7 +830,6 @@
 static void
 aprint_naive_internal(const char *prefix, const char *fmt, va_list ap)
 {
-
        if ((boothowto & (AB_QUIET|AB_SILENT|AB_VERBOSE)) != AB_QUIET)
                return;
 
@@ -876,7 +932,6 @@
 static void
 aprint_debug_internal(const char *prefix, const char *fmt, va_list ap)
 {
-
        if ((boothowto & AB_DEBUG) == 0)
                return;
 
@@ -927,7 +982,7 @@
        kprintf_lock();
 
        va_start(ap, fmt);
-       (void)kprintf(fmt, TOLOG, NULL, NULL, ap);
+       kprintf(fmt, TOLOG, NULL, NULL, ap);
        va_end(ap);
 
        kprintf_unlock();
@@ -983,7 +1038,6 @@
 void
 vprintf(const char *fmt, va_list ap)
 {
-
        kprintf_lock();
 
        kprintf(fmt, TOCONS | TOLOG, NULL, NULL, ap);
@@ -1129,6 +1183,7 @@
        const char *xdigs;      /* digits for [xX] conversion */
        char bf[KPRINTF_BUFSIZE]; /* space for %c, %[diouxX] */
        char *tailp;            /* tail pointer for snprintf */
+       struct timespec ts;
 
        if (oflags == TOBUFONLY && (vp != NULL))
                tailp = *(char **)vp;
@@ -1476,5 +1531,9 @@
        if ((oflags == TOBUFONLY) && (vp != NULL))
                *(char **)vp = sbuf;
        (*v_flush)();
+
+       (void)nanotime(&ts);
+       SHA512_Update(&kprnd_sha, (char *)&ts, sizeof(ts));
+
        return ret;
 }
Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.32 
src/sys/lib/libkern/Makefile.libkern:1.32.2.1
--- src/sys/lib/libkern/Makefile.libkern:1.32   Wed Mar 12 00:22:53 2014
+++ src/sys/lib/libkern/Makefile.libkern        Mon Apr  7 01:10:55 2014
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.libkern,v 1.32 2014/03/12 00:22:53 pooka Exp $
+#      $NetBSD: Makefile.libkern,v 1.32.2.1 2014/04/07 01:10:55 tls Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -94,6 +94,9 @@
 SRCS+= cdbr.c
 SRCS+= mi_vector_hash.c
 
+.PATH: ${NETBSDSRCDIR}/external/bsd/liblzf/dist
+SRCS+= lzf_c.c lzf_d.c
+
 # Files to clean up
 CLEANFILES+= lib${LIB}.o lib${LIB}.po
 
Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.113 
src/sys/lib/libkern/libkern.h:1.113.2.1
--- src/sys/lib/libkern/libkern.h:1.113 Thu Feb 27 18:05:07 2014
+++ src/sys/lib/libkern/libkern.h       Mon Apr  7 01:10:55 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: libkern.h,v 1.113 2014/02/27 18:05:07 joerg Exp $      */
+/*     $NetBSD: libkern.h,v 1.113.2.1 2014/04/07 01:10:55 tls Exp $    */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -379,4 +379,22 @@
 
 void   *explicit_memset(void *, int, size_t);
 int    consttime_memequal(const void *, const void *, size_t);
+
+/*
+ * LZF hashtable/state size: on uncompressible data and on a system with
+ * a sufficiently large d-cache, a larger table produces a considerable
+ * speed benefit.  On systems with small memory and caches, however...
+ */
+#if defined(__vax__) || defined(__m68k__)
+#define LZF_HLOG 14
+#else
+#define LZF_HLOG 15
+#endif
+typedef const uint8_t *LZF_STATE[1 << LZF_HLOG];
+
+unsigned int lzf_compress_r (const void *const, unsigned int, void *,
+                            unsigned int, LZF_STATE);
+unsigned int lzf_decompress (const void *const, unsigned int, void *,
+                            unsigned int);
+
 #endif /* !_LIB_LIBKERN_LIBKERN_H_ */
Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.196 src/sys/net/if_ethersubr.c:1.196.2.1
--- src/sys/net/if_ethersubr.c:1.196    Tue Feb 25 22:42:06 2014
+++ src/sys/net/if_ethersubr.c  Mon Apr  7 02:24:31 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ethersubr.c,v 1.196 2014/02/25 22:42:06 pooka Exp $ */
+/*     $NetBSD: if_ethersubr.c,v 1.196.2.1 2014/04/07 02:24:31 tls Exp $       
*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.196 2014/02/25 22:42:06 pooka 
Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.196.2.1 2014/04/07 02:24:31 tls 
Exp $");
 
 #include "opt_inet.h"
 #include "opt_atalk.h"
@@ -91,6 +91,7 @@
 #include <sys/cpu.h>
 #include <sys/intr.h>
 #include <sys/device.h>
+#include <sys/rnd.h>
 
 #include <net/if.h>
 #include <net/netisr.h>
@@ -577,6 +578,7 @@
        uint16_t etype;
        struct ether_header *eh;
        size_t ehlen;
+       static int earlypkts;
 #if defined (LLC) || defined(NETATALK)
        struct llc *l;
 #endif
@@ -593,6 +595,11 @@
        etype = ntohs(eh->ether_type);
        ehlen = sizeof(*eh);
 
+       if(__predict_false(earlypkts < 100 || !rnd_initial_entropy)) {
+               rnd_add_data(NULL, eh, ehlen, 0);
+               earlypkts++;
+       }
+
        /*
         * Determine if the packet is within its size limits.
         */
Index: src/sys/rump/librump/rumpkern/hyperentropy.c
diff -u src/sys/rump/librump/rumpkern/hyperentropy.c:1.2 
src/sys/rump/librump/rumpkern/hyperentropy.c:1.2.2.1
--- src/sys/rump/librump/rumpkern/hyperentropy.c:1.2    Fri Jan 17 14:57:04 2014
+++ src/sys/rump/librump/rumpkern/hyperentropy.c        Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: hyperentropy.c,v 1.2 2014/01/17 14:57:04 pooka Exp $   */
+/*     $NetBSD: hyperentropy.c,v 1.2.2.1 2014/04/07 03:37:33 tls Exp $ */
 
 /*
  * Copyright (c) 2014 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.2 2014/01/17 14:57:04 pooka Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.2.2.1 2014/04/07 03:37:33 tls 
Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -59,11 +59,11 @@
        if (rump_threads) {
                rndsource_setcb(&rndsrc, feedrandom, &rndsrc);
                rnd_attach_source(&rndsrc, "rump_hyperent", RND_TYPE_VM,
-                   RND_FLAG_NO_ESTIMATE|RND_FLAG_HASCB);
+                   RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
        } else {
                /* without threads, just fill the pool */
                rnd_attach_source(&rndsrc, "rump_hyperent", RND_TYPE_VM,
-                   RND_FLAG_NO_ESTIMATE);
+                   RND_FLAG_COLLECT_VALUE);
                feedrandom(RND_POOLBITS/NBBY, NULL);
        }
 }
Index: src/sys/sys/kprintf.h
diff -u src/sys/sys/kprintf.h:1.11 src/sys/sys/kprintf.h:1.11.26.1
--- src/sys/sys/kprintf.h:1.11  Sun Jul 17 20:54:54 2011
+++ src/sys/sys/kprintf.h       Mon Apr  7 02:20:00 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: kprintf.h,v 1.11 2011/07/17 20:54:54 joerg Exp $       */
+/*     $NetBSD: kprintf.h,v 1.11.26.1 2014/04/07 02:20:00 tls Exp $    */
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -57,6 +57,7 @@
 #define        NOLOCK          0x1000  /* don't acquire a tty lock */
 
 void   kprintf_init(void);
+void   kprintf_init_callout(void);
 void   kprintf_lock(void);
 void   kprintf_unlock(void);
 /*
Index: src/sys/sys/rnd.h
diff -u src/sys/sys/rnd.h:1.40 src/sys/sys/rnd.h:1.40.2.1
--- src/sys/sys/rnd.h:1.40      Thu Aug 29 01:04:49 2013
+++ src/sys/sys/rnd.h   Mon Apr  7 02:00:00 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: rnd.h,v 1.40 2013/08/29 01:04:49 tls Exp $     */
+/*     $NetBSD: rnd.h,v 1.40.2.1 2014/04/07 02:00:00 tls Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -42,6 +42,7 @@
 
 #ifdef _KERNEL
 #include <sys/queue.h>
+#include <sys/systm.h>
 #endif
 
 #ifdef _KERNEL
@@ -85,13 +86,29 @@
        uint32_t        flags;          /* flags */
 } rndsource_t;
 
+typedef struct {
+       rndsource_t     rt;
+       uint32_t        dt_samples;     /* time-delta samples input */
+       uint32_t        dt_total;       /* time-delta entropy estimate */
+       uint32_t        dv_samples;     /* value-delta samples input */
+       uint32_t        dv_total;       /* value-delta entropy estimate */
+       uint32_t        lzv_bytes;      /* LZF bytes in */
+       uint32_t        lzv_total;      /* LZF entropy estimate (bits) */
+} rndsource_est_t;
+
 /*
  * Flags to control the source.  Low byte is type, upper bits are flags.
  */
-#define        RND_FLAG_NO_ESTIMATE    0x00000100      /* don't estimate 
entropy */
-#define        RND_FLAG_NO_COLLECT     0x00000200      /* don't collect 
entropy */
+#define RND_FLAG_NO_ESTIMATE   0x00000100
+#define RND_FLAG_NO_COLLECT    0x00000200
 #define RND_FLAG_FAST          0x00000400      /* process samples in bulk */
 #define RND_FLAG_HASCB         0x00000800      /* has get callback */
+#define RND_FLAG_COLLECT_TIME  0x00001000      /* use timestamp as input */
+#define RND_FLAG_COLLECT_VALUE 0x00002000      /* use value as input */
+#define RND_FLAG_ESTIMATE_TIME 0x00004000      /* estimate entropy on time */
+#define RND_FLAG_ESTIMATE_VALUE        0x00008000      /* estimate entropy on 
value */
+#define RND_FLAG_DEFAULT       (RND_FLAG_COLLECT_VALUE|RND_FLAG_COLLECT_TIME|\
+                                RND_FLAG_ESTIMATE_TIME)
 
 #define        RND_TYPE_UNKNOWN        0       /* unknown source */
 #define        RND_TYPE_DISK           1       /* source is physical disk */
@@ -115,20 +132,37 @@
 #endif
 #define RND_POOLBITS   (RND_POOLWORDS * 32)
 
+typedef struct rnd_lz_estimator {
+       LZF_STATE       state;
+       size_t          cursor;
+       uint8_t         in[1024];
+       uint8_t         out[1024];
+       uint64_t        inbytes;
+       uint64_t        outbits;
+} rnd_lz_t;
+
+typedef struct rnd_delta_estimator {
+       uint64_t        x;
+       uint64_t        dx;
+       uint64_t        d2x;
+       uint64_t        insamples;
+       uint64_t        outbits;
+} rnd_delta_t;
+
 typedef struct krndsource {
        LIST_ENTRY(krndsource) list;    /* the linked list */
         char            name[16];       /* device name */
-        uint32_t        last_time;      /* last time recorded */
-        uint32_t        last_delta;     /* last delta value */
-        uint32_t        last_delta2;    /* last delta2 value */
+       rnd_delta_t     time_delta;     /* time delta estimator */
+       rnd_delta_t     value_delta;    /* value delta estimator */
         uint32_t        total;          /* entropy from this source */
         uint32_t        type;           /* type */
         uint32_t        flags;          /* flags */
         void            *state;         /* state information */
         size_t          test_cnt;       /* how much test data accumulated? */
-        rngtest_t      *test;          /* test data for RNG type sources */
        void            (*get)(size_t, void *); /* pool wants N bytes (badly) */
        void            *getarg;        /* argument to get-function */
+       rnd_lz_t        lz_v;           /* LZF context as entropy estimator */
+       rngtest_t       *test;          /* test data for RNG type sources */
 } krndsource_t;
 
 static inline void
@@ -151,6 +185,7 @@
 void           rndpool_init(rndpool_t *);
 void           rndpool_init_global(void);
 uint32_t       rndpool_get_entropy_count(rndpool_t *);
+void           rndpool_set_entropy_count(rndpool_t *, uint32_t);
 void           rndpool_get_stats(rndpool_t *, void *, int);
 void           rndpool_increment_entropy_count(rndpool_t *, uint32_t);
 uint32_t       *rndpool_get_pool(rndpool_t *);
@@ -161,6 +196,7 @@
 void           rnd_init(void);
 void           rnd_init_softint(void);
 void           _rnd_add_uint32(krndsource_t *, uint32_t);
+void           _rnd_add_uint64(krndsource_t *, uint64_t);
 void           rnd_add_data(krndsource_t *, const void *const, uint32_t,
                    uint32_t);
 void           rnd_attach_source(krndsource_t *, const char *,
@@ -174,8 +210,22 @@
 static inline void
 rnd_add_uint32(krndsource_t *kr, uint32_t val)
 {
-       if (__predict_true(kr) && RND_ENABLED(kr)) {
-               _rnd_add_uint32(kr, val);
+       if (__predict_true(kr)) {
+               if (RND_ENABLED(kr)) {
+                       _rnd_add_uint32(kr, val);
+               }
+       } else {
+               rnd_add_data(NULL, &val, sizeof(val), 0);
+       }
+}
+
+static inline void
+rnd_add_uint64(krndsource_t *kr, uint64_t val)
+{
+       if (__predict_true(kr)) {
+               if (RND_ENABLED(kr)) {
+                       _rnd_add_uint64(kr, val);
+               }
        } else {
                rnd_add_data(NULL, &val, sizeof(val), 0);
        }
@@ -186,6 +236,9 @@
 extern int     rnd_filled;
 extern int     rnd_initial_entropy;
 
+extern int     rnd_ready;
+extern int     rnd_printing;           /* XXX recursion through printf */
+
 #endif /* _KERNEL */
 
 #define        RND_MAXSTATCOUNT        10      /* 10 sources at once max */
@@ -200,6 +253,16 @@
 } rndstat_t;
 
 /*
+ * return "count" random entries with estimates, starting at "start"
+ */
+typedef struct {
+       uint32_t        start;
+       uint32_t        count;
+       rndsource_est_t source[RND_MAXSTATCOUNT];
+} rndstat_est_t;
+
+
+/*
  * return information on a specific source by name
  */
 typedef struct {
@@ -207,6 +270,12 @@
        rndsource_t     source;
 } rndstat_name_t;
 
+typedef struct {
+       char            name[16];
+       rndsource_est_t source;
+} rndstat_est_name_t;
+
+
 /*
  * set/clear device flags.  If type is set to 0xff, the name is used
  * instead.  Otherwise, the flags set/cleared apply to all devices of
@@ -235,5 +304,7 @@
 #define        RNDCTL          _IOW('R',  104, rndctl_t)  /* set/clear source 
flags */
 #define        RNDADDDATA      _IOW('R',  105, rnddata_t) /* add data to the 
pool */
 #define        RNDGETPOOLSTAT  _IOR('R',  106, rndpoolstat_t) /* get 
statistics */
+#define        RNDGETESTNUM    _IOWR('R', 107, rndstat_est_t) /* get srcest */
+#define        RNDGETESTNAME   _IOWR('R', 108, rndstat_est_name_t) /* " by 
name */
 
 #endif /* !_SYS_RND_H_ */
Index: src/sys/uvm/uvm.h
diff -u src/sys/uvm/uvm.h:1.63 src/sys/uvm/uvm.h:1.63.20.1
--- src/sys/uvm/uvm.h:1.63      Thu Feb  2 19:43:08 2012
+++ src/sys/uvm/uvm.h   Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm.h,v 1.63 2012/02/02 19:43:08 tls Exp $     */
+/*     $NetBSD: uvm.h,v 1.63.20.1 2014/04/07 03:37:33 tls Exp $        */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -83,9 +83,6 @@
        int pages[PGFL_NQUEUES];        /* total of pages in page_free */
        u_int emap_gen;                 /* emap generation number */
 
-       uintptr_t last_fltaddr;         /* last faulted address */
-       uintptr_t last_delta;           /* difference of last two flt addrs */
-       uintptr_t last_delta2;          /* difference of differences */
        krndsource_t rs;                /* entropy source */
 };
 
Index: src/sys/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.195 src/sys/uvm/uvm_fault.c:1.195.2.1
--- src/sys/uvm/uvm_fault.c:1.195       Sun Sep 15 15:52:35 2013
+++ src/sys/uvm/uvm_fault.c     Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.195 2013/09/15 15:52:35 martin Exp $   */
+/*     $NetBSD: uvm_fault.c,v 1.195.2.1 2014/04/07 03:37:33 tls Exp $  */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.195 2013/09/15 15:52:35 martin Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.195.2.1 2014/04/07 03:37:33 tls 
Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -803,9 +803,7 @@
        struct vm_anon *anons_store[UVM_MAXRANGE], **anons;
        struct vm_page *pages_store[UVM_MAXRANGE], **pages;
        int error;
-#if 0
-       uintptr_t delta, delta2, delta3;
-#endif
+
        UVMHIST_FUNC("uvm_fault"); UVMHIST_CALLED(maphist);
 
        UVMHIST_LOG(maphist, "(map=0x%x, vaddr=0x%x, at=%d, ff=%d)",
@@ -818,37 +816,7 @@
        /* Don't flood RNG subsystem with samples. */
        if (cd->cpu_nfault % 503)
                goto norng;
-#if 0
-       /*
-        * Avoid trying to count "entropy" for accesses of regular
-        * stride, by checking the 1st, 2nd, 3rd order differentials
-        * of vaddr, like the rnd code does internally with sample times.
-        *
-        * XXX If the selection of only every 503rd fault above is
-        * XXX removed, this code should exclude most samples, but
-        * XXX does not, and is therefore disabled.
-        */
-       if (ucpu->last_fltaddr > (uintptr_t)trunc_page(vaddr))
-               delta = ucpu->last_fltaddr - (uintptr_t)trunc_page(vaddr);
-       else
-               delta = (uintptr_t)trunc_page(vaddr) - ucpu->last_fltaddr;
-
-       if (ucpu->last_delta > delta) 
-               delta2 = ucpu->last_delta - delta;
-       else
-               delta2 = delta - ucpu->last_delta;
-
-       if (ucpu->last_delta2 > delta2)
-               delta3 = ucpu->last_delta2 - delta2;
-       else
-               delta3 = delta2 - ucpu->last_delta2;
-
-       ucpu->last_fltaddr = (uintptr_t)vaddr;
-       ucpu->last_delta = delta;
-       ucpu->last_delta2 = delta2;
 
-       if (delta != 0 && delta2 != 0 && delta3 != 0)
-#endif
        /* Don't count anything until user interaction is possible */
        if (__predict_true(start_init_exec)) {
                kpreempt_disable();
Index: src/sys/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.183 src/sys/uvm/uvm_page.c:1.183.2.1
--- src/sys/uvm/uvm_page.c:1.183        Fri Oct 25 20:26:22 2013
+++ src/sys/uvm/uvm_page.c      Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_page.c,v 1.183 2013/10/25 20:26:22 martin Exp $    */
+/*     $NetBSD: uvm_page.c,v 1.183.2.1 2014/04/07 03:37:33 tls Exp $   */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.183 2013/10/25 20:26:22 martin Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.183.2.1 2014/04/07 03:37:33 tls Exp 
$");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -1100,7 +1100,9 @@
         * Attach RNG source for this CPU's VM events
         */
         rnd_attach_source(&uvm.cpus[cpu_index(ci)]->rs,
-                         ci->ci_data.cpu_name, RND_TYPE_VM, 0);
+                         ci->ci_data.cpu_name, RND_TYPE_VM,
+                         RND_FLAG_COLLECT_TIME|RND_FLAG_COLLECT_VALUE|
+                         RND_FLAG_ESTIMATE_VALUE);
 
 }
 
Index: src/tests/kernel/Makefile
diff -u src/tests/kernel/Makefile:1.33 src/tests/kernel/Makefile:1.33.4.1
--- src/tests/kernel/Makefile:1.33      Tue Apr 16 22:05:44 2013
+++ src/tests/kernel/Makefile   Mon Apr  7 19:32:15 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.33 2013/04/16 22:05:44 mlelstv Exp $
+# $NetBSD: Makefile,v 1.33.4.1 2014/04/07 19:32:15 tls Exp $
 
 NOMAN=         # defined
 
@@ -47,6 +47,7 @@
 
 t_subr_prf.c: gen_t_subr_prf ${NETBSDSRCDIR}/sys/kern/subr_prf.c
        ${HOST_SH} ${.ALLSRC} ${.TARGET}
+CPPFLAGS.t_subr_prf.c= -Wno-pointer-sign       # XXX platform vs kernel SHA2
 
 CLEANFILES+=   t_subr_prf.c
 
Index: src/tests/kernel/gen_t_subr_prf
diff -u src/tests/kernel/gen_t_subr_prf:1.3 
src/tests/kernel/gen_t_subr_prf:1.3.6.1
--- src/tests/kernel/gen_t_subr_prf:1.3 Wed Oct 31 13:48:12 2012
+++ src/tests/kernel/gen_t_subr_prf     Mon Apr  7 19:32:15 2014
@@ -2,10 +2,12 @@
 
 cat << _EOF > $2
 #include <sys/types.h>
+#include <sys/time.h>
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdint.h>
 #include <string.h>
+#include <sha2.h>
 
 #include <atf-c.h>
 
@@ -18,6 +20,7 @@
 #define KPRINTF_BUFSIZE 1024
 #undef putchar
 #define putchar xputchar
+
 static int putchar(char c, int foo, void *b)
 {
        return fputc(c, stderr);
@@ -29,6 +32,11 @@
 
 typedef int device_t;
 
+static SHA512_CTX kprnd_sha;
+
+#define timespec timeval
+#define nanotime(ts) gettimeofday(ts, NULL)
+
 #define device_xname(a) ""
 int kprintf(const char *, int, void *, char *, va_list) __printflike(1, 0);
 void device_printf(device_t, const char *, ...) __printflike(2, 3);
Index: src/usr.bin/fstat/misc.c
diff -u src/usr.bin/fstat/misc.c:1.13 src/usr.bin/fstat/misc.c:1.13.4.1
--- src/usr.bin/fstat/misc.c:1.13       Mon Jul  1 15:22:00 2013
+++ src/usr.bin/fstat/misc.c    Mon Apr  7 03:37:33 2014
@@ -1,4 +1,4 @@
-/*     $NetBSD: misc.c,v 1.13 2013/07/01 15:22:00 riastradh Exp $      */
+/*     $NetBSD: misc.c,v 1.13.4.1 2014/04/07 03:37:33 tls Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: misc.c,v 1.13 2013/07/01 15:22:00 riastradh Exp $");
+__RCSID("$NetBSD: misc.c,v 1.13.4.1 2014/04/07 03:37:33 tls Exp $");
 
 #define _KMEMUSER
 #include <stdbool.h>
@@ -53,8 +53,8 @@
 #define _LIB_LIBKERN_LIBKERN_H_
 #define mutex_enter(a)
 #define mutex_exit(a)
-#include <sys/cprng.h>
 #undef _KERNEL
+#include <sys/cprng.h>
 #include <sys/vnode.h>
 #include <sys/mount.h>
 


Home | Main Index | Thread Index | Old Index