The NetBSD Project

CVS log for src/sys/sys/rnd.h

[BACK] Up to [cvs.NetBSD.org] / src / sys / sys

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.35 / (download) - annotate - [select for diffs], Sat Jan 26 19:05:11 2013 UTC (3 months, 3 weeks ago) by tls
Branch: MAIN
CVS Tags: tls-maxphys-nbase, tls-maxphys-base, khorben-n900, agc-symver-base, agc-symver, HEAD
Changes since 1.34: +2 -1 lines
Diff to previous 1.34 (colored)

Rather than holding samples from each source until we have 64 at a time to
process, process them ASAP for low-rate sources, and for all sources if we
have not yet acquired initial entropy.

Revision 1.34 / (download) - annotate - [select for diffs], Sun Nov 25 15:29:55 2012 UTC (5 months, 3 weeks ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7
Changes since 1.33: +13 -1 lines
Diff to previous 1.33 (colored)

add the context struct

Revision 1.33 / (download) - annotate - [select for diffs], Wed Sep 5 18:57:33 2012 UTC (8 months, 2 weeks ago) by tls
Branch: MAIN
CVS Tags: yamt-pagecache-base6
Branch point for: tls-maxphys
Changes since 1.32: +2 -1 lines
Diff to previous 1.32 (colored)

Don't wait until the pool *fills* to rekey anything that was keyed with
insufficient entropy at boot: key it as soon as it makes any request after
we hit the minimum entropy threshold.

This too should help avoid predictable output at boot time.

Revision 1.32 / (download) - annotate - [select for diffs], Fri Apr 20 21:57:34 2012 UTC (13 months ago) by tls
Branch: MAIN
CVS Tags: yamt-pagecache-base5, jmcneill-usbmp-base9, jmcneill-usbmp-base10
Changes since 1.31: +2 -1 lines
Diff to previous 1.31 (colored)

Fix a bug and a compilation problem.  Bug: spin mutexes don't have owners,
so KASSERT(!mutex_owned()) shouldn't be used to assert that the current
LWP does not have the mutex.  Compilation problem: explicitly include
sys/mutex.h from rnd.h so evbarm builds again.

Revision 1.31 / (download) - annotate - [select for diffs], Tue Apr 17 02:50:39 2012 UTC (13 months ago) by tls
Branch: MAIN
Changes since 1.30: +9 -1 lines
Diff to previous 1.30 (colored)

Address multiple problems with rnd(4)/cprng(9):

1) Add a per-cpu CPRNG to handle short reads from /dev/urandom so that
   programs like perl don't drain the entropy pool dry by repeatedly
   opening, reading 4 bytes, closing.

2) Really fix the locking around reseeds and destroys.

3) Fix the opportunistic-reseed strategy so it actually works, reseeding
   existing RNGs once each (as they are used, so idle RNGs don't get
   reseeded) until the pool is half empty or newly full again.

Revision 1.30 / (download) - annotate - [select for diffs], Tue Apr 10 14:02:28 2012 UTC (13 months, 1 week ago) by tls
Branch: MAIN
CVS Tags: yamt-pagecache-base4
Changes since 1.29: +2 -1 lines
Diff to previous 1.29 (colored)


Add a spin mutex to the rndsink structure; it is used to avoid lock
ordering and sleep-holding-locks problems when rekeying, and thus
to avoid a nasty race between cprng destruction and reseeding.

Revision 1.29 / (download) - annotate - [select for diffs], Thu Feb 2 19:43:08 2012 UTC (15 months, 2 weeks ago) by tls
Branch: MAIN
CVS Tags: netbsd-6-base, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3, jmcneill-usbmp-base2
Branch point for: netbsd-6
Changes since 1.28: +16 -5 lines
Diff to previous 1.28 (colored)

Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
   to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
   source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
   avoid expensive operations on disabled entropy sources; make the
   rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
   have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
   system events, and skew between clocks, with a sample implementation
   for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files).  Tested with release
builds on amd64 and evbarm and live testing on amd64.

Revision 1.28 / (download) - annotate - [select for diffs], Sat Dec 17 20:05:40 2011 UTC (17 months ago) by tls
Branch: MAIN
Changes since 1.27: +3 -1 lines
Diff to previous 1.27 (colored)


