qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v3 12/18] sev: add LAUNCH_FINISH command


From: Brijesh Singh
Subject: [Qemu-devel] [RFC PATCH v3 12/18] sev: add LAUNCH_FINISH command
Date: Tue, 1 Nov 2016 11:53:58 -0400
User-agent: StGit/0.17.1-dirty

The command is used to finalize the SEV guest launch process.

The command returns a measurement value of the data encrypted through
the LAUNCH_UPDATE command. This measurement can be handed to the guest
owner to verify that the guest was launched into SEV-enabled mode.

Signed-off-by: Brijesh Singh <address@hidden>
---
 sev.c |   25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/sev.c b/sev.c
index fafef6f..ff9266a 100644
--- a/sev.c
+++ b/sev.c
@@ -278,7 +278,30 @@ sev_launch_start(SEVState *s)
 static int
 sev_launch_finish(SEVState *s)
 {
-    return 0;
+    int ret;
+    struct kvm_sev_launch_finish *data;
+
+    assert(s->state == SEV_STATE_LAUNCHING);
+
+    data = g_malloc0(sizeof(*data));
+    if (!data) {
+        return 1;
+    }
+
+    ret = sev_ioctl(KVM_SEV_LAUNCH_FINISH, data);
+    if (ret) {
+        goto err;
+    }
+
+    DPRINTF("SEV: LAUNCH_FINISH ");
+    DPRINTF_U8_PTR(" measurement", data->measurement,
+                   sizeof(data->measurement));
+
+    s->state = SEV_STATE_RUNNING;
+err:
+    g_free(data);
+
+    return ret;
 }
 
 static int




reply via email to

[Prev in Thread] Current Thread [Next in Thread]