llvm-project/llvm/lib/Support/Windows
Simon Tatham aab9e9de4d [Support,Windows] Tolerate failure of CryptGenRandom
Summary:
In `Unix/Process.inc`, we seed a random number generator from
`/dev/urandom` if possible, but if not, we're happy to fall back to
ordinary pseudorandom strategies, like the current time and PID.

The corresponding function on Windows calls `CryptGenRandom`, but it
//doesn't// have a fallback if that strategy fails. But `CryptGenRandom`
//can// fail, if a cryptography provider isn't properly initialized, or
occasionally (by our observation) simply intermittently.

If it's reasonable on Unix to implement traditional pseudorandom-number
seeding as a fallback, then it's surely reasonable to do the same on
Windows. So this patch adds a last-ditch use of ordinary rand(), using
much the same strategy as the Unix fallback code.

Reviewers: hans, sammccall

Reviewed By: hans

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77553
2020-04-07 09:18:12 +01:00
..
COM.inc Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DynamicLibrary.inc llvm-ar: Fix MinGW compilation 2020-02-28 09:59:24 +01:00
Host.inc llvm-ar: Fix MinGW compilation 2020-02-28 09:59:24 +01:00
Memory.inc llvm-ar: Fix MinGW compilation 2020-02-28 09:59:24 +01:00
Path.inc [Support] Fix clang warning in widenPath NFC 2020-03-23 18:59:55 +00:00
Process.inc [Support,Windows] Tolerate failure of CryptGenRandom 2020-04-07 09:18:12 +01:00
Program.inc [Support] Improve Windows widenPath and add support for long UNC paths 2020-03-19 13:00:21 +00:00
Signals.inc llvm-ar: Fix MinGW compilation 2020-02-28 09:59:24 +01:00
ThreadLocal.inc llvm-ar: Fix MinGW compilation 2020-02-28 09:59:24 +01:00
Threading.inc [ThinLTO] Allow usage of all hardware threads in the system 2020-03-27 10:20:58 -04:00
Watchdog.inc Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
explicit_symbols.inc Remove support for unsupported MSVC versions 2019-08-02 23:09:01 +00:00