User Tools

Site Tools


usb-devices:onerng

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
usb-devices:onerng [2020/06/16 17:28] – [System Info] chuckusb-devices:onerng [2020/06/16 19:29] (current) – [Installing software] chuck
Line 30: Line 30:
 ====Installing software==== ====Installing software====
  
-In order for this thing to work properly, we need to install some packages on our host system.+  * In order for this thing to work properly, we need to install some packages on our host system:<code> 
 +[user@mainpc:~]$ sudo apt install at openssl python-gnupg rng-tools</code>
  
-<code>[user@mainpc:~]$ sudo apt install at openssl python-gnupg rng-tools</code> +  * Finally, download the host software from their site, verify, then install it:<code> 
- +[user@mainpc:Downloads]$ wget -O onerng.deb 'https://github.com/OneRNG/onerng.github.io/blob/master/sw/onerng_3.6-1_all.deb?raw=true'
-Finally, download the host software from their site, verify, then install it: +
- +
-<code>[user@mainpc:Downloads]$ wget -O onerng.deb 'https://github.com/OneRNG/onerng.github.io/blob/master/sw/onerng_3.6-1_all.deb?raw=true'+
  
 [user@mainpc:Downloads]$ sha256sum onerng.deb [user@mainpc:Downloads]$ sha256sum onerng.deb
Line 44: Line 42:
 </code> </code>
  
