Re: Allegations regarding OpenBSD IPSEC

Previous thread: Re: Allegations regarding OpenBSD IPSEC by Theo de Raadt on Tuesday, December 21, 2010 - 12:34 pm. (2 messages)

Next thread: Re: Allegations regarding OpenBSD IPSEC by Theo de Raadt on Tuesday, December 21, 2010 - 1:33 pm. (6 messages)
From: Theo de Raadt
Date: Tuesday, December 21, 2010 - 12:59 pm

HANG ON.

Go look at the function random_seed() in /usr/src/etc/rc
Then look at when it is called.

You are reading the code attempts to make-do in a world without any
real entropy (minus a few interrupts) very very early in the boot
process.

Except in the case of nfs diskless, no network traffic has moved at
that time, since no interfaces are up.

Please keep that context in mind.

From: Kurt Knochner
Date: Tuesday, December 21, 2010 - 3:51 pm

so, the current state of the PRNG will be preserved during reboots.
Good. That gives some information about system entropy, which will be
"good" at all times, except for the very first boot of an
installation. See : rnd.c: randomwrite() -> add_entropy_words();

However, arc4_stir will still be called once after every reboot.
During its first call, the value of nanotime() will be placed at the
beginning of buf, which is then beeing used to init the rc4 context.

So, at the first glance it looks like using the value of nanotime() in
arc4_stir is not necessary at all, as there will allways be enough
system entropy. At least I would XOR the value of nanotime() to buf,
instead of just prepending it. MD5 and the like does not seem to be
necessary, as buf will allways contain some good random data.

Reagards
Kurt Knochner

http://knochner.com/

From: Kurt Knochner
Date: Tuesday, December 21, 2010 - 3:55 pm

I wanted to say: get_random_bytes() will allways return enough good
random values.

Reagards
Kurt Knochner

http://knochner.com/

From: Vadim Zhukov
Date: Tuesday, December 21, 2010 - 10:28 pm

And it's definitely worth looking... Patch below.

--
  Best wishes,
    Vadim Zhukov

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


Index: rc
===================================================================
RCS file: /cvs/src/etc/rc,v
retrieving revision 1.345
diff -u -p -r1.345 rc
--- rc	8 Nov 2010 19:44:36 -0000	1.345
+++ rc	22 Dec 2010 05:25:37 -0000
@@ -102,14 +102,12 @@ wsconsctl_conf()
 random_seed()
 {
 	if [ -f /var/db/host.random -a "X$random_seed_done" = "X" ]; then
-		dd if=/var/db/host.random of=/dev/urandom bs=1024 count=64 \
-		    > /dev/null 2>&1
 		dd if=/var/db/host.random of=/dev/arandom bs=1024 count=64 \
 		    > /dev/null 2>&1

 		# reset seed file, so that if a shutdown-less reboot occurs,
 		# the next seed is not a repeat
-		dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 \
+		dd if=/dev/arandom of=/var/db/host.random bs=1024 count=64 \
 		    > /dev/null 2>&1

 		random_seed_done=1
@@ -312,7 +310,7 @@ mount -s /var >/dev/null 2>&1

 # if there's no /var/db/host.random, make one through /dev/urandom
 if [ ! -f /var/db/host.random ]; then
-	dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 \
+	dd if=/dev/arandom of=/var/db/host.random bs=1024 count=64 \
 		>/dev/null 2>&1
 	chmod 600 /var/db/host.random >/dev/null 2>&1
 else

From: Martin Toft
Date: Wednesday, December 22, 2010 - 12:34 am

From: Otto Moerbeek
Date: Wednesday, December 22, 2010 - 1:44 am

Believe it or not, but this diff has been circling around developers
already a few days ago. 


Previous thread: Re: Allegations regarding OpenBSD IPSEC by Theo de Raadt on Tuesday, December 21, 2010 - 12:34 pm. (2 messages)

Next thread: Re: Allegations regarding OpenBSD IPSEC by Theo de Raadt on Tuesday, December 21, 2010 - 1:33 pm. (6 messages)