Hardware Random Number Generator on the RPi 3B+

This is for ARMv8 based devices

Hardware Random Number Generator on the RPi 3B+

Postby cedricmc » Wed Oct 30, 2019 3:18 am

Hi there!

According to the wiki tab here, the system should load the bcm2835_rng kernel module that creates the hwrng device.

On the one hand,
$this->bbcode_second_pass_code('', '$ dmesg | grep rng | grep bcm
bcm2835-rng 3f104000.rng: hwrng registered
$ ls -l /dev/hwrng
crw------- 1 root root 10, 183 oct 21 07:34 /dev/hwrng')
on the other hand,
$this->bbcode_second_pass_code('', 'lsmod | grep rng')
gives nothing.

QUESTION 1: where is the bcm2835_rng kernel module?
ANSWER: The driver seems to be built-in into the kernel. (Thx to @Kabbone and @lategoodbye)

QUESTION 2: Why isn't the rng-tools package installed by default to control the hwrng device instead of haveged?
ANSWER: <You can help providing an answer!>

QUESTION 3: When using LUKS, what is preferable, to use rng-tools or haveged?
ANSWER: <You can help providing an answer!>

Thx!
Last edited by cedricmc on Fri Nov 01, 2019 5:47 pm, edited 2 times in total.
cedricmc
 
Posts: 25
Joined: Sun Dec 01, 2013 8:55 pm

Re: Hardware Random Number Generator on the RPi 3B+

Postby Kabbone » Wed Oct 30, 2019 4:59 pm

For me, my Rpi 3B has its bcm2835_rng loaded.

What is the output of:
pacman -Qi linux
Kabbone
 
Posts: 153
Joined: Thu Jul 25, 2013 9:20 am

Re: Hardware Random Number Generator on the RPi 3B+

Postby cedricmc » Thu Oct 31, 2019 12:02 am

My system is a fresh fully updated system, btw.
$this->bbcode_second_pass_code('', '$ LANG=en_US.UTF-8 pacman -Qi linux
Name : linux-aarch64
Version : 5.3.8-1
Description : The Linux Kernel and modules - AArch64 multi-platform
Architecture : aarch64
URL : http://www.kernel.org/
Licenses : GPL2
Groups : None
Provides : kernel26 linux=5.3.8
Depends On : coreutils linux-firmware kmod mkinitcpio>=0.7
Optional Deps : crda: to set the correct wireless channels of your country [installed]
Required By : None
Optional For : None
Conflicts With : linux
Replaces : linux-armv8
Installed Size : 120.38 MiB
Packager : Arch Linux ARM Build System <builder+seattle@archlinuxarm.org>
Build Date : Tue 29 Oct 2019 08:30:39 PM -05
Install Date : Tue 29 Oct 2019 10:58:07 PM -05
Install Reason : Explicitly installed
Install Script : Yes
Validated By : Signature')
cedricmc
 
Posts: 25
Joined: Sun Dec 01, 2013 8:55 pm

Re: Hardware Random Number Generator on the RPi 3B+

Postby cedricmc » Thu Oct 31, 2019 12:03 am

@Kabbone, could you ouput this?
$this->bbcode_second_pass_code('', 'lsmod | grep rng')
cedricmc
 
Posts: 25
Joined: Sun Dec 01, 2013 8:55 pm

Re: Hardware Random Number Generator on the RPi 3B+

Postby Kabbone » Thu Oct 31, 2019 4:37 pm

probably because you are on the mainline kernel, I'm on the raspi kernel and yes it shows up in lsmod there.
Kabbone
 
Posts: 153
Joined: Thu Jul 25, 2013 9:20 am

Re: Hardware Random Number Generator on the RPi 3B+

Postby cedricmc » Thu Oct 31, 2019 11:15 pm

I see, you mean it might be compiled into the kernel. How could I check that?
cedricmc
 
Posts: 25
Joined: Sun Dec 01, 2013 8:55 pm

Re: Hardware Random Number Generator on the RPi 3B+

Postby Kabbone » Fri Nov 01, 2019 6:39 am

search in /usr/lib/modules for it.
$this->bbcode_second_pass_code('', '
find /usr/lib/modules -name bcm2835?rng*
')
Kabbone
 
Posts: 153
Joined: Thu Jul 25, 2013 9:20 am

Re: Hardware Random Number Generator on the RPi 3B+

Postby lategoodbye » Fri Nov 01, 2019 2:58 pm

@cedricmc

Since you already found bcm2835-rng in dmesg and didn't find it in lsmod, the only plausible explanation is that the driver is built-in. This is no easy way to proof this, expect you have a file /proc/config.gz to doublecheck the configuration.
lategoodbye
 
Posts: 116
Joined: Sat Dec 29, 2018 1:24 am

Re: Hardware Random Number Generator on the RPi 3B+

Postby cedricmc » Tue Nov 05, 2019 5:14 pm

$this->bbcode_second_pass_quote('Kabbone', 's')earch in /usr/lib/modules for it.
$this->bbcode_second_pass_code('', '
find /usr/lib/modules -name bcm2835?rng*
')


That's the first thing I did. Moreover...
$this->bbcode_second_pass_code('', '# find / -name *bcm2835* | grep rng
/sys/bus/platform/drivers/bcm2835-rng')

So it must be definitively built-in.
cedricmc
 
Posts: 25
Joined: Sun Dec 01, 2013 8:55 pm

Re: Hardware Random Number Generator on the RPi 3B+

Postby Kabbone » Tue Nov 05, 2019 7:36 pm

I'm not an expert on the sysfs but as far as I understand it's just the virtual device. Take a look into this folder you found and check these files.
It wouldn't make much sense that this module is built-in with the mainline config. Even though you should be able to get more results than only this one. You could also check your actual kernel config how it's defined for bcm2835-rng
Kabbone
 
Posts: 153
Joined: Thu Jul 25, 2013 9:20 am

Next

Return to ARMv8 Devices

Who is online

Users browsing this forum: No registered users and 2 guests