From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Stefan Berger <stefanb@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PULL v1 09/10] tpm: Implement tpm_sized_buffer_reset
Date: Fri, 22 Dec 2017 15:16:24 -0500 [thread overview]
Message-ID: <1513973785-14427-10-git-send-email-stefanb@linux.vnet.ibm.com> (raw)
In-Reply-To: <1513973785-14427-1-git-send-email-stefanb@linux.vnet.ibm.com>
Move the definition of TPMSizedBuffer out of tpm_tis.c into tpm_util.h
and implement tpm_sized_buffer_reset() for the following patches to use.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
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 ac5d5c6..561384c 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 17cafbe..747075e 100644
--- a/hw/tpm/tpm_util.c
+++ b/hw/tpm/tpm_util.c
@@ -355,3 +355,10 @@ int tpm_util_get_buffer_size(int tpm_fd, TPMVersion tpm_version,
return 0;
}
+
+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 2393b6b..19b2847 100644
--- a/hw/tpm/tpm_util.h
+++ b/hw/tpm/tpm_util.h
@@ -42,4 +42,11 @@ int tpm_util_get_buffer_size(int tpm_fd, TPMVersion tpm_version,
#define DEFINE_PROP_TPMBE(_n, _s, _f) \
DEFINE_PROP(_n, _s, _f, qdev_prop_tpm, TPMBackend *)
+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
next prev parent reply other threads:[~2017-12-22 20:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-22 20:16 [Qemu-devel] [PULL v1 00/10] Merge tpm 2017/12/22 Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 01/10] tpm_emulator: Add a caching layer for the TPM Established flag Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 02/10] tpm_tis: convert uint32_t to size_t Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 03/10] tpm_tis: limit size of buffer from backend Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 04/10] tpm_tis: remove TPMSizeBuffer usage Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 05/10] tpm_tis: move buffers from localities into common location Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 06/10] tpm_tis: merge read and write buffer into single buffer Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 07/10] tpm_tis: move r/w_offsets to TPMState Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 08/10] tpm_tis: merge r/w_offset into rw_offset Stefan Berger
2017-12-22 20:16 ` Stefan Berger [this message]
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 10/10] acpi: Update TPM2 ACPI table to more recent specs Stefan Berger
2018-01-08 11:39 ` [Qemu-devel] [PULL v1 00/10] Merge tpm 2017/12/22 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1513973785-14427-10-git-send-email-stefanb@linux.vnet.ibm.com \
--to=stefanb@linux.vnet.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).