Browse Source

use getgentropy() call. If it fails, things are pretty bad --

call abort().
this direction discussed at length with miod beck tedu matthew etc
OPENBSD_5_6
deraadt 10 years ago
parent
commit
42da378a93
1 changed files with 3 additions and 8 deletions
  1. +3
    -8
      src/lib/libc/crypt/arc4random.c

+ 3
- 8
src/lib/libc/crypt/arc4random.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: arc4random.c,v 1.31 2014/05/31 10:32:12 jca Exp $ */
/* $OpenBSD: arc4random.c,v 1.32 2014/06/13 15:36:37 deraadt Exp $ */
/* /*
* Copyright (c) 1996, David Mazieres <dm@uun.org> * Copyright (c) 1996, David Mazieres <dm@uun.org>
@ -77,15 +77,10 @@ _rs_init(u_char *buf, size_t n)
static void static void
_rs_stir(void) _rs_stir(void)
{ {
int mib[2];
size_t len;
u_char rnd[KEYSZ + IVSZ]; u_char rnd[KEYSZ + IVSZ];
mib[0] = CTL_KERN;
mib[1] = KERN_ARND;
len = sizeof(rnd);
sysctl(mib, 2, rnd, &len, NULL, 0);
if (getentropy(rnd, sizeof rnd) == -1)
abort();
if (!rs_initialized) { if (!rs_initialized) {
rs_initialized = 1; rs_initialized = 1;


Loading…
Cancel
Save