ODROID-C1 AMLogic S805 has a Hardware Random Number Generator Accelerator!
This entry explains how to enable it and how to test it.
Note: You must be running a kernel whose version is 3.10.66-45 or later.
sudo apt-get install rng-tools
That's enough to have the RNGD daemon running.
RNGD is daemon that will check if the kernel needs more entropy and feed that to the kernel when its needed.
When running you'll see something like:
root@odroid:~# ps xa | grep rng 968 ? Ss 0:27 /usr/sbin/rngd -r /dev/hwrng
Here we'll see the difference that the hardware generator does.
1. We stop the rngd daemon in order to let the kernel/CPU do its job.
sudo /etc/init.d/rng-tools stop
2. We ask the kernel 10Kbytes of random data (Remember this number)
sudo dd if=/dev/random of=./random bs=10 count=1024
The output of the command above should be something like:
root@odroid:~# sudo dd if=/dev/random of=./random bs=10 count=1024 dd: warning: partial read (8 bytes); suggest iflag=fullblock 49+975 records in 49+975 records out 8290 bytes (8.3 kB) copied, 328.245 s, 0.0 kB/s root@odroid:~#
And you can see it took 5 minutes and 28 seconds to read 8290 bytes.
1. Start the rngd daemon (Previously stopped, not required at every boot)
sudo /etc/init.d/rng-tools start
2. We ask the kernel for 100Kbytes of random that. (We request 10K only previously) Its a increase by 10.
sudo dd if=/dev/random of=./random bs=100 count=1024
The output should be something like:
root@odroid:~# sudo dd if=/dev/random of=./random bs=100 count=1024 dd: warning: partial read (25 bytes); suggest iflag=fullblock 984+40 records in 984+40 records out 102175 bytes (102 kB) copied, 0.215086 s, 475 kB/s
As you can see if took only 0.21 seconds to get 10 times more data. If you request only 10K again it will take only 0.03 seconds. Even requesting 1Mbyte takes only 3.3 Seconds.
Having the Hardware Random generator off-loads the CPU and increases the amount of “random-ness” to applications that requires it, such as cryptography. Increase in security and speed on those applications.