summary refs log tree commit diff stats
path: root/backends/tpm/tpm_ioctl.h
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.ibm.com>2024-10-16 13:51:28 -0400
committerStefan Berger <stefanb@linux.ibm.com>2024-10-18 07:53:11 -0400
commit312c5404011f6a80d1467a19abd916fd203dd7d4 (patch)
tree31fda66eaabf017ab1747b1a9436e318c98419c5 /backends/tpm/tpm_ioctl.h
parent95a16ee753d6da651fce8df876333bf7fcf134d9 (diff)
downloadfocaccia-qemu-312c5404011f6a80d1467a19abd916fd203dd7d4.tar.gz
focaccia-qemu-312c5404011f6a80d1467a19abd916fd203dd7d4.zip
tpm: Use new ptm_cap_n structure for PTM_GET_CAPABILITY
Use the new ptm_cap_n structure for getting the PTM_GET_CAPABILITY response
from swtpm. Previously only 17 bits could possibly have been set in ptm_cap
(uint64_t) in big endian order and those bits are now found in the 2nd
32bit word in the response in the caps field.

This data structure makes it now clear that the 1st 32bit word carries the
tpm_result like all the other response structures of all other commands
do.

The changes are taken from the swtpm project's tpm_ioctl.h.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Diffstat (limited to 'backends/tpm/tpm_ioctl.h')
-rw-r--r--backends/tpm/tpm_ioctl.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
index 1933ab6855..ee2dd15d35 100644
--- a/backends/tpm/tpm_ioctl.h
+++ b/backends/tpm/tpm_ioctl.h
@@ -29,6 +29,16 @@
 
 typedef uint32_t ptm_res;
 
+/* PTM_GET_CAPABILITY: Get supported capabilities (ioctl's) */
+struct ptm_cap_n {
+    union {
+        struct {
+            ptm_res tpm_result; /* will always be TPM_SUCCESS (0) */
+            uint32_t caps;
+        } resp; /* response */
+    } u;
+};
+
 /* PTM_GET_TPMESTABLISHED: get the establishment bit */
 struct ptm_est {
     union {
@@ -242,7 +252,8 @@ struct ptm_lockstorage {
     } u;
 };
 
-typedef uint64_t ptm_cap;
+typedef uint64_t ptm_cap; /* CUSE-only; use ptm_cap_n otherwise */
+typedef struct ptm_cap_n ptm_cap_n;
 typedef struct ptm_est ptm_est;
 typedef struct ptm_reset_est ptm_reset_est;
 typedef struct ptm_loc ptm_loc;