mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-07-01 21:31:14 +02:00
Fix reading the TPM 2.0 PCRs
Prior to the support for reading the TPM 2.0 PCRs via the sysfs
interface, based on environment variables the userspace application read
either the physical or software TPM's PCRs.
With the support for reading the exported TPM 2.0 PCRs via the sysfs
interface, the physical TPM's PCRs are always read. Define a new evmctl
option named '--hwtpm' to limit reading the TPM 2.0 PCRs via the sysfs
interface.
Fixes: a141bd5942
("add support for reading per bank TPM 2.0 PCRs via sysfs")
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
@ -126,8 +126,10 @@ display_pcrs() {
|
||||
# Verify that the last "boot_aggregate" record in the IMA measurement
|
||||
# list matches.
|
||||
check() {
|
||||
local options=$1
|
||||
|
||||
echo "INFO: Calculating the boot_aggregate (PCRs 0 - 9) for multiple banks"
|
||||
bootaggr=$(evmctl ima_boot_aggregate)
|
||||
bootaggr=$(evmctl ima_boot_aggregate ${options})
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "${CYAN}SKIP: evmctl ima_boot_aggregate: $bootaggr${NORM}"
|
||||
exit "$SKIP"
|
||||
@ -151,6 +153,7 @@ check() {
|
||||
}
|
||||
|
||||
if [ "$(id -u)" = 0 ] && [ -c "/dev/tpm0" ]; then
|
||||
BOOTAGGR_OPTIONS="--hwtpm"
|
||||
ASCII_RUNTIME_MEASUREMENTS="/sys/kernel/security/ima/ascii_runtime_measurements"
|
||||
if [ ! -d "/sys/kernel/security/ima" ]; then
|
||||
echo "${CYAN}SKIP: CONFIG_IMA not enabled${NORM}"
|
||||
@ -194,4 +197,4 @@ if [ "$(id -u)" != 0 ] || [ ! -c "/dev/tpm0" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
expect_pass check
|
||||
expect_pass check $BOOTAGGR_OPTIONS
|
||||
|
Reference in New Issue
Block a user