Skip to content

Commit d6d3f0b

Browse files
author
itojun
committed
use sysctl(kern.urandom) if /dev/urandom is not present (like chroot jail)
1 parent 263b55c commit d6d3f0b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/libc/gen/arc4random.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: arc4random.c,v 1.3 2002/06/14 03:11:24 itojun Exp $ */
1+
/* $NetBSD: arc4random.c,v 1.4 2002/07/02 17:10:19 itojun Exp $ */
22
/* $OpenBSD: arc4random.c,v 1.6 2001/06/05 05:05:38 pvalchev Exp $ */
33

44
/*
@@ -103,7 +103,7 @@ arc4_stir(as)
103103
read(fd, rdat.rnd, sizeof(rdat.rnd));
104104
close(fd);
105105
}
106-
#ifdef KERN_ARND
106+
#ifdef KERN_URND
107107
else {
108108
int i, mib[2];
109109
size_t len;
@@ -112,7 +112,7 @@ arc4_stir(as)
112112
* randomness from sysctl. */
113113

114114
mib[0] = CTL_KERN;
115-
mib[1] = KERN_ARND;
115+
mib[1] = KERN_URND;
116116

117117
for (i = 0; i < sizeof(rdat.rnd) / sizeof(u_int); i ++) {
118118
len = sizeof(u_int);

0 commit comments

Comments
 (0)