diff options
author | Stefan Berger <stefanb@linux.ibm.com> | 2021-08-02 17:52:38 -0400 |
---|---|---|
committer | Stefan Berger <stefanb@linux.ibm.com> | 2021-08-31 17:33:11 -0400 |
commit | 09b20a148afeebe2084c92672d3acaa26a371296 (patch) | |
tree | 537307e3133dc01e8c12ac5612c2e03d49a52c35 /tests/qtest/tpm-emu.c | |
parent | 9bd0e32a194826facff4e12d2cc8ba027dc107cb (diff) |
tests: Add tpm_version field to TPMTestState and fill it
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-id: 20210802215246.1433175-3-stefanb@linux.ibm.com
Diffstat (limited to 'tests/qtest/tpm-emu.c')
-rw-r--r-- | tests/qtest/tpm-emu.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/qtest/tpm-emu.c b/tests/qtest/tpm-emu.c index b9cddcc240..8baf49eafd 100644 --- a/tests/qtest/tpm-emu.c +++ b/tests/qtest/tpm-emu.c @@ -56,9 +56,16 @@ static void *tpm_emu_tpm_thread(void *data) s->tpm_msg->code = be32_to_cpu(s->tpm_msg->code); /* reply error */ - s->tpm_msg->tag = cpu_to_be16(TPM2_ST_NO_SESSIONS); - s->tpm_msg->len = cpu_to_be32(sizeof(struct tpm_hdr)); - s->tpm_msg->code = cpu_to_be32(TPM_RC_FAILURE); + switch (s->tpm_version) { + case TPM_VERSION_2_0: + s->tpm_msg->tag = cpu_to_be16(TPM2_ST_NO_SESSIONS); + s->tpm_msg->len = cpu_to_be32(sizeof(struct tpm_hdr)); + s->tpm_msg->code = cpu_to_be32(TPM_RC_FAILURE); + break; + default: + g_debug("unsupport TPM version %u", s->tpm_version); + g_assert_not_reached(); + } qio_channel_write(ioc, (char *)s->tpm_msg, be32_to_cpu(s->tpm_msg->len), &error_abort); } |