arc4random.c


Log

Author Commit Date CI Message
Nick Mathewson c44de06c 2010-05-08T18:09:27 Numerous opensolaris compilation fixes For future note, opensolaris doesn't have sys/sysctl.h, doesn't like comparing iov_buf to a chain_space_ptr without a cast, and is (predictably) unforgiving of dumb syntax errors. Also, we had accidentally broken the devpoll backend test in configure.in
Nick Mathewson 90d42251 2010-05-08T15:31:54 Fix some crazy macro mistakes in arc4random.c
Nick Mathewson 20fda296 2010-05-03T13:00:00 Try /proc on Linux as entropy fallback; use sysctl as last resort It turns out that the happy fun Linux kernel is deprecating sysctl, and using sysctl to fetch entropy will spew messages in the kernel logs. Let's not do that. Instead, let's call sysctl for our entropy only when all other means fail. Additionally, let's add another means, and try /proc/sys/kernel/random/uuid if /dev/urandom fails.
Nick Mathewson a47a4b7e 2010-04-23T16:08:09 Fix a couple of bugs in the BSD sysctl arc4seed logic Of course, FreeBSD has its own arc4random() implementation, so this should never actually be needed. Still, it's good to paint the underside of the wagon.
Nick Mathewson 71fc3eb0 2010-03-04T01:13:51 Seed the RNG using sysctl() as well as /dev/urandom William Ahern points out that if the user has chrooted, they might not have a working /dev/urandom. Linux and many of the BSDs, however, define a sysctl interface to their kernel random number generators. This patch takes a belt-and-suspenders approach and tries to do use the sysctl _and_ the /dev/urandom approach if both are present. When using the sysctl approach, it tries to bulletproof itself by checking to make sure that the buffers are actually set by the sysctl calls.
Nick Mathewson 98edb891 2010-02-25T17:14:41 Fix arc4random compilation on MSVC.
Nick Mathewson ff2a134d 2010-02-18T00:54:44 Fix getpid() usage on Windows On Windows, getpid() is _getpid(), and requires that we first include <process.h>. arc4random.c previously didn't know that. Actually, I question whether arc4random needs to do its getpid() tricks on Windows. They exist only so that we remember to re-seed the ARC4 cipher whenever we fork... but Windows has no fork(), so I think we're in the clear.
Nick Mathewson 4ec8fea6 2010-02-13T00:11:44 Make RNG work when we have arc4random() but not arc4random_buf()
Nick Mathewson d4de062e 2010-02-10T17:19:18 Add an arc4random implementation for use by evdns Previously, evdns was at the mercy of the user for providing a good entropy source; without one, it would be vulnerable to various active attacks. This patch adds a port of OpenBSD's arc4random() calls to Libevent [port by Chris Davis], and wraps it up a little bit so we can use it more safely.