1
0
mirror of https://git.code.sf.net/p/linux-ima/ima-evm-utils synced 2025-04-28 06:33:36 +02:00

ima-evm-utils: sysfs pathname change

Commit 313d21e "tpm: device class for tpm" moved the TPM sysfs location
from /sys/class/misc/tpmX/device/ to /sys/class/tpm/tpmX/device/.

Mimi Zohar <zohar@linux.vnet.ibm.com>
This commit is contained in:
Mimi Zohar 2018-01-29 14:13:54 -05:00
parent 81010f0d87
commit c2ef2aabe2

View File

@ -1265,7 +1265,8 @@ static int cmd_ima_clear(struct command *cmd)
return do_cmd(cmd, ima_clear);
}
static char *pcrs = "/sys/class/misc/tpm0/device/pcrs";
static char *pcrs = "/sys/class/tpm/tpm0/device/pcrs"; /* Kernels >= 4.0 */
static char *misc_pcrs = "/sys/class/misc/tpm0/device/pcrs";
static int tpm_pcr_read(int idx, uint8_t *pcr, int len)
{
@ -1276,8 +1277,11 @@ static int tpm_pcr_read(int idx, uint8_t *pcr, int len)
sprintf(pcr_str, "PCR-%d", idx);
fp = fopen(pcrs, "r");
if (!fp)
fp = fopen(misc_pcrs, "r");
if (!fp) {
log_err("Unable to open %s\n", pcrs);
log_err("Unable to open %s or %s\n", pcrs, misc_pcrs);
return -1;
}