freebsd-dev/sys/libkern
Conrad Meyer 10b1a17594 arc4random(9): Integrate with RANDOM_FENESTRASX push-reseed
There is no functional change for the existing Fortuna random(4)
implementation, which remains the default in GENERIC.

In the FenestrasX model, when the root CSPRNG is reseeded from pools due to
an (infrequent) timer, child CSPRNGs can cheaply detect this condition and
reseed.  To do so, they just need to track an additional 64-bit value in the
associated state, and compare it against the root seed version (generation)
on random reads.

This revision integrates arc4random(9) into that model without substantially
changing the design or implementation of arc4random(9).  The motivation is
that arc4random(9) is immediately reseeded when the backing random(4)
implementation has additional entropy.  This is arguably most important
during boot, when fenestrasX is reseeding at 1, 3, 9, 27, etc., second
intervals.  Today, arc4random(9) has a hardcoded 300 second reseed window.
Without this mechanism, if arc4random(9) gets weak entropy during initial
seed (and arc4random(9) is used early in boot, so this is quite possible),
it may continue to emit poorly seeded output for 5 minutes.  The FenestrasX
push-reseed scheme corrects consumers, like arc4random(9), as soon as
possible.

Reviewed by:	markm
Approved by:	csprng (markm)
Differential Revision:	https://reviews.freebsd.org/D22838
2020-10-10 21:48:06 +00:00
..
arm sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
arm64
x86 Separate kernel crc32() implementation to its own header (gsb_crc32.h) and 2019-06-17 19:49:08 +00:00
arc4random_uniform.c libkern: Add arc4random_uniform 2020-05-23 17:51:06 +00:00
arc4random.c arc4random(9): Integrate with RANDOM_FENESTRASX push-reseed 2020-10-10 21:48:06 +00:00
ashldi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
ashrdi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
asprintf.c
bcd.c
bcmp.c Use __builtin for various mem* and b* (e.g. bzero) routines. 2018-06-02 18:03:35 +00:00
bcopy.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
bsearch.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
cmpdi2.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
divdi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
explicit_bzero.c
ffs.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
ffsl.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
ffsll.c
fls.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
flsl.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
flsll.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
fnmatch.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
gsb_crc32.c arm64: check for CRC32 support via HWCAP 2020-09-08 15:39:19 +00:00
iconv_converter_if.m
iconv_ucs.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
iconv_xlat16.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
iconv_xlat.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
iconv.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
inet_aton.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
inet_ntoa.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
inet_ntop.c
inet_pton.c Remove pre-FreeBSD 7.0 compatibility. 2019-07-19 18:38:47 +00:00
jenkins_hash.c
lshrdi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
mcount.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
memcchr.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
memchr.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
memcmp.c Use __builtin for various mem* and b* (e.g. bzero) routines. 2018-06-02 18:03:35 +00:00
memmem.c
memset.c Use __builtin for various mem* and b* (e.g. bzero) routines. 2018-06-02 18:03:35 +00:00
moddi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
murmur3_32.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
qdivrem.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
qsort_r.c
qsort.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
quad.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
random.c Add prng(9) API 2020-08-13 20:48:14 +00:00
scanc.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strcasecmp.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
strcat.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strchr.c str(r)chr: Replace union abuse with __DECONST 2018-06-04 18:47:14 +00:00
strchrnul.c libkern: Implement strchrnul(3) 2019-08-19 22:53:05 +00:00
strcmp.c Port the NetBSD KCSAN runtime to FreeBSD. 2019-11-21 11:22:08 +00:00
strcpy.c Port the NetBSD KCSAN runtime to FreeBSD. 2019-11-21 11:22:08 +00:00
strcspn.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
strdup.c Add non-sleepable strdup variant strdup_flags 2019-02-20 20:48:10 +00:00
strlcat.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
strlcpy.c Sync strlcpy with userland version, again 2018-06-21 17:35:13 +00:00
strlen.c Port the NetBSD KCSAN runtime to FreeBSD. 2019-11-21 11:22:08 +00:00
strncat.c libkern: use nul for terminating char rather than 0 2018-02-13 19:17:48 +00:00
strncmp.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strncpy.c libkern: use nul for terminating char rather than 0 2018-02-13 19:17:48 +00:00
strndup.c
strnlen.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
strrchr.c str(r)chr: Replace union abuse with __DECONST 2018-06-04 18:47:14 +00:00
strsep.c libkern: use nul for terminating char rather than 0 2018-02-13 19:17:48 +00:00
strspn.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
strstr.c libkern: use nul for terminating char rather than 0 2018-02-13 19:17:48 +00:00
strtol.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strtoq.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strtoul.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strtouq.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
strvalid.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
timingsafe_bcmp.c
ucmpdi2.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
udivdi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
umoddi3.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00