Merge tls-earlyentropy branch into HEAD.

This commit is contained in:
tls 2014-08-10 16:44:32 +00:00
parent c4d96b015d
commit ea6af427bd
148 changed files with 1795 additions and 996 deletions

View File

@ -1,4 +1,8 @@
# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1960 $>
<<<<<<< CHANGES
# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1961 $>
=======
# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1961 $>
>>>>>>> 1.1910.2.1
#
#
# [Note: This file does not mention every change made to the NetBSD source tree.
@ -465,3 +469,12 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
ekermit(1): Add BSD-licenced ekermit, and remove GPL-licenced
gkermit. [apb 20140808]
rescue(8): Add /rescue/ekermit. [apb 20140809]
rnd(4): Suck in much more entropy early in boot and thereafter:
autoconf timings, all sysctl settings (including hostname),
contents of early network packets, environmental sensor
values generically rather than as per-driver special cases.
[tls 20140810]
cprng_fast(9): Replace slow/broken mutex-protected kernel
_arc4random() with new cprng_fast implemenation
from riastradh@ using per-cpu instances of chacha8.
[tls 20140810]

View File

@ -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 uint8_t u8;
typedef uint16_t u16;
typedef const u8 *LZF_STATE[1 << (HLOG)];
#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

View File

@ -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 @@ lzf_compress_r (const void *const in_data, unsigned int in_len,
#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]

View File

@ -34,13 +34,23 @@
* either the BSD or the GPL.
*/
#include "lzf.h"
#if AVOID_ERRNO
# define SET_ERRNO(n)
#if defined(_KERNEL) || defined (_STANDALONE)
#include <lib/libkern/libkern.h>
#include <sys/systm.h>
#include "lzfP.h"
#else
# include <errno.h>
# define SET_ERRNO(n) errno = (n)
#include "lzf.h"
#endif
#ifdef _KERNEL
# define SET_ERRNO(n) panic("lzf decompression failure: %s", #n)
#else
# ifdef AVOID_ERRNO
# define SET_ERRNO(n)
# else
# include <errno.h>
# define SET_ERRNO(n) errno = (n)
# endif
#endif
#if (__i386 || __amd64) && __GNUC__ >= 3

View File

@ -1,4 +1,4 @@
.\" $NetBSD: rndctl.8,v 1.20 2011/11/23 12:15:30 wiz Exp $
.\" $NetBSD: rndctl.8,v 1.21 2014/08/10 16:44:32 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 @@ Terminal, mouse, or other user input devices.
.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

View File

@ -1,4 +1,4 @@
/* $NetBSD: rndctl.c,v 1.27 2014/01/15 15:05:27 apb Exp $ */
/* $NetBSD: rndctl.c,v 1.28 2014/08/10 16:44:32 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.28 2014/08/10 16:44:32 tls Exp $");
#endif
@ -78,6 +78,8 @@ static char * strflags(u_int32_t);
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 @@ strflags(u_int32_t fl)
{
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 @@ strflags(u_int32_t fl)
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,25 @@ do_list(int all, u_int32_t type, char *name)
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);
}
close(fd);
return;
}
@ -311,22 +332,32 @@ do_list(int all, u_int32_t type, char *name)
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);
}
}
start += rstat.count;
}
@ -375,7 +406,7 @@ main(int argc, char **argv)
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 +461,9 @@ main(int argc, char **argv)
case 's':
sflag++;
break;
case 'v':
vflag++;
break;
case '?':
default:
usage();

View File

@ -1,4 +1,4 @@
.\" $NetBSD: rnd.9,v 1.22 2012/07/12 00:07:36 pgoyette Exp $
.\" $NetBSD: rnd.9,v 1.23 2014/08/10 16:44:32 tls Exp $
.\"
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -100,15 +100,32 @@ It is used internally to the rnd system.
.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.

View File

@ -1,4 +1,4 @@
/* $NetBSD: arckbd.c,v 1.22 2012/02/02 19:42:57 tls Exp $ */
/* $NetBSD: arckbd.c,v 1.23 2014/08/10 16:44:32 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.23 2014/08/10 16:44:32 tls Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -219,8 +219,10 @@ arckbd_attach(device_t parent, device_t self, void *aux)
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;

View File

@ -0,0 +1,24 @@
# $NetBSD: RNDVERBOSE,v 1.2 2014/08/10 16:44:33 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"

View File

@ -31,7 +31,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: awin_eth.c,v 1.4 2014/06/05 03:48:08 matt Exp $");
__KERNEL_RCSID(1, "$NetBSD: awin_eth.c,v 1.5 2014/08/10 16:44:33 tls Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -254,7 +254,7 @@ awin_eth_attach(device_t parent, device_t self, void *aux)
if_attach(ifp);
ether_ifattach(ifp, enaddr);
rnd_attach_source(&sc->sc_rnd_source, device_xname(self),
RND_TYPE_NET, 0);
RND_TYPE_NET, RND_FLAG_DEFAULT);
}
int

View File

@ -1,5 +1,5 @@
/* $Id: at91dbgu.c,v 1.11 2014/07/25 08:10:31 dholland Exp $ */
/* $NetBSD: at91dbgu.c,v 1.11 2014/07/25 08:10:31 dholland Exp $ */
/* $Id: at91dbgu.c,v 1.12 2014/08/10 16:44:33 tls Exp $ */
/* $NetBSD: at91dbgu.c,v 1.12 2014/08/10 16:44:33 tls Exp $ */
/*
*
@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: at91dbgu.c,v 1.11 2014/07/25 08:10:31 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: at91dbgu.c,v 1.12 2014/08/10 16:44:33 tls Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -289,7 +289,7 @@ at91dbgu_attach(device_t parent, device_t self, void *aux)
#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

View File

@ -1,5 +1,5 @@
/* $Id: at91usart.c,v 1.10 2014/07/25 08:10:31 dholland Exp $ */
/* $NetBSD: at91usart.c,v 1.10 2014/07/25 08:10:31 dholland Exp $ */
/* $Id: at91usart.c,v 1.11 2014/08/10 16:44:33 tls Exp $ */
/* $NetBSD: at91usart.c,v 1.11 2014/08/10 16:44:33 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.10 2014/07/25 08:10:31 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: at91usart.c,v 1.11 2014/08/10 16:44:33 tls Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -315,7 +315,7 @@ at91usart_attach_subr(struct at91usart_softc *sc, struct at91bus_attach_args *sa
#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

View File

@ -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.10 2014/08/10 16:44:33 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.10 2014/08/10 16:44:33 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -129,7 +129,7 @@ bcmrng_attach(device_t parent, device_t self, void *aux)
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);

View File

@ -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.7 2014/08/10 16:44:33 tls Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -143,7 +143,7 @@ bcmrng_ccb_attach(device_t parent, device_t self, void *aux)
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,

View File

@ -1,4 +1,4 @@
/* $NetBSD: clpscom.c,v 1.3 2014/07/25 08:10:32 dholland Exp $ */
/* $NetBSD: clpscom.c,v 1.4 2014/08/10 16:44:33 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.3 2014/07/25 08:10:32 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: clpscom.c,v 1.4 2014/08/10 16:44:33 tls Exp $");
#include "rnd.h"
@ -248,7 +248,7 @@ clpscom_attach(device_t parent, device_t self, void *aux)
#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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: epcom.c,v 1.27 2014/07/25 08:10:32 dholland Exp $ */
/* $NetBSD: epcom.c,v 1.28 2014/08/10 16:44:33 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.27 2014/07/25 08:10:32 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: epcom.c,v 1.28 2014/08/10 16:44:33 tls Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -249,7 +249,7 @@ epcom_attach_subr(struct epcom_softc *sc)
#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

View File

@ -1,4 +1,4 @@
/* $NetBSD: imxuart.c,v 1.13 2014/07/25 08:10:32 dholland Exp $ */
/* $NetBSD: imxuart.c,v 1.14 2014/08/10 16:44:33 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.13 2014/07/25 08:10:32 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.14 2014/08/10 16:44:33 tls Exp $");
#include "opt_imxuart.h"
#include "opt_ddb.h"
@ -505,7 +505,8 @@ imxuart_attach_common(device_t parent, device_t self,
#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

View File

@ -1,4 +1,4 @@
/* $NetBSD: ixp12x0_com.c,v 1.44 2014/07/25 08:10:32 dholland Exp $ */
/* $NetBSD: ixp12x0_com.c,v 1.45 2014/08/10 16:44:33 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.44 2014/07/25 08:10:32 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ixp12x0_com.c,v 1.45 2014/08/10 16:44:33 tls Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -248,7 +248,8 @@ ixpcom_attach_subr(struct ixpcom_softc *sc)
#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

View File

@ -1,4 +1,4 @@
/* $NetBSD: sscom.c,v 1.45 2014/07/25 08:10:32 dholland Exp $ */
/* $NetBSD: sscom.c,v 1.46 2014/08/10 16:44:33 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.45 2014/07/25 08:10:32 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.46 2014/08/10 16:44:33 tls Exp $");
#include "opt_sscom.h"
#include "opt_ddb.h"
@ -510,7 +510,8 @@ sscom_attach_subr(struct sscom_softc *sc)
#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

View File

@ -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.17 2014/08/10 16:44:33 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.17 2014/08/10 16:44:33 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -276,7 +276,7 @@ sackbc_attach(device_t parent, device_t self, void *aux)
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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sa11x0_com.c,v 1.52 2014/07/25 08:10:32 dholland Exp $ */
/* $NetBSD: sa11x0_com.c,v 1.53 2014/08/10 16:44:33 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.52 2014/07/25 08:10:32 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.53 2014/08/10 16:44:33 tls Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@ -342,7 +342,8 @@ sacom_attach_subr(struct sacom_softc *sc)
#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

View File

@ -1,4 +1,4 @@
/* $NetBSD: sscom.c,v 1.5 2014/04/20 22:45:27 matt Exp $ */
/* $NetBSD: sscom.c,v 1.6 2014/08/10 16:44:33 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.5 2014/04/20 22:45:27 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.6 2014/08/10 16:44:33 tls Exp $");
#include "opt_sscom.h"
#include "opt_ddb.h"
@ -514,7 +514,7 @@ sscom_attach_subr(struct sscom_softc *sc)
#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

View File

@ -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.26 2014/08/10 16:44:33 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.26 2014/08/10 16:44:33 tls Exp $");
/*
* Intel XScale NPE Ethernet driver.
@ -334,7 +334,7 @@ npe_attach(device_t parent, device_t self, void *arg)
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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ace_ebus.c,v 1.12 2014/07/25 08:10:32 dholland Exp $ */
/* $NetBSD: ace_ebus.c,v 1.13 2014/08/10 16:44:33 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.12 2014/07/25 08:10:32 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ace_ebus.c,v 1.13 2014/08/10 16:44:33 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1462,8 +1462,6 @@ sysace_send_config(struct ace_softc *sc, uint32_t *Data, unsigned int nBytes)
* Rest of code lifted with mods from the dev\ata\wd.c driver
*/
/* $NetBSD: ace_ebus.c,v 1.12 2014/07/25 08:10:32 dholland Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
*
@ -1657,7 +1655,7 @@ aceattach(struct ace_softc *ace)
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);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: flash_ebus.c,v 1.10 2014/07/25 08:10:32 dholland Exp $ */
/* $NetBSD: flash_ebus.c,v 1.11 2014/08/10 16:44:33 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.10 2014/07/25 08:10:32 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: flash_ebus.c,v 1.11 2014/08/10 16:44:33 tls Exp $");
/* Driver for the Intel 28F320/640/128 (J3A150) StrataFlash memory device
* Extended to include the Intel JS28F256P30T95.
@ -1302,8 +1302,6 @@ static int eflash_write_at (struct eflash_softc *sc,
/* Rest of code lifted with mods from the dev\ata\wd.c driver
*/
/* $NetBSD: flash_ebus.c,v 1.10 2014/07/25 08:10:32 dholland Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
*
@ -1472,7 +1470,7 @@ eflashattach(struct eflash_softc *sc)
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);
}

View File

@ -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.6 2014/08/10 16:44:33 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.6 2014/08/10 16:44:33 tls Exp $");
#include "opt_inet.h"
@ -223,7 +223,7 @@ enic_attach(device_t parent, device_t self, void *aux)
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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: wmcom.c,v 1.3 2014/07/25 08:10:32 dholland Exp $ */
/* $NetBSD: wmcom.c,v 1.4 2014/08/10 16:44:33 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.3 2014/07/25 08:10:32 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: wmcom.c,v 1.4 2014/08/10 16:44:33 tls Exp $");
#include "rnd.h"
@ -225,7 +225,7 @@ wmcom_attach(device_t parent, device_t self, void *aux)
#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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: plcom.c,v 1.49 2014/07/25 08:10:32 dholland Exp $ */
/* $NetBSD: plcom.c,v 1.50 2014/08/10 16:44:34 tls Exp $ */
/*-
* Copyright (c) 2001 ARM Ltd
@ -94,7 +94,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.49 2014/07/25 08:10:32 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.50 2014/08/10 16:44:34 tls Exp $");
#include "opt_plcom.h"
#include "opt_ddb.h"
@ -562,7 +562,7 @@ plcom_attach_subr(struct plcom_softc *sc)
#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
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: rd.c,v 1.97 2014/07/25 08:10:33 dholland Exp $ */
/* $NetBSD: rd.c,v 1.98 2014/08/10 16:44:34 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.97 2014/07/25 08:10:33 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.98 2014/08/10 16:44:34 tls Exp $");
#include "opt_useleds.h"
@ -376,7 +376,7 @@ rdattach(device_t parent, device_t self, void *aux)
* 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

View File

@ -1,4 +1,4 @@
/* $NetBSD: harmony.c,v 1.1 2014/02/24 07:23:43 skrll Exp $ */
/* $NetBSD: harmony.c,v 1.2 2014/08/10 16:44:34 tls Exp $ */
/* $OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $ */
@ -320,7 +320,7 @@ harmony_attach(device_t parent, device_t self, void *aux)
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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: glxsb.c,v 1.11 2014/04/04 14:47:26 christos Exp $ */
/* $NetBSD: glxsb.c,v 1.12 2014/08/10 16:44:34 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.12 2014/08/10 16:44:34 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -247,7 +247,7 @@ glxsb_attach(device_t parent, device_t self, void *aux)
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 @@ glxsb_rnd(void *v)
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);

View File

@ -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.44 2014/08/10 16:44:34 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.44 2014/08/10 16:44:34 tls Exp $");
#include "opt_inet.h"
@ -248,7 +248,8 @@ gmac_attach(device_t parent, device_t self, void *aux)
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

View File

@ -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.38 2014/08/10 16:44:34 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.38 2014/08/10 16:44:34 tls Exp $");
@ -341,7 +341,7 @@ aumac_attach(device_t parent, device_t self, void *aux)
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,

View File

@ -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.25 2014/08/10 16:44:34 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.25 2014/08/10 16:44:34 tls Exp $");
#include <sys/param.h>
@ -387,7 +387,7 @@ ae_attach(device_t parent, device_t self, void *aux)
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.

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbscn.c,v 1.39 2014/07/25 08:10:34 dholland Exp $ */
/* $NetBSD: sbscn.c,v 1.40 2014/08/10 16:44:34 tls Exp $ */
/*
* Copyright 2000, 2001
@ -109,7 +109,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.39 2014/07/25 08:10:34 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.40 2014/08/10 16:44:34 tls Exp $");
#define SBSCN_DEBUG
@ -394,7 +394,8 @@ sbscn_attach_channel(struct sbscn_softc *sc, int chan, int intr)
#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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mb8795.c,v 1.52 2014/03/24 20:01:03 christos Exp $ */
/* $NetBSD: mb8795.c,v 1.53 2014/08/10 16:44:34 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.53 2014/08/10 16:44:34 tls Exp $");
#include "opt_inet.h"
@ -138,7 +138,7 @@ mb8795_config(struct mb8795_softc *sc, int *media, int nmedia, int defmedia)
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)));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_smap.c,v 1.16 2014/06/29 11:18:40 mrg Exp $ */
/* $NetBSD: if_smap.c,v 1.17 2014/08/10 16:44:34 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.16 2014/06/29 11:18:40 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.17 2014/08/10 16:44:34 tls Exp $");
#include "debug_playstation2.h"
@ -260,7 +260,7 @@ smap_attach(struct device *parent, struct device *self, void *aux)
#if NRND > 0
rnd_attach_source(&sc->rnd_source, DEVNAME,
RND_TYPE_NET, 0);
RND_TYPE_NET, RND_FLAG_DEFAULT);
#endif
}

View File

@ -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.50 2014/08/10 16:44:34 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.50 2014/08/10 16:44:34 tls Exp $");
#include "opt_ddb.h"
@ -620,7 +620,7 @@ mec_attach(device_t parent, device_t self, void *aux)
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,

View File

@ -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.21 2014/08/10 16:44:34 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.21 2014/08/10 16:44:34 tls Exp $");
#include "opt_inet.h"
#include "opt_ns.h"
@ -245,7 +245,7 @@ ec_attach(device_t parent, device_t self, void *aux)
ec_intr, sc);
rnd_attach_source(&sc->rnd_source, device_xname(self),
RND_TYPE_NET, 0);
RND_TYPE_NET, RND_FLAG_DEFAULT);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.110 2014/07/25 08:10:35 dholland Exp $ */
/* $NetBSD: fd.c,v 1.111 2014/08/10 16:44:34 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.110 2014/07/25 08:10:35 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.111 2014/08/10 16:44:34 tls Exp $");
#include "opt_ddb.h"
#include "opt_m68k_arch.h"
@ -662,7 +662,7 @@ fdattach(device_t parent, device_t self, void *aux)
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 *

View File

@ -1,4 +1,4 @@
/* $NetBSD: fwhrng.c,v 1.6 2013/10/17 21:12:24 christos Exp $ */
/* $NetBSD: fwhrng.c,v 1.7 2014/08/10 16:44:34 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.7 2014/08/10 16:44:34 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -194,7 +194,7 @@ fwhrng_attach(device_t parent, device_t self, void *aux)
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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ipmi.c,v 1.56 2013/10/17 20:58:55 christos Exp $ */
/* $NetBSD: ipmi.c,v 1.57 2014/08/10 16:44:34 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.57 2014/08/10 16:44:34 tls Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -1511,10 +1511,6 @@ ipmi_convert_sensor(uint8_t *reading, struct ipmi_sensor *psensor)
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 @@ add_child_sensors(struct ipmi_softc *sc, uint8_t *psdr, int count,
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 @@ add_child_sensors(struct ipmi_softc *sc, uint8_t *psdr, int count,
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_thread(void *cookie)
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.
*/

View File

@ -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.22 2014/08/10 16:44:34 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.22 2014/08/10 16:44:34 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -124,9 +124,8 @@ via_c3_rnd_init(struct via_padlock_softc *sc)
} 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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: viac7temp.c,v 1.7 2013/11/15 08:47:55 msaitoh Exp $ */
/* $NetBSD: viac7temp.c,v 1.8 2014/08/10 16:44:34 tls Exp $ */
/*-
* Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca>
@ -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.8 2014/08/10 16:44:34 tls Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -96,7 +96,7 @@ viac7temp_attach(device_t parent, device_t self, void *aux)
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",

View File

@ -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.63 2014/08/10 16:44:35 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.63 2014/08/10 16:44:35 tls Exp $");
#include "opt_xen.h"
#include "opt_nfs_boot.h"
@ -401,7 +401,7 @@ xennet_xenbus_attach(device_t parent, device_t self, void *aux)
}
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))

View File

@ -1,4 +1,4 @@
/* $NetBSD: xbd_xenbus.c,v 1.65 2014/07/25 08:10:35 dholland Exp $ */
/* $NetBSD: xbd_xenbus.c,v 1.66 2014/08/10 16:44:35 tls Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.65 2014/07/25 08:10:35 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.66 2014/08/10 16:44:35 tls Exp $");
#include "opt_xen.h"
@ -318,7 +318,7 @@ xbd_xenbus_attach(device_t parent, device_t self, void *aux)
}
rnd_attach_source(&sc->sc_rnd_source, device_xname(self),
RND_TYPE_DISK, RND_FLAG_NO_COLLECT | RND_FLAG_NO_ESTIMATE);
RND_TYPE_DISK, RND_FLAG_DEFAULT);
if (!pmf_device_register(self, xbd_xenbus_suspend, xbd_xenbus_resume))
aprint_error_dev(self, "couldn't establish power handler\n");

View File

@ -1,4 +1,4 @@
# $NetBSD: files,v 1.1095 2014/07/30 13:32:09 ozaki-r Exp $
# $NetBSD: files,v 1.1096 2014/08/10 16:44:35 tls Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20100430
@ -116,6 +116,9 @@ defflag opt_gre.h GRE_DEBUG
defflag opt_wapbl.h WAPBL WAPBL_DEBUG
defparam opt_wapbl.h WAPBL_DEBUG_PRINT
# printf entropy source
defflag opt_rnd_printf.h RND_PRINTF
# compatibility options
#
defflag opt_compat_netbsd.h COMPAT_NETBSD
@ -166,6 +169,9 @@ include "opencrypto/files.opencrypto"
# NIST SP800.90 CTR DRBG
include "crypto/nist_ctr_drbg/files.nist_ctr_drbg"
# ChaCha-based fast PRNG
include "crypto/cprng_fast/files.cprng_fast"
#
# Kernel history/tracing. Old UVMHIST depends upon this.
#

View File

@ -1,4 +1,4 @@
/* $NetBSD: arc4.c,v 1.6 2005/12/11 12:20:48 christos Exp $ */
/* $NetBSD: arc4.c,v 1.7 2014/08/10 16:44:35 tls Exp $ */
/*
* ARC4 implementation
@ -30,19 +30,12 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: arc4.c,v 1.6 2005/12/11 12:20:48 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: arc4.c,v 1.7 2014/08/10 16:44:35 tls Exp $");
#include <sys/types.h>
#include <crypto/arc4/arc4.h>
struct arc4_ctx {
unsigned int x;
unsigned int y;
unsigned int state[256];
/* was unsigned char, changed to int for performance -- onoe */
};
int
arc4_ctxlen(void)
{
@ -96,9 +89,32 @@ arc4_encrypt(void *ctxp, u_char *dst, const u_char *src, int len)
ctx->y = y;
}
void
arc4_stream(void *ctxp, u_char *dst, int len)
{
struct arc4_ctx *ctx = ctxp;
unsigned int x, y, sx, sy;
unsigned int *state;
const unsigned char *enddst;
state = ctx->state;
x = ctx->x;
y = ctx->y;
for (enddst = dst + len; dst != enddst; dst++) {
x = (x + 1) & 0xff;
sx = state[x];
y = (sx + y) & 0xff;
state[x] = sy = state[y];
state[y]= sx;
*dst = state[(sx + sy) & 0xff];
}
ctx->x = x;
ctx->y = y;
}
void
arc4_decrypt(void *ctxp, u_char *dst, const u_char *src, int len)
{
arc4_encrypt(ctxp, dst, src, len);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: arc4.h,v 1.4 2005/12/11 12:20:48 christos Exp $ */
/* $NetBSD: arc4.h,v 1.5 2014/08/10 16:44:35 tls Exp $ */
/*
* ARC4 implementation
@ -32,9 +32,18 @@
#ifndef _CRYPTO_ARC4_H_
#define _CRYPTO_ARC4_H_
typedef struct arc4_ctx {
unsigned int x;
unsigned int y;
unsigned int state[256];
/* was unsigned char, changed to int for performance -- onoe */
} arc4_ctx_t;
int arc4_ctxlen(void);
void arc4_setkey(void *, const u_char *, unsigned int);
void arc4_encrypt(void *, u_char *, const u_char *, int);
void arc4_decrypt(void *, u_char *, const u_char *, int);
void arc4_stream(void *, u_char *, int);
#endif /* _CRYPTO_ARC4_H_ */

