[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
This commit is contained in:
David Carlier 2019-01-02 19:11:44 +00:00
parent 205b709366
commit 5e164b53db
1 changed files with 6 additions and 0 deletions

View File

@ -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));
}