Re: [PATCH ima-evm-utils] add support for reading per bank TPM 2.0 PCRs via sysfs

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

 



On Fri, 2022-09-02 at 21:54 -0400, Stefan Berger wrote:

> > +static int read_tpm2_one_bank(struct tpm_bank_info *tpm_bank, int bank)
> > +{
> > +	FILE *fp;
> > +	char file_name[NAME_MAX];
> > +	char digest[MAX_DIGEST_SIZE + 1];
> > +	char *p;
> > +	int i;
> > +
> > +	for (i = 0; i < NUM_PCRS; i++) {
> > +		sprintf(file_name, "%s%d/%d", tpm2_pcr_path, bank, i);
> 
> ... and just write "/sys/class/tpm/tpm0/pcr-sha%d/%d" here ?

Thanks, Stefan.  Although the only banks currently supported are sha1
and sha256, let's not hard code the hash algorithm.   The tpm_bank_info
struct contains the algo_name.   With this change, there's no need for
the "banks[]" definition in read_sysfs_tpm2_pcrs() or passing it to
read_tpm2_one_bank().

-- 
thanks,

Mimi




[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