View File

@ -1,5 +1,5 @@
# $NetBSD: files.arc4,v 1.1 2002/10/11 01:52:07 thorpej Exp $
# $NetBSD: files.arc4,v 1.2 2014/08/10 16:44:35 tls Exp $
define arc4
file crypto/arc4/arc4.c arc4
file crypto/arc4/arc4.c

View File

@ -0,0 +1,496 @@
/* $NetBSD: cprng_fast.c,v 1.2 2014/08/10 16:44:35 tls Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Taylor R. Campbell.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cprng_fast.c,v 1.2 2014/08/10 16:44:35 tls Exp $");
#include <sys/types.h>
#include <sys/bitops.h>
#include <sys/param.h>
#include <sys/cpu.h>
#include <sys/intr.h>
#include <sys/percpu.h>
#include <sys/cprng.h>
/* ChaCha core */
#define crypto_core_OUTPUTWORDS 16
#define crypto_core_INPUTWORDS 4
#define crypto_core_KEYWORDS 8
#define crypto_core_CONSTWORDS 4
#define crypto_core_ROUNDS 8
static uint32_t
rotate(uint32_t u, unsigned c)
{
return (u << c) | (u >> (32 - c));
}
#define QUARTERROUND(a, b, c, d) do { \
(a) += (b); (d) ^= (a); (d) = rotate((d), 16); \
(c) += (d); (b) ^= (c); (b) = rotate((b), 12); \
(a) += (b); (d) ^= (a); (d) = rotate((d), 8); \
(c) += (d); (b) ^= (c); (b) = rotate((b), 7); \
} while (0)
static void
crypto_core(uint32_t *out, const uint32_t *in, const uint32_t *k,
const uint32_t *c)
{
uint32_t x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15;
int i;
x0 = c[0];
x1 = c[1];
x2 = c[2];
x3 = c[3];
x4 = k[0];
x5 = k[1];
x6 = k[2];
x7 = k[3];
x8 = k[4];
x9 = k[5];
x10 = k[6];
x11 = k[7];
x12 = in[0];
x13 = in[1];
x14 = in[2];
x15 = in[3];
for (i = crypto_core_ROUNDS; i > 0; i -= 2) {
QUARTERROUND( x0, x4, x8,x12);
QUARTERROUND( x1, x5, x9,x13);
QUARTERROUND( x2, x6,x10,x14);
QUARTERROUND( x3, x7,x11,x15);
QUARTERROUND( x0, x5,x10,x15);
QUARTERROUND( x1, x6,x11,x12);
QUARTERROUND( x2, x7, x8,x13);
QUARTERROUND( x3, x4, x9,x14);
}
out[0] = x0 + c[0];
out[1] = x1 + c[1];
out[2] = x2 + c[2];
out[3] = x3 + c[3];
out[4] = x4 + k[0];
out[5] = x5 + k[1];
out[6] = x6 + k[2];
out[7] = x7 + k[3];
out[8] = x8 + k[4];
out[9] = x9 + k[5];
out[10] = x10 + k[6];
out[11] = x11 + k[7];
out[12] = x12 + in[0];
out[13] = x13 + in[1];
out[14] = x14 + in[2];
out[15] = x15 + in[3];
}
/* `expand 32-byte k' */
static const uint32_t crypto_core_constant32[4] = {
0x61707865U, 0x3320646eU, 0x79622d32U, 0x6b206574U,
};
/*
* Test vector for ChaCha20 from
* <http://tools.ietf.org/html/draft-strombergson-chacha-test-vectors-00>,
* test vectors for ChaCha12 and ChaCha8 generated by the same
* crypto_core code with crypto_core_ROUNDS varied.
*/
#define check(E) do \
{ \
if (!(E)) \
panic("crypto self-test failed: %s", #E); \
} while (0)
static void
crypto_core_selftest(void)
{
const uint32_t zero32[8] = {0};
const uint8_t sigma[] = "expand 32-byte k";
uint32_t block[16];
unsigned i;
#if crypto_core_ROUNDS == 8
static const uint8_t out[64] = {
0x3e,0x00,0xef,0x2f,0x89,0x5f,0x40,0xd6,
0x7f,0x5b,0xb8,0xe8,0x1f,0x09,0xa5,0xa1,
0x2c,0x84,0x0e,0xc3,0xce,0x9a,0x7f,0x3b,
0x18,0x1b,0xe1,0x88,0xef,0x71,0x1a,0x1e,
0x98,0x4c,0xe1,0x72,0xb9,0x21,0x6f,0x41,
0x9f,0x44,0x53,0x67,0x45,0x6d,0x56,0x19,
0x31,0x4a,0x42,0xa3,0xda,0x86,0xb0,0x01,
0x38,0x7b,0xfd,0xb8,0x0e,0x0c,0xfe,0x42,
};
#elif crypto_core_ROUNDS == 12
static const uint8_t out[64] = {
0x9b,0xf4,0x9a,0x6a,0x07,0x55,0xf9,0x53,
0x81,0x1f,0xce,0x12,0x5f,0x26,0x83,0xd5,
0x04,0x29,0xc3,0xbb,0x49,0xe0,0x74,0x14,
0x7e,0x00,0x89,0xa5,0x2e,0xae,0x15,0x5f,
0x05,0x64,0xf8,0x79,0xd2,0x7a,0xe3,0xc0,
0x2c,0xe8,0x28,0x34,0xac,0xfa,0x8c,0x79,
0x3a,0x62,0x9f,0x2c,0xa0,0xde,0x69,0x19,
0x61,0x0b,0xe8,0x2f,0x41,0x13,0x26,0xbe,
};
#elif crypto_core_ROUNDS == 20
static const uint8_t out[64] = {
0x76,0xb8,0xe0,0xad,0xa0,0xf1,0x3d,0x90,
0x40,0x5d,0x6a,0xe5,0x53,0x86,0xbd,0x28,
0xbd,0xd2,0x19,0xb8,0xa0,0x8d,0xed,0x1a,
0xa8,0x36,0xef,0xcc,0x8b,0x77,0x0d,0xc7,
0xda,0x41,0x59,0x7c,0x51,0x57,0x48,0x8d,
0x77,0x24,0xe0,0x3f,0xb8,0xd8,0x4a,0x37,
0x6a,0x43,0xb8,0xf4,0x15,0x18,0xa1,0x1c,
0xc3,0x87,0xb6,0x69,0xb2,0xee,0x65,0x86,
};
#else
#error crypto_core_ROUNDS must be 8, 12, or 20.
#endif
check(crypto_core_constant32[0] == le32dec(&sigma[0]));
check(crypto_core_constant32[1] == le32dec(&sigma[4]));
check(crypto_core_constant32[2] == le32dec(&sigma[8]));
check(crypto_core_constant32[3] == le32dec(&sigma[12]));
crypto_core(block, zero32, zero32, crypto_core_constant32);
for (i = 0; i < 16; i++)
check(block[i] == le32dec(&out[i*4]));
}
#undef check
#define CPRNG_FAST_SEED_BYTES (crypto_core_KEYWORDS * sizeof(uint32_t))
struct cprng_fast {
uint32_t buffer[crypto_core_OUTPUTWORDS];
uint32_t key[crypto_core_KEYWORDS];
uint32_t nonce[crypto_core_INPUTWORDS];
bool have_initial;
};
__CTASSERT(sizeof ((struct cprng_fast *)0)->key == CPRNG_FAST_SEED_BYTES);
static void cprng_fast_schedule_reseed(struct cprng_fast *);
static void cprng_fast_intr(void *);
static void cprng_fast_seed(struct cprng_fast *, const void *);
static void cprng_fast_buf(struct cprng_fast *, void *, unsigned);
static void cprng_fast_buf_short(void *, size_t);
static void cprng_fast_buf_long(void *, size_t);
static percpu_t *cprng_fast_percpu __read_mostly;
static void *cprng_fast_softint __read_mostly;
extern int rnd_initial_entropy;
void
cprng_fast_init(void)
{
struct cpu_info *ci;
CPU_INFO_ITERATOR cii;
crypto_core_selftest();
cprng_fast_percpu = percpu_alloc(sizeof(struct cprng_fast));
for (CPU_INFO_FOREACH(cii, ci)) {
struct cprng_fast *cprng;
uint8_t seed[CPRNG_FAST_SEED_BYTES];
percpu_traverse_enter();
cprng = percpu_getptr_remote(cprng_fast_percpu, ci);
cprng_strong(kern_cprng, seed, sizeof(seed), FASYNC);
/* Can't do anything about it if not full entropy. */
cprng_fast_seed(cprng, seed);
explicit_memset(seed, 0, sizeof(seed));
percpu_traverse_exit();
}
cprng_fast_softint = softint_establish(SOFTINT_SERIAL|SOFTINT_MPSAFE,
&cprng_fast_intr, NULL);
}
static inline int
cprng_fast_get(struct cprng_fast **cprngp)
{
*cprngp = percpu_getref(cprng_fast_percpu);
return splvm();
}
static inline void
cprng_fast_put(struct cprng_fast *cprng, int s)
{
KASSERT((cprng == percpu_getref(cprng_fast_percpu)) &&
(percpu_putref(cprng_fast_percpu), true));
splx(s);
percpu_putref(cprng_fast_percpu);
}
static inline void
cprng_fast_schedule_reseed(struct cprng_fast *cprng __unused)
{
softint_schedule(cprng_fast_softint);
}
static void
cprng_fast_intr(void *cookie __unused)
{
struct cprng_fast *cprng;
uint8_t seed[CPRNG_FAST_SEED_BYTES];
cprng_strong(kern_cprng, seed, sizeof(seed), FASYNC);
cprng = percpu_getref(cprng_fast_percpu);
cprng_fast_seed(cprng, seed);
percpu_putref(cprng_fast_percpu);
explicit_memset(seed, 0, sizeof(seed));
}
/* CPRNG algorithm */
/*
* The state consists of a key, the current nonce, and a 64-byte buffer
* of output. Since we fill the buffer only when we need output, and
* eat a 32-bit word at a time, one 32-bit word of the buffer would be
* wasted. Instead, we repurpose it to count the number of entries in
* the buffer remaining, counting from high to low in order to allow
* comparison to zero to detect when we need to refill it.
*/
#define CPRNG_FAST_BUFIDX (crypto_core_OUTPUTWORDS - 1)
static inline void
cprng_fast_seed(struct cprng_fast *cprng, const void *seed)
{
(void)memset(cprng->buffer, 0, sizeof cprng->buffer);
(void)memcpy(cprng->key, seed, sizeof cprng->key);
(void)memset(cprng->nonce, 0, sizeof cprng->nonce);
if (__predict_true(rnd_initial_entropy)) {
cprng->have_initial = true;
} else {
cprng->have_initial = false;
}
}
static inline uint32_t
cprng_fast_word(struct cprng_fast *cprng)
{
uint32_t v;
if (__predict_true(0 < cprng->buffer[CPRNG_FAST_BUFIDX])) {
v = cprng->buffer[--cprng->buffer[CPRNG_FAST_BUFIDX]];
} else {
/* If we don't have enough words, refill the buffer. */
crypto_core(cprng->buffer, cprng->nonce, cprng->key,
crypto_core_constant32);
if (__predict_false(++cprng->nonce[0] == 0)) {
cprng->nonce[1]++;
cprng_fast_schedule_reseed(cprng);
} else {
if (__predict_false(false == cprng->have_initial)) {
if (rnd_initial_entropy) {
cprng_fast_schedule_reseed(cprng);
}
}
}
v = cprng->buffer[CPRNG_FAST_BUFIDX];
cprng->buffer[CPRNG_FAST_BUFIDX] = CPRNG_FAST_BUFIDX;
}
return v;
}
static inline void
cprng_fast_buf(struct cprng_fast *cprng, void *buf, unsigned n)
{
uint8_t *p = buf;
uint32_t v;
unsigned r;
while (n) {
r = MIN(n, 4);
n -= r;
v = cprng_fast_word(cprng);
while (r--) {
*p++ = (v & 0xff);
v >>= 8;
}
}
}
/*
* crypto_onetimestream: Expand a short unpredictable one-time seed
* into a long unpredictable output.
*/
static void
crypto_onetimestream(const uint32_t seed[crypto_core_KEYWORDS], void *buf,
size_t n)
{
uint32_t block[crypto_core_OUTPUTWORDS];
uint32_t nonce[crypto_core_INPUTWORDS] = {0};
uint8_t *p8;
uint32_t *p32;
size_t ni, nb, nf;
/*
* Guarantee we can generate up to n bytes. We have
* 2^(32*INPUTWORDS) possible inputs yielding output of
* 4*OUTPUTWORDS*2^(32*INPUTWORDS) bytes. It suffices to
* require that sizeof n > (1/CHAR_BIT) log_2 n be less than
* (1/CHAR_BIT) log_2 of the total output stream length. We
* have
*
* log_2 (4 o 2^(32 i)) = log_2 (4 o) + log_2 2^(32 i)
* = 2 + log_2 o + 32 i.
*/
__CTASSERT(CHAR_BIT*sizeof n <=
(2 + ilog2(crypto_core_OUTPUTWORDS) + 32*crypto_core_INPUTWORDS));
p8 = buf;
p32 = (uint32_t *)roundup2((uintptr_t)p8, sizeof(uint32_t));
ni = (uint8_t *)p32 - p8;
if (n < ni)
ni = n;
nb = (n - ni) / sizeof block;
nf = (n - ni) % sizeof block;
KASSERT(((uintptr_t)p32 & 3) == 0);
KASSERT(ni <= n);
KASSERT(nb <= (n / sizeof block));
KASSERT(nf <= n);
KASSERT(n == (ni + (nb * sizeof block) + nf));
KASSERT(ni < sizeof(uint32_t));
KASSERT(nf < sizeof block);
if (ni) {
crypto_core(block, nonce, seed, crypto_core_constant32);
nonce[0]++;
(void)memcpy(p8, block, ni);
}
while (nb--) {
crypto_core(p32, nonce, seed, crypto_core_constant32);
if (++nonce[0] == 0)
nonce[1]++;
p32 += crypto_core_OUTPUTWORDS;
}
if (nf) {
crypto_core(block, nonce, seed, crypto_core_constant32);
if (++nonce[0] == 0)
nonce[1]++;
(void)memcpy(p32, block, nf);
}
if (ni | nf)
(void)explicit_memset(block, 0, sizeof block);
}
/* Public API */
uint32_t
cprng_fast32(void)
{
struct cprng_fast *cprng;
uint32_t v;
int s;
s = cprng_fast_get(&cprng);
v = cprng_fast_word(cprng);
cprng_fast_put(cprng, s);
return v;
}
uint64_t
cprng_fast64(void)
{
struct cprng_fast *cprng;
uint32_t hi, lo;
int s;
s = cprng_fast_get(&cprng);
hi = cprng_fast_word(cprng);
lo = cprng_fast_word(cprng);
cprng_fast_put(cprng, s);
return ((uint64_t)hi << 32) | lo;
}
static void
cprng_fast_buf_short(void *buf, size_t len)
{
struct cprng_fast *cprng;
int s;
s = cprng_fast_get(&cprng);
cprng_fast_buf(cprng, buf, len);
cprng_fast_put(cprng, s);
}
static __noinline void
cprng_fast_buf_long(void *buf, size_t len)
{
uint32_t seed[crypto_core_KEYWORDS];
struct cprng_fast *cprng;
int s;
s = cprng_fast_get(&cprng);
cprng_fast_buf(cprng, seed, sizeof seed);
cprng_fast_put(cprng, s);
crypto_onetimestream(seed, buf, len);
(void)explicit_memset(seed, 0, sizeof seed);
}
size_t
cprng_fast(void *buf, size_t len)
{
/*
* We don't want to hog the CPU, so we use the short version,
* to generate output without preemption, only if we can do it
* with at most one crypto_core.
*/
if (len <= (sizeof(uint32_t) * crypto_core_OUTPUTWORDS))
cprng_fast_buf_short(buf, len);
else
cprng_fast_buf_long(buf, len);
return len;
}

View File

@ -0,0 +1,9 @@
#ifndef _SYS_CPRNG_FAST_H_
#define _SYS_CPRNG_FAST_H_
size_t cprng_fast(void *, size_t);
uint32_t cprng_fast32(void);
uint64_t cprng_fast64(void);
void cprng_fast_init(void);
#endif /* _SYS_CPRNG_FAST_H_ */

View File

@ -0,0 +1,3 @@
# $NetBSD: files.cprng_fast,v 1.2 2014/08/10 16:44:35 tls Exp $
file crypto/cprng_fast/cprng_fast.c

View File

@ -1,4 +1,4 @@
/* $NetBSD: wd.c,v 1.411 2014/07/25 08:34:27 dholland Exp $ */
/* $NetBSD: wd.c,v 1.412 2014/08/10 16:44:35 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.411 2014/07/25 08:34:27 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.412 2014/08/10 16:44:35 tls Exp $");
#include "opt_ata.h"
@ -409,7 +409,7 @@ out:
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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rd.c,v 1.35 2014/07/25 08:10:36 dholland Exp $ */
/* $NetBSD: rd.c,v 1.36 2014/08/10 16:44:35 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.35 2014/07/25 08:10:36 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.36 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -428,7 +428,7 @@ rdattach(device_t parent, device_t self, void *aux)
* 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);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: dbcool.c,v 1.40 2014/02/25 18:30:09 pooka Exp $ */
/* $NetBSD: dbcool.c,v 1.41 2014/08/10 16:44:35 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.41 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1606,6 +1606,7 @@ dbcool_setup_sensors(struct dbcool_softc *sc)
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 @@ dbcool_setup_sensors(struct dbcool_softc *sc)
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:

View File

@ -1,4 +1,4 @@
/* $NetBSD: hytp14var.h,v 1.1 2014/05/18 11:46:23 kardel Exp $ */
/* $NetBSD: hytp14var.h,v 1.2 2014/08/10 16:44:35 tls Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@ -68,6 +68,12 @@ struct hytp14_sensor {
#endif
/*
* $Log: hytp14var.h,v $
* Revision 1.2 2014/08/10 16:44:35 tls
* Merge tls-earlyentropy branch into HEAD.
*
* Revision 1.1.4.2 2014/08/10 06:54:51 tls
* Rebase.
*
* Revision 1.1 2014/05/18 11:46:23 kardel
* add HYT-221/271/939 humidity/temperature I2C sensor
* extend envsys(4) framework by %rH (relative humidity)

View File

@ -1,4 +1,4 @@
/* $NetBSD: com.c,v 1.326 2014/07/25 08:10:37 dholland Exp $ */
/* $NetBSD: com.c,v 1.327 2014/08/10 16:44:35 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.326 2014/07/25 08:10:37 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.327 2014/08/10 16:44:35 tls Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@ -626,7 +626,7 @@ fifodone:
#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

View File

@ -1,4 +1,4 @@
/* $NetBSD: cs89x0.c,v 1.33 2012/02/02 19:43:03 tls Exp $ */
/* $NetBSD: cs89x0.c,v 1.34 2014/08/10 16:44:35 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.34 2014/08/10 16:44:35 tls Exp $");
#include "opt_inet.h"
@ -489,7 +489,7 @@ cs_attach(struct cs_softc *sc, u_int8_t *enaddr, int *media,
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))

View File

@ -1,4 +1,4 @@
/* $NetBSD: dp8390.c,v 1.80 2012/02/02 19:43:03 tls Exp $ */
/* $NetBSD: dp8390.c,v 1.81 2014/08/10 16:44:35 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.81 2014/08/10 16:44:35 tls Exp $");
#include "opt_ipkdb.h"
#include "opt_inet.h"
@ -154,7 +154,7 @@ dp8390_config(struct dp8390_softc *sc)
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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: elink3.c,v 1.134 2012/10/27 17:18:20 chs Exp $ */
/* $NetBSD: elink3.c,v 1.135 2014/08/10 16:44:35 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.135 2014/08/10 16:44:35 tls Exp $");
#include "opt_inet.h"
@ -488,7 +488,7 @@ epconfig(struct ep_softc *sc, u_short chipset, u_int8_t *enaddr)
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. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: elinkxl.c,v 1.115 2012/07/22 14:32:57 matt Exp $ */
/* $NetBSD: elinkxl.c,v 1.116 2014/08/10 16:44:35 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.116 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -437,7 +437,7 @@ ex_config(struct ex_softc *sc)
/* 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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: gem.c,v 1.101 2013/02/04 18:29:55 jdc Exp $ */
/* $NetBSD: gem.c,v 1.102 2014/08/10 16:44:35 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.102 2014/08/10 16:44:35 tls Exp $");
#include "opt_inet.h"
@ -581,7 +581,7 @@ gem_attach(struct gem_softc *sc, const uint8_t *enaddr)
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");

View File

@ -1,4 +1,4 @@
/* $NetBSD: hme.c,v 1.89 2012/07/22 14:32:57 matt Exp $ */
/* $NetBSD: hme.c,v 1.90 2014/08/10 16:44:35 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.90 2014/08/10 16:44:35 tls Exp $");
/* #define HMEDEBUG */
@ -315,7 +315,7 @@ hme_config(struct hme_softc *sc)
"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);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: i82557.c,v 1.141 2013/09/12 20:40:46 martin Exp $ */
/* $NetBSD: i82557.c,v 1.142 2014/08/10 16:44:35 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.142 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -409,7 +409,7 @@ fxp_attach(struct fxp_softc *sc)
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,

View File

@ -1,4 +1,4 @@
/* $NetBSD: lan9118.c,v 1.16 2012/07/22 14:32:57 matt Exp $ */
/* $NetBSD: lan9118.c,v 1.17 2014/08/10 16:44:35 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.17 2014/08/10 16:44:35 tls Exp $");
/*
* The LAN9118 Family
@ -279,7 +279,7 @@ lan9118_attach(struct lan9118_softc *sc)
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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lance.c,v 1.46 2012/02/02 19:43:03 tls Exp $ */
/* $NetBSD: lance.c,v 1.47 2014/08/10 16:44:35 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.47 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -255,7 +255,7 @@ lance_config(struct lance_softc *sc)
M_WAITOK);
rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
RND_TYPE_NET, 0);
RND_TYPE_NET, RND_FLAG_DEFAULT);
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: lemac.c,v 1.41 2012/10/27 17:18:21 chs Exp $ */
/* $NetBSD: lemac.c,v 1.42 2014/08/10 16:44:35 tls Exp $ */
/*-
* Copyright (c) 1994, 1995, 1997 Matt Thomas <matt@3am-software.com>
@ -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.42 2014/08/10 16:44:35 tls Exp $");
#include "opt_inet.h"
@ -1012,7 +1012,7 @@ lemac_ifattach(
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,

View File

@ -1,4 +1,4 @@
/* $NetBSD: mb86950.c,v 1.20 2012/10/27 17:18:21 chs Exp $ */
/* $NetBSD: mb86950.c,v 1.21 2014/08/10 16:44:35 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.21 2014/08/10 16:44:35 tls Exp $");
/*
* Device driver for Fujitsu mb86950 based Ethernet cards.
@ -294,7 +294,7 @@ mb86950_config(struct mb86950_softc *sc, int *media,
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

View File

@ -1,4 +1,4 @@
/* $NetBSD: mb86960.c,v 1.79 2013/05/17 10:48:54 mbalmer Exp $ */
/* $NetBSD: mb86960.c,v 1.80 2014/08/10 16:44:35 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.80 2014/08/10 16:44:35 tls Exp $");
/*
* Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards.
@ -250,7 +250,7 @@ mb86960_config(struct mb86960_softc *sc, int *media, int nmedia, int defmedia)
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",

View File

@ -1,4 +1,4 @@
/* $NetBSD: mtd803.c,v 1.28 2013/10/17 21:24:24 christos Exp $ */
/* $NetBSD: mtd803.c,v 1.29 2014/08/10 16:44:35 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.29 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
@ -177,7 +177,7 @@ mtd_config(struct mtd_softc *sc)
/* 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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pckbc.c,v 1.56 2014/01/11 20:17:56 jakllsch Exp $ */
/* $NetBSD: pckbc.c,v 1.57 2014/08/10 16:44:35 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.57 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -268,7 +268,7 @@ pckbc_attach_slot(struct pckbc_softc *sc, pckbc_slot_t slot)
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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtl8169.c,v 1.139 2013/05/10 14:55:08 tsutsui Exp $ */
/* $NetBSD: rtl8169.c,v 1.140 2014/08/10 16:44:35 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.140 2014/08/10 16:44:35 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 @@ re_attach(struct rtk_softc *sc)
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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtl81x9.c,v 1.94 2012/07/22 14:32:58 matt Exp $ */
/* $NetBSD: rtl81x9.c,v 1.95 2014/08/10 16:44:35 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.95 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
@ -740,7 +740,7 @@ rtk_attach(struct rtk_softc *sc)
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:

View File

@ -1,4 +1,4 @@
/* $NetBSD: seeq8005.c,v 1.51 2012/10/10 22:40:33 skrll Exp $ */
/* $NetBSD: seeq8005.c,v 1.52 2014/08/10 16:44:35 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.52 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -293,7 +293,7 @@ seeq8005_attach(struct seeq8005_softc *sc, const u_int8_t *myaddr, int *media,
/* 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);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: smc91cxx.c,v 1.87 2014/07/10 15:26:30 christos Exp $ */
/* $NetBSD: smc91cxx.c,v 1.88 2014/08/10 16:44:35 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.87 2014/07/10 15:26:30 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: smc91cxx.c,v 1.88 2014/08/10 16:44:35 tls Exp $");
#include "opt_inet.h"
@ -377,7 +377,7 @@ smc91cxx_attach(struct smc91cxx_softc *sc, u_int8_t *myea)
}
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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: tulip.c,v 1.183 2013/09/15 14:58:32 martin Exp $ */
/* $NetBSD: tulip.c,v 1.184 2014/08/10 16:44:35 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.184 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
@ -524,7 +524,7 @@ tlp_attach(struct tulip_softc *sc, const uint8_t *enaddr)
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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.104 2014/07/25 08:10:37 dholland Exp $ */
/* $NetBSD: fd.c,v 1.105 2014/08/10 16:44:35 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.104 2014/07/25 08:10:37 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.105 2014/08/10 16:44:35 tls Exp $");
#include "opt_ddb.h"
@ -587,7 +587,7 @@ fdattach(device_t parent, device_t self, void *aux)
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);

View File

@ -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.87 2014/08/10 16:44:35 tls Exp $ */
/*
* Copyright (c) 1993 Dean Huxley <dean@fsa.ca>
@ -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.87 2014/08/10 16:44:35 tls Exp $");
#include "opt_inet.h"
@ -465,7 +465,7 @@ egattach(device_t parent, device_t self, void *aux)
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

View File

@ -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.90 2014/08/10 16:44:35 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.90 2014/08/10 16:44:35 tls Exp $");
#include "opt_inet.h"
@ -255,7 +255,7 @@ elattach(device_t parent, device_t self, void *aux)
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"));
}

View File

@ -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.93 2014/08/10 16:44:35 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.93 2014/08/10 16:44:35 tls Exp $");
#include "opt_inet.h"
@ -363,7 +363,7 @@ iyattach(device_t parent, device_t self, void *aux)
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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ld.c,v 1.74 2014/07/25 08:10:35 dholland Exp $ */
/* $NetBSD: ld.c,v 1.75 2014/08/10 16:44:35 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.74 2014/07/25 08:10:35 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.75 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -164,7 +164,7 @@ ldattach(struct ld_softc *sc)
/* 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))

View File

@ -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.42 2014/08/10 16:44:35 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.42 2014/08/10 16:44:35 tls Exp $");
#include "opt_inet.h"
@ -537,7 +537,7 @@ gfe_attach(device_t parent, device_t self, void *aux)
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);
}

View File

@ -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.39 2014/08/10 16:44:35 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.39 2014/08/10 16:44:35 tls Exp $");
#include "opt_multiprocessor.h"
@ -894,7 +894,7 @@ mvgbe_attach(device_t parent, device_t self, void *aux)
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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ed_mca.c,v 1.57 2014/07/25 08:10:37 dholland Exp $ */
/* $NetBSD: ed_mca.c,v 1.58 2014/08/10 16:44:35 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.57 2014/07/25 08:10:37 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.58 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -189,7 +189,7 @@ ed_mca_attach(device_t parent, device_t self, void *aux)
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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: amdpm.c,v 1.37 2013/06/13 00:55:01 tls Exp $ */
/* $NetBSD: amdpm.c,v 1.38 2014/08/10 16:44:35 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.38 2014/08/10 16:44:35 tls Exp $");
#include "opt_amdpm.h"
@ -194,18 +194,7 @@ amdpm_attach(device_t parent, device_t self, void *aux)
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");

View File

@ -1,4 +1,4 @@
/* $NetBSD: auich.c,v 1.143 2014/03/29 19:28:24 christos Exp $ */
/* $NetBSD: auich.c,v 1.144 2014/08/10 16:44:35 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.144 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -123,6 +123,7 @@ __KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.143 2014/03/29 19:28:24 christos Exp $")
#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 @@ auich_calibrate(struct auich_softc *sc)
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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: hifn7751.c,v 1.55 2014/06/03 13:53:28 msaitoh Exp $ */
/* $NetBSD: hifn7751.c,v 1.56 2014/08/10 16:44:35 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.55 2014/06/03 13:53:28 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.56 2014/08/10 16:44:35 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -595,20 +595,9 @@ hifn_init_pubrng(struct hifn_softc *sc)
#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)

View File

@ -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.39 2014/08/10 16:44:36 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.39 2014/08/10 16:44:36 tls Exp $");
#include "vlan.h"
@ -461,7 +461,7 @@ bce_attach(device_t parent, device_t self, void *aux)
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))

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_bge.c,v 1.276 2014/08/05 04:29:01 msaitoh Exp $ */
/* $NetBSD: if_bge.c,v 1.277 2014/08/10 16:44:36 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.276 2014/08/05 04:29:01 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.277 2014/08/10 16:44:36 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -3998,7 +3998,7 @@ bge_attach(device_t parent, device_t self, void *aux)
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.

View File

@ -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.22 2014/08/10 16:44:36 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.22 2014/08/10 16:44:36 tls Exp $");
#ifndef _MODULE
#include "opt_inet.h"
@ -612,7 +612,7 @@ cas_config(struct cas_softc *sc, const uint8_t *enaddr)
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");

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_de.c,v 1.143 2014/05/18 18:43:46 christos Exp $ */
/* $NetBSD: if_de.c,v 1.144 2014/08/10 16:44:36 tls Exp $ */
/*-
* Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com)
@ -37,7 +37,7 @@
* board which support 21040, 21041, or 21140 (mostly).
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.143 2014/05/18 18:43:46 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.144 2014/08/10 16:44:36 tls Exp $");
#define TULIP_HDR_DATA
@ -5143,7 +5143,7 @@ tulip_attach(
#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
}

View File

@ -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.38 2014/08/10 16:44:36 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.38 2014/08/10 16:44:36 tls Exp $");
@ -895,7 +895,7 @@ dge_attach(device_t parent, device_t self, void *aux)
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 */

View File

@ -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.26 2014/08/10 16:44:36 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.26 2014/08/10 16:44:36 tls Exp $");
#include <sys/param.h>
@ -510,7 +510,7 @@ jme_pci_attach(device_t parent, device_t self, void *aux)
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;

View File

@ -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.46 2014/08/10 16:44:36 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.46 2014/08/10 16:44:36 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1117,7 +1117,7 @@ msk_attach(device_t parent, device_t self, void *aux)
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;

View File

@ -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.58 2014/08/10 16:44:36 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.58 2014/08/10 16:44:36 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -814,7 +814,7 @@ pcn_attach(device_t parent, device_t self, void *aux)
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. */

View File

@ -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.158 2014/08/10 16:44:36 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.158 2014/08/10 16:44:36 tls Exp $");
@ -1290,7 +1290,7 @@ sipcom_attach(device_t parent, device_t self, void *aux)
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

View File

@ -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.78 2014/08/10 16:44:36 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.78 2014/08/10 16:44:36 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1462,7 +1462,7 @@ sk_attach(device_t parent, device_t self, void *aux)
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);

View File

@ -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.101 2014/08/10 16:44:36 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.101 2014/08/10 16:44:36 tls Exp $");
#undef TLDEBUG
#define TL_PRIV_STATS
@ -470,7 +470,7 @@ tl_pci_attach(device_t parent, device_t self, void *aux)
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

View File

@ -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.114 2014/08/10 16:44:36 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.114 2014/08/10 16:44:36 tls Exp $");
@ -1742,7 +1742,7 @@ vr_attach(device_t parent, device_t self, void *aux)
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);

Some files were not shown because too many files have changed in this diff Show More