From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMB5e-00069F-Vw for qemu-devel@nongnu.org; Thu, 21 Jan 2016 03:59:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMB5e-0002bh-29 for qemu-devel@nongnu.org; Thu, 21 Jan 2016 03:59:38 -0500 Date: Thu, 21 Jan 2016 08:59:28 +0000 From: "Daniel P. Berrange" Message-ID: <20160121085928.GC19835@redhat.com> References: <1453311539-1193-1-git-send-email-berrange@redhat.com> <1453311539-1193-3-git-send-email-berrange@redhat.com> <20160121061205.GC31960@ad.usersys.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160121061205.GC31960@ad.usersys.redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 02/17] crypto: add cryptographic random byte source Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , qemu-devel@nongnu.org, qemu-block@nongnu.org On Thu, Jan 21, 2016 at 02:12:06PM +0800, Fam Zheng wrote: > On Wed, 01/20 17:38, Daniel P. Berrange wrote: > > +int qcrypto_random_bytes(uint8_t *buf G_GNUC_UNUSED, > > + size_t buflen G_GNUC_UNUSED, > > + Error **errp) > > +{ > > + error_setg(errp, "No random byte source provided in this build"); > > + return -1; > > Curious, why does a random(3) or /dev/random implementation fall short to > error? random(3) does not provide crytographically strong random numbers. /dev/random would be suitable, but if we read that directly we would deplete entropy very quickly. The gnutls backends will use /dev/random in combination with a cryptographically secure generator to provide high entropy numbers, at a high data rate. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|