summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2019-01-02 19:11:44 +0000
committerDavid Carlier <devnexen@gmail.com>2019-01-02 19:11:44 +0000
commit5e164b53dbface7621c647d1219bbd32433a4fb4 (patch)
tree72b7b25073a574924dbe71db8defd7bd961ffeea
parent205b7093669382fe21554bdfb325a8e17b379e03 (diff)
downloadbcm5719-llvm-5e164b53dbface7621c647d1219bbd32433a4fb4.tar.gz
bcm5719-llvm-5e164b53dbface7621c647d1219bbd32433a4fb4.zip
[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 llvm-svn: 350249
-rw-r--r--compiler-rt/test/sanitizer_common/TestCases/Posix/arc4random.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/arc4random.cc b/compiler-rt/test/sanitizer_common/TestCases/Posix/arc4random.cc
index a34930973e6..0a983b58f59 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/arc4random.cc
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/arc4random.cc
@@ -15,8 +15,10 @@ void print_buf(unsigned char *buf, size_t buflen) {
}
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));
}
OpenPOWER on IntegriCloud