diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-25 11:37:21 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-25 11:37:55 +0000 |
| commit | e9cefe81b07f803ca87ae0f06123bca9c9528fbf (patch) | |
| tree | 42d274ed41b0f2a28deb79c9111030bf28505a51 | |
| parent | 6db9514c956c74afa171cca165d207a3ec502af0 (diff) | |
libreboot-utils: usleep 100 on rand failure
it's extremely unlikely that a 2nd call would
also fail. this is fine.
it mitigates DoS attacks (entropy exhaustion)
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rw-r--r-- | util/libreboot-utils/lib/rand.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/util/libreboot-utils/lib/rand.c b/util/libreboot-utils/lib/rand.c index 0b156e51..9c1fa4e3 100644 --- a/util/libreboot-utils/lib/rand.c +++ b/util/libreboot-utils/lib/rand.c @@ -79,8 +79,10 @@ retry_rand: (char *)&rval + off, len - off, 0); if (rc < 0) { - if (errno == EINTR || errno == EAGAIN) + if (errno == EINTR || errno == EAGAIN) { + usleep(100); goto retry_rand; + } goto err; /* possibly unsupported by kernel */ } |
