summaryrefslogtreecommitdiff
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
commit92f96584f7e27b3bc6c9dbc2442a8ef411a30778 (patch)
treecf140eb66eaa6b2343d0166402dc9e3d60332543
parentaf66c5c7cad29fac16d0d428562c5285e6da5d68 (diff)
downloadcompiler-rt-92f96584f7e27b3bc6c9dbc2442a8ef411a30778.tar.gz
[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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@350249 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/sanitizer_common/TestCases/Posix/arc4random.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/sanitizer_common/TestCases/Posix/arc4random.cc b/test/sanitizer_common/TestCases/Posix/arc4random.cc
index a34930973..0a983b58f 100644
--- a/test/sanitizer_common/TestCases/Posix/arc4random.cc
+++ b/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));
}