summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>2004-08-10 09:48:00 +0000
committerHakan Olsson <ho@cvs.openbsd.org>2004-08-10 09:48:00 +0000
commit368011382977bb5e51b90acf93f6bec11fd1a005 (patch)
treec0d72dee454a42e13be074cc37bfa8a0e516e837
parent9e89ae6c30c340f98e2352d7c805ed9285f37b29 (diff)
If opening /dev/arandom fails, try /dev/random. Suggested by Benjamin Pineau.
-rw-r--r--sbin/isakmpd/sysdep/common/libsysdep/arc4random.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sbin/isakmpd/sysdep/common/libsysdep/arc4random.c b/sbin/isakmpd/sysdep/common/libsysdep/arc4random.c
index 3be7f1cb075..d6fe39aa683 100644
--- a/sbin/isakmpd/sysdep/common/libsysdep/arc4random.c
+++ b/sbin/isakmpd/sysdep/common/libsysdep/arc4random.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc4random.c,v 1.4 2001/06/05 05:05:37 pvalchev Exp $ */
+/* $OpenBSD: arc4random.c,v 1.5 2004/08/10 09:47:59 ho Exp $ */
/*
* Arc4 random number generator for OpenBSD.
@@ -88,6 +88,8 @@ arc4_stir(as)
gettimeofday(&rdat.tv, NULL);
fd = open("/dev/arandom", O_RDONLY);
+ if (fd < 0)
+ fd = open("/dev/random", O_RDONLY);
if (fd >= 0) {
read(fd, rdat.rnd, sizeof(rdat.rnd));
close(fd);