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.