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