netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] get_random_bytes returns the same on every boot
       [not found] <Pine.LNX.4.58.0407222254440.3652@pingvin.fazekas.hu>
@ 2004-07-22 23:28 ` Patrick McHardy
  0 siblings, 0 replies; 4+ messages in thread
From: Patrick McHardy @ 2004-07-22 23:28 UTC (permalink / raw)
  To: Balint Marton; +Cc: linux-kernel, netdev

Balint Marton wrote:
> Hi, 
> 
> At boot time, get_random_bytes always returns the same random data, as if
> there were a constant random seed. For example, if I use the kernel level
> ip autoconfiguration with dhcp, the kernel will create a dhcp request
> packet with always the same transaction ID. (If you have more than one
> computers, and they are booting at the same time, then this is a big
> problem)
> 
> That happens, because only the primary entropy pool is initialized with
> the system time, in function rand_initialize. The secondary pool is only
> cleared. In this early stage of booting, there is usually no user
> interaction, or usable disk interrupts, so the kernel can't add any real
> random bytes to the primary pool. And altough the system time is in the
> primary pool, the kernel does not consider it real random data, so you
> can't read from the primary pool, before at least a part of it will be
> filled with some real randomness (interrupt timing).
> Therefore all random data will come from the secondary pool, and the
> kernel cannot reseed the secondary pool, because there is no real 
> randomness in the primary one.
> 
> The solution is simple: Initialize not just the primary, but also the 
> secondary pool with the system time. My patch worked for me with 
> 2.6.8-rc2, but it was not tested too long. 

Many network hashes use get_random_bytes() to initialize a secret
value to avoid attacks on the hash function when first used.
I assume if DHCP can get bad random, they can too. Is this patch
enough to prevent get_random_bytes() from returning predictable
data at boot time ?

Regards
Patrick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] get_random_bytes returns the same on every boot
@ 2004-07-26 13:57 Eble, Dan
  2004-07-26 19:31 ` Balint Marton
  2004-07-27 18:01 ` Balint Marton
  0 siblings, 2 replies; 4+ messages in thread
From: Eble, Dan @ 2004-07-26 13:57 UTC (permalink / raw)
  To: Balint Marton; +Cc: linux-kernel, netdev

Balint Marton wrote:
> At boot time, get_random_bytes always returns the same 
> random data, as if there were a constant random seed.
> packet with always the same transaction ID. (If you have 
> more than one computers, and they are booting at the
> same time, then this is a big problem)

If many systems are booting at the same time, is seeding with the system
time really an appropriate solution?  Shouldn't some system-specific
value also contribute to the randomization?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] get_random_bytes returns the same on every boot
  2004-07-26 13:57 Eble, Dan
@ 2004-07-26 19:31 ` Balint Marton
  2004-07-27 18:01 ` Balint Marton
  1 sibling, 0 replies; 4+ messages in thread
From: Balint Marton @ 2004-07-26 19:31 UTC (permalink / raw)
  To: Eble, Dan; +Cc: linux-kernel, netdev

On Mon, 26 Jul 2004, Eble, Dan wrote:
> If many systems are booting at the same time, is seeding with the system
> time really an appropriate solution?  Shouldn't some system-specific
> value also contribute to the randomization?

Yes, i agree, it would be nicer, if we could also use some 
system-specific stuff for the seeding, but i don't know if there is 
such data during the initialization of the random module. For example, 
we may use the MAC address of a network device, but unless i am mistaken 
the initialization of such network devices take place after the random 
dirver init. 

By the way, i made a little test with 40 computers. They were totally 
equvivalent by hardware, and all of them had a synchronized system 
clock. I turned them on by Wake On LAN exactly at the same time. All of 
them used the kernel level ip autoconfig, all of them got their right IP 
address, and i didn't even find a line of DHCPNAK in the dhcpd logfile.

Conclusion: Although using some system-specific data and the clock would 
be nicer, the system time alone also does the right thing dependably.

bye,
Cus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] get_random_bytes returns the same on every boot
  2004-07-26 13:57 Eble, Dan
  2004-07-26 19:31 ` Balint Marton
@ 2004-07-27 18:01 ` Balint Marton
  1 sibling, 0 replies; 4+ messages in thread
From: Balint Marton @ 2004-07-27 18:01 UTC (permalink / raw)
  To: Eble, Dan; +Cc: linux-kernel, netdev

Hi, 

In my previous email, i wrote about a 40 computer test.
Today, I repeated my test, and although every computer got the right IP 
address, there were at least 7 lines of DHCPNAK in the dhcpd logfile.
So the system time alone is not as good as it looked like.

Cus

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-07-27 18:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.58.0407222254440.3652@pingvin.fazekas.hu>
2004-07-22 23:28 ` [PATCH] get_random_bytes returns the same on every boot Patrick McHardy
2004-07-26 13:57 Eble, Dan
2004-07-26 19:31 ` Balint Marton
2004-07-27 18:01 ` Balint Marton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).