From owner-freebsd-current Fri Jun 9 10: 9:30 2000 Delivered-To: freebsd-current@freebsd.org Received: from cypherpunks.ai (cypherpunks.ai [209.88.68.47]) by hub.freebsd.org (Postfix) with ESMTP id D0FD037C720; Fri, 9 Jun 2000 10:09:24 -0700 (PDT) (envelope-from jeroen@vangelderen.org) Received: from vangelderen.org (grolsch.ai [209.88.68.214]) by cypherpunks.ai (Postfix) with ESMTP id AD05951; Fri, 9 Jun 2000 13:09:23 -0400 (AST) Message-ID: <394124C3.221E61BC@vangelderen.org> Date: Fri, 09 Jun 2000 13:09:23 -0400 From: "Jeroen C. van Gelderen" X-Mailer: Mozilla 4.72 [en] (X11; I; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: Mark Murray Cc: Kris Kennaway , current@FreeBSD.ORG Subject: Re: mktemp() patch References: <200006081724.TAA00705@grimreaper.grondar.za> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Mark Murray wrote: > > > > What is the purpose of this? It looks hugely wasteful to me. If you > > > really need a single random bit, it is not good to waste a block of > > > hard-gained gryptographic randomness; can you not use a pseudo-random > > > bit-generator? > > > > arc4random() does not consume entropy except the first time it is called > > and when explicitly reseeded through arc4random_stir(). Apart from that > > it's a deterministic function (the arc4 stream cipher), but it's still a > > reasonably good cryptographic PRNG because arc4 is a cryptographically > > strong algorithm. > > But I repeat myself; are you still intending to use cryptographic security > for one bit? What does that buy you? An attacker will laugh at the waste > of resources that went into a coin-flip :-). Much better is to use something > cheaper like time-of-day XOR 1 << whatever. Pseudo random numbers are so cheap (or they should be) that you just don't want to try and 'optimize' here. It is much better to be conservative and use a good PRNG until it *proves* to be very problematic. Cheers, Jeroen -- Jeroen C. van Gelderen o _ _ _ jeroen@vangelderen.org _o /\_ _ \\o (_)\__/o (_) _< \_ _>(_) (_)/<_ \_| \ _|/' \/ (_)>(_) (_) (_) (_) (_)' _\o_ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message