All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Richard Henderson <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org, Thomas Huth <thuth@redhat.com>,
	Laurent Vivier <laurent@vivier.eu>
Subject: Re: [Qemu-devel] [PATCH v3 12/23] linux-user: Call qcrypto_init if not using -seed
Date: Mon, 15 Apr 2019 11:28:38 +0100	[thread overview]
Message-ID: <20190415102838.GH5718@redhat.com> (raw)
In-Reply-To: <bed878ef-0ce1-1081-a4cb-88b7775d1433@redhat.com>

On Mon, Apr 15, 2019 at 12:23:18PM +0200, Philippe Mathieu-Daudé wrote:
> On 4/13/19 8:44 AM, Richard Henderson wrote:
> > On 4/10/19 11:49 PM, Philippe Mathieu-Daudé wrote:
> >>> -    if (seed_optarg != NULL) {
> >>> -        qemu_guest_random_seed_main(seed_optarg, &error_fatal);
> >>> +    {
> >> Since 7be41675f7c we use gnu99 C, so this extra block indentation can be
> >> removed.
> >>
> >>> +        Error *err = NULL;
> >>> +        if (seed_optarg != NULL) {
> >>> +            qemu_guest_random_seed_main(seed_optarg, &err);
> >>> +        } else {
> >>> +            /* ??? Assumes qcrypto is only used by qemu_guest_getrandom.  */
> >>> +            qcrypto_init(&err);
> >>> +        }
> >>> +        if (err) {
> >>> +            error_reportf_err(err, "cannot initialize crypto: ");
> >>> +            exit(1);
> >>> +        }
> >>>      }
> > 
> > I could, but it also limits the scope, which is of more importance to variables
> > who have their address taken.  It means that their storage could (in theory) be
> > shared with objects not overlapping in scope.
> 
> Fine then.
> 
> I think your '???' comment is appropriate but I'd rather let Daniel
> opinate. Except that comment, for the rest:

In linux-user context, afaik, the random APIs are the only stuff that
will be used, none of the hash or cipher stuff is needed.

> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 

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 :|

WARNING: multiple messages have this Message-ID (diff)
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>
Subject: Re: [Qemu-devel] [PATCH v3 12/23] linux-user: Call qcrypto_init if not using -seed
Date: Mon, 15 Apr 2019 11:28:38 +0100	[thread overview]
Message-ID: <20190415102838.GH5718@redhat.com> (raw)
Message-ID: <20190415102838.I-IJFfDvuqqUmSRYbxz7zyZeM88HiGD7hRwg79_mbJc@z> (raw)
In-Reply-To: <bed878ef-0ce1-1081-a4cb-88b7775d1433@redhat.com>

On Mon, Apr 15, 2019 at 12:23:18PM +0200, Philippe Mathieu-Daudé wrote:
> On 4/13/19 8:44 AM, Richard Henderson wrote:
> > On 4/10/19 11:49 PM, Philippe Mathieu-Daudé wrote:
> >>> -    if (seed_optarg != NULL) {
> >>> -        qemu_guest_random_seed_main(seed_optarg, &error_fatal);
> >>> +    {
> >> Since 7be41675f7c we use gnu99 C, so this extra block indentation can be
> >> removed.
> >>
> >>> +        Error *err = NULL;
> >>> +        if (seed_optarg != NULL) {
> >>> +            qemu_guest_random_seed_main(seed_optarg, &err);
> >>> +        } else {
> >>> +            /* ??? Assumes qcrypto is only used by qemu_guest_getrandom.  */
> >>> +            qcrypto_init(&err);
> >>> +        }
> >>> +        if (err) {
> >>> +            error_reportf_err(err, "cannot initialize crypto: ");
> >>> +            exit(1);
> >>> +        }
> >>>      }
> > 
> > I could, but it also limits the scope, which is of more importance to variables
> > who have their address taken.  It means that their storage could (in theory) be
> > shared with objects not overlapping in scope.
> 
> Fine then.
> 
> I think your '???' comment is appropriate but I'd rather let Daniel
> opinate. Except that comment, for the rest:

In linux-user context, afaik, the random APIs are the only stuff that
will be used, none of the hash or cipher stuff is needed.

> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 

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-04-15 10:28 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190315032629.21234-1-richard.henderson@linaro.org>
2019-03-15  3:26 ` [Qemu-arm] [PATCH v3 16/23] aspeed/scu: Use qemu_guest_getrandom_nofail Richard Henderson
2019-03-15  3:50   ` [Qemu-devel] " Joel Stanley
2019-03-15  6:36   ` Cédric Le Goater
2019-04-11  9:51   ` [Qemu-arm] " Philippe Mathieu-Daudé
2019-04-11  9:51     ` Philippe Mathieu-Daudé
2019-03-15  3:26 ` [Qemu-devel] [PATCH v3 17/23] hw/misc/nrf51_rng: " Richard Henderson
2019-03-15  3:52   ` [Qemu-arm] " Joel Stanley
2019-03-15  3:26 ` [Qemu-devel] [PATCH v3 18/23] hw/misc/bcm2835_rng: " Richard Henderson
2019-04-11  9:52   ` [Qemu-arm] " Philippe Mathieu-Daudé
2019-04-11  9:52     ` Philippe Mathieu-Daudé
2019-03-15  3:26 ` [Qemu-arm] [PATCH v3 19/23] hw/misc/exynos4210_rng: Use qemu_guest_getrandom Richard Henderson
2019-04-11  9:53   ` [Qemu-arm] [Qemu-devel] " Philippe Mathieu-Daudé
2019-04-11  9:53     ` Philippe Mathieu-Daudé
2019-03-15  3:26 ` [Qemu-arm] [PATCH v3 21/23] target/arm: Implement ARMv8.5-RNG Richard Henderson
     [not found] ` <20190315032629.21234-5-richard.henderson@linaro.org>
2019-04-11  9:36   ` [Qemu-devel] [PATCH v3 04/23] crypto: Use O_CLOEXEC in qcrypto_random_init Philippe Mathieu-Daudé
     [not found] ` <20190315032629.21234-8-richard.henderson@linaro.org>
2019-04-11  9:39   ` [Qemu-devel] [PATCH v3 07/23] ui/vnc: Split out authentication_failure Philippe Mathieu-Daudé
     [not found] ` <20190315032629.21234-9-richard.henderson@linaro.org>
2019-04-11  9:40   ` [Qemu-devel] [PATCH v3 08/23] ui/vnc: Use gcrypto_random_bytes for start_auth_vnc Philippe Mathieu-Daudé
     [not found] ` <20190315032629.21234-10-richard.henderson@linaro.org>
2019-04-11  9:42   ` [Qemu-devel] [PATCH v3 09/23] util: Add qemu_guest_getrandom and associated routines Philippe Mathieu-Daudé
     [not found] ` <20190315032629.21234-11-richard.henderson@linaro.org>
2019-04-11  9:43   ` [Qemu-devel] [PATCH v3 10/23] cpus: Initialize pseudo-random seeds for all guest cpus Philippe Mathieu-Daudé
     [not found] ` <20190315032629.21234-12-richard.henderson@linaro.org>
2019-04-11  9:44   ` [Qemu-devel] [PATCH v3 11/23] linux-user: " Philippe Mathieu-Daudé
     [not found] ` <20190315032629.21234-13-richard.henderson@linaro.org>
2019-04-11  9:49   ` [Qemu-devel] [PATCH v3 12/23] linux-user: Call qcrypto_init if not using -seed Philippe Mathieu-Daudé
2019-04-11  9:49     ` Philippe Mathieu-Daudé
2019-04-13  6:44     ` Richard Henderson
2019-04-13  6:44       ` Richard Henderson
2019-04-15 10:23       ` Philippe Mathieu-Daudé
2019-04-15 10:23         ` Philippe Mathieu-Daudé
2019-04-15 10:28         ` Daniel P. Berrangé [this message]
2019-04-15 10:28           ` Daniel P. Berrangé
     [not found] ` <20190315032629.21234-15-richard.henderson@linaro.org>
2019-04-11  9:50   ` [Qemu-devel] [PATCH v3 14/23] linux-user/aarch64: Use qemu_guest_getrandom for PAUTH keys Philippe Mathieu-Daudé
     [not found] ` <20190315032629.21234-16-richard.henderson@linaro.org>
2019-04-11  9:51   ` [Qemu-devel] [PATCH v3 15/23] linux-user: Remove srand call Philippe Mathieu-Daudé
     [not found] ` <20190315032629.21234-21-richard.henderson@linaro.org>
2019-04-11  9:54   ` [Qemu-devel] [PATCH v3 20/23] target/arm: Put all PAC keys into a structure Philippe Mathieu-Daudé
     [not found] ` <20190315032629.21234-2-richard.henderson@linaro.org>
2019-04-29 12:57   ` [Qemu-devel] [PATCH v3 01/23] crypto: Merge crypto-obj-y into libqemuutil.a Peter Maydell
2019-05-06 17:01     ` Richard Henderson

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=20190415102838.GH5718@redhat.com \
    --to=berrange@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.