util/nvmutil: rhex: don't read twice!

we currently never read the 0th byte, so if we need
all 12, and we do when every byte is random, we
read again just to get one byte.

not really a bug, but it is a performance penalty,
so let's fix it!

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-04 10:45:00 +00:00
parent aceafd684a
commit 2f2295fc37
+2 -2
View File
@@ -395,10 +395,10 @@ hextonum(char ch)
static uint8_t
rhex(void)
{
static uint8_t n = 0;
static int n = -1;
static uint8_t rnum[12];
if (!n) {
if (n == -1) {
n = sizeof(rnum) - 1;
read_file_PERFECTLY_or_die(rfd, rnum, sizeof(rnum),
0, "/dev/urandom", NULL);