libreboot-utils: replace rlong() with rset()

now you can send an arbitrary number of bytes
with random numbers

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-25 18:01:38 +00:00
parent 00b56c0278
commit a70ede850d
4 changed files with 9 additions and 26 deletions
+1 -12
View File
@@ -635,12 +635,6 @@ mkhtemp(int *fd,
p, xc, fd, st, type);
if (r == 0) {
if (retries >= MKHTEMP_SPIN_THRESHOLD) {
/* usleep can return EINTR */
close_errno = errno;
usleep((useconds_t)rlong() & 0x3FF);
errno = close_errno;
}
continue;
}
if (r < 0)
@@ -903,12 +897,7 @@ mkhtemp_fill_random(char *p, size_t xc)
for (chx = 0; chx < xc; chx++) {
retry_rand:
/* /dev/urandom if enabled, OR:
* on bsd: uses arc4random
* on linux: uses getrandom
NOTE: *aborts* on error, regardless of method
*/
r = rlong(); /* always *returns* successfully */
rset(&r, sizeof(r));
if (r >= limit)
goto retry_rand;