diff options
Diffstat (limited to 'src/lib/libc/stdlib')
| -rw-r--r-- | src/lib/libc/stdlib/random.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/libc/stdlib/random.c b/src/lib/libc/stdlib/random.c index 7ed911bf65..0c388983be 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.20 2014/06/13 15:35:34 deraadt Exp $ */ | 1 | /* $OpenBSD: random.c,v 1.21 2014/06/15 01:49:06 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. |
| @@ -242,8 +242,7 @@ __warn_references(srandom, | |||
| 242 | * srandomdev: | 242 | * srandomdev: |
| 243 | * | 243 | * |
| 244 | * Many programs choose the seed value in a totally predictable manner. | 244 | * Many programs choose the seed value in a totally predictable manner. |
| 245 | * This often causes problems. We seed the generator using random | 245 | * This often causes problems. We seed the generator using random data. |
| 246 | * data from the kernel. | ||
| 247 | * Note that this particular seeding procedure can generate states | 246 | * Note that this particular seeding procedure can generate states |
| 248 | * which are impossible to reproduce by calling srandom() with any | 247 | * which are impossible to reproduce by calling srandom() with any |
| 249 | * value, since the succeeding terms in the state buffer are no longer | 248 | * value, since the succeeding terms in the state buffer are no longer |
| @@ -260,7 +259,7 @@ srandomdev(void) | |||
| 260 | else | 259 | else |
| 261 | len = rand_deg * sizeof(state[0]); | 260 | len = rand_deg * sizeof(state[0]); |
| 262 | 261 | ||
| 263 | getentropy(state, len); | 262 | arc4random_buf(buf, len); |
| 264 | 263 | ||
| 265 | if (rand_type != TYPE_0) { | 264 | if (rand_type != TYPE_0) { |
| 266 | fptr = &state[rand_sep]; | 265 | fptr = &state[rand_sep]; |
