qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL v1 0/2] Merge tpm 2020/07/15 v1
@ 2020-07-15 19:23 Stefan Berger
  2020-07-15 19:23 ` [PULL v1 1/2] tpm: tpm_spapr: Exit on TPM backend failures Stefan Berger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Berger @ 2020-07-15 19:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, 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

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(-)

-- 
2.24.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PULL v1 1/2] tpm: tpm_spapr: Exit on TPM backend failures
  2020-07-15 19:23 [PULL v1 0/2] Merge tpm 2020/07/15 v1 Stefan Berger
@ 2020-07-15 19:23 ` Stefan Berger
  2020-07-15 19:23 ` [PULL v1 2/2] tests: tpm: Skip over pcrUpdateCounter byte in result comparison Stefan Berger
  2020-07-16 17:50 ` [PULL v1 0/2] Merge tpm 2020/07/15 v1 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Berger @ 2020-07-15 19:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, Stefan Berger, Marc-André Lureau, Stefan Berger

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

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20200707201625.4177419-2-stefanb@linux.vnet.ibm.com
---
 hw/tpm/tpm_spapr.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/tpm/tpm_spapr.c b/hw/tpm/tpm_spapr.c
index cb4dfd1e6a..8288ab0a15 100644
--- a/hw/tpm/tpm_spapr.c
+++ b/hw/tpm/tpm_spapr.c
@@ -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)
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PULL v1 2/2] tests: tpm: Skip over pcrUpdateCounter byte in result comparison
  2020-07-15 19:23 [PULL v1 0/2] Merge tpm 2020/07/15 v1 Stefan Berger
  2020-07-15 19:23 ` [PULL v1 1/2] tpm: tpm_spapr: Exit on TPM backend failures Stefan Berger
@ 2020-07-15 19:23 ` Stefan Berger
  2020-07-16 17:50 ` [PULL v1 0/2] Merge tpm 2020/07/15 v1 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Berger @ 2020-07-15 19:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, Stefan Berger, Marc-André Lureau, 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.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20200707201625.4177419-3-stefanb@linux.vnet.ibm.com
---
 tests/qtest/tpm-util.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/qtest/tpm-util.c b/tests/qtest/tpm-util.c
index 34efae8f18..58a9593745 100644
--- a/tests/qtest/tpm-util.c
+++ b/tests/qtest/tpm-util.c
@@ -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)
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PULL v1 0/2] Merge tpm 2020/07/15 v1
  2020-07-15 19:23 [PULL v1 0/2] Merge tpm 2020/07/15 v1 Stefan Berger
  2020-07-15 19:23 ` [PULL v1 1/2] tpm: tpm_spapr: Exit on TPM backend failures Stefan Berger
  2020-07-15 19:23 ` [PULL v1 2/2] tests: tpm: Skip over pcrUpdateCounter byte in result comparison Stefan Berger
@ 2020-07-16 17:50 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2020-07-16 17:50 UTC (permalink / raw)
  To: Stefan Berger; +Cc: QEMU Developers

On Wed, 15 Jul 2020 at 20:23, Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:
>
> 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


Applied, thanks.

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

-- PMM


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-16 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 19:23 [PULL v1 0/2] Merge tpm 2020/07/15 v1 Stefan Berger
2020-07-15 19:23 ` [PULL v1 1/2] tpm: tpm_spapr: Exit on TPM backend failures Stefan Berger
2020-07-15 19:23 ` [PULL v1 2/2] tests: tpm: Skip over pcrUpdateCounter byte in result comparison Stefan Berger
2020-07-16 17:50 ` [PULL v1 0/2] Merge tpm 2020/07/15 v1 Peter Maydell

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).