mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-06-30 21:02:33 +02:00
ima-evm-utils: check the return code from tpm_pcr_read() in ima_measurement()
Don't log garbage when neither /sys/class/tpm/tpm0/device/pcrs nor /sys/class/misc/tpm0/device/pcrs can be read and exit nicely with a value of 1. Signed-off-by: George Wilson <gcwilson@linux.ibm.com> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
This commit is contained in:

committed by
Mimi Zohar

parent
9119f771a2
commit
8c8f29e870
@ -1535,7 +1535,8 @@ static int ima_measurement(const char *file)
|
||||
log_info("PCRAgg %.2d: ", i);
|
||||
log_dump(pcr[i], SHA_DIGEST_LENGTH);
|
||||
|
||||
tpm_pcr_read(i, hwpcr, sizeof(hwpcr));
|
||||
if (tpm_pcr_read(i, hwpcr, sizeof(hwpcr)))
|
||||
exit(1);
|
||||
log_info("HW PCR-%d: ", i);
|
||||
log_dump(hwpcr, sizeof(hwpcr));
|
||||
|
||||
|
Reference in New Issue
Block a user