diff options
author | Simon Tatham <simon.tatham@arm.com> | 2020-04-07 09:18:09 +0100 |
---|---|---|
committer | Simon Tatham <simon.tatham@arm.com> | 2020-04-07 09:18:12 +0100 |
commit | aab9e9de4d9925617bb9bc3891fa96107b615149 (patch) | |
tree | c101a363fc8c13c2f1307fb50913a9d7482323ef /llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp | |
parent | 4fc59a468ff43e6ea25f5184053f763b9fa34590 (diff) | |
download | llvm-aab9e9de4d9925617bb9bc3891fa96107b615149.zip llvm-aab9e9de4d9925617bb9bc3891fa96107b615149.tar.gz llvm-aab9e9de4d9925617bb9bc3891fa96107b615149.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp')
0 files changed, 0 insertions, 0 deletions