aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2019-03-14 14:55:26 -0700
committerRichard Henderson <richard.henderson@linaro.org>2019-05-22 12:38:54 -0400
commit9d44cb5b2ae10b224e91abb68e6f06a58af43389 (patch)
treefe92c1297a162b4d5024302d3f9cadbeddc00260
parent79743bdbcb7a1a72e6c8ad4fd0bc946a0c552f88 (diff)
aspeed/scu: Use qemu_guest_getrandom_nofail
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 rolling our own error handling locally. Reviewed-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--hw/misc/aspeed_scu.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
index c8217740ef..ab1e18ed4b 100644
--- a/hw/misc/aspeed_scu.c
+++ b/hw/misc/aspeed_scu.c
@@ -16,7 +16,7 @@
#include "qapi/visitor.h"
#include "qemu/bitops.h"
#include "qemu/log.h"
-#include "crypto/random.h"
+#include "qemu/guest-random.h"
#include "trace.h"
#define TO_REG(offset) ((offset) >> 2)
@@ -157,14 +157,8 @@ static const uint32_t ast2500_a1_resets[ASPEED_SCU_NR_REGS] = {
static uint32_t aspeed_scu_get_random(void)
{
- Error *err = NULL;
uint32_t num;
-
- if (qcrypto_random_bytes((uint8_t *)&num, sizeof(num), &err)) {
- error_report_err(err);
- exit(1);
- }
-
+ qemu_guest_getrandom_nofail(&num, sizeof(num));
return num;
}