We're no longer updating This wiki!!

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:c1_hardware_number_generator [2015/01/29 04:46]
mdrjr created
en:c1_hardware_number_generator [2015/01/29 05:28] (current)
mdrjr
Line 1: Line 1:
 +====== Introduction ======
 +
 +**ODROID-C1** AMLogic S805 has a Hardware Random Number Generator Accelerator!
 +
 +This entry explains how to enable it and how to test it.
 +
 +
 +==== Enabling ====
 +Note: You must be running a kernel whose version is **3.10.66-45 or later**.
 +<​code>​
 +sudo apt-get install rng-tools
 +</​code>​
 +
 +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:
 +<​code>​
 +root@odroid:​~#​ ps xa | grep rng
 +  968 ?        Ss     0:27 /​usr/​sbin/​rngd -r /dev/hwrng
 +</​code>​
 +
 +
 +
 +==== Testing with and Without ====
 +Here we'll see the difference that the hardware generator does.
 +
 +=== Test 1. Without ===
 +
 +1. We stop the rngd daemon in order to let the kernel/CPU do its job.
 +<​code>​sudo /​etc/​init.d/​rng-tools stop</​code>​
 +
 +2. We ask the kernel **10Kbytes** of random data (Remember this number)
 +<​code>​sudo dd if=/​dev/​random of=./random bs=10 count=1024</​code>​
 +
 +
 +The output of the command above should be something like:
 +<​code>​
 +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:​~#​
 +</​code>​
 +
 +And you can see it took **5 minutes and 28 seconds to read 8290 bytes**.
 +
 +
 +
 +=== Test 2. With HWRNG ===
 +
 +1. Start the rngd daemon (Previously stopped, not required at every boot)
 +<​code>​sudo /​etc/​init.d/​rng-tools start</​code>​
 +
 +2. We ask the kernel for **100Kbytes** of random that. (We request 10K only previously)
 +Its a increase by 10.
 +<​code>​sudo dd if=/​dev/​random of=./random bs=100 count=1024</​code>​
 +
 +The output should be something like:
 +<​code>​
 +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
 +</​code>​
 +
 +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.
 +
 +
 +
 +==== Conclusion ====
 +
 +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.
  
en/c1_hardware_number_generator.txt ยท Last modified: 2015/01/29 05:28 by mdrjr
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0