Commit efe42251 authored by Brad Smith's avatar Brad Smith Committed by Rémi Denis-Courmont

rand: Also use /dev/urandom on OpenBSD as well

On older OpenBSD releases you especially should not have been
using /dev/random, nowdays due to changes all the device nodes
are actually all the same so either way this code can be simplified
to not special case OpenBSD in vlc_rand_init().
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
(manually cherry picked from 3fc4af48)
parent 46c54854
...@@ -50,15 +50,10 @@ static uint8_t okey[BLOCK_SIZE], ikey[BLOCK_SIZE]; ...@@ -50,15 +50,10 @@ static uint8_t okey[BLOCK_SIZE], ikey[BLOCK_SIZE];
static void vlc_rand_init (void) static void vlc_rand_init (void)
{ {
#if defined (__OpenBSD__) || defined (__OpenBSD_kernel__)
static const char randfile[] = "/dev/random";
#else
static const char randfile[] = "/dev/urandom";
#endif
uint8_t key[BLOCK_SIZE]; uint8_t key[BLOCK_SIZE];
/* Get non-predictible value as key for HMAC */ /* Get non-predictible value as key for HMAC */
int fd = vlc_open (randfile, O_RDONLY); int fd = vlc_open ("/dev/urandom", O_RDONLY);
if (fd == -1) if (fd == -1)
return; /* Uho! */ return; /* Uho! */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment