Skip to contentSkip to conversation

get_random_bytes returns the same on every boot

PATCH Andi Kleen 2 participants 2 messages Jul 27, 2004 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#1 lore raw
Quoted 7 lines · Balint Marton

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.

That still is an easily predictible value and may not even be unique when lots of systems are powered up at the same time (e.g. after a power failure)

It would be better to use the hardware random generators that are available in some southbridges and some CPUs now. I did a patch a long time ago to automatically seed random from the intel/amd random driver. Maybe that would be a better solution here?

Also BTW your problem presents a strong case why compiling in DHCP probes is bad and such stuff should run from initrd/initramfs.

-Andi

#2 lore raw
Quoted 3 lines · Andi Kleen

That still is an easily predictible value and may not even be unique when lots of systems are powered up at the same time (e.g. after a power failure)

Yes, my patch is not an ultimate solution, rather a step in the working way :)

Quoted 2 lines

Also BTW your problem presents a strong case why compiling in DHCP probes is bad and such stuff should run from initrd/initramfs.

I wouldn't say, its bad, it is only not supported yet under all circumstances. But DHCP support may be improved for example by adding the MAC address as entropy bytes to the secondary pool. Since we don't add bytes to the primary pool, we don't harm things that really require secure random data. Any opinions about this workaround?

Cus