Date: Mon, 18 Jul 2016 11:54:55 -0400 From: Steve Kiernan <stevek@juniper.net> To: "Jukka A. Ukkonen" <jau789@gmail.com> Cc: Jia-Shiun Li <jiashiun@gmail.com>, "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org> Subject: Re: Random number generator on rpi Message-ID: <20160718115455.10fa95bb@juniper.net> In-Reply-To: <790435eb-f3fc-8d4c-4231-e3cfbf93157b@gmail.com> References: <CAHNYxxP8fqEdXsL2Jwu-=P4g9_w5P2pnJ-yOvtU1ssEP4ZpqCQ@mail.gmail.com> <5d8ec4d4-4c36-139d-6102-4fdb200fdf65@gmail.com> <CAHNYxxPQtyXZU4%2ByNAVEDPu60mpK87O-4xcCuniCW576-meY0g@mail.gmail.com> <790435eb-f3fc-8d4c-4231-e3cfbf93157b@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 17 Jul 2016 15:27:51 +0300 "Jukka A. Ukkonen" <jau789@gmail.com> wrote: > On 07/15/16 07:32, Jia-Shiun Li wrote: > > sorry for replying so late. Turns out I need to attach rndtest device to > > hook it on. Updated patch attached. Also commented some code lines in > > rndtest to print report messages. You should be able to see repeated > > kernel messages like below: > > > > bcmrng0: rndtest: runs pass zeros interval 1 (2343 < 2543 < 2657) > > bcmrng0: rndtest: runs pass zeros interval 2 (1135 < 1255 < 1365) > > bcmrng0: rndtest: runs pass zeros interval 3 (542 < 624 < 708) > > bcmrng0: rndtest: runs pass zeros interval 4 (251 < 301 < 373) > > bcmrng0: rndtest: runs pass zeros interval 5 (111 < 158 < 201) > > bcmrng0: rndtest: runs pass zeros interval 6 (111 < 149 < 201) > > bcmrng0: rndtest: runs pass ones interval 1 (2343 < 2535 < 2657) > > bcmrng0: rndtest: runs pass ones interval 2 (1135 < 1265 < 1365) > > bcmrng0: rndtest: runs pass ones interval 3 (542 < 576 < 708) > > bcmrng0: rndtest: runs pass ones interval 4 (251 < 315 < 373) > > bcmrng0: rndtest: runs pass ones interval 5 (111 < 185 < 201) > > bcmrng0: rndtest: runs pass ones interval 6 (111 < 153 < 201) > > bcmrng0: rndtest: chi^2(4): pass (sum 1570182) > > bcmrng0: rndtest: longruns pass (15 ones, 12 zeros) > > > > > > by the rndtest result, guess I can safely conclude the hardware rng > > working correctly? > > > > > > On Thu, Jun 9, 2016 at 3:53 PM, Jukka A. Ukkonen <jau789@gmail.com > > <mailto:jau789@gmail.com>> wrote: > > > > > > So, does this somehow indicate that fortuna has attached the > > new random device as a source of true randomness? > > > > root@rpi2:~ # sysctl kern.random > > kern.random.fortuna.minpoolsize: 64 > > kern.random.harvest.mask_symbolic: > > [UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED > > kern.random.harvest.mask_bin: 00111111111 > > kern.random.harvest.mask: 511 > > kern.random.random_sources: > > > > > > The mask only reports environmental sources, not hardware rng sources. > > I kind of guessed that. > > I tested the modified patch yesterday. Now I see the following couple > of lines during a verbose boot... > > bcmrng0: <BCM2708/2835 random number generator> mem 0x104000-0x10400f on > simplebus0 > random: harvesting attach, 8 bytes (4 bits) from bcmrng0 > > So, at least random claims it tries to use bcmrng as a source of > randomness. Thanks. You might want to see my RPi rng driver review up on Phabricator. It is interrupt driven, which keeps the CPU utilization down to a fraction of a percent, whereas using a callout or other method easily consumes much more of the CPU. The review is here: https://reviews.freebsd.org/D6888 Note that for RBG (random bit generator) like the one in the RPi, they are not really RNGs themselves but random bit sources that must be processed by other algorithms to generate random numbers. So even if one were to grab the data to test for "randomness", one would need to not assume the rndtest would necessarily be appropriate, since the values returned by the RBG are not to be used directly as random numbers without post-processing. -Steve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160718115455.10fa95bb>