From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Steffen Görtz" <contrib@steffen-goertz.de>
Cc: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@gmail.com>,
Jim Mussared <jim@groklearning.com>,
Julia Suvorova <jusual@mail.ru>, Joel Stanley <joel@jms.id.au>
Subject: Re: [Qemu-devel] [RFC] Add NRF51 RNG peripheral
Date: Tue, 19 Jun 2018 14:11:02 +0100 [thread overview]
Message-ID: <20180619131102.GW20929@redhat.com> (raw)
In-Reply-To: <20180619105451.29163-1-contrib@steffen-goertz.de>
On Tue, Jun 19, 2018 at 06:54:51AM -0400, Steffen Görtz wrote:
> Add a model of the NRF51 RNG peripheral.
>
> Signed-off-by: Steffen Görtz <contrib@steffen-goertz.de>
> ---
> hw/misc/Makefile.objs | 1 +
> hw/misc/nrf51_rng.c | 241 ++++++++++++++++++++++++++++++++++++
> include/hw/misc/nrf51_rng.h | 61 +++++++++
> 3 files changed, 303 insertions(+)
> create mode 100644 hw/misc/nrf51_rng.c
> create mode 100644 include/hw/misc/nrf51_rng.h
>
> +static void nrf51_rng_timer_expire(void *opaque) {
> + Nrf51RNGState *s = NRF51_RNG(opaque);
> +
> + qcrypto_random_bytes(&s->value, 1, NULL);
Passing NULL for the error object and ignoring return value is a
security flaw, because you'll be reporting non-random data to the
guest on failure. If you don't want to handle failure, then best
thing todo is pass &error_abort so that QEMU terminates if the
RNG fails
> +
> + s->state.event_valrdy = 1;
> + qemu_set_irq(s->eep_valrdy, 1);
> +
> + if(s->state.interrupt_enabled) {
> + qemu_irq_pulse(s->irq);
> + }
> +
> + if(s->state.shortcut_stop_on_valrdy) {
> + s->state.active = 0;
> + }
> +
> + rng_update_timer(s);
> +}
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 :|
next prev parent reply other threads:[~2018-06-19 13:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-19 10:54 [Qemu-devel] [RFC] Add NRF51 RNG peripheral Steffen Görtz
2018-06-19 13:02 ` no-reply
2018-06-19 13:11 ` Daniel P. Berrangé [this message]
2018-06-19 13:20 ` no-reply
2018-06-20 20:48 ` Philippe Mathieu-Daudé
2018-06-20 11:23 ` Stefan Hajnoczi
2018-06-26 10:37 ` Steffen Görtz
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=20180619131102.GW20929@redhat.com \
--to=berrange@redhat.com \
--cc=contrib@steffen-goertz.de \
--cc=jim@groklearning.com \
--cc=joel@jms.id.au \
--cc=jusual@mail.ru \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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.