-You can and should verify what I typed here at the Official Site:+You can (and shouldverify what I typed here at the Official Site:
 http://onerng.info/onerng/ http://onerng.info/onerng/
 +
 +----
 +
 +====rng-tools service====
 +I noticed that rng-tools was failing to start due to not finding a hardware RNG device to use.
 +  * Check the status of the service: <code>
 +[user@mainpc:~]$ systemctl status rng-tools
 +● rng-tools.service
 +   Loaded: loaded (/etc/init.d/rng-tools; generated)
 +   Active: failed (Result: exit-code) since Tue 2020-06-16 13:31:13 EDT; 7s ago
 +     Docs: man:systemd-sysv-generator(8)
 +  Process: 29738 ExecStart=/etc/init.d/rng-tools start (code=exited, status=1/FAILURE)
 +
 +Jun 16 13:31:13 mainpc systemd[1]: Starting rng-tools.service...
 +Jun 16 13:31:13 mainpc rng-tools[29738]: Starting Hardware RNG entropy gatherer daemon: (Hardware RNG dev>
 +Jun 16 13:31:13 mainpc rng-tools[29738]: /etc/init.d/rng-tools: Cannot find a hardware RNG device to use.
 +Jun 16 13:31:13 mainpc systemd[1]: rng-tools.service: Control process exited, code=exited, status=1/FAILU>
 +Jun 16 13:31:13 mainpc systemd[1]: rng-tools.service: Failed with result 'exit-code'.
 +Jun 16 13:31:13 mainpc systemd[1]: Failed to start rng-tools.service.
 +</code>
 +
 +===Fixing it===
 +I was able to fix it by editing ''%%/etc/default/rng-tools%%'' and pointing it to ''%%/dev/ttyACM0%%''.
 +
 +  * Edit the file:<code>
 +[user@mainpc:~]$ sudoedit /etc/default/rng-tools
 +</code>
 +  * Uncomment and edit:<code>
 +HRNGDEVICE=/dev/ttyACM0
 +</code>
 +  * Start the service:<code>
 +[user@mainpc:~]$ sudo systemctl start rng-tools.service
 +</code>
 +  * Check the status:<code>
 +[user@mainpc:~]$ systemctl status rng-tools
 +● rng-tools.service
 +   Loaded: loaded (/etc/init.d/rng-tools; generated)
 +   Active: active (running) since Tue 2020-06-16 13:35:07 EDT; 3s ago
 +     Docs: man:systemd-sysv-generator(8)
 +  Process: 17170 ExecStart=/etc/init.d/rng-tools start (code=exited, status=0/SUCCESS)
 +    Tasks: 4 (limit: 4915)
 +   Memory: 708.0K
 +   CGroup: /system.slice/rng-tools.service
 +           └─17172 /usr/sbin/rngd -r /dev/ttyACM0
 +
 +Jun 16 13:35:07 mainpc systemd[1]: Starting rng-tools.service...
 +Jun 16 13:35:07 mainpc rng-tools[17170]: Starting Hardware RNG entropy gatherer daemon: rngd.
 +Jun 16 13:35:07 mainpc systemd[1]: Started rng-tools.service.
 +Jun 16 13:35:07 mainpc rngd[17172]: rngd 2-unofficial-mt.14 starting up...
 +Jun 16 13:35:07 mainpc rngd[17172]: entropy feed to the kernel ready
 +</code>
  
 ---- ----
Line 268: Line 317:
   * **/dev/urandom** - Not using the OneRNG at all   * **/dev/urandom** - Not using the OneRNG at all
  
 +
 +===Using /dev/random===
 <code> <code>
-# OneRNG using /dev/random +[user@mainpc:~]$ time dd if=/dev/random of=random.img iflag=fullblock bs=1M count=10 status=progress
-[user@mainpc:~]$ time dd if=/dev/random of=random.img iflag=fullblock bs=1M count=10+
 10+0 records in 10+0 records in
 10+0 records out 10+0 records out
Line 278: Line 328:
 user 0m0.028s user 0m0.028s
 sys 0m4.308s sys 0m4.308s
- +</code> 
-# OneRNG using /dev/ttyACM0 +===Using /dev/ttyACM0=== 
-[user@mainpc:~]$ time sudo dd if=/dev/ttyACM0 of=tty.img iflag=fullblock bs=1M count=10+<code> 
 +[user@mainpc:~]$ time sudo dd if=/dev/ttyACM0 of=tty.img iflag=fullblock bs=1M count=10 status=progress
 10+0 records in 10+0 records in
 10+0 records out 10+0 records out
Line 288: Line 339:
 user 0m0.092s user 0m0.092s
 sys 0m1.016s sys 0m1.016s
 +</code>
  
-# Just using /dev/urandom +===Using /dev/urandom=== 
-[user@mainpc:~]$ time dd if=/dev/urandom of=urandom.img iflag=fullblock bs=1M count=10+<code> 
 +[user@mainpc:~]$ time dd if=/dev/urandom of=urandom.img iflag=fullblock bs=1M count=10 status=progress
 10+0 records in 10+0 records in
 10+0 records out 10+0 records out
Line 302: Line 355:
 ---- ----
  
 +===Results===
 +The results show that using ''%%/dev/ttyACM0%%'' is roughly 3x faster than using ''%%/dev/random%%'' while both are much slower than ''%%/dev/urandom%%''.
 +
 +^ Stat ^ /dev/random ^ /dev/ttyACM0 ^ /dev/urandom ^
 +^ real | 9m55.880s   | 3m2.079s     | 0m0.056s     |
 +^ user | 0m0.028s    | 0m0.092s     | 0m0.000s     |
 +^ sys  | 0m4.308s    | 0m1.016s     | 0m0.056s     |
 +
 +----
 +
 +====entropy_avail====
 +You can check the amount of entropy available by reading the file ''%%/proc/sys/kernel/random/entropy_avail%%''
 +
 +<WRAP announcement green>
 +Here's a oneliner I wrote to monitor it from another terminal while I ran the above tests:
 +<code>
 +while true; do cat /proc/sys/kernel/random/entropy_avail; sleep 1; done
 +</code>
 +</WRAP>
 +
 +I noticed that while idle and with the OneRNG plugged in, the value stayed above 2500 and would climb well past 3000 if left alone for a while. The max value can be found in ''%%/proc/sys/kernel/random/poolsize%%'' (where mine is set at 4096).
 +
 +  * When running from ''%%/dev/random%%'', the **entropy_available** quickly depletes until the task is finished.
 +    * When the OneRNG **is** plugged in, it instantly regenerates to above 2000 once the task is finished.
 +    * When the OneRNG ** is not** plugged in, it slowly starts rising once the task is finished.
 +  * When running from ''%%/dev/ttyACM0%%'', the **entropy_available** seems to stay the same while creating the 10M file.
 +  * When running from ''%%/dev/urandom%%'', the **entropy_available** seems to stay the same while creating the 10M file.
 +
 +----
 ====ent==== ====ent====
  
usb-devices/onerng.1592328538.txt.gz · Last modified: by chuck