[PATCH ima-evm-utils 2/3] Don't run tsspcrread on systems without TPM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



as we don't have any algorithm:

./src/evmctl ima_boot_aggregate
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `tsspcrread -halg (null) -ha 0 -ns 2> /dev/null'
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `tsspcrread -halg (null) -ha 0 -ns 2> /dev/null'
errno: No such file or directory (2)

Now it just prints:
errno: No such file or directory (2)

Fixes: dc00c92 ("ima-evm-utils: calculate the per TPM bank
boot_aggregate")

Signed-off-by: Petr Vorel <pvorel@xxxxxxx>
---
Hi Mimi,

not really sure if this is a best place to handle the problem.

Kind regards,
Petr

 src/evmctl.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/evmctl.c b/src/evmctl.c
index 94ec56b..03eeb6e 100644
--- a/src/evmctl.c
+++ b/src/evmctl.c
@@ -1796,6 +1796,12 @@ static int read_tpm_banks(int num_banks, struct tpm_bank_info *bank)
 	for (i = 0; i < num_banks; i++) {
 		err = 0;
 		for (j = 0; j < NUM_PCRS && !err; j++) {
+			if (!bank[i].algo_name) {
+				log_debug("No algo_name for PCR: %d\n", i);
+				bank[i].supported = 0;
+				continue;
+			}
+
 			err = tpm2_pcr_read(bank[i].algo_name, j,
 					    bank[i].pcr[j], bank[i].digest_size,
 					    &errmsg);
-- 
2.27.0




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux