[PATCH] D34412: [sanitizer] Add a function to gather random bytes

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 20 15:54:12 PDT 2017


alekseyshl added a comment.

I think it's fine to leave them unimplemented on win/mac and let someone with access to the actual platform to add and test the code.



================
Comment at: lib/sanitizer_common/sanitizer_common.h:924
+// be used to seed a PRNG.
+bool GetRandom(u8 *buffer, uptr length);
+
----------------
Why u8*? Why not customary void*?


================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:928
+bool GetRandom(u8 *buffer, uptr length) {
+  return false;
+}
----------------
Maybe UNIMPLEMENTED(); is slightly more robust than return false?


================
Comment at: lib/sanitizer_common/tests/sanitizer_common_test.cc:316
+  }
+}
+#endif
----------------
Please use ARRAY_SIZE(buffer_*) instead of literal 32.


https://reviews.llvm.org/D34412





More information about the llvm-commits mailing list