From 3b805725c15022783f0737a72b4f27962abf48cd Mon Sep 17 00:00:00 2001 From: Andrey Pronin Date: Fri, 6 Oct 2017 20:01:53 -0700 Subject: tlcl, tpmc: extend GetVersion to report vendor specific data 1) Extend TlclGetVersion to return vendor specific data, if requested. 2) Extend 'tpmc getver' to include vendor specific data. BRANCH=none BUG=chromium:771561 TEST=unit tests, running 'tpmc getver' Change-Id: Ic04c242d4e6f33b45a80479be9ab9777b317ebe2 Reviewed-on: https://chromium-review.googlesource.com/706240 Commit-Ready: Andrey Pronin Tested-by: Andrey Pronin Reviewed-by: Andrey Pronin --- utility/tpmc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'utility/tpmc.c') diff --git a/utility/tpmc.c b/utility/tpmc.c index a36f7e94..0584e32e 100644 --- a/utility/tpmc.c +++ b/utility/tpmc.c @@ -460,10 +460,18 @@ static uint32_t HandlerSendRaw(void) { static uint32_t HandlerGetVersion(void) { uint32_t vendor; uint64_t firmware_version; - uint32_t result = TlclGetVersion(&vendor, &firmware_version); + uint8_t vendor_specific[32]; + size_t vendor_specific_size = sizeof(vendor_specific); + uint32_t result = TlclGetVersion(&vendor, &firmware_version, vendor_specific, + &vendor_specific_size); if (result == 0) { - printf("vendor %08x\nfirmware_version %016" PRIx64 "\n", + printf("vendor %08x\nfirmware_version %016" PRIx64 "\nvendor_specific ", vendor, firmware_version); + size_t n; + for (n = 0; n < vendor_specific_size; ++n) { + printf("%02x", vendor_specific[n]); + } + printf("\n"); } return result; } -- cgit v1.2.1