freebsd-skq/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
arm64
x86
arc4random_uniform.c
arc4random.c arc4random(9): Integrate with RANDOM_FENESTRASX push-reseed 2020-10-10 21:48:06 +00:00
ashldi3.c
ashrdi3.c
asprintf.c
bcd.c
bcmp.c
bcopy.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
bsearch.c
cmpdi2.c
divdi3.c
explicit_bzero.c
ffs.c
ffsl.c
ffsll.c
fls.c
flsl.c
flsll.c
fnmatch.c
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
iconv.c
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
jenkins_hash.c
lshrdi3.c
mcount.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
memcchr.c
memchr.c
memcmp.c
memmem.c
memset.c
moddi3.c
murmur3_32.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
qdivrem.c
qsort_r.c
qsort.c
quad.h
random.c
scanc.c
strcasecmp.c
strcat.c
strchr.c
strchrnul.c
strcmp.c
strcpy.c
strcspn.c
strdup.c
strlcat.c
strlcpy.c
strlen.c
strncat.c
strncmp.c
strncpy.c
strndup.c
strnlen.c
strrchr.c
strsep.c
strspn.c
strstr.c
strtol.c
strtoq.c
strtoul.c
strtouq.c
strvalid.c
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
umoddi3.c