[compiler-rt] r350249 - [Sanitizer] Disable arc4random seeding apis on for Non NetBSD platforms.
David Carlier via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 2 11:11:45 PST 2019
Author: devnexen
Date: Wed Jan 2 11:11:44 2019
New Revision: 350249
URL: http://llvm.org/viewvc/llvm-project?rev=350249&view=rev
Log:
[Sanitizer] Disable arc4random seeding apis on for Non NetBSD platforms.
- arc4random_stir / arc4random_addrandom had been made obsolete (and removed) from FreeBSD 12.
Reviewers: krytarowski
Reviewed By: krytarowski
Differential Revision: https://reviews.llvm.org/D56210
Modified:
compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/arc4random.cc
Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/arc4random.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/arc4random.cc?rev=350249&r1=350248&r2=350249&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/arc4random.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/arc4random.cc Wed Jan 2 11:11:44 2019
@@ -15,8 +15,10 @@ void print_buf(unsigned char *buf, size_
}
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_uniform() {
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_buf10() {
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));
}
More information about the llvm-commits
mailing list