[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 10/14] linux-user: Call qcrypto_init if not using
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v2 10/14] linux-user: Call qcrypto_init if not using -seed |
Date: |
Wed, 13 Mar 2019 21:55:22 -0700 |
This is required before using qcrypto_random_bytes
by way of qemu_getrandom.
Cc: Laurent Vivier <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
linux-user/main.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/linux-user/main.c b/linux-user/main.c
index 9682e81610..192bf759b8 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -38,6 +38,7 @@
#include "trace/control.h"
#include "target_elf.h"
#include "cpu_loop-common.h"
+#include "crypto/init.h"
char *exec_path;
@@ -688,6 +689,13 @@ int main(int argc, char **argv, char **envp)
}
if (seed_optarg != NULL) {
qemu_seedrandom_main(seed_optarg, &error_fatal);
+ } else {
+ /* ??? This assumes qcrypto is only used by qemu_getrandom. */
+ Error *err = NULL;
+ if (qcrypto_init(&err) < 0) {
+ error_reportf_err(err, "cannot initialize crypto: ");
+ exit(1);
+ }
}
target_environ = envlist_to_environ(envlist, NULL);
--
2.17.1
- Re: [Qemu-devel] [PATCH v2 01/14] crypto: Merge crypto-obj-y into libqemuutil.a, (continued)
[Qemu-devel] [PATCH v2 03/14] crypto: Do not fail for EINTR during qcrypto_random_bytes, Richard Henderson, 2019/03/14
[Qemu-devel] [PATCH v2 04/14] crypto: Use O_CLOEXEC in qcrypto_random_init, Richard Henderson, 2019/03/14
[Qemu-devel] [PATCH v2 05/14] crypto: Use getrandom for qcrypto_random_bytes, Richard Henderson, 2019/03/14
[Qemu-devel] [PATCH v2 10/14] linux-user: Call qcrypto_init if not using -seed,
Richard Henderson <=
[Qemu-devel] [PATCH v2 09/14] util: Use qcrypto_random_bytes for qemu_getrandom, Richard Henderson, 2019/03/14
[Qemu-devel] [PATCH v2 07/14] ui/vnc: Use qcrypto_random_bytes for make_challenge, Richard Henderson, 2019/03/14
[Qemu-devel] [PATCH v2 08/14] util: Add qemu_getrandom and support functions, Richard Henderson, 2019/03/14