summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/random.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2014-06-13 15:35:34 +0000
committerderaadt <deraadt@openbsd.org>2014-06-13 15:35:34 +0000
commitb53a866ddaf41f341f9536b56f6a680f4fbcc9c3 (patch)
tree8da283caecb46ac148742ccb113730675cbed424 /lib/libc/stdlib/random.c
parentUse meaningful variable names, rather than i, j, k and cl. (diff)
downloadwireguard-openbsd-b53a866ddaf41f341f9536b56f6a680f4fbcc9c3.tar.xz
wireguard-openbsd-b53a866ddaf41f341f9536b56f6a680f4fbcc9c3.zip
use getentropy; from matthew
Diffstat (limited to 'lib/libc/stdlib/random.c')
-rw-r--r--lib/libc/stdlib/random.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c
index 00edf2dca1c..7ed911bf657 100644
--- a/lib/libc/stdlib/random.c
+++ b/lib/libc/stdlib/random.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: random.c,v 1.19 2013/08/01 19:42:08 kettenis Exp $ */
+/* $OpenBSD: random.c,v 1.20 2014/06/13 15:35:34 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
@@ -252,7 +252,6 @@ __warn_references(srandom,
void
srandomdev(void)
{
- int mib[2];
size_t len;
LOCK();
@@ -261,9 +260,7 @@ srandomdev(void)
else
len = rand_deg * sizeof(state[0]);
- mib[0] = CTL_KERN;
- mib[1] = KERN_ARND;
- sysctl(mib, 2, state, &len, NULL, 0);
+ getentropy(state, len);
if (rand_type != TYPE_0) {
fptr = &state[rand_sep];