diff options
author | Kostya Kortchinsky <kostyak@google.com> | 2017-08-29 21:52:56 +0000 |
---|---|---|
committer | Kostya Kortchinsky <kostyak@google.com> | 2017-08-29 21:52:56 +0000 |
commit | 454ce793bfd6e54f91d224a12636d2cb1db00a86 (patch) | |
tree | 19270c3b87154bc1081b998ff4b0086269e62065 /lib/sanitizer_common/sanitizer_fuchsia.cc | |
parent | 25500b158196752cb12a88207ba1fe5c9a86f5b1 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312046 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_fuchsia.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_fuchsia.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_fuchsia.cc b/lib/sanitizer_common/sanitizer_fuchsia.cc index 75924536a..a6abe4391 100644 --- a/lib/sanitizer_common/sanitizer_fuchsia.cc +++ b/lib/sanitizer_common/sanitizer_fuchsia.cc @@ -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 |