Linux Integrity Measurement development
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Stefan Berger <stefanb@linux.ibm.com>,
	Tergel Myanganbayar <tergel@linux.ibm.com>,
	linux-integrity@vger.kernel.org
Cc: Petr Vorel <pvorel@suse.cz>,
	Tergel Myanganbayar <tergel@u.northwestern.edu>
Subject: Re: [PATCH ima-evm-utils] add support for reading per bank TPM 2.0 PCRs via sysfs
Date: Sun, 04 Sep 2022 13:08:36 -0400	[thread overview]
Message-ID: <fb1c4b0e77398d53c8ca06b869ccabb4d66c33a9.camel@linux.ibm.com> (raw)
In-Reply-To: <57e1b104-e1bf-de17-3567-6bb148047403@linux.ibm.com>

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


      reply	other threads:[~2022-09-04 17:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 23:08 [PATCH ima-evm-utils] add support for reading per bank TPM 2.0 PCRs via sysfs Tergel Myanganbayar
2022-09-03  1:54 ` Stefan Berger
2022-09-04 17:08   ` Mimi Zohar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb1c4b0e77398d53c8ca06b869ccabb4d66c33a9.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=pvorel@suse.cz \
    --cc=stefanb@linux.ibm.com \
    --cc=tergel@linux.ibm.com \
    --cc=tergel@u.northwestern.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox