Skip to content

Commit df8a756

Browse files
committed
tests: tpm: Skip over pcrUpdateCounter byte in result comparison
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 <[email protected]> Reviewed-by: Marc-André Lureau <[email protected]> Message-id: [email protected]
1 parent f8b332a commit df8a756

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/qtest/tpm-util.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ void tpm_util_pcrread(QTestState *s, tx_func *tx,
139139

140140
tx(s, tpm_pcrread, sizeof(tpm_pcrread), buffer, sizeof(buffer));
141141

142-
g_assert_cmpmem(buffer, exp_resp_size, exp_resp, exp_resp_size);
142+
/* skip pcrUpdateCounter (14th byte) in comparison */
143+
g_assert(exp_resp_size >= 15);
144+
g_assert_cmpmem(buffer, 13, exp_resp, 13);
145+
g_assert_cmpmem(&buffer[14], exp_resp_size - 14,
146+
&exp_resp[14], exp_resp_size - 14);
143147
}
144148

145149
bool tpm_util_swtpm_has_tpm2(void)

0 commit comments

Comments
 (0)