freebsd-dev/sys/libkern
Mark Murray d1b06863fb Huge cleanup of random(4) code.
* GENERAL
- Update copyright.
- Make kernel options for RANDOM_YARROW and RANDOM_DUMMY. Set
  neither to ON, which means we want Fortuna
- If there is no 'device random' in the kernel, there will be NO
  random(4) device in the kernel, and the KERN_ARND sysctl will
  return nothing. With RANDOM_DUMMY there will be a random(4) that
  always blocks.
- Repair kern.arandom (KERN_ARND sysctl). The old version went
  through arc4random(9) and was a bit weird.
- Adjust arc4random stirring a bit - the existing code looks a little
  suspect.
- Fix the nasty pre- and post-read overloading by providing explictit
  functions to do these tasks.
- Redo read_random(9) so as to duplicate random(4)'s read internals.
  This makes it a first-class citizen rather than a hack.
- Move stuff out of locked regions when it does not need to be
  there.
- Trim RANDOM_DEBUG printfs. Some are excess to requirement, some
  behind boot verbose.
- Use SYSINIT to sequence the startup.
- Fix init/deinit sysctl stuff.
- Make relevant sysctls also tunables.
- Add different harvesting "styles" to allow for different requirements
  (direct, queue, fast).
- Add harvesting of FFS atime events. This needs to be checked for
  weighing down the FS code.
- Add harvesting of slab allocator events. This needs to be checked for
  weighing down the allocator code.
- Fix the random(9) manpage.
- Loadable modules are not present for now. These will be re-engineered
  when the dust settles.
- Use macros for locks.
- Fix comments.

* src/share/man/...
- Update the man pages.

* src/etc/...
- The startup/shutdown work is done in D2924.

* src/UPDATING
- Add UPDATING announcement.

* src/sys/dev/random/build.sh
- Add copyright.
- Add libz for unit tests.

* src/sys/dev/random/dummy.c
- Remove; no longer needed. Functionality incorporated into randomdev.*.

* live_entropy_sources.c live_entropy_sources.h
- Remove; content moved.
- move content to randomdev.[ch] and optimise.

* src/sys/dev/random/random_adaptors.c src/sys/dev/random/random_adaptors.h
- Remove; plugability is no longer used. Compile-time algorithm
  selection is the way to go.

* src/sys/dev/random/random_harvestq.c src/sys/dev/random/random_harvestq.h
- Add early (re)boot-time randomness caching.

* src/sys/dev/random/randomdev_soft.c src/sys/dev/random/randomdev_soft.h
- Remove; no longer needed.

* src/sys/dev/random/uint128.h
- Provide a fake uint128_t; if a real one ever arrived, we can use
  that instead. All that is needed here is N=0, N++, N==0, and some
  localised trickery is used to manufacture a 128-bit 0ULLL.

* src/sys/dev/random/unit_test.c src/sys/dev/random/unit_test.h
- Improve unit tests; previously the testing human needed clairvoyance;
  now the test will do a basic check of compressibility. Clairvoyant
  talent is still a good idea.
- This is still a long way off a proper unit test.

* src/sys/dev/random/fortuna.c src/sys/dev/random/fortuna.h
- Improve messy union to just uint128_t.
- Remove unneeded 'static struct fortuna_start_cache'.
- Tighten up up arithmetic.
- Provide a method to allow eternal junk to be introduced; harden
  it against blatant by compress/hashing.
- Assert that locks are held correctly.
- Fix the nasty pre- and post-read overloading by providing explictit
  functions to do these tasks.
- Turn into self-sufficient module (no longer requires randomdev_soft.[ch])

* src/sys/dev/random/yarrow.c src/sys/dev/random/yarrow.h
- Improve messy union to just uint128_t.
- Remove unneeded 'staic struct start_cache'.
- Tighten up up arithmetic.
- Provide a method to allow eternal junk to be introduced; harden
  it against blatant by compress/hashing.
- Assert that locks are held correctly.
- Fix the nasty pre- and post-read overloading by providing explictit
  functions to do these tasks.
- Turn into self-sufficient module (no longer requires randomdev_soft.[ch])
- Fix some magic numbers elsewhere used as FAST and SLOW.

