qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: Kashyap Chamarthy <kchamart@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org, "Richard W.M. Jones" <rjones@redhat.com>,
	Nikos Mavrogiannopoulos <nmav@redhat.com>,
	Laszlo Ersek <lersek@redhat.com>
Subject: Re: [Qemu-devel] [RFC] Virtio RNG: Consider changing the default entropy source to /dev/urandom?
Date: Tue, 7 May 2019 18:27:17 +0100	[thread overview]
Message-ID: <20190507172717.GZ27205@redhat.com> (raw)
In-Reply-To: <82f77ed6-b308-c5b0-2bdc-3f18472d7061@linaro.org>

On Tue, May 07, 2019 at 10:14:25AM -0700, Richard Henderson wrote:
> On 5/7/19 8:22 AM, Daniel P. Berrangé wrote:
> > On Tue, May 07, 2019 at 11:59:05AM +0200, Nikos Mavrogiannopoulos wrote:
> >> In terms of RHEL what is preferred is (1) use a crypto lib, and (2) if
> >> that's not possible use getrandom(). That is summarized in this
> >> article:
> >>
> >> https://www.redhat.com/en/blog/understanding-red-hat-enterprise-linux-random-number-generator-interface
> > 
> > For QEMU this would mean re-writing the code to use qcrypto_random_bytes
> > instead. This internal API is backed by a crypto lib if available,
> > falling back to /dev/urandom or /dev/random on UNIX, or CryptGenRandom
> > on Windows. We could add getrandom() support there too.
> 
> At least this last step is done:
> 
>   https://patchwork.ozlabs.org/patch/1056828/

Ah yes, I forgot you had done that already, which is nice.

> > The main question is whether to implement a new backends/rng-builtin.c
> > or modify backends/rng-random.c so that it has a NULL filename by
> > default, which would be taken as meaning use the qcrypto_random_bytes
> > API.  The latter benefits that all existing VMs which don't have a
> > filename set would get the new behaviour. The latter has downside
> > that it is not discoverable from mgmt apps, so they won't know if
> > they can rely on it or not.
> > 
> > Thus I'd probably tend towards a new backend for discoverability.
> 
> What does it mean to rely on the filename, really?
> 
> We could special case "/dev/urandom" as qcrypto_random_bytes, which would end
> up using getrandom(2) or /dev/urandom via the crypto lib anyway.
> 
> We could even special case "/dev/random" as getrandom(2) w/GRND_RANDOM, if we
> cared to bypass the crypto lib.

IME magic like this has a habit of coming back to bite you. eg if we later
find there is some use case where its important to /really/ use /dev/urandom
and we've magically turned /dev/urandom into a call to gnutls, we're stuck.

If we want to use qcrypto_random_bytes we must have an explicit way to get
that, rather than changing semantics of existing filenames apps might be
passing.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


      reply	other threads:[~2019-05-07 17:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180921154323.GS28120@paraplu>
2019-05-02 18:02 ` [Qemu-devel] [RFC] Virtio RNG: Consider changing the default entropy source to /dev/urandom? Kashyap Chamarthy
2019-05-02 18:02   ` Kashyap Chamarthy
2019-05-03  7:59   ` Richard W.M. Jones
2019-05-03  7:59     ` Richard W.M. Jones
2019-05-07  9:59   ` Nikos Mavrogiannopoulos
2019-05-07 15:22     ` Daniel P. Berrangé
2019-05-07 15:53       ` Eric Blake
2019-05-07 17:14       ` Richard Henderson
2019-05-07 17:27         ` Daniel P. Berrangé [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190507172717.GZ27205@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kchamart@redhat.com \
    --cc=lersek@redhat.com \
    --cc=nmav@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=rjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).