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
This commit is contained in:
Elliott Hughes 2017-09-29 08:58:35 -07:00
parent b3639adf9c
commit 6a5dfebd41
1 changed files with 0 additions and 15 deletions

View File

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