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 <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1627640
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
This commit is contained in:
Vadim Bendebury 2019-05-24 09:35:21 -07:00 committed by chrome-bot
parent 70f795f497
commit 236bfb0bc3
1 changed files with 2 additions and 1 deletions

View File

@ -304,7 +304,8 @@ static uint32_t HandlerPCRExtend(void) {
exit(OTHER_ERROR);
}
if (HexStringToArray(args[3], value, TPM_PCR_DIGEST)) {
fprintf(stderr, "<extend_hash> must be a 20-byte hex string\n");
fprintf(stderr, "<extend_hash> must be a %d-byte hex string\n",
TPM_PCR_DIGEST);
exit(OTHER_ERROR);
}
return TlclExtend(index, value, value);