forked from OSchip/llvm-project
Enable GetRandom for Fuchsia sanitizer.
Summary: Adds a true implementation of GetRandom, to be used by scudo_utils.h. Reviewers: mcgrathr, phosek, kcc, vitalybuka, cryptoad Reviewed By: mcgrathr Subscribers: kubamracek Differential Revision: https://reviews.llvm.org/D37218 llvm-svn: 312046
This commit is contained in:
parent
ebb9327759
commit
913d038b29
|
@ -480,6 +480,14 @@ uptr ReadLongProcessName(/*out*/ char *buf, uptr buf_len) {
|
|||
|
||||
uptr MainThreadStackBase, MainThreadStackSize;
|
||||
|
||||
bool GetRandom(void *buffer, uptr length, bool blocking) {
|
||||
CHECK_LE(length, MX_CPRNG_DRAW_MAX_LEN);
|
||||
size_t size;
|
||||
CHECK_EQ(_mx_cprng_draw(buffer, length, &size), MX_OK);
|
||||
CHECK_EQ(size, length);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace __sanitizer
|
||||
|
||||
using namespace __sanitizer; // NOLINT
|
||||
|
|
Loading…
Reference in New Issue