CVS log for src/sys/kern/Attic/kern_rndpool.c
Up to [cvs.NetBSD.org] / src / sys / kern
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
Revision 1.19
Thu Apr 30 03:28:18 2020 UTC (5 years ago) by riastradh
Branches: MAIN
CVS tags: thorpej-futex-base,
perseant-exfatfs-base-20240630,
perseant-exfatfs-base,
perseant-exfatfs,
cjep_sun2x-base,
cjep_sun2x,
cjep_staticlib_x-base1,
cjep_staticlib_x-base,
cjep_staticlib_x,
bouyer-sunxi-drm-base,
bouyer-sunxi-drm,
HEAD
FILE REMOVED
Changes since revision 1.18: +2 -2
lines
Rewrite entropy subsystem.
Primary goals:
1. Use cryptography primitives designed and vetted by cryptographers.
2. Be honest about entropy estimation.
3. Propagate full entropy as soon as possible.
4. Simplify the APIs.
5. Reduce overhead of rnd_add_data and cprng_strong.
6. Reduce side channels of HWRNG data and human input sources.
7. Improve visibility of operation with sysctl and event counters.
Caveat: rngtest is no longer used generically for RND_TYPE_RNG
rndsources. Hardware RNG devices should have hardware-specific
health tests. For example, checking for two repeated 256-bit outputs
works to detect AMD's 2019 RDRAND bug. Not all hardware RNGs are
necessarily designed to produce exactly uniform output.
ENTROPY POOL
- A Keccak sponge, with test vectors, replaces the old LFSR/SHA-1
kludge as the cryptographic primitive.
- `Entropy depletion' is available for testing purposes with a sysctl
knob kern.entropy.depletion; otherwise it is disabled, and once the
system reaches full entropy it is assumed to stay there as far as
modern cryptography is concerned.
- No `entropy estimation' based on sample values. Such `entropy
estimation' is a contradiction in terms, dishonest to users, and a
potential source of side channels. It is the responsibility of the
driver author to study the entropy of the process that generates
the samples.
- Per-CPU gathering pools avoid contention on a global queue.
- Entropy is occasionally consolidated into global pool -- as soon as
it's ready, if we've never reached full entropy, and with a rate
limit afterward. Operators can force consolidation now by running
sysctl -w kern.entropy.consolidate=1.
- rndsink(9) API has been replaced by an epoch counter which changes
whenever entropy is consolidated into the global pool.
. Usage: Cache entropy_epoch() when you seed. If entropy_epoch()
has changed when you're about to use whatever you seeded, reseed.
. Epoch is never zero, so initialize cache to 0 if you want to reseed
on first use.
. Epoch is -1 iff we have never reached full entropy -- in other
words, the old rnd_initial_entropy is (entropy_epoch() != -1) --
but it is better if you check for changes rather than for -1, so
that if the system estimated its own entropy incorrectly, entropy
consolidation has the opportunity to prevent future compromise.
- Sysctls and event counters provide operator visibility into what's
happening:
. kern.entropy.needed - bits of entropy short of full entropy
. kern.entropy.pending - bits known to be pending in per-CPU pools,
can be consolidated with sysctl -w kern.entropy.consolidate=1
. kern.entropy.epoch - number of times consolidation has happened,
never 0, and -1 iff we have never reached full entropy
CPRNG_STRONG
- A cprng_strong instance is now a collection of per-CPU NIST
Hash_DRBGs. There are only two in the system: user_cprng for
/dev/urandom and sysctl kern.?random, and kern_cprng for kernel
users which may need to operate in interrupt context up to IPL_VM.
(Calling cprng_strong in interrupt context does not strike me as a
particularly good idea, so I added an event counter to see whether
anything actually does.)
- Event counters provide operator visibility into when reseeding
happens.
INTEL RDRAND/RDSEED, VIA C3 RNG (CPU_RNG)
- Unwired for now; will be rewired in a subsequent commit.
Revision 1.16.18.1: download - view: text, markup, annotated - select for diffs
Mon Jun 10 22:09:03 2019 UTC (5 years, 10 months ago) by christos
Branches: phil-wifi
Diff to: previous 1.16: preferred, colored; next MAIN 1.17: preferred, colored
Changes since revision 1.16: +7 -4
lines
Sync with HEAD
Revision 1.18: download - view: text, markup, annotated - select for diffs
Sun Feb 3 03:19:28 2019 UTC (6 years, 2 months ago) by mrg
Branches: MAIN
CVS tags: phil-wifi-20200421,
phil-wifi-20200411,
phil-wifi-20200406,
phil-wifi-20191119,
phil-wifi-20190609,
netbsd-9-base,
netbsd-9-4-RELEASE,
netbsd-9-3-RELEASE,
netbsd-9-2-RELEASE,
netbsd-9-1-RELEASE,
netbsd-9-0-RELEASE,
netbsd-9-0-RC2,
netbsd-9-0-RC1,
netbsd-9,
isaki-audio2-base,
isaki-audio2,
is-mlppp-base,
is-mlppp,
bouyer-xenpvh-base2,
bouyer-xenpvh-base1,
bouyer-xenpvh-base,
bouyer-xenpvh,
ad-namecache-base3,
ad-namecache-base2,
ad-namecache-base1,
ad-namecache-base,
ad-namecache
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +5 -2
lines
- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
Revision 1.16.16.1: download - view: text, markup, annotated - select for diffs
Thu Sep 6 06:56:42 2018 UTC (6 years, 7 months ago) by pgoyette
Branches: pgoyette-compat
CVS tags: pgoyette-compat-merge-20190127
Diff to: previous 1.16: preferred, colored; next MAIN 1.17: preferred, colored
Changes since revision 1.16: +4 -4
lines
Sync with HEAD
Resolve a couple of conflicts (result of the uimin/uimax changes)
Revision 1.17: download - view: text, markup, annotated - select for diffs
Mon Sep 3 16:29:35 2018 UTC (6 years, 7 months ago) by riastradh
Branches: MAIN
CVS tags: pgoyette-compat-20190127,
pgoyette-compat-20190118,
pgoyette-compat-1226,
pgoyette-compat-1126,
pgoyette-compat-1020,
pgoyette-compat-0930,
pgoyette-compat-0906
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +4 -4
lines
Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.
HOWEVER! Some subsystems have
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.
To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.
I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:
cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))
It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.
Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
Revision 1.2.2.3: download - view: text, markup, annotated - select for diffs
Sun Dec 3 11:38:44 2017 UTC (7 years, 4 months ago) by jdolecek
Branches: tls-maxphys
Diff to: previous 1.2.2.2: preferred, colored; branchpoint 1.2: preferred, colored; next MAIN 1.3: preferred, colored
Changes since revision 1.2.2.2: +6 -51
lines
update from HEAD
Revision 1.7.2.1: download - view: text, markup, annotated - select for diffs
Sat Jun 6 14:40:21 2015 UTC (9 years, 10 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.7: preferred, colored; next MAIN 1.8: preferred, colored
Changes since revision 1.7: +8 -53
lines
Sync with HEAD
Revision 1.16: download - view: text, markup, annotated - select for diffs
Tue Apr 21 04:41:36 2015 UTC (10 years ago) by riastradh
Branches: MAIN
CVS tags: tls-maxphys-base-20171202,
prg-localcount2-base3,
prg-localcount2-base2,
prg-localcount2-base1,
prg-localcount2-base,
prg-localcount2,
phil-wifi-base,
pgoyette-localcount-base,
pgoyette-localcount-20170426,
pgoyette-localcount-20170320,
pgoyette-localcount-20170107,
pgoyette-localcount-20161104,
pgoyette-localcount-20160806,
pgoyette-localcount-20160726,
pgoyette-localcount,
pgoyette-compat-base,
pgoyette-compat-0728,
pgoyette-compat-0625,
pgoyette-compat-0521,
pgoyette-compat-0502,
pgoyette-compat-0422,
pgoyette-compat-0415,
pgoyette-compat-0407,
pgoyette-compat-0330,
pgoyette-compat-0322,
pgoyette-compat-0315,
perseant-stdc-iso10646-base,
perseant-stdc-iso10646,
nick-nhusb-base-20170825,
nick-nhusb-base-20170204,
nick-nhusb-base-20161204,
nick-nhusb-base-20161004,
nick-nhusb-base-20160907,
nick-nhusb-base-20160529,
nick-nhusb-base-20160422,
nick-nhusb-base-20160319,
nick-nhusb-base-20151226,
nick-nhusb-base-20150921,
nick-nhusb-base-20150606,
netbsd-8-base,
netbsd-8-3-RELEASE,
netbsd-8-2-RELEASE,
netbsd-8-1-RELEASE,
netbsd-8-1-RC1,
netbsd-8-0-RELEASE,
netbsd-8-0-RC2,
netbsd-8-0-RC1,
netbsd-8,
matt-nb8-mediatek-base,
matt-nb8-mediatek,
localcount-20160914,
jdolecek-ncq-base,
jdolecek-ncq,
bouyer-socketcan-base1,
bouyer-socketcan-base,
bouyer-socketcan
Branch point for: phil-wifi,
pgoyette-compat
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +4 -5
lines
Turn a kassert into a more appropriately placed ctassert.
Revision 1.15: download - view: text, markup, annotated - select for diffs
Tue Apr 21 03:30:06 2015 UTC (10 years ago) by riastradh
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +4 -4
lines
Sort includes.
Revision 1.14: download - view: text, markup, annotated - select for diffs
Tue Apr 14 06:04:47 2015 UTC (10 years ago) by nat
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +3 -3
lines
Fix typo expliict -> explicit.
Revision 1.13: download - view: text, markup, annotated - select for diffs
Mon Apr 13 23:26:54 2015 UTC (10 years ago) by riastradh
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +4 -4
lines
Use explicit_memset.
Revision 1.12: download - view: text, markup, annotated - select for diffs
Mon Apr 13 23:25:14 2015 UTC (10 years ago) by riastradh
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +2 -4
lines
Omit needless declaration.
Revision 1.11: download - view: text, markup, annotated - select for diffs
Mon Apr 13 23:24:33 2015 UTC (10 years ago) by riastradh
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +2 -14
lines
Cull another unused rndpool routine.
Revision 1.10: download - view: text, markup, annotated - select for diffs
Mon Apr 13 23:21:03 2015 UTC (10 years ago) by riastradh
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +4 -18
lines
Cull some unused rndpool routines.
Revision 1.9: download - view: text, markup, annotated - select for diffs
Mon Apr 13 22:43:41 2015 UTC (10 years ago) by riastradh
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +3 -3
lines
More rnd.h user cleanup.
Revision 1.8: download - view: text, markup, annotated - select for diffs
Wed Apr 8 13:45:01 2015 UTC (10 years ago) by riastradh
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +2 -18
lines
Omit needless state.
Revision 1.1.2.1.4.1: download - view: text, markup, annotated - select for diffs
Mon Nov 3 15:31:15 2014 UTC (10 years, 5 months ago) by msaitoh
Branches: netbsd-6-0
Diff to: previous 1.1.2.1: preferred, colored; next MAIN 1.1.2.2: preferred, colored
Changes since revision 1.1.2.1: +3 -4
lines
Pull up following revision(s) (requested by riastradh in ticket #1118):
sys/kern/kern_rndq.c: revision 1.27
sys/kern/kern_rndpool.c: revision 1.7
buf is not guaranteed to be aligned; don't *(uint32_t *) it in kern_rndq.c.
done is not guaranteed to be aligned; don't *(uint32_t *) it in kern_rndpool.c.
Revision 1.1.2.1.6.1: download - view: text, markup, annotated - select for diffs
Mon Nov 3 15:30:10 2014 UTC (10 years, 5 months ago) by msaitoh
Branches: netbsd-6-1
Diff to: previous 1.1.2.1: preferred, colored; next MAIN 1.1.2.2: preferred, colored
Changes since revision 1.1.2.1: +3 -4
lines
Pull up following revision(s) (requested by riastradh in ticket #1118):
sys/kern/kern_rndq.c: revision 1.27
sys/kern/kern_rndpool.c: revision 1.7
buf is not guaranteed to be aligned; don't *(uint32_t *) it in kern_rndq.c.
done is not guaranteed to be aligned; don't *(uint32_t *) it in kern_rndpool.c.
Revision 1.1.2.2: download - view: text, markup, annotated - select for diffs
Mon Nov 3 15:27:46 2014 UTC (10 years, 5 months ago) by msaitoh
Branches: netbsd-6
Diff to: previous 1.1.2.1: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.2.1: +3 -4
lines
Pull up following revision(s) (requested by riastradh in ticket #1118):
sys/kern/kern_rndq.c: revision 1.27
sys/kern/kern_rndpool.c: revision 1.7
buf is not guaranteed to be aligned; don't *(uint32_t *) it in kern_rndq.c.
done is not guaranteed to be aligned; don't *(uint32_t *) it in kern_rndpool.c.
Revision 1.2.2.2: download - view: text, markup, annotated - select for diffs
Wed Aug 20 00:04:29 2014 UTC (10 years, 8 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.2.2.1: preferred, colored; branchpoint 1.2: preferred, colored
Changes since revision 1.2.2.1: +20 -4
lines
Rebase to HEAD as of a few days ago.
Revision 1.6.2.1: download - view: text, markup, annotated - select for diffs
Mon Aug 11 15:38:27 2014 UTC (10 years, 8 months ago) by martin
Branches: netbsd-7
CVS tags: netbsd-7-nhusb-base-20170116,
netbsd-7-nhusb-base,
netbsd-7-nhusb,
netbsd-7-2-RELEASE,
netbsd-7-1-RELEASE,
netbsd-7-1-RC2,
netbsd-7-1-RC1,
netbsd-7-1-2-RELEASE,
netbsd-7-1-1-RELEASE,
netbsd-7-1,
netbsd-7-0-RELEASE,
netbsd-7-0-RC3,
netbsd-7-0-RC2,
netbsd-7-0-RC1,
netbsd-7-0-2-RELEASE,
netbsd-7-0-1-RELEASE,
netbsd-7-0
Diff to: previous 1.6: preferred, colored; next MAIN 1.7: preferred, colored
Changes since revision 1.6: +3 -4
lines
Pull up following revision(s) (requested by riastradh in ticket #4):
sys/kern/kern_rndq.c: revision 1.27
sys/kern/kern_rndpool.c: revision 1.7
buf is not guaranteed to be aligned; don't *(uint32_t *) it.
done is not guaranteed to be aligned; don't *(uint32_t *) it.
Revision 1.7: download - view: text, markup, annotated - select for diffs
Mon Aug 11 13:59:24 2014 UTC (10 years, 8 months ago) by riastradh
Branches: MAIN
CVS tags: tls-maxphys-base,
nick-nhusb-base-20150406,
nick-nhusb-base
Branch point for: nick-nhusb
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +3 -4
lines
buf is not guaranteed to be aligned; don't *(uint32_t *) it.
Revision 1.6: download - view: text, markup, annotated - select for diffs
Sun Aug 10 16:44:36 2014 UTC (10 years, 8 months ago) by tls
Branches: MAIN
CVS tags: netbsd-7-base
Branch point for: netbsd-7
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +18 -2
lines
Merge tls-earlyentropy branch into HEAD.
Revision 1.5.2.2: download - view: text, markup, annotated - select for diffs
Sun Aug 10 08:30:18 2014 UTC (10 years, 8 months ago) by tls
Branches: tls-earlyentropy
Diff to: previous 1.5.2.1: preferred, colored; branchpoint 1.5: preferred, colored; next MAIN 1.6: preferred, colored
Changes since revision 1.5.2.1: +12 -2
lines
Fix rndctl accounting.
Revision 1.1.6.4: download - view: text, markup, annotated - select for diffs
Thu May 22 11:41:03 2014 UTC (10 years, 11 months ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.1.6.3: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.6.3: +18 -17
lines
sync with head.
for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
Revision 1.4.2.1: download - view: text, markup, annotated - select for diffs
Sun May 18 17:46:07 2014 UTC (10 years, 11 months ago) by rmind
Branches: rmind-smpnet
Diff to: previous 1.4: preferred, colored; next MAIN 1.5: preferred, colored
Changes since revision 1.4: +6 -5
lines
sync with head
Revision 1.5.2.1: download - view: text, markup, annotated - select for diffs
Mon Apr 7 02:00:00 2014 UTC (11 years ago) by tls
Branches: tls-earlyentropy
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +8 -2
lines
Entropy estimation changes:
1) Avoid wraparound problems with delta estimator by making estimation
framework 64-bit.
2) Adjust rnd_counter to always return a 64-bit value, accordingly.
3) Make delta estimator generic and create two instances: delta-time and
delta-value.
4) Add LZF estimator -- used mostly to protect us against injection of
bulk data we think is random but is really constant.
5) Allow value and time estimation/collection to be controlled separately.
6) Expose estimator performance to userspace.
Revision 1.5: download - view: text, markup, annotated - select for diffs
Thu Aug 29 01:04:49 2013 UTC (11 years, 8 months ago) by tls
Branches: MAIN
CVS tags: yamt-pagecache-base9,
tls-earlyentropy-base,
rmind-smpnet-nbase,
rmind-smpnet-base,
riastradh-xf86-video-intel-2-7-1-pre-2-21-15,
riastradh-drm2-base3
Branch point for: tls-earlyentropy
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +6 -5
lines
Fix rnd_add_* to conform to manual page: allow addition of entropy
with NULL source.
Revision 1.2.2.1: download - view: text, markup, annotated - select for diffs
Sun Jun 23 06:18:58 2013 UTC (11 years, 10 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +14 -14
lines
resync from head
Revision 1.4: download - view: text, markup, annotated - select for diffs
Thu Jun 13 19:18:00 2013 UTC (11 years, 10 months ago) by tls
Branches: MAIN
CVS tags: riastradh-drm2-base2,
riastradh-drm2-base1,
riastradh-drm2-base,
riastradh-drm2
Branch point for: rmind-smpnet
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +11 -14
lines
Correct use of entropy estimate when data are extracted from the pool.
The "threshold" value was being inappropriately used to limit how many
bytes could be output even after the estimator said enough bytes had
been put in to meet our minimum security guarantee.
This fixes a panic observed with the automatic test harness and by
msaitoh, where it was not possible to extract the full estimate's worth
of bytes even holding the pool lock across the estimate and extract
calls.
Revision 1.3: download - view: text, markup, annotated - select for diffs
Thu Jun 13 00:55:01 2013 UTC (11 years, 10 months ago) by tls
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +5 -2
lines
Convert the entropy pool framework from pseudo-callout-driven to
soft interrupt driven operation.
Add a polling mode of operation -- now we can ask hardware random number
generators to top us up just when we need it (bcm2835_rng and amdpm
converted as examples).
Fix a stall noticed with repeated reads from /dev/random while testing.
Revision 1.1.6.3: download - view: text, markup, annotated - select for diffs
Wed May 23 10:08:11 2012 UTC (12 years, 11 months ago) by yamt
Branches: yamt-pagecache
CVS tags: yamt-pagecache-tag8
Diff to: previous 1.1.6.2: preferred, colored; branchpoint 1.1: preferred, colored
Changes since revision 1.1.6.2: +8 -4
lines
sync with head.
Revision 1.1.4.3: download - view: text, markup, annotated - select for diffs
Sun Apr 29 23:05:05 2012 UTC (13 years ago) by mrg
Branches: jmcneill-usbmp
Diff to: previous 1.1.4.2: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.4.2: +8 -4
lines
sync to latest -current.
Revision 1.1.2.1: download - view: text, markup, annotated - select for diffs
Fri Apr 20 23:35:20 2012 UTC (13 years ago) by riz
Branches: netbsd-6
CVS tags: netbsd-6-1-RELEASE,
netbsd-6-1-RC4,
netbsd-6-1-RC3,
netbsd-6-1-RC2,
netbsd-6-1-RC1,
netbsd-6-1-5-RELEASE,
netbsd-6-1-4-RELEASE,
netbsd-6-1-3-RELEASE,
netbsd-6-1-2-RELEASE,
netbsd-6-1-1-RELEASE,
netbsd-6-0-RELEASE,
netbsd-6-0-RC2,
netbsd-6-0-RC1,
netbsd-6-0-6-RELEASE,
netbsd-6-0-5-RELEASE,
netbsd-6-0-4-RELEASE,
netbsd-6-0-3-RELEASE,
netbsd-6-0-2-RELEASE,
netbsd-6-0-1-RELEASE,
matt-nb6-plus-nbase,
matt-nb6-plus-base,
matt-nb6-plus
Branch point for: netbsd-6-1,
netbsd-6-0
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +8 -4
lines
Pull up following revision(s) (requested by tls in ticket #190):
sys/sys/rnd.h: revision 1.31
sys/sys/rnd.h: revision 1.32
sys/sys/cprng.h: revision 1.5
sys/kern/subr_cprng.c: revision 1.8
share/man/man4/rnd.4: revision 1.19
sys/kern/kern_rndq.c: revision 1.3
sys/dev/rndpseudo.c: revision 1.8
sys/dev/rndpseudo.c: revision 1.9
sys/kern/kern_rndpool.c: revision 1.2
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.
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.2: download - view: text, markup, annotated - select for diffs
Tue Apr 17 02:50:38 2012 UTC (13 years ago) by tls
Branches: MAIN
CVS tags: yamt-pagecache-base8,
yamt-pagecache-base7,
yamt-pagecache-base6,
yamt-pagecache-base5,
khorben-n900,
jmcneill-usbmp-base9,
jmcneill-usbmp-base10,
agc-symver-base,
agc-symver
Branch point for: tls-maxphys
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +8 -4
lines
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.1.6.2: download - view: text, markup, annotated - select for diffs
Tue Apr 17 00:08:25 2012 UTC (13 years ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.1.6.1: preferred, colored; branchpoint 1.1: preferred, colored
Changes since revision 1.1.6.1: +311 -0
lines
sync with head
Revision 1.1.4.2: download - view: text, markup, annotated - select for diffs
Sat Feb 18 07:35:31 2012 UTC (13 years, 2 months ago) by mrg
Branches: jmcneill-usbmp
Diff to: previous 1.1.4.1: preferred, colored; branchpoint 1.1: preferred, colored
Changes since revision 1.1.4.1: +311 -0
lines
merge to -current.
Revision 1.1.6.1
Thu Feb 2 19:43:07 2012 UTC (13 years, 2 months ago) by yamt
Branches: yamt-pagecache
FILE REMOVED
Changes since revision 1.1: +0 -311
lines
file kern_rndpool.c was added on branch yamt-pagecache on 2012-04-17 00:08:25 +0000
Revision 1.1.4.1
Thu Feb 2 19:43:07 2012 UTC (13 years, 2 months ago) by mrg
Branches: jmcneill-usbmp
FILE REMOVED
Changes since revision 1.1: +0 -311
lines
file kern_rndpool.c was added on branch jmcneill-usbmp on 2012-02-18 07:35:31 +0000
Revision 1.1: download - view: text, markup, annotated - select for diffs
Thu Feb 2 19:43:07 2012 UTC (13 years, 2 months ago) by tls
Branches: MAIN
CVS tags: yamt-pagecache-base4,
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: yamt-pagecache,
netbsd-6,
jmcneill-usbmp
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.
CVSweb <webmaster@jp.NetBSD.org>