[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 4/7] tpm: Implement tpm_sized_buffer_reset
From: |
Stefan Berger |
Subject: |
[Qemu-devel] [PATCH v2 4/7] tpm: Implement tpm_sized_buffer_reset |
Date: |
Fri, 27 Oct 2017 19:02:38 -0400 |
Signed-off-by: Stefan Berger <address@hidden>
---
hw/tpm/tpm_tis.c | 5 -----
hw/tpm/tpm_util.c | 7 +++++++
hw/tpm/tpm_util.h | 7 +++++++
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 90dca4e..60887c3 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -48,11 +48,6 @@ typedef enum {
TPM_TIS_STATE_RECEPTION,
} TPMTISState;
-typedef struct TPMSizedBuffer {
- uint32_t size;
- uint8_t *buffer;
-} TPMSizedBuffer;
-
/* locality data -- all fields are persisted */
typedef struct TPMLocality {
TPMTISState state;
diff --git a/hw/tpm/tpm_util.c b/hw/tpm/tpm_util.c
index daf1faa..6132a14 100644
--- a/hw/tpm/tpm_util.c
+++ b/hw/tpm/tpm_util.c
@@ -151,3 +151,10 @@ int tpm_util_test_tpmdev(int tpm_fd, TPMVersion
*tpm_version)
return 1;
}
+
+void tpm_sized_buffer_reset(TPMSizedBuffer *tsb)
+{
+ g_free(tsb->buffer);
+ tsb->buffer = NULL;
+ tsb->size = 0;
+}
diff --git a/hw/tpm/tpm_util.h b/hw/tpm/tpm_util.h
index aca10c9..4c0d596 100644
--- a/hw/tpm/tpm_util.h
+++ b/hw/tpm/tpm_util.h
@@ -36,4 +36,11 @@ static inline uint32_t tpm_cmd_get_size(const void *b)
return be32_to_cpu(*(const uint32_t *)(b + 2));
}
+typedef struct TPMSizedBuffer {
+ uint32_t size;
+ uint8_t *buffer;
+} TPMSizedBuffer;
+
+void tpm_sized_buffer_reset(TPMSizedBuffer *tsb);
+
#endif /* TPM_TPM_UTIL_H */
--
2.5.5
- [Qemu-devel] [PATCH v2 0/7] tpm: Extend TPM with state migration support, Stefan Berger, 2017/10/27
- [Qemu-devel] [PATCH v2 1/7] tpm: Introduce condition to notify waiters of completed command, Stefan Berger, 2017/10/27
- [Qemu-devel] [PATCH v2 4/7] tpm: Implement tpm_sized_buffer_reset,
Stefan Berger <=
- [Qemu-devel] [PATCH v2 2/7] tpm: Introduce condition in TPM backend for notification, Stefan Berger, 2017/10/27
- [Qemu-devel] [PATCH v2 7/7] tpm: extend TPM CRB with state migration support, Stefan Berger, 2017/10/27
- [Qemu-devel] [PATCH v2 3/7] tpm: implement tpm_backend_wait_cmd_completed, Stefan Berger, 2017/10/27
- [Qemu-devel] [PATCH v2 5/7] tpm: extend TPM emulator with state migration support, Stefan Berger, 2017/10/27
- [Qemu-devel] [PATCH v2 6/7] tpm: extend TPM TIS with state migration support, Stefan Berger, 2017/10/27