OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: /dev/urandom empty?

From: Todd C. Miller (Todd.Millercourtesan.com)
Date: Thu Jan 27 2005 - 12:38:56 CST


In message <6.2.0.14.2.20050126190916.00be5790cheyenne.wixb.com>
        so spake "J.D. Bronson" (jbronson):

> Using 3.6...and postfix, I have been seeing this:
>
> postfix/tlsmgr[30968]: cannot read from entropy device /dev/urandom:
> Operation timed out -- exiting to reopen
>
> is there anything I can do to add more entropy??

This is a bug in the poll function for the random device that
was just fixed by mickey. Only /dev/srandom should block...

 - todd

Index: rnd.c
===================================================================
RCS file: /cvs/src/sys/dev/rnd.c,v
retrieving revision 1.73
diff -u -r1.73 rnd.c
--- rnd.c 21 Jul 2004 01:02:07 -0000 1.73
+++ rnd.c 27 Jan 2005 17:57:23 -0000
-1044,10 +1044,10
         int revents = 0;
 
         if (events & (POLLIN | POLLRDNORM)) {
- if (random_state.entropy_count > 0)
- revents |= events & (POLLIN | POLLRDNORM);
- else
+ if (minor(dev) == RND_SRND && random_state.entropy_count <= 0)
                         selrecord(p, &rnd_rsel);
+ else
+ revents |= events & (POLLIN | POLLRDNORM);
         }
         if (events & (POLLOUT | POLLWRNORM))
                 revents = events & (POLLOUT | POLLWRNORM); /* always writable */