mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 14:02:52 +02:00
util/nvmutil: disable urandom if not found
disable random mac address generation on really old operating systems. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -718,13 +718,8 @@ open_dev_urandom(void)
|
||||
if (urandom_fd != -1)
|
||||
return;
|
||||
|
||||
fprintf(stderr, "Can't open %s (will use %s instead)\n",
|
||||
newrandom, oldrandom);
|
||||
|
||||
rname = oldrandom;
|
||||
urandom_fd = open(rname, O_RDONLY | O_BINARY | O_NONBLOCK);
|
||||
if (urandom_fd == -1)
|
||||
err(errno, "%s: could not open", rname);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1001,6 +996,9 @@ rhex(void)
|
||||
static size_t n = 0;
|
||||
static uint8_t rnum[12];
|
||||
|
||||
if (urandom_fd)
|
||||
err(ECANCELED, "Your operating system has no /dev/[u]random");
|
||||
|
||||
if (!n) {
|
||||
n = sizeof(rnum);
|
||||
if (rw_file_exact(urandom_fd, rnum, n, 0, LESEN) == -1)
|
||||
|
||||
Reference in New Issue
Block a user