diff options
author | Claudio Carvalho <cclaudio@linux.vnet.ibm.com> | 2016-11-01 20:40:26 -0200 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-11-02 17:07:27 +1100 |
commit | ddfc16d1275e7a2354913b3b3c2df6f0aa9f31ee (patch) | |
tree | 9cc42f505620982e8ee60a37bf58eda25bbd7279 /libstb/tpm_chip.c | |
parent | f9f3d0e2b20e01c32baf6546137dc9cdf0bc516e (diff) | |
download | skiboot-ddfc16d1275e7a2354913b3b3c2df6f0aa9f31ee.zip skiboot-ddfc16d1275e7a2354913b3b3c2df6f0aa9f31ee.tar.gz skiboot-ddfc16d1275e7a2354913b3b3c2df6f0aa9f31ee.tar.bz2 |
tpm_extendl: log the calling results
Currently, the tpm_extendl() results are logged by the caller, but
tpm_extendl() walks through all the tpm_chip registered and consequently
multiple tpm_chips can fail.
This turns the logging over to tpm_extendl(), which now logs how many
tpm_chips successfully measured and failed to measure a given data.
Another option would be to provide the caller the number of tpm_chips
that failed and successfully measured the data, but the caller will use
this information only for logging.
Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libstb/tpm_chip.c')
-rw-r--r-- | libstb/tpm_chip.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libstb/tpm_chip.c b/libstb/tpm_chip.c index 93a8e04..d387ea0 100644 --- a/libstb/tpm_chip.c +++ b/libstb/tpm_chip.c @@ -226,10 +226,11 @@ int tpm_extendl(TPM_Pcr pcr, TPM_Alg_Id alg2, uint8_t* digest2, size_t size2, uint32_t event_type, const char* event_msg) { - int rc, failed; + int rc, measured, failed; TCG_PCR_EVENT2 event; struct tpm_chip *tpm = NULL; + measured = 0; failed = 0; list_for_each(&tpm_list, tpm, link) { @@ -297,7 +298,12 @@ int tpm_extendl(TPM_Pcr pcr, tpm_print_pcr(tpm, pcr, alg2, size2); } #endif + measured++; } + + prlog(PR_NOTICE, "TPM: %s (pcr%d) measured on %d tpms and " + "failed on %d tpms\n", event_msg, pcr, measured, failed); + if (failed > 0) return STB_MEASURE_FAILED; return 0; |