From owner-freebsd-arch@FreeBSD.ORG Tue Feb 24 20:20:53 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6B6C070C for ; Tue, 24 Feb 2015 20:20:53 +0000 (UTC) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 382EAD7 for ; Tue, 24 Feb 2015 20:20:52 +0000 (UTC) Received: by pdjp10 with SMTP id p10so35884296pdj.3 for ; Tue, 24 Feb 2015 12:20:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=hqnzeQ7/tIc4cGXTpsPpX7MdfIeRVtxA33nLHPWEdKc=; b=fWRoboxX7xQhqU2lUiURrWL5kPhMt3KIWOI1WqE2OOHfqAIedq9BFBddGMDat7rjG1 7KcBRXv1A1XU8CkPph+Mq5Z2vM8PATFRdDwpYjZfJSLvmO7XESHpmXju1qNkALrlHzsw LSHvPNDcWI83mrT64e+z0JjcanZBWt/1SVpuBXC/1kEpWV3Wzuc2N5iCjDuBDwQdbu73 UpoOw8rNKA2S16EPDpw+kqraHDDgoJ9AdHEl3n9ws0ZfiXln8HCbLEekABCpD+kwtMzr IAwyUms4zxVJmdgMiS4kK4VYKPDetckZB4u1ziTE88/VypBsKHHdi4IrwkNNidIhv9/u /bUA== X-Gm-Message-State: ALoCoQkWLM3JK4vMlqEfcxGVNYQZcOWOR5wCoGe2FxkeHNw/5Q0x2ZUfwgLI+VaUsFNDIFQg7x80 X-Received: by 10.66.124.225 with SMTP id ml1mr31609827pab.142.1424809245849; Tue, 24 Feb 2015 12:20:45 -0800 (PST) Received: from macintosh-3c0754232d17.corp.netflix.com ([69.53.236.236]) by mx.google.com with ESMTPSA id of14sm4660396pdb.50.2015.02.24.12.20.44 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 24 Feb 2015 12:20:45 -0800 (PST) Sender: Warner Losh Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Re: locks and kernel randomness... From: Warner Losh In-Reply-To: <20150224200643.GN46794@funkthat.com> Date: Tue, 24 Feb 2015 13:20:42 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20150224012026.GY46794@funkthat.com> <20150224015721.GT74514@kib.kiev.ua> <54EBDC1C.3060007@astrodoggroup.com> <20150224024250.GV74514@kib.kiev.ua> <20150224174053.GG46794@funkthat.com> <1E4A5E62-6E06-48BA-B5C5-9BD05811CDEF@bsdimp.com> <20150224183051.GJ46794@funkthat.com> <8157A5FC-C402-4C77-8535-AAF73BB64E8E@bsdimp.com> <20150224200643.GN46794@funkthat.com> To: John-Mark Gurney X-Mailer: Apple Mail (2.2070.6) Cc: Konstantin Belousov , Harrison Grundy , freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Feb 2015 20:20:53 -0000 > On Feb 24, 2015, at 1:06 PM, John-Mark Gurney = wrote: >=20 >> Historically, a CSPRNG is spelled rand() or random(). So by calling = those functions, >> they are saying they want that. Some callers need more, others do = not. >=20 > Citation please? In my copy of the C99 specification, the rand = function > says nothing about being cryptographicly secure.. and the srand = function > specificly states that after calling srand, rand will be seeded w/ > a unsigned int, or 32bits, so by definition not CSPRNG.. >=20 > Also, Single UNIX Specification: > http://pubs.opengroup.org/onlinepubs/007908799/xsh/rand.html >=20 > has the same definition. >=20 > As for random() from our own man page: > The random() function uses a non-linear additive feedback random = number > generator employing a default table of size 31 long integers to = return > successive pseudo-random numbers in the range from 0 to (2**31)-1. = The >=20 > oh, and immediately before that, it says: > The functions described in this manual page are not = cryptographically > secure. Cryptographic applications should use arc4random(3) = instead. >=20 > So, I really would like to know where you get the idea the rand() and > random() are CSPRNG.. Though I'm fine w/ making them so.. Historically algorithmic PRNG is spelled random(). My brain thought that = and typed CSPRNG. Warner