libobstcp: Error reading from /dev/random: Success

37 views
Skip to first unread message

Timo Juhani Lindfors

unread,
Oct 8, 2008, 8:41:50 AM10/8/08
to obstcp
$ obstcp-keygen > a
Generating random data...
Error reading from /dev/random: Success

is a bit confusing error message. Using

$ strace -o s -f -s4096 obstcp-keygen > a

I can see that for some reason /dev/random returns less data than was
requested:

26064 open("/dev/random", O_RDONLY) = 3
26064 read(3, "\303\344", 2) = 2
26064 write(2, "Generating random data...\n", 26) = 26
26064 read(3, "c\372M\250{\336", 32) = 6
26064 write(2, "Error reading from /dev/random: Success\n", 40) = 40
26064 exit_group(1) = ?

Shouldn't /dev/random block until there is enough entropy? This is
debian stable on x86 with linux-image-2.6.18-6-686 2.6.18.dfsg.
1-22etch2.

Adam Langley

unread,
Oct 8, 2008, 10:00:25 AM10/8/08
to obs...@googlegroups.com
On Wed, Oct 8, 2008 at 5:41 AM, Timo Juhani Lindfors
<timo.l...@gmail.com> wrote:
> $ obstcp-keygen > a
> Generating random data...
> Error reading from /dev/random: Success

Thanks for the patches! I'll apply them once I'm at my devel machine
later today. I don't know why /dev/random wouldn't block, but shall
look into it.


Cheers

AGL

--
Adam Langley a...@imperialviolet.org http://www.imperialviolet.org

Adam Langley

unread,
Oct 8, 2008, 8:19:07 PM10/8/08
to obs...@googlegroups.com
On Wed, Oct 8, 2008 at 5:41 AM, Timo Juhani Lindfors
<timo.l...@gmail.com> wrote:
> I can see that for some reason /dev/random returns less data than was
> requested:

I always thought that /dev/random blocked when empty. However, it may
be that, if the pool is insufficient to serve the request, it returns
what it has and only blocks on the next call. Thus I've committed a
patch to git to deal with this case
(e6dbb7a0bad09f6780c79221ed65b44a963c15d6). Thanks for the report!

Reply all
Reply to author
Forward
0 new messages