Skip to contentSkip to conversation

Merge tpm 2020/07/15 v1

GIT PULL Applied Stefan Berger 2 participants 4 messages Jul 15, 2020 – Jul 16, 2020

lore
Share & tools
lore
#0 lore raw

Hello!

This series fixes a couple of minor issues with the PPC64 TPM SPAPR interface and a test case.

Stefan

The following changes since commit 8746309137ba470d1b2e8f5ce86ac228625db940:

Update version for v5.1.0-rc0 release (2020-07-15 19:08:07 +0100)

are available in the Git repository at:

git://github.com/stefanberger/qemu-tpm.git tags/pull-tpm-2020-07-15-1

for you to fetch changes up to df8a7568932e4c3c930fdfeb228dd72b4bb71a1f:

tests: tpm: Skip over pcrUpdateCounter byte in result comparison (2020-07-15 14:57:33 -0400)

---------------------------------------------------------------
Stefan Berger (2):
tpm: tpm_spapr: Exit on TPM backend failures
tests: tpm: Skip over pcrUpdateCounter byte in result comparison

 hw/tpm/tpm_spapr.c     | 5 ++++-
 tests/qtest/tpm-util.c | 6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
Signature · 1 line
2.24.1
#1 lore raw

[PULL v1 1/2] tpm: tpm_spapr: Exit on TPM backend failures

Exit on TPM backend failures in the same way as the TPM CRB and TIS device models do. With this change we now get an error report when the backend did not start up properly:

error: internal error: qemu unexpectedly closed the monitor:

2020-07-07T12:49:28.333928Z qemu-system-ppc64: tpm-emulator: \
  TPM result for CMD_INIT: 0x101 operation failed

Message-id: [email protected]

---
 hw/tpm/tpm_spapr.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
hw/tpm/tpm_spapr.c +4 -1
index cb4dfd1e6a..8288ab0a15 100644
@@ -306,7 +306,10 @@ static void tpm_spapr_reset(SpaprVioDevice *dev)
                             TPM_SPAPR_BUFFER_MAX);
 
     tpm_backend_reset(s->be_driver);
-    tpm_spapr_do_startup_tpm(s, s->be_buffer_size);
+
+    if (tpm_spapr_do_startup_tpm(s, s->be_buffer_size) < 0) {
+        exit(1);
+    }
 }
 
 static enum TPMVersion tpm_spapr_get_version(TPMIf *ti)
Signature · 1 line
2.24.1
#2 lore raw

[PULL v1 2/2] tests: tpm: Skip over pcrUpdateCounter byte in result comparison

In reply to Stefan Berger

The TPM 2 code in libtpms was fixed to handle the PCR 'TCB group' according to the PCClient profile. The change of the PCRs belonging to the 'TCB group' now affects the pcrUpdateCounter in the TPM2_PCRRead() responses where its value is now different (typically lower by '1') than what it was before. To not fail the tests, we skip the comparison of the 14th byte, which represents the pcrUpdateCounter.

Message-id: [email protected]

---
 tests/qtest/tpm-util.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tests/qtest/tpm-util.c +5 -1
index 34efae8f18..58a9593745 100644
@@ -139,7 +139,11 @@ void tpm_util_pcrread(QTestState *s, tx_func *tx,
 
     tx(s, tpm_pcrread, sizeof(tpm_pcrread), buffer, sizeof(buffer));
 
-    g_assert_cmpmem(buffer, exp_resp_size, exp_resp, exp_resp_size);
+    /* skip pcrUpdateCounter (14th byte) in comparison */
+    g_assert(exp_resp_size >= 15);
+    g_assert_cmpmem(buffer, 13, exp_resp, 13);
+    g_assert_cmpmem(&buffer[14], exp_resp_size - 14,
+                    &exp_resp[14], exp_resp_size - 14);
 }
 
 bool tpm_util_swtpm_has_tpm2(void)
Signature · 1 line
2.24.1
#3 lore raw
In reply to Stefan Berger
Quoted 16 lines · Stefan Berger

Hello!

This series fixes a couple of minor issues with the PPC64 TPM SPAPR interface and a test case.

Stefan

The following changes since commit 8746309137ba470d1b2e8f5ce86ac228625db940:

Update version for v5.1.0-rc0 release (2020-07-15 19:08:07 +0100)

are available in the Git repository at:

git://github.com/stefanberger/qemu-tpm.git tags/pull-tpm-2020-07-15-1

Quoted 8 lines

for you to fetch changes up to df8a7568932e4c3c930fdfeb228dd72b4bb71a1f:

tests: tpm: Skip over pcrUpdateCounter byte in result comparison (2020-07-15 14:57:33 -0400)

---------------------------------------------------------------
Stefan Berger (2):
tpm: tpm_spapr: Exit on TPM backend failures
tests: tpm: Skip over pcrUpdateCounter byte in result comparison

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.

-- PMM