Skip to content

Commit

Permalink
rand: Also use /dev/urandom on OpenBSD as well
Browse files Browse the repository at this point in the history
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: Rémi Denis-Courmont <[email protected]>
  • Loading branch information
brad0 authored and Rémi Denis-Courmont committed Jan 29, 2012
1 parent dd74923 commit 3fc4af4
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/posix/rand.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,10 @@ static uint8_t okey[BLOCK_SIZE], ikey[BLOCK_SIZE];

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];

/* 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)
return; /* Uho! */

Expand Down

0 comments on commit 3fc4af4

Please sign in to comment.