Separate /dev/random pseudodevice implemenation from kernel entropy pool
implementation.  Rewrite pseudodevice code to use cprng_strong(9).

The new pseudodevice is cloning, so each caller gets bits from a stream
generated with its own key.  Users of /dev/urandom get their generators
keyed on a "best effort" basis -- the kernel will rekey generators
whenever the entropy pool hits the high water mark -- while users of
/dev/random get their generators rekeyed every time key-length bits
are output.

The underlying cprng_strong API can use AES-256 or AES-128, but we use
AES-128 because of concerns about related-key attacks on AES-256.  This
improves performance (and reduces entropy pool depletion) significantly
for users of /dev/urandom but does cause users of /dev/random to rekey
twice as often.

Also fixes various bugs (including some missing locking and a reseed-counter
overflow in the CTR_DRBG code) found while testing this.

For long reads, this generator is approximately 20 times as fast as the
old generator (dd with bs=64K yields 53MB/sec on 2Ghz Core2 instead of
2.5MB/sec) and also uses a separate mutex per instance so concurrency
is greatly improved.  For reads of typical key sizes for modern
cryptosystems (16-32 bytes) performance is about the same as the old
code: a little better for 32 bytes, a little worse for 16 bytes.

Revision 1.27 / (download) - annotate - [select for diffs], Sat Dec 17 12:59:21 2011 UTC (17 months ago) by apb
Branch: MAIN
Changes since 1.26: +8 -3 lines
Diff to previous 1.26 (colored)

Add comments for some ioctls and structs; fix a typo in another comment.

Revision 1.26 / (download) - annotate - [select for diffs], Tue Nov 29 03:50:32 2011 UTC (17 months, 3 weeks ago) by tls
Branch: MAIN
CVS Tags: jmcneill-usbmp-pre-base2, jmcneill-usbmp-base
Branch point for: jmcneill-usbmp
Changes since 1.25: +9 -36 lines
Diff to previous 1.25 (colored)

Remove rnd_extract_data from the public kernel API (it is for use by the
stream generators only).  Clean up some related minor issues.

Revision 1.25 / (download) - annotate - [select for diffs], Mon Nov 28 08:00:48 2011 UTC (17 months, 3 weeks ago) by tls
Branch: MAIN
Changes since 1.24: +3 -1 lines
Diff to previous 1.24 (colored)

Change to rnd.h missed in previous commit.

Revision 1.24 / (download) - annotate - [select for diffs], Sat Nov 26 01:17:17 2011 UTC (17 months, 3 weeks ago) by tls
Branch: MAIN
Changes since 1.23: +18 -2 lines
Diff to previous 1.23 (colored)

Make the rndsave structure public -- the kernel will learn to read it
and sysinst may learn to write it (since, on some systems, most of
the keyboard input they ever get happens to be during install).  Fix a
couple of minor problems with the random_seed rc script addition.

Revision 1.23 / (download) - annotate - [select for diffs], Wed Nov 23 10:47:49 2011 UTC (17 months, 4 weeks ago) by tls
Branch: MAIN
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)


Load entropy at system boot (only works at securelevel < 1); save
at system shutdown.  Disable with random_seed=NO in rc.conf if desired.

Goes to some trouble to never load or save to network filesystems.

Entropy should really be loaded by the boot loader but I am still
sorting out how to pass it to the kernel.

Revision 1.22 / (download) - annotate - [select for diffs], Sat Nov 19 22:51:31 2011 UTC (18 months ago) by tls
Branch: MAIN
Changes since 1.21: +44 -27 lines
Diff to previous 1.21 (colored)

