The attached patch should apply cleanly to the Debian urandom. My apologies for attaching the wrong patch previously. I picked up the Ubuntu patch instead of the Debian patch.
>From 7cafdbe365e0ce93014fd88c0f465777d4610a2f Mon Sep 17 00:00:00 2001 From: root <r...@localhost.localdomain> Date: Sat, 11 Sep 2010 15:23:20 -0700 Subject: [PATCH] Calculate POOLBYTES correctly. Note that /proc/sys/kernel/random/poolsize reports the number of bits, not bytes, so a conversion is necessary. --- urandom | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/urandom b/urandom index f5b4bcb..ffca615 100755 --- a/urandom +++ b/urandom @@ -14,8 +14,11 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin SAVEDFILE=/var/lib/urandom/random-seed -POOLSIZE=512 -[ -f /proc/sys/kernel/random/poolsize ] && POOLSIZE="$(cat /proc/sys/kernel/random/poolsize)" +if ! POOLBYTES=$(( + ($(cat /proc/sys/kernel/random/poolsize 2>/dev/null) + 7) / 8 +)) ; then + POOLBYTES=512 +fi . /lib/init/vars.sh . /lib/lsb/init-functions @@ -23,7 +26,7 @@ POOLSIZE=512 case "$1" in start|"") [ "$VERBOSE" = no ] || log_action_begin_msg "Initializing random number generator" - # Load and then save $POOLSIZE bytes, + # Load and then save $POOLBYTES bytes, # which is the size of the entropy pool if [ -f "$SAVEDFILE" ] then @@ -31,7 +34,7 @@ case "$1" in fi rm -f $SAVEDFILE umask 077 - dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1 + dd if=/dev/urandom of=$SAVEDFILE bs=$POOLBYTES count=1 >/dev/null 2>&1 ES=$? umask 022 [ "$VERBOSE" = no ] || log_action_end_msg $ES @@ -41,7 +44,7 @@ case "$1" in # see documentation in linux/drivers/char/random.c [ "$VERBOSE" = no ] || log_action_begin_msg "Saving random seed" umask 077 - dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1 + dd if=/dev/urandom of=$SAVEDFILE bs=$POOLBYTES count=1 >/dev/null 2>&1 ES=$? [ "$VERBOSE" = no ] || log_action_end_msg $ES ;; -- 1.5.6.5