9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] bcm2835 random number generator
@ 2014-03-28 17:19 Bakul Shah
  2014-03-28 21:09 ` erik quanstrom
  0 siblings, 1 reply; 5+ messages in thread
From: Bakul Shah @ 2014-03-28 17:19 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I have put an initial version of raspberryPi hardware RNG
driver on sources.  Supposedly bcm2835 uses a reverse bias
transistor as a noise source (though I couldn't find anything
a definitive source for this). FWIW, I ran the output through
rngtest (does FIPS 140-2 tests) and the failure rate is about
the same as FreeBSD's (about 1 out of 1000).  rngtest tests at
a minimum 2*10^6 bits and plan9's stock /dev/random seems far
too slow so I didn't bother testing it.

Just copy /n/sources/contrib/bakul/random.c to sys/src/9/bcm
and rebuild 9pi.

Arguably this should be a new device, /dev/hrng or something,
but plan9's /dev/random code is very simple compared to the
elaborate versions on *BSD's. I have kept this one simple too.
If you are concerned about the quality of RNG or paranoid
about bcm2835's unpublic algorithm, feel free to complexify!



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] bcm2835 random number generator
  2014-03-28 17:19 [9fans] bcm2835 random number generator Bakul Shah
@ 2014-03-28 21:09 ` erik quanstrom
  2014-03-28 21:39   ` Bakul Shah
  0 siblings, 1 reply; 5+ messages in thread
From: erik quanstrom @ 2014-03-28 21:09 UTC (permalink / raw)
  To: 9fans

On Fri Mar 28 13:21:35 EDT 2014, bakul@bitblocks.com wrote:
> I have put an initial version of raspberryPi hardware RNG
> driver on sources.  Supposedly bcm2835 uses a reverse bias
> transistor as a noise source (though I couldn't find anything
> a definitive source for this). FWIW, I ran the output through
> rngtest (does FIPS 140-2 tests) and the failure rate is about
> the same as FreeBSD's (about 1 out of 1000).  rngtest tests at
> a minimum 2*10^6 bits and plan9's stock /dev/random seems far
> too slow so I didn't bother testing it.
>
> Just copy /n/sources/contrib/bakul/random.c to sys/src/9/bcm
> and rebuild 9pi.
>
> Arguably this should be a new device, /dev/hrng or something,
> but plan9's /dev/random code is very simple compared to the
> elaborate versions on *BSD's. I have kept this one simple too.
> If you are concerned about the quality of RNG or paranoid
> about bcm2835's unpublic algorithm, feel free to complexify!

i have not had luck with this.  i get data aborts when booting
from flash, and hangs when rebooting via /dev/reboot.

- erik



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] bcm2835 random number generator
  2014-03-28 21:09 ` erik quanstrom
@ 2014-03-28 21:39   ` Bakul Shah
  2014-03-28 23:51     ` erik quanstrom
  0 siblings, 1 reply; 5+ messages in thread
From: Bakul Shah @ 2014-03-28 21:39 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, 28 Mar 2014 17:09:43 EDT erik quanstrom <quanstro@quanstro.net> wrote:
> On Fri Mar 28 13:21:35 EDT 2014, bakul@bitblocks.com wrote:
> > I have put an initial version of raspberryPi hardware RNG
> > driver on sources.  Supposedly bcm2835 uses a reverse bias
> > transistor as a noise source (though I couldn't find anything
> > a definitive source for this). FWIW, I ran the output through
> > rngtest (does FIPS 140-2 tests) and the failure rate is about
> > the same as FreeBSD's (about 1 out of 1000).  rngtest tests at
> > a minimum 2*10^6 bits and plan9's stock /dev/random seems far
> > too slow so I didn't bother testing it.
> >
> > Just copy /n/sources/contrib/bakul/random.c to sys/src/9/bcm
> > and rebuild 9pi.
> >
> > Arguably this should be a new device, /dev/hrng or something,
> > but plan9's /dev/random code is very simple compared to the
> > elaborate versions on *BSD's. I have kept this one simple too.
> > If you are concerned about the quality of RNG or paranoid
> > about bcm2835's unpublic algorithm, feel free to complexify!
>
> i have not had luck with this.  i get data aborts when booting
> from flash, and hangs when rebooting via /dev/reboot.

Sorry about that! I forgot to mention that this facility was
added around Jan 30, 2013.  See Dom's message on page 12 on
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=19334&p=273944#p273944
Make sure you have firmware as least as recent as that.  Not
sure if Richard's 9pi image on sources has something more
recent. I will check this evening.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] bcm2835 random number generator
  2014-03-28 21:39   ` Bakul Shah
@ 2014-03-28 23:51     ` erik quanstrom
  2014-03-29  0:11       ` Bakul Shah
  0 siblings, 1 reply; 5+ messages in thread
From: erik quanstrom @ 2014-03-28 23:51 UTC (permalink / raw)
  To: 9fans

> Sorry about that! I forgot to mention that this facility was
> added around Jan 30, 2013.  See Dom's message on page 12 on
> http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=19334&p=273944#p273944
> Make sure you have firmware as least as recent as that.  Not
> sure if Richard's 9pi image on sources has something more
> recent. I will check this evening.

no problems.  i am using very old firmware because of the problems
experienced in upgrading at one point.  can you post the exact version
required?  i may do as i did for the amd64 RDRAND.

- erik



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] bcm2835 random number generator
  2014-03-28 23:51     ` erik quanstrom
@ 2014-03-29  0:11       ` Bakul Shah
  0 siblings, 0 replies; 5+ messages in thread
From: Bakul Shah @ 2014-03-29  0:11 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, 28 Mar 2014 19:51:50 EDT erik quanstrom <quanstro@quanstro.net> wrote:
> > Sorry about that! I forgot to mention that this facility was
> > added around Jan 30, 2013.  See Dom's message on page 12 on
> > http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=19334&p=273944#p2739
> 44
> > Make sure you have firmware as least as recent as that.  Not
> > sure if Richard's 9pi image on sources has something more
> > recent. I will check this evening.
>
> no problems.  i am using very old firmware because of the problems
> experienced in upgrading at one point.  can you post the exact version
> required?  i may do as i did for the amd64 RDRAND.

/n/sources/extra/pi.uboot.sd.img.gz has start.elf from Feb 7 2013.
/n/sources/contrib/miller/9pi.img.gz has start.elf from Nov 15 2013.

Either should work. Let me know if you are still seeing a
crash.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-03-29  0:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-28 17:19 [9fans] bcm2835 random number generator Bakul Shah
2014-03-28 21:09 ` erik quanstrom
2014-03-28 21:39   ` Bakul Shah
2014-03-28 23:51     ` erik quanstrom
2014-03-29  0:11       ` Bakul Shah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).