2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Use getentropy() in mkstemp/mkdtemp replacement.

This commit is contained in:
Todd C. Miller
2017-06-29 18:11:30 -06:00
parent 6d4d4594b7
commit c000189684
4 changed files with 24 additions and 1 deletions

View File

@@ -81,6 +81,10 @@ seed_random(void)
SEED_T seed;
int fd;
# ifdef HAVE_GETENTROPY
/* Not really an fd, just has to be -1 on error. */
fd = getentropy(&seed, sizeof(seed));
# else
/*
* Seed from /dev/urandom if possible.
*/
@@ -95,7 +99,7 @@ seed_random(void)
if (nread != (ssize_t)sizeof(seed))
fd = -1;
}
# endif /* HAVE_GETENTROPY */
/*
* If no /dev/urandom, seed from time of day and process id
* multiplied by small primes.