[vlc-commits] rand: Also use /dev/urandom on OpenBSD as well

Brad Smith git at videolan.org
Mon Jan 30 18:41:42 CET 2012


vlc/vlc-2.0 | branch: master | Brad Smith <git at videolan.org> | Sun Jan 29 10:30:03 2012 +0200| [efe42251c6b9fe25985fefda67d9bd5da3af391b] | committer: 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: Rémi Denis-Courmont <remi at remlab.net>
(manually cherry picked from 3fc4af487dc23113a3c9602e1022f464f3992601)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=efe42251c6b9fe25985fefda67d9bd5da3af391b
---

 src/misc/rand.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/src/misc/rand.c b/src/misc/rand.c
index ec78ebe..875c733 100644
--- a/src/misc/rand.c
+++ b/src/misc/rand.c
@@ -50,15 +50,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! */
 



More information about the vlc-commits mailing list