1 --- dropbear-0.45.orig/options.h 2005-03-08 14:43:07.000000000 -0500
2 +++ dropbear-0.45/options.h 2005-03-08 14:44:41.000000000 -0500
4 /* prngd must be manually set up to produce output */
5 /*#define DROPBEAR_PRNGD_SOCKET "/var/run/dropbear-rng"*/
7 +/* If the normal random source would block for a while, fall back to
8 + * the urandom source so that connections don't hang forever. */
9 +#define DROPBEAR_URANDOM_DEV "/dev/urandom"
11 /* Specify the number of clients we will allow to be connected but
12 * not yet authenticated. After this limit, connections are rejected */
13 #ifndef MAX_UNAUTH_CLIENTS
14 diff -ur dropbear-0.45.orig/random.c dropbear-0.45/random.c
15 --- dropbear-0.45.orig/random.c 2005-03-08 14:43:07.000000000 -0500
16 +++ dropbear-0.45/random.c 2005-03-08 14:57:31.000000000 -0500
18 struct sockaddr_un egdsock;
21 + mode_t readmode = O_RDONLY;
22 +#ifdef DROPBEAR_URANDOM_DEV
23 + unsigned int readtries = 0;
24 + readmode |= O_NONBLOCK;
27 #ifdef DROPBEAR_RANDOM_DEV
28 - readfd = open(DROPBEAR_RANDOM_DEV, O_RDONLY);
29 + readfd = open(DROPBEAR_RANDOM_DEV, readmode);
31 dropbear_exit("couldn't open random device");
34 if (readlen < 0 && errno == EINTR) {
37 +#ifdef DROPBEAR_URANDOM_DEV
38 + /* if the main random source blocked, lets retry a few times,
39 + * but then give up and try a constant random source. */
40 + if (readlen < 0 && errno == EAGAIN) {
42 + if (readtries < 5) {
45 + } else if (readtries == 5) {
47 + readfd = open(DROPBEAR_URANDOM_DEV, readmode);
49 + dropbear_exit("couldn't open secondary random device");
55 dropbear_exit("error reading random source");