lbrycrd/src/util
Wladimir J. van der Laan 6e6b3b944d
Merge #14955: Switch all RNG code to the built-in PRNG
223de8d94d Document RNG design in random.h (Pieter Wuille)
f2e60ca985 Use secure allocator for RNG state (Pieter Wuille)
cddb31bb0a Encapsulate RNGState better (Pieter Wuille)
152146e782 DRY: Implement GetRand using FastRandomContext::randrange (Pieter Wuille)
a1f252eda8 Sprinkle some sweet noexcepts over the RNG code (Pieter Wuille)
4ea8e50837 Remove hwrand_initialized. (Pieter Wuille)
9d7032e4f0 Switch all RNG code to the built-in PRNG. (Pieter Wuille)
16e40a8b56 Integrate util/system's CInit into RNGState (Pieter Wuille)
2ccc3d3aa3 Abstract out seeding/extracting entropy into RNGState::MixExtract (Pieter Wuille)
aae8b9bf0f Add thread safety annotations to RNG state (Pieter Wuille)
d3f54d1c82 Rename some hardware RNG related functions (Pieter Wuille)
05fde14e3a Automatically initialize RNG on first use. (Pieter Wuille)
2d1cc50939 Don't log RandAddSeedPerfmon details (Pieter Wuille)
6a57ca91da Use FRC::randbytes instead of reading >32 bytes from RNG (Pieter Wuille)

Pull request description:

  This does not remove OpenSSL, but makes our own PRNG the 'main' one; for GetStrongRandBytes, the OpenSSL RNG is still used (indirectly, by feeding its output into our PRNG state).

  It includes a few policy changes (regarding what entropy is seeded when).

  Before this PR:
  * GetRand*:
    * OpenSSL
  * GetStrongRand*:
    * CPU cycle counter
    * Perfmon data (on Windows, once 10 min)
    * /dev/urandom (or equivalent)
    * rdrand (if available)
  * From scheduler when idle:
    * CPU cycle counter before and after 1ms sleep
  * At startup:
    * CPU cycle counter before and after 1ms sleep

  After this PR:
  * GetRand*:
    * Stack pointer (which indirectly identifies thread and some call stack information)
    * rdrand (if available)
    * CPU cycle counter
  * GetStrongRand*:
    * Stack pointer (which indirectly identifies thread and some call stack information)
    * rdrand (if available)
    * CPU cycle counter
    * /dev/urandom (or equivalent)
    * OpenSSL
    * CPU cycle counter again
  * From scheduler when idle:
    * Stack pointer (which indirectly identifies thread and some call stack information)
    * rdrand (if available)
    * CPU cycle counter before and after 1ms sleep
    * Perfmon data (on Windows, once every 10 min)
  * At startup:
    * Stack pointer (which indirectly identifies thread and some call stack information)
    * rdrand (if available)
    * CPU cycle counter
    * /dev/urandom (or equivalent)
    * OpenSSL
    * CPU cycle counter again
    * Perfmon data (on Windows, once every 10 min)

  The interface of random.h is also simplified, and documentation is added.

  This implements most of #14623.

Tree-SHA512: 0120e19bd4ce80a509b5c180a4f29497d299ce8242e25755880851344b825bc2d64a222bc245e659562fb5463fb7c70fbfcf003616be4dc59d0ed6534f93dd20
2019-01-21 19:46:45 +01:00
..
bytevectorhash.cpp blockfilter: Use unordered_set instead of set in blockfilter. 2018-11-05 09:30:56 -08:00
bytevectorhash.h blockfilter: Use unordered_set instead of set in blockfilter. 2018-11-05 09:30:56 -08:00
memory.h scripted-diff: Move util files to separate directory. 2018-11-04 22:46:07 -08:00
moneystr.cpp Use IsDigit(...) instead of std::isdigit 2018-11-06 17:32:08 +01:00
moneystr.h Add NODISCARD to all {Decode,Parse}[...](...) functions returning bool. Sort includes. 2018-11-05 17:03:11 +01:00
strencodings.cpp util: Make ToLower and ToUpper take a char 2019-01-10 02:51:14 +01:00
strencodings.h util: Make ToLower and ToUpper take a char 2019-01-10 02:51:14 +01:00
system.cpp Merge #14955: Switch all RNG code to the built-in PRNG 2019-01-21 19:46:45 +01:00
system.h Merge #14409: utils and libraries: Make 'blocksdir' always net specific 2019-01-16 13:40:27 +01:00
time.cpp scripted-diff: Move util files to separate directory. 2018-11-04 22:46:07 -08:00
time.h scripted-diff: Move util files to separate directory. 2018-11-04 22:46:07 -08:00