summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lib/mkhtemp.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-25 18:01:38 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 06:59:42 +0000
commita70ede850d4aa5942e59b5ba3ba9dbd3cd1a93e7 (patch)
tree07493965487f89c675f3e87dbafabb6fb8711907 /util/libreboot-utils/lib/mkhtemp.c
parent00b56c0278966edfd2acc29e55efac734982013e (diff)
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>
Diffstat (limited to 'util/libreboot-utils/lib/mkhtemp.c')
-rw-r--r--util/libreboot-utils/lib/mkhtemp.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/util/libreboot-utils/lib/mkhtemp.c b/util/libreboot-utils/lib/mkhtemp.c
index d22f526a..d32d8de4 100644
--- a/util/libreboot-utils/lib/mkhtemp.c
+++ b/util/libreboot-utils/lib/mkhtemp.c
@@ -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;