From owner-cvs-src@FreeBSD.ORG Fri Aug 8 06:32:14 2008 Return-Path: Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E22B106564A; Fri, 8 Aug 2008 06:32:14 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 73C1E8FC08; Fri, 8 Aug 2008 06:32:13 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.14.2/8.14.2) with ESMTP id m786W9p1053273; Fri, 8 Aug 2008 10:32:09 +0400 (MSD) (envelope-from ache@nagual.pp.ru) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nagual.pp.ru; s=default; t=1218177129; bh=Gy+9RASETiap93cvwblGDS1uBOfrMRIOZUKE6QB dOuU=; l=739; h=Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=cyLTMcfiX7nr9ED9ugsnnUckL q+YC4pnPCLK3ze3nAMt7Cz3lLsqa5+qt1/DaucJNflMlyWtns0Rm4wHcgohMEa46EJZ TiateRMggSVbPPrGCSESF1saLB7bbrwSBIKgBosxFM6CRVDUm6hUG00MMRpPkf0bRfN MDOYCvf6MULk= Received: (from ache@localhost) by nagual.pp.ru (8.14.2/8.14.2/Submit) id m786W8gM053272; Fri, 8 Aug 2008 10:32:08 +0400 (MSD) (envelope-from ache) Date: Fri, 8 Aug 2008 10:32:08 +0400 From: Andrey Chernov To: "M. Warner Losh" Message-ID: <20080808063208.GA51624@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , "M. Warner Losh" , kris@FreeBSD.org, src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org References: <489B797F.7020101@FreeBSD.org> <20080807230532.GA42775@nagual.pp.ru> <489B81AC.8090508@FreeBSD.org> <20080808.002150.-1037138460.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080808.002150.-1037138460.imp@bsdimp.com> User-Agent: Mutt/1.5.18 (2008-05-17) 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 X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Aug 2008 06:32:14 -0000 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/