Require getrandom(2).
It's almost 2018, Linux 3.17 -- the first kernel with getrandom(2) --
was released in October 2014, and being able to assume getrandom lets
us simplify and improve some security-related code in libc, and revert a
hack to getentropy that's been necessary in the meantime. Only the fugu
kernel doesn't have getrandom(2) at this point, and that's EOL.
Bug: http://b/67014255
Test: ran tests
Change-Id: I1736f4dd33d50fe99e7a524851180989f4c85a33
diff --git a/tests/sys_random_test.cpp b/tests/sys_random_test.cpp
index a25490c..78cbf4a 100644
--- a/tests/sys_random_test.cpp
+++ b/tests/sys_random_test.cpp
@@ -72,11 +72,6 @@
TEST(sys_random, getrandom) {
#if defined(HAVE_SYS_RANDOM)
- if (getrandom(nullptr, 0, 0) == -1 && errno == ENOSYS) {
- GTEST_LOG_(INFO) << "This test requires a >= 3.17 kernel with getrandom(2).\n";
- return;
- }
-
char buf1[64];
char buf2[64];
@@ -90,11 +85,6 @@
TEST(sys_random, getrandom_EFAULT) {
#if defined(HAVE_SYS_RANDOM)
- if (getrandom(nullptr, 0, 0) == -1 && errno == ENOSYS) {
- GTEST_LOG_(INFO) << "This test requires a >= 3.17 kernel with getrandom(2).\n";
- return;
- }
-
errno = 0;
ASSERT_EQ(-1, getrandom(nullptr, 256, 0));
ASSERT_EQ(EFAULT, errno);
@@ -105,11 +95,6 @@
TEST(sys_random, getrandom_EINVAL) {
#if defined(HAVE_SYS_RANDOM)
- if (getrandom(nullptr, 0, 0) == -1 && errno == ENOSYS) {
- GTEST_LOG_(INFO) << "This test requires a >= 3.17 kernel with getrandom(2).\n";
- return;
- }
-
errno = 0;
char buf[64];
ASSERT_EQ(-1, getrandom(buf, sizeof(buf), ~0));