Differential Revision: https://reviews.freebsd.org/D2025
Reviewed by: vsevolod,delphij,rwatson,trasz,jmg
Approved by: so (delphij)
2015-06-30 17:00:45 +00:00
..
arm Add more __aeabi_memcpy functions, later versions of clang generate calls 2015-05-31 07:31:20 +00:00
arc4random.c Huge cleanup of random(4) code. 2015-06-30 17:00:45 +00:00
ashldi3.c Fix ixp425 boot2 with ARM EABI: 2013-09-29 15:19:34 +00:00
ashrdi3.c
asprintf.c Implement asprintf in libkern 2015-03-01 00:22:16 +00:00
bcd.c
bcmp.c
bsearch.c
cmpdi2.c
crc32.c Remove second consts in r233288 in order to appease C++ compilers. 2012-03-26 18:22:04 +00:00
divdi3.c
explicit_bzero.c Remove duplicated code. 2014-10-16 22:04:07 +00:00
ffs.c
ffsl.c
fls.c
flsl.c
flsll.c Fix watchdog pretimeout. 2013-07-27 20:47:01 +00:00
fnmatch.c Use strchr() and strrchr(). 2012-01-02 12:12:10 +00:00
iconv_converter_if.m
iconv_ucs.c Use strcasecmp() instead of strcmp() when checking user-supplied encoding 2014-06-09 19:27:47 +00:00
iconv_xlat16.c
iconv_xlat.c
iconv.c Use strcasecmp() instead of strcmp() when checking user-supplied encoding 2014-06-09 19:27:47 +00:00
inet_aton.c
inet_ntoa.c
inet_ntop.c
inet_pton.c
jenkins_hash.c s/ is is / is /g 2012-09-14 22:00:03 +00:00
lshrdi3.c
mcount.c
memcchr.c Introducing memcchr(3). 2012-01-01 20:26:11 +00:00
memchr.c
memcmp.c
memmem.c Use __DECONST to avoid compiler warnings (and thus build failures) 2014-09-08 08:12:09 +00:00
memmove.c
memset.c
moddi3.c
murmur3_32.c Add a complete implementation of MurmurHash3. Tweak both implementations 2014-10-18 22:15:11 +00:00
qdivrem.c
qsort_r.c
qsort.c
quad.h Add __aeabi_ulcmp to allow building of the LINT kernel. 2013-01-23 09:18:18 +00:00
random.c Huge cleanup of random(4) code. 2015-06-30 17:00:45 +00:00
scanc.c
strcasecmp.c
strcat.c
strchr.c Implement extensions on top of standards instead of the other way around. 2012-01-03 07:05:30 +00:00
strcmp.c
strcpy.c
strcspn.c
strdup.c
strlcat.c
strlcpy.c Sync strlcpy with userland version. 2012-11-03 04:29:24 +00:00
strlen.c Sync strlen with userland implementation. 2012-11-03 04:28:53 +00:00
strncmp.c Sync with userland variant. 2014-11-17 21:01:35 +00:00
strncpy.c
strndup.c Bring in the new automounter, similar to what's provided in most other 2014-08-17 09:44:42 +00:00
strnlen.c
strrchr.c Implement extensions on top of standards instead of the other way around. 2012-01-03 07:05:30 +00:00
strsep.c
strspn.c
strstr.c
strtol.c Fix a -Wcast-qual warning in libkern's strtol(), by using __DECONST. No 2015-01-29 21:16:45 +00:00
strtoq.c Similar to r277901, fix more -Wcast-qual warnings in libkern's strtoq(), 2015-01-29 21:54:01 +00:00
strtoul.c Similar to r277901, fix more -Wcast-qual warnings in libkern's strtoq(), 2015-01-29 21:54:01 +00:00
strtouq.c Similar to r277901, fix more -Wcast-qual warnings in libkern's strtoq(), 2015-01-29 21:54:01 +00:00
strvalid.c
timingsafe_bcmp.c Add some new modes to OpenCrypto. These modes are AES-ICM (can be used 2014-12-12 19:56:36 +00:00
ucmpdi2.c Add __aeabi_ulcmp to allow building of the LINT kernel. 2013-01-23 09:18:18 +00:00
udivdi3.c
umoddi3.c
zlib.c Move zlib.c from net to libkern. 2015-04-22 14:38:58 +00:00