]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/misc/nrf51_rng: Use qemu_guest_getrandom_nofail
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 14 Mar 2019 22:43:01 +0000 (15:43 -0700)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 22 May 2019 16:38:54 +0000 (12:38 -0400)
The random number is intended for use by the guest.  As such, we should
honor the -seed argument for reproducibility.  Use the *_nofail routine
instead of error_abort directly.

Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
hw/misc/nrf51_rng.c

index d188f044f4cb99b4c6162bdf4124991ff796cce5..3400e90a9b21f01b9cbc9e174a2d2d7fd7d9df44 100644 (file)
@@ -14,7 +14,7 @@
 #include "qapi/error.h"
 #include "hw/arm/nrf51.h"
 #include "hw/misc/nrf51_rng.h"
-#include "crypto/random.h"
+#include "qemu/guest-random.h"
 
 static void update_irq(NRF51RNGState *s)
 {
@@ -145,7 +145,7 @@ static void nrf51_rng_timer_expire(void *opaque)
 {
     NRF51RNGState *s = NRF51_RNG(opaque);
 
-    qcrypto_random_bytes(&s->value, 1, &error_abort);
+    qemu_guest_getrandom_nofail(&s->value, 1);
 
     s->event_valrdy = 1;
     qemu_set_irq(s->eep_valrdy, 1);