mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-07-09 08:40:43 +02:00
extend ima_measurement --pcrs option to support per-bank pcr files
Extend the ima_measurement --pcrs option to support per-bank pcr files. The extended syntax is "--pcrs algorithm,pathname". If no algorithm is specified, it defaults to sha1 as before. Multiple --pcrs options are now supported, one per bank of PCRs. The file format remains unchanged. If --pcrs is specified, only try to read PCRs from the specified file(s); do not fall back to trying to read from sysfs or the TPM itself in this case since the user requested use of the files. Create per-bank pcr files, depends on "tpm: add sysfs exports for all banks of PCR registers" kernel patch: $ cat tpm2pcrread.sh for alg in sha1 sha256 do rm -f pcr-$alg pcr=0; while [ $pcr -lt 24 ]; do printf "PCR-%02d: " $pcr >> pcr-$alg; cat /sys/class/tpm/tpm0/pcr-$alg/$pcr >> pcr-$alg; pcr=$[$pcr+1]; done done $ sh ./tpm2pcrread.sh Pass only the sha1 PCRs to evmctl defaulting to sha1: $ sudo evmctl ima_measurement --pcrs pcr-sha1 /sys/kernel/security/integrity/ima/binary_runtime_measurements Pass only the sha1 PCRs to evmctl with explicit selection of sha1: $ sudo evmctl ima_measurement --pcrs sha1,pcr-sha1 /sys/kernel/security/integrity/ima/binary_runtime_measurements Pass both sha1 and sha256 PCRs to evmctl: $ sudo evmctl ima_measurement --pcrs sha1,pcr-sha1 --pcrs sha256,pcr-sha256 /sys/kernel/security/integrity/ima/binary_runtime_measurements Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com> [zohar@linux.ibm.com: although support for exporting TPM 2.0 PCRs has not yet been upstreamed, add support for the file format anyway.] Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:

committed by
Mimi Zohar

parent
79ab82f55f
commit
8e2738dd44
@ -203,7 +203,7 @@ struct RSA_ASN1_template {
|
||||
size_t size;
|
||||
};
|
||||
|
||||
#define NUM_PCRS 20
|
||||
#define NUM_PCRS 24
|
||||
#define DEFAULT_PCR 10
|
||||
|
||||
extern struct libimaevm_params imaevm_params;
|
||||
|
Reference in New Issue
Block a user