[PATCH] D56210: [Sanitizer] Disable arc4random seeing apis for non NetBSD platforms

David CARLIER via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 2 11:05:52 PST 2019


devnexen created this revision.
devnexen added a reviewer: krytarowski.
devnexen created this object with visibility "All Users".
Herald added subscribers: Sanitizers, llvm-commits, kubamracek, emaste.

- arc4random_stir / arc4random_addrandom had been made obsolete from FreeBSD 12.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D56210

Files:
  test/sanitizer_common/TestCases/Posix/arc4random.cc


Index: test/sanitizer_common/TestCases/Posix/arc4random.cc
===================================================================
--- test/sanitizer_common/TestCases/Posix/arc4random.cc
+++ test/sanitizer_common/TestCases/Posix/arc4random.cc
@@ -15,8 +15,10 @@
 }
 
 void test_seed() {
+#ifdef __NetBSD__
   time_t now = ::time(nullptr);
   arc4random_addrandom((unsigned char *)&now, sizeof(now));
+#endif
 }
 
 void test_arc4random() {
@@ -34,7 +36,9 @@
 void test_arc4random_buf10() {
   printf("test_arc4random_buf10\n");
   char buf[10];
+#ifdef __NetBSD__
   arc4random_stir();
+#endif
   arc4random_buf(buf, sizeof(buf));
   print_buf((unsigned char *)buf, sizeof(buf));
 }
@@ -42,7 +46,9 @@
 void test_arc4random_buf256() {
   printf("test_arc4random_buf256\n");
   char buf[256];
+#ifdef __NetBSD__
   arc4random_stir();
+#endif
   arc4random_buf(buf, sizeof(buf));
   print_buf((unsigned char *)buf, sizeof(buf));
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56210.179894.patch
Type: text/x-patch
Size: 924 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190102/6b3d7ab3/attachment.bin>


More information about the llvm-commits mailing list