[SOLVED] better entropy for raspberry pi?

Ask questions about Arch Linux ARM. Please search before making a new topic.

[SOLVED] better entropy for raspberry pi?

Postby iMike » Thu Feb 14, 2019 8:52 pm

I was following the instructions at https://archlinuxarm.org/wiki/Raspberry_Pi to make use of the hardware random number generator. That page mentions that when you set things up correctly, the available entropy will be in the 1000s vs 3000s. However, mine is staying in the 3000s. Here is what I did:
$this->bbcode_second_pass_code('', '
[mike@piameter ~]$ Pacmatic -S rng-tools
')
This installed jitterentropy-2.1.2-1 and rng-tools-6.6-2. I modified as instructed:
$this->bbcode_second_pass_code('', '
[mike@piameter ~]$ sudo cat /etc/conf.d/rngd
# <mike>
# RNGD_OPTS=""
RNGD_OPTS="-o /dev/random -r /dev/hwrng"
# </mike>
')
Checked current entropy:
$this->bbcode_second_pass_code('', '[mike@piameter ~]$ cat /proc/sys/kernel/random/entropy_avail
3477
')
Shutdown haveged, started rngd, and checked on it.
$this->bbcode_second_pass_code('', '
[mike@piameter ~]$ systemctl status haveged
[mike@piameter ~]$ sudo systemctl stop haveged
[mike@piameter ~]$ sudo systemctl disable haveged
[mike@piameter ~]$ sudo systemctl start rngd
[mike@piameter ~]$ sudo systemctl enable rngd
[mike@piameter ~]$ dmesg | grep rngd
[28323.041247] audit: type=1130 audit(1550068965.751:42): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=rngd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[mike@piameter ~]$ systemctl status rngd
● rngd.service - Hardware RNG Entropy Gatherer Daemon
Loaded: loaded (/usr/lib/systemd/system/rngd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2019-02-13 15:42:45 CET; 53s ago
Main PID: 2180 (rngd)
Tasks: 2 (limit: 840)
CGroup: /system.slice/rngd.service
└─2180 /usr/bin/rngd -f -o /dev/random -r /dev/hwrng

Feb 13 15:42:45 piameter systemd[1]: Started Hardware RNG Entropy Gatherer Daemon.
Feb 13 15:42:46 piameter rngd[2180]: Initalizing available sources
Feb 13 15:42:46 piameter rngd[2180]: Initalizing entropy source hwrng
')
Checked entropy, still the same. Rebooted, still the same. Next day after some system updates: still the same.
$this->bbcode_second_pass_code('', '
[mike@piameter ~]$ cat /proc/sys/kernel/random/entropy_avail
3157
')
Is this a value that drops very slowly? Or, more likely, can you point to what I need to do differently, or how I have perhaps misunderstood what rngd is supposed to do?
Thanks for you time.
Last edited by iMike on Sat Feb 16, 2019 9:25 pm, edited 1 time in total.
iMike
 
Posts: 10
Joined: Mon Jul 13, 2015 7:55 pm

Re: better entropy for raspberry pi?

Postby ufo6000 » Fri Feb 15, 2019 5:18 pm

Everything is fine, greater values mean you have a greater entropy pool == better.
ufo6000
 
Posts: 117
Joined: Fri Jan 22, 2016 7:54 pm

Re: [SOLVED] better entropy for raspberry pi?

Postby iMike » Sat Feb 16, 2019 9:30 pm

I think I was partly surprised there was no change in entropy available when I change haveged to rngd. No problem though. Thanks for the response.
iMike
 
Posts: 10
Joined: Mon Jul 13, 2015 7:55 pm

Re: [SOLVED] better entropy for raspberry pi?

Postby ufo6000 » Sun Feb 17, 2019 9:12 am

Both haveged and rngd provides the same amount of entropy, max: cat /proc/sys/kernel/random/poolsize
haveged is doing it by a software algorithm, which you have to trust.
rngd uses the the build in hardware random number generator in the p3 cpu, you have to trust too.

The difference could be how many new random bytes are produced per second, I didn't check, but you can compare haveged and rngd of course:

$this->bbcode_second_pass_code('', '
time dd if=/dev/random of=/dev/null bs=1024 count=100 iflag=fullblock
# or
time rngtest -c 1000 </dev/random
')
ufo6000
 
Posts: 117
Joined: Fri Jan 22, 2016 7:54 pm

Re: [SOLVED] better entropy for raspberry pi?

Postby iMike » Sun Feb 17, 2019 9:07 pm

@ufo6000 Thanks for taking the time to reply, and for the tips.

This is a fun topic, but important topic. I also found this blog post about it. Perhaps good for anyone else interested in the topic http://scruss.com/blog/2013/06/07/well-that-was-unexpected-the-raspberry-pis-hardware-random-number-generator/.

Thanks for helping me understand it better.
iMike
 
Posts: 10
Joined: Mon Jul 13, 2015 7:55 pm


Return to User Questions

Who is online

Users browsing this forum: No registered users and 15 guests