diff options
author | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2017-11-03 22:49:23 -0400 |
---|---|---|
committer | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2017-12-14 23:39:15 -0500 |
commit | abc5cda097f46bdb86833a38ee0961a0e6a47ae1 (patch) | |
tree | d3d32ae6b6d96a7b9cd3a6e6b8cb831384efb57f /hw/tpm/tpm_passthrough.c | |
parent | 56388eee01144d59d5c94a34431a29c75073ba53 (diff) |
tpm: tpm_passthrough: Read the buffer size from the host device
Rather than hard coding the buffer size in the tpm_passthrough
backend read the TPM I/O buffer size from the host device.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'hw/tpm/tpm_passthrough.c')
-rw-r--r-- | hw/tpm/tpm_passthrough.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c index daac67d44a..886af9e702 100644 --- a/hw/tpm/tpm_passthrough.c +++ b/hw/tpm/tpm_passthrough.c @@ -57,6 +57,7 @@ struct TPMPassthruState { int cancel_fd; TPMVersion tpm_version; + size_t tpm_buffersize; }; typedef struct TPMPassthruState TPMPassthruState; @@ -201,7 +202,15 @@ static TPMVersion tpm_passthrough_get_tpm_version(TPMBackend *tb) static size_t tpm_passthrough_get_buffer_size(TPMBackend *tb) { - return 4096; + TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb); + int ret; + + ret = tpm_util_get_buffer_size(tpm_pt->tpm_fd, tpm_pt->tpm_version, + &tpm_pt->tpm_buffersize); + if (ret < 0) { + tpm_pt->tpm_buffersize = 4096; + } + return tpm_pt->tpm_buffersize; } /* |