First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>.  This change includes
the following:

	An initial cleanup and minor reorganization of the entropy pool
	code in sys/dev/rnd.c and sys/dev/rndpool.c.  Several bugs are
	fixed.  Some effort is made to accumulate entropy more quickly at
	boot time.

	A generic interface, "rndsink", is added, for stream generators to
	request that they be re-keyed with good quality entropy from the pool
	as soon as it is available.

	The arc4random()/arc4randbytes() implementation in libkern is
	adjusted to use the rndsink interface for rekeying, which helps
	address the problem of low-quality keys at boot time.

	An implementation of the FIPS 140-2 statistical tests for random
	number generator quality is provided (libkern/rngtest.c).  This
	is based on Greg Rose's implementation from Qualcomm.

	A new random stream generator, nist_ctr_drbg, is provided.  It is
	based on an implementation of the NIST SP800-90 CTR_DRBG by
	Henric Jungheim.  This generator users AES in a modified counter
	mode to generate a backtracking-resistant random stream.

	An abstraction layer, "cprng", is provided for in-kernel consumers
	of randomness.  The arc4random/arc4randbytes API is deprecated for
	in-kernel use.  It is replaced by "cprng_strong".  The current
	cprng_fast implementation wraps the existing arc4random
	implementation.  The current cprng_strong implementation wraps the
	new CTR_DRBG implementation.  Both interfaces are rekeyed from
	the entropy pool automatically at intervals justifiable from best
	current cryptographic practice.

	In some quick tests, cprng_fast() is about the same speed as
	the old arc4randbytes(), and cprng_strong() is about 20% faster
	than rnd_extract_data().  Performance is expected to improve.

	The AES code in src/crypto/rijndael is no longer an optional
	kernel component, as it is required by cprng_strong, which is
	not an optional kernel component.

	The entropy pool output is subjected to the rngtest tests at
	startup time; if it fails, the system will reboot.  There is
	approximately a 3/10000 chance of a false positive from these
	tests.  Entropy pool _input_ from hardware random numbers is
	subjected to the rngtest tests at attach time, as well as the
	FIPS continuous-output test, to detect bad or stuck hardware
	RNGs; if any are detected, they are detached, but the system
	continues to run.

	A problem with rndctl(8) is fixed -- datastructures with
	pointers in arrays are no longer passed to userspace (this
	was not a security problem, but rather a major issue for
	compat32).  A new kernel will require a new rndctl.

	The sysctl kern.arandom() and kern.urandom() nodes are hooked
	up to the new generators, but the /dev/*random pseudodevices
	are not, yet.

	Manual pages for the new kernel interfaces are forthcoming.

Revision 1.21 / (download) - annotate - [select for diffs], Mon Apr 28 20:24:11 2008 UTC (5 years ago) by martin
Branch: MAIN
CVS Tags: yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-nfs-mp-base9, yamt-nfs-mp-base8, yamt-nfs-mp-base7, yamt-nfs-mp-base6, yamt-nfs-mp-base5, yamt-nfs-mp-base4, yamt-nfs-mp-base3, yamt-nfs-mp-base2, yamt-nfs-mp-base11, yamt-nfs-mp-base10, wrstuden-revivesa-base-4, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, uebayasi-xip-base7, uebayasi-xip-base6, uebayasi-xip-base5, uebayasi-xip-base4, uebayasi-xip-base3, uebayasi-xip-base2, uebayasi-xip-base1, uebayasi-xip-base, uebayasi-xip, simonb-wapbl-nbase, simonb-wapbl-base, simonb-wapbl, rmind-uvmplock-nbase, rmind-uvmplock-base, rmind-uvmplock, nick-hppapmap-base4, nick-hppapmap-base3, nick-hppapmap-base2, nick-hppapmap-base, nick-hppapmap, netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, mjf-devfs2-base, matt-premerge-20091211, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-premerge-20101231, matt-mips64-base2, jymxensuspend-base, jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend, jruoho-x86intr-base, jruoho-x86intr, jmcneill-audiomp3-base, jmcneill-audiomp3, hpcarm-cleanup-nbase, haad-nbase2, haad-dm-base2, haad-dm-base1, haad-dm-base, haad-dm, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, ad-audiomp2-base, ad-audiomp2
Branch point for: yamt-pagecache
Changes since 1.20: +1 -8 lines
Diff to previous 1.20 (colored)

Remove clause 3 and 4 from TNF licenses

Revision 1.20 / (download) - annotate - [select for diffs], Wed Sep 20 05:21:38 2006 UTC (6 years, 8 months ago) by cube
Branch: MAIN
CVS Tags: yamt-x86pmap-base4, yamt-x86pmap-base3, yamt-x86pmap-base2, yamt-x86pmap-base, yamt-x86pmap, yamt-splraiseipl-base5, yamt-splraiseipl-base4, yamt-splraiseipl-base3, yamt-splraiseipl-base2, yamt-pf42-baseX, yamt-pf42-base, yamt-nfs-mp-base, yamt-lazymbuf-base15, yamt-lazymbuf-base14, yamt-kmem-base3, yamt-kmem-base2, yamt-kmem-base, yamt-kmem, yamt-idlelwp-base8, yamt-idlelwp, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, vmlocking2-base3, vmlocking2-base2, vmlocking2-base1, vmlocking2, vmlocking-nbase, vmlocking-base, vmlocking, thorpej-atomic-base, thorpej-atomic, reinoud-bufcleanup-nbase, reinoud-bufcleanup-base, reinoud-bufcleanup, post-newlock2-merge, nick-net80211-sync-base, nick-net80211-sync, nick-csl-alignment-base5, nick-csl-alignment-base, nick-csl-alignment, newlock2-nbase, newlock2-base, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, mjf-ufs-trans-base, mjf-ufs-trans, mjf-devfs-base, mjf-devfs, matt-nb4-arm-base, matt-nb4-arm, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, keiichi-mipv6-nbase, keiichi-mipv6-base, keiichi-mipv6, jmcneill-pm-base, jmcneill-pm, jmcneill-base, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf, bouyer-xeni386-nbase, bouyer-xeni386-merge1, bouyer-xeni386-base, bouyer-xeni386, bouyer-xenamd64-base2, bouyer-xenamd64-base, bouyer-xenamd64, ad-socklock-base1, ad-audiomp-base, ad-audiomp
Branch point for: yamt-pf42, yamt-nfs-mp, mjf-devfs2
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)

Constification.

Revision 1.19 / (download) - annotate - [select for diffs], Mon Dec 26 18:41:36 2005 UTC (7 years, 4 months ago) by perry
Branch: MAIN
CVS Tags: yamt-uio_vmspace-base5, yamt-uio_vmspace, yamt-splraiseipl-base, yamt-pdpolicy-base9, yamt-pdpolicy-base8, yamt-pdpolicy-base7, yamt-pdpolicy-base6, yamt-pdpolicy-base5, yamt-pdpolicy-base4, yamt-pdpolicy-base3, yamt-pdpolicy-base2, yamt-pdpolicy-base, yamt-pdpolicy, simonb-timecounters-base, simonb-timecounters, simonb-timcounters-final, rpaulo-netinet-merge-pcb-base, rpaulo-netinet-merge-pcb, peter-altq-base, peter-altq, gdamore-uart-base, gdamore-uart, elad-kernelauth-base, elad-kernelauth, chap-midi-nbase, chap-midi-base, chap-midi, abandoned-netbsd-4-base, abandoned-netbsd-4
Branch point for: yamt-splraiseipl, newlock2
Changes since 1.18: +39 -39 lines
Diff to previous 1.18 (colored)

u_intN_t -> uintN_t

Revision 1.18 / (download) - annotate - [select for diffs], Sun Dec 11 12:25:21 2005 UTC (7 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.17: +1 -1 lines
Diff to previous 1.17 (colored)

merge ktrace-lwp.

Revision 1.17 / (download) - annotate - [select for diffs], Thu Feb 3 19:20:02 2005 UTC (8 years, 3 months ago) by perry
Branch: MAIN
CVS Tags: yamt-vop-base3, yamt-vop-base2, yamt-vop-base, yamt-vop, yamt-readahead-pervnode, yamt-readahead-perfile, yamt-readahead-base3, yamt-readahead-base2, yamt-readahead-base, yamt-readahead, yamt-km-base4, yamt-km-base3, yamt-km-base2, thorpej-vnode-attr-base, thorpej-vnode-attr, netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0, netbsd-3, matt-timespec, ktrace-lwp-base, kent-audio2-base
Branch point for: yamt-lazymbuf
Changes since 1.16: +20 -21 lines
Diff to previous 1.16 (colored)

de-__P

Revision 1.16 / (download) - annotate - [select for diffs], Sun Nov 10 03:28:59 2002 UTC (10 years, 6 months ago) by thorpej
Branch: MAIN
CVS Tags: yamt-km-base, netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-base, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0, netbsd-2, nathanw_sa_before_merge, nathanw_sa_base, kent-audio1-beforemerge, kent-audio1-base, kent-audio1, gmcgarry_ucred_base, gmcgarry_ucred, gmcgarry_ctxsw_base, gmcgarry_ctxsw, fvdl_fs64_base
Branch point for: yamt-km, ktrace-lwp, kent-audio2
Changes since 1.15: +3 -3 lines
Diff to previous 1.15 (colored)

Fix signed/unsigned comparison warnings.

Revision 1.15 / (download) - annotate - [select for diffs], Tue Aug 20 22:30:53 2002 UTC (10 years, 9 months ago) by itojun
Branch: MAIN
CVS Tags: kqueue-beforemerge, kqueue-base, kqueue-aftermerge, gehenna-devsw-base
Changes since 1.14: +4 -1 lines
Diff to previous 1.14 (colored)

expose a way to see if random number source is enabled, some wants it
for avoiding extra function call for rnd_add_uint32 and such.

Revision 1.14 / (download) - annotate - [select for diffs], Sun Sep 9 00:48:55 2001 UTC (11 years, 8 months ago) by enami
Branch: MAIN
CVS Tags: thorpej-mips-cache-base, thorpej-mips-cache, thorpej-devvp-base3, thorpej-devvp-base2, pre-chs-ubcperf, post-chs-ubcperf, newlock-base, newlock, netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6, ifpoll-base, ifpoll, eeh-devprop-base, eeh-devprop
Branch point for: gehenna-devsw
Changes since 1.13: +6 -2 lines
Diff to previous 1.13 (colored)

Mix random data directly into the pool and increase entropy instead of
estimating entropy with polling based timing.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Sep 9 00:32:52 2001 UTC (11 years, 8 months ago) by enami
Branch: MAIN
Changes since 1.12: +39 -38 lines
Diff to previous 1.12 (colored)

Cosmetic changes.

Revision 1.12 / (download) - annotate - [select for diffs], Mon Jun 5 23:42:35 2000 UTC (12 years, 11 months ago) by sommerfeld
Branch: MAIN
CVS Tags: thorpej_scsipi_nbase, thorpej_scsipi_beforemerge, thorpej_scsipi_base, thorpej-devvp-base, netbsd-1-5-base, netbsd-1-5-RELEASE, netbsd-1-5-PATCH003, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA, netbsd-1-5-ALPHA2, netbsd-1-5
Branch point for: thorpej-devvp, nathanw_sa, kqueue
Changes since 1.11: +20 -5 lines
Diff to previous 1.11 (colored)

/dev/random code cleanups:
 - Add comments about which spls apply to which data structures.
 - Consistently protect the rnd_samples queue (the queue of
unprocessed samples) at splhigh().
 - allow MD code to supply cpu_timestamp() and cpu_havetimestamp() for
an optional higher-resolution clock/roulette wheel source.
 - Collect more statistics on the pool state (keeping track of where
collected bits are going, in addition to where they came from).
 - Add RNDGETPOOLSTAT ioctl to get the additional stats.
 - Flush a few unused rndpool calls.
 - XXX XXX Cryptographic changes:
  - 32-bit rotate is:
	((val << rp->rotate) | (val >> (32 - rp->rotate))),
    not
	(val << rp->rotate) | (val >> rp->rotate)
    or
	((val << rp->rotate) | (val >> (31 - rp->rotate)))
  - Avoid overloading of rp->rotate and double-rotation of data
(which limited pool mixing somewhat; "rotate" never got above 7).
  - Be more paranoid (but probably not paranoid enough) about mixing
output back into the pool.  This is an improvement, but it needs
revisiting soon.

We should follow the spirit of some of the recommendations in
the Schneier PRNG papers:

http://www.counterpane.com/yarrow-notes.html
http://www.counterpane.com/pseudorandom_number.html

including:
 - two (or more) stage operation for better isolation between inputs
and outputs.
 - use of keyed one-way functions (probably better even than
invertible keyed functions like 3DES) at key points in the data flow,
so that breaking the PRNG is clearly as hard as breaking the function.

Revision 1.11 / (download) - annotate - [select for diffs], Sun Feb 28 17:18:42 1999 UTC (14 years, 2 months ago) by explorer
Branch: MAIN
CVS Tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, netbsd-1-4-base, netbsd-1-4-RELEASE, netbsd-1-4-PATCH003, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001, netbsd-1-4, minoura-xpg4dl-base, kame_14_19990705, kame_14_19990628, kame_141_19991130, kame, fvdl-softdep-base, fvdl-softdep, comdex-fall-1999-base, comdex-fall-1999, chs-ubc2-newbase, chs-ubc2-base, chs-ubc2
Branch point for: thorpej_scsipi, minoura-xpg4dl
Changes since 1.10: +9 -12 lines
Diff to previous 1.10 (colored)

Cleanup (in preparation for using gzip to estimate entropy)
(1) remove unused and probably bad (from an API POV) ioctls,
(2) split tyfl into type and flags,
(3) collect an array of samples, and add them all at once.  Soon, this
    will be using gzip to estimate the entropy, but for now the original
    estimation methods are still used.
(4) kill rnd_add_data() -- it compliated the API for little benefit

Revision 1.10 / (download) - annotate - [select for diffs], Sun Sep 13 14:46:24 1998 UTC (14 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: kenh-if-detach-base, kenh-if-detach, chs-ubc-base, chs-ubc
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

Fix copyright typos...

Revision 1.9 / (download) - annotate - [select for diffs], Wed May 27 00:59:30 1998 UTC (15 years ago) by explorer
Branch: MAIN
CVS Tags: eeh-paddr_t-base, eeh-paddr_t
Changes since 1.8: +8 -1 lines
Diff to previous 1.8 (colored)

Move RND_ENTROPY_THRESHOLD to sys/rnd.h.  Use sha1 rather than md5, and
release the first 96 bits of the hash directly rather than by folding.
The full 160 bit hash is mixed back into the entropy pool.  This keeps
64 bits secret to stir the pool with.

Revision 1.8 / (download) - annotate - [select for diffs], Mon Oct 20 15:06:04 1997 UTC (15 years, 7 months ago) by explorer
Branch: MAIN
CVS Tags: netbsd-1-3-base, netbsd-1-3-RELEASE, netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002, netbsd-1-3-PATCH001, netbsd-1-3-BETA, netbsd-1-3
Changes since 1.7: +12 -5 lines
Diff to previous 1.7 (colored)

cleanup of queue code

Revision 1.7 / (download) - annotate - [select for diffs], Sun Oct 19 03:47:50 1997 UTC (15 years, 7 months ago) by explorer
Branch: MAIN
Changes since 1.6: +5 -1 lines
Diff to previous 1.6 (colored)

Start teaching the random driver to use timeout() rather than immediate mixing

Revision 1.6 / (download) - annotate - [select for diffs], Wed Oct 15 07:22:59 1997 UTC (15 years, 7 months ago) by explorer
Branch: MAIN
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

clean up ioctl arguments.

Revision 1.5 / (download) - annotate - [select for diffs], Mon Oct 13 19:59:26 1997 UTC (15 years, 7 months ago) by explorer
Branch: MAIN
CVS Tags: marc-pcmcia-base
Branch point for: marc-pcmcia
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (colored)

Update notice to indicate the the IDEAS were derived from Ted's code, not the
code itself, per phone conversation with Ted

Revision 1.4 / (download) - annotate - [select for diffs], Mon Oct 13 18:34:29 1997 UTC (15 years, 7 months ago) by explorer
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

update copyright to include the CORRECT spelling of Ted Ts'o's name

Revision 1.3 / (download) - annotate - [select for diffs], Mon Oct 13 10:24:21 1997 UTC (15 years, 7 months ago) by veego
Branch: MAIN
Changes since 1.2: +3 -2 lines
Diff to previous 1.2 (colored)

Add the define for RND_TYPE_TTY.

Revision 1.2 / (download) - annotate - [select for diffs], Mon Oct 13 00:48:21 1997 UTC (15 years, 7 months ago) by explorer
Branch: MAIN
Changes since 1.1: +38 -1 lines
Diff to previous 1.1 (colored)

o Make usage of /dev/random dependant on
  pseudo-device   rnd                     # /dev/random and in-kernel generator
  in config files.

o Add declaration to all architectures.

o Clean up copyright message in rnd.c, rnd.h, and rndpool.c to include
  that this code is derived in part from Ted Tyso's linux code.

Revision 1.1 / (download) - annotate - [select for diffs], Thu Oct 9 23:13:16 1997 UTC (15 years, 7 months ago) by explorer
Branch: MAIN

Addition of /dev/random and in-kernel random value generation.

Over the next few days (thank goodness for long weekends) I'll be hunting
down device drivers and adding hooks to gather entropy from many devices,
and adding the conf.c changes to the various port's device structs to
define major numbers for /dev/random and /dev/urandom.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>