Date: Fri, 8 Aug 2008 10:32:08 +0400 From: Andrey Chernov <ache@nagual.pp.ru> To: "M. Warner Losh" <imp@bsdimp.com> Cc: cvs-src@FreeBSD.org, kris@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/games/fortune/strfile strfile.c Message-ID: <20080808063208.GA51624@nagual.pp.ru> In-Reply-To: <20080808.002150.-1037138460.imp@bsdimp.com> References: <489B797F.7020101@FreeBSD.org> <20080807230532.GA42775@nagual.pp.ru> <489B81AC.8090508@FreeBSD.org> <20080808.002150.-1037138460.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 08, 2008 at 12:21:50AM -0600, M. Warner Losh wrote: > This does beg the question why we need cryptographically secure > randomness for fortune, however... 1) PRNG is not crypto. 2) We already have it "cryptographically" secure via randomdev() for a long time in anycase. 3) Any code which use something like (...random() % modulo) when modulo is not divider of ...random()'s max suffer well known "modulo bias" bug which is not crypto but bad math and there is the main problem. 4) Uniformly distributed PRNG to avoid "modulo bias" bug available only for arc4random() at this time (making the same for random() involves too much math). 5) This changes comes from OpenBSD. -- http://ache.pp.ru/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080808063208.GA51624>