summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/random.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2014-06-15 01:49:06 +0000
committerderaadt <deraadt@openbsd.org>2014-06-15 01:49:06 +0000
commitecdcc3532b95f1e603cfcc890c0fa1adf859d59a (patch)
tree098eb60316137605f456e5865145c172bbe905a4 /lib/libc/stdlib/random.c
parentPreallocate sgmap extent regions for tsp, cia and mcpcia dma maps, which fall (diff)
downloadwireguard-openbsd-ecdcc3532b95f1e603cfcc890c0fa1adf859d59a.tar.xz
wireguard-openbsd-ecdcc3532b95f1e603cfcc890c0fa1adf859d59a.zip
In srandomdev(), use arc4random_buf() instead of from the kernel.
discussion with matthew
Diffstat (limited to 'lib/libc/stdlib/random.c')
-rw-r--r--lib/libc/stdlib/random.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c
index 7ed911bf657..0c388983be2 100644
--- a/lib/libc/stdlib/random.c
+++ b/lib/libc/stdlib/random.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: random.c,v 1.20 2014/06/13 15:35:34 deraadt Exp $ */
+/* $OpenBSD: random.c,v 1.21 2014/06/15 01:49:06 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
@@ -242,8 +242,7 @@ __warn_references(srandom,
* srandomdev:
*
* Many programs choose the seed value in a totally predictable manner.
- * This often causes problems. We seed the generator using random
- * data from the kernel.
+ * This often causes problems. We seed the generator using random data.
* Note that this particular seeding procedure can generate states
* which are impossible to reproduce by calling srandom() with any
* value, since the succeeding terms in the state buffer are no longer
@@ -260,7 +259,7 @@ srandomdev(void)
else
len = rand_deg * sizeof(state[0]);
- getentropy(state, len);
+ arc4random_buf(buf, len);
if (rand_type != TYPE_0) {
fptr = &state[rand_sep];