Use our own getentropy() by default on Linux.

The glibc getentropy() emulation will fail on older kernels that
don't support getrandom().
Also use sudo_fatal() instead of sending SIGKILL on getentropy() failure.
GitHub issue #117.
This commit is contained in:
Todd C. Miller
2021-10-20 09:53:01 -06:00
parent de4fd4a31d
commit 00e53b32e5
4 changed files with 10 additions and 16 deletions

View File

@@ -34,10 +34,6 @@
#ifndef HAVE_ARC4RANDOM
#ifdef HAVE_SYS_RANDOM_H
# include <sys/random.h>
#endif
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
@@ -51,6 +47,7 @@
#endif
#include "sudo_compat.h"
#include "sudo_fatal.h"
#include "sudo_rand.h"
#define KEYSTREAM_ONLY
@@ -96,7 +93,7 @@ _rs_stir(void)
unsigned char rnd[KEYSZ + IVSZ];
if (getentropy(rnd, sizeof rnd) == -1)
raise(SIGKILL);
sudo_fatal_nodebug("getentropy");
if (!rs_initialized) {
rs_initialized = 1;