Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1425487 > unrolled thread

[PATCH 5/5] tpm: use tpm1_pcr_read() in tpm_do_selftest()

Started byJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
First post2016-06-17 23:20 +0200
Last post2016-06-17 23:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 5/5] tpm: use tpm1_pcr_read() in tpm_do_selftest() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-06-17 23:20 +0200

#1425487 — [PATCH 5/5] tpm: use tpm1_pcr_read() in tpm_do_selftest()

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-06-17 23:20 +0200
Subject[PATCH 5/5] tpm: use tpm1_pcr_read() in tpm_do_selftest()
Message-ID<rL9lf-3mT-23@gated-at.bofh.it>
Remove ad-hoc protocol message construction and call instead
tpm1_pcr_read().

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/char/tpm/tpm-interface.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index 3995f5c..d0899fb 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -797,7 +797,7 @@ int tpm_do_selftest(struct tpm_chip *chip)
 	unsigned int loops;
 	unsigned int delay_msec = 100;
 	unsigned long duration;
-	struct tpm_cmd_t cmd;
+	u8 dummy[TPM_DIGEST_SIZE];
 
 	duration = tpm_calc_ordinal_duration(chip, TPM_ORD_CONTINUE_SELFTEST);
 
@@ -812,9 +812,7 @@ int tpm_do_selftest(struct tpm_chip *chip)
 
 	do {
 		/* Attempt to read a PCR value */
-		cmd.header.in = pcrread_header;
-		cmd.params.pcrread_in.pcr_idx = cpu_to_be32(0);
-		rc = tpm_transmit(chip, (u8 *) &cmd, READ_PCR_RESULT_SIZE);
+		rc = tpm1_pcr_read(chip, 0, dummy);
 		/* Some buggy TPMs will not respond to tpm_tis_ready() for
 		 * around 300ms while the self test is ongoing, keep trying
 		 * until the self test duration expires. */
@@ -829,7 +827,6 @@ int tpm_do_selftest(struct tpm_chip *chip)
 		if (rc < TPM_HEADER_SIZE)
 			return -EFAULT;
 
-		rc = be32_to_cpu(cmd.header.out.return_code);
 		if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
 			dev_info(&chip->dev,
 				 "TPM is disabled/deactivated (0x%X)\n", rc);
-- 
2.7.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web