summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorderaadt <>2014-06-13 15:35:34 +0000
committerderaadt <>2014-06-13 15:35:34 +0000
commitc2d937dced6c0707f6b56cdd86aa9084f9aa18f0 (patch)
tree7536187605ac3a2d8c5378f07af96b356ecfe069 /src
parentba98a1ee5638387b7647bc29d0c5a190d732632f (diff)
downloadopenbsd-c2d937dced6c0707f6b56cdd86aa9084f9aa18f0.tar.gz
openbsd-c2d937dced6c0707f6b56cdd86aa9084f9aa18f0.tar.bz2
openbsd-c2d937dced6c0707f6b56cdd86aa9084f9aa18f0.zip
use getentropy; from matthew
Diffstat (limited to 'src')
-rw-r--r--src/lib/libc/stdlib/random.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/lib/libc/stdlib/random.c b/src/lib/libc/stdlib/random.c
index 00edf2dca1..7ed911bf65 100644
--- a/src/lib/libc/stdlib/random.c
+++ b/src/lib/libc/stdlib/random.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: random.c,v 1.19 2013/08/01 19:42:08 kettenis Exp $ */ 1/* $OpenBSD: random.c,v 1.20 2014/06/13 15:35:34 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 1983 Regents of the University of California. 3 * Copyright (c) 1983 Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -252,7 +252,6 @@ __warn_references(srandom,
252void 252void
253srandomdev(void) 253srandomdev(void)
254{ 254{
255 int mib[2];
256 size_t len; 255 size_t len;
257 256
258 LOCK(); 257 LOCK();
@@ -261,9 +260,7 @@ srandomdev(void)
261 else 260 else
262 len = rand_deg * sizeof(state[0]); 261 len = rand_deg * sizeof(state[0]);
263 262
264 mib[0] = CTL_KERN; 263 getentropy(state, len);
265 mib[1] = KERN_ARND;
266 sysctl(mib, 2, state, &len, NULL, 0);
267 264
268 if (rand_type != TYPE_0) { 265 if (rand_type != TYPE_0) {
269 fptr = &state[rand_sep]; 266 fptr = &state[rand_sep];