[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 16/23] aspeed/scu: Use qemu_guest_getrandom_nofai
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v3 16/23] aspeed/scu: Use qemu_guest_getrandom_nofail |
Date: |
Thu, 14 Mar 2019 20:26:22 -0700 |
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.
Cc: address@hidden
Cc: Cédric Le Goater <address@hidden>
Cc: Andrew Jeffery <address@hidden>
Cc: Joel Stanley <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
hw/misc/aspeed_scu.c | 10 ++--------
1 file 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;
}
--
2.17.2
- [Qemu-devel] [PATCH v3 19/23] hw/misc/exynos4210_rng: Use qemu_guest_getrandom, (continued)
- [Qemu-devel] [PATCH v3 19/23] hw/misc/exynos4210_rng: Use qemu_guest_getrandom, Richard Henderson, 2019/03/14
- [Qemu-devel] [PATCH v3 21/23] target/arm: Implement ARMv8.5-RNG, Richard Henderson, 2019/03/14
- [Qemu-devel] [PATCH v3 18/23] hw/misc/bcm2835_rng: Use qemu_guest_getrandom_nofail, Richard Henderson, 2019/03/14
- [Qemu-devel] [PATCH v3 13/23] linux-user: Use qemu_guest_getrandom_nofail for AT_RANDOM, Richard Henderson, 2019/03/14
- [Qemu-devel] [PATCH v3 20/23] target/arm: Put all PAC keys into a structure, Richard Henderson, 2019/03/14
- [Qemu-devel] [PATCH v3 08/23] ui/vnc: Use gcrypto_random_bytes for start_auth_vnc, Richard Henderson, 2019/03/14
- [Qemu-devel] [PATCH v3 04/23] crypto: Use O_CLOEXEC in qcrypto_random_init, Richard Henderson, 2019/03/14
- [Qemu-devel] [PATCH v3 02/23] crypto: Reverse code blocks in random-platform.c, Richard Henderson, 2019/03/14
- [Qemu-devel] [PATCH v3 16/23] aspeed/scu: Use qemu_guest_getrandom_nofail,
Richard Henderson <=
- [Qemu-devel] [PATCH v3 14/23] linux-user/aarch64: Use qemu_guest_getrandom for PAUTH keys, Richard Henderson, 2019/03/14
- [Qemu-devel] [PATCH v3 11/23] linux-user: Initialize pseudo-random seeds for all guest cpus, Richard Henderson, 2019/03/14
- [Qemu-devel] [PATCH v3 07/23] ui/vnc: Split out authentication_failure, Richard Henderson, 2019/03/14
- [Qemu-devel] [PATCH v3 15/23] linux-user: Remove srand call, Richard Henderson, 2019/03/14
- [Qemu-devel] [PATCH v3 10/23] cpus: Initialize pseudo-random seeds for all guest cpus, Richard Henderson, 2019/03/14