diff options
author | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2011-03-30 12:13:23 -0400 |
---|---|---|
committer | Rajiv Andrade <srajiv@linux.vnet.ibm.com> | 2011-07-12 17:53:07 -0400 |
commit | 979b140614a5459f340f5f8b1641ef77c863d899 (patch) | |
tree | 187c508ee023f34e755a7416349c1936c03a31fe /drivers/char | |
parent | 97fb35e413f256ded07b88c73b3d932ec31ea84e (diff) |
tpm: Use durations returned from TPM
The TPM driver currently discards the durations values returned
from the TPM. The check of the response packet needs to consider that
the return_code field is 0 on success and the size of the expected
packet is equivalent to the header size + u32 length indicator for the
TPM_GetCapability() result + 3 timeout indicators of type u32.
v4:
- sysfs entry 'durations' is now a patch of its own
- the work-around for TPMs reporting durations in milliseconds is now in a
patch of its own
v3:
- sysfs entry now called 'durations' to resemble TPM-speak (previously
was called 'timeouts')
v2:
- adjusting all timeouts for TPM devices reporting timeouts in msec rather
than usec
- also displaying in sysfs whether the timeouts are 'original' or 'adjusted'
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Tested-by: Guillaume Chazarain <guichaz@gmail.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/tpm/tpm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 7beb0e25f1e1..aebb4b5a199c 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -575,9 +575,11 @@ duration: | |||
575 | if (rc) | 575 | if (rc) |
576 | return; | 576 | return; |
577 | 577 | ||
578 | if (be32_to_cpu(tpm_cmd.header.out.return_code) | 578 | if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 || |
579 | != 3 * sizeof(u32)) | 579 | be32_to_cpu(tpm_cmd.header.out.length) |
580 | != sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32)) | ||
580 | return; | 581 | return; |
582 | |||
581 | duration_cap = &tpm_cmd.params.getcap_out.cap.duration; | 583 | duration_cap = &tpm_cmd.params.getcap_out.cap.duration; |
582 | chip->vendor.duration[TPM_SHORT] = | 584 | chip->vendor.duration[TPM_SHORT] = |
583 | usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); | 585 | usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); |