summaryrefslogtreecommitdiff
path: root/tests/sys_random_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-09-29 08:58:35 -0700
committerElliott Hughes <enh@google.com>2017-09-29 09:01:01 -0700
commit6a5dfebd41d84a02008d559faebbe6ded78f3fb3 (patch)
treeae0b7e53a1e97980049b17610c92238efa995c69 /tests/sys_random_test.cpp
parentb3639adf9ce41f520f7a64a5016e6ffc41ccd009 (diff)
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
Diffstat (limited to 'tests/sys_random_test.cpp')
-rw-r--r--tests/sys_random_test.cpp15
1 files changed, 0 insertions, 15 deletions
diff --git a/tests/sys_random_test.cpp b/tests/sys_random_test.cpp
index a25490c67..78cbf4a71 100644
--- a/tests/sys_random_test.cpp
+++ b/tests/sys_random_test.cpp
@@ -72,11 +72,6 @@ TEST(sys_random, getentropy_EIO) {
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) {
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_EFAULT) {
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));