From 236bfb0bc3bd0aa37bd06702c25993446f9b6dba Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Fri, 24 May 2019 09:35:21 -0700 Subject: tpmc: fix tpmc pcrextend error message The PCR extension value size should not have been hardcoded, it is different for different TPM specification versions. BRANCH=none BUG=none TEST=the error message prints the correct expected input size for both tpm and tpm2 case now. Change-Id: I8e65181edff1e62bbaae46e622fe67f420cbab25 Signed-off-by: Vadim Bendebury Reviewed-on: https://chromium-review.googlesource.com/1627640 Legacy-Commit-Queue: Commit Bot Reviewed-by: Andrey Pronin --- utility/tpmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'utility') diff --git a/utility/tpmc.c b/utility/tpmc.c index f5012eaf..dc41b03c 100644 --- a/utility/tpmc.c +++ b/utility/tpmc.c @@ -304,7 +304,8 @@ static uint32_t HandlerPCRExtend(void) { exit(OTHER_ERROR); } if (HexStringToArray(args[3], value, TPM_PCR_DIGEST)) { - fprintf(stderr, " must be a 20-byte hex string\n"); + fprintf(stderr, " must be a %d-byte hex string\n", + TPM_PCR_DIGEST); exit(OTHER_ERROR); } return TlclExtend(index, value, value); -- cgit v1.2.1