Random numbers from HW_DIGCTL_ENTROPY

Started by petri, September 22, 2012, 08:06:31 PM

Previous topic - Next topic

petri

Hi community!

I am working on to initialize operating system's random number generator.
I'd like to have pseudo-random number to feed OS's random pool.
I tried to read random number from i.MX23's HW_DIGCTL_ENTROPY register which, kinda works on
OLinuXino-MAXI but there's but:

I am powering the system from the 5V (no battery)

I only able get stable feed of random numebers from HW_DIGCTL_ENTROPY if I press POWER/REC button
same time as I read the values. Values here are values from the HW_DIGCTL_ENTROPY register:

Reset:

loop1        0x39b08cf0
loop2        0xc95f2999
loop3        0x3a65687f
loop4        0xa7ac7ec5         <-- POWER/REC button released.
loop5        0xa7ac7ec5
loop6        0xa7ac7ec5
loop7        0xa7ac7ec5
...

I don't have a problem if random number changes after every boot, but it constantly stays same if I don't
fiddle with the POWER/REC button. Is this known problem to someone? Has anyone figured workaround for this?
I don't want to tell users to press POWER/REC button when they boot the device manually. And I i reboot the
device remotely, there are no one to hold the button to feed random pool...

Kindly yours,
Petri

davidjf2001

Per i.mx233 Product Data Sheet "A 32-bit entropy register begins running a pseudo-random number algorithm from the time reset is removed until the PSWITCH is released by the user."


davidjf2001

I just read "HW_DIGCTL_CTRL Bit Field Descriptions"

Bit 0 LATCH_ENTROPY RW 0x0
Setting this bit latches the current value of the entropy register into HW_DIGCTL_ENTROPY_VALUE. This
can be used get a stable value on players that do not deassert the PSWITCH while powered up.

davidjf2001

Later thinking about this I am not sure how random this is.  Reset to some particular point in running code is repeatable.  Variations in how long linux boots and loads modules, connects to networks would probably add enough variability.

petri

Quote from: davidjf2001 on September 25, 2012, 05:47:46 AM
Later thinking about this I am not sure how random this is.  Reset to some particular point in running code is repeatable.  Variations in how long linux boots and loads modules, connects to networks would probably add enough variability.

Now just test on boot that if HW_DIGCTL_ENTROPY is emitting changing numbers. If it does, someone is pressing the button and I use the values. If not, well, I am not going to accumulate randomness...