From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-integrity@vger.kernel.org, Mimi Zohar <zohar@linux.ibm.com>
Subject: Re: [PATCH v4 1/1] tpm: add sysfs exports for all banks of PCR registers
Date: Tue, 15 Sep 2020 14:22:06 +0300 [thread overview]
Message-ID: <20200915112206.GA896555@linux.intel.com> (raw)
In-Reply-To: <1600111168.4061.15.camel@HansenPartnership.com>
On Mon, Sep 14, 2020 at 12:19:28PM -0700, James Bottomley wrote:
> On Mon, 2020-09-14 at 20:41 +0300, Jarkko Sakkinen wrote:
> > On Mon, Aug 17, 2020 at 02:35:06PM -0700, James Bottomley wrote:
> > > Create sysfs per hash groups with 24 PCR files in them one group,
> > > named pcr-<hash>, for each agile hash of the TPM. The files are
> > > plugged in to a PCR read function which is TPM version agnostic, so
> > > this works also for TPM 1.2 but the hash is only sha1 in that case.
> > >
> > > Note: the macros used to create the hashes emit spurious checkpatch
> > > warnings. Do not try to "fix" them as checkpatch recommends,
> > > otherwise
> > > they'll break.
> >
> > "PCR access is required because IMA tools should be able to run
> > without any sort of TSS dependencies."
> >
> > AFAIK, this is the only reason to merge this and it is missing from
> > the description. Perhaps you could either include that sentence, or
> > alternatively write something along the lines?
>
> Sure, I'll add all of them: it's IMA tools, early boot and key locking
> to PCR policy.
Great!
> > > Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.c
> > > om>
> > > Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
> > > Tested-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
> >
> > Please also cc this at least to Greg and Jason Gunthorpe next time.
>
> OK
>
> [...]
>
> > >
> > enum tpm_alg_misc {
> > TPM_ALG_ERROR = 0x0000,
> > TPM_ALG_KEYEDHASH = 0x0008,
> > TPM_ALG_NULL = 0x0010,
> > }
> >
> > enum tpm_alg_hash {
> > TPM_ALG_SHA1 = 0x0004,
> > TPM_ALG_SHA256 = 0x000B,
> > TPM_ALG_SHA384 = 0x000C,
> > TPM_ALG_SHA512 = 0x000D,
> > TPM_ALG_SM3_256 = 0x0012,
> > TPM_ALG_HASH_MAX,
> > };
>
> I can separate them if you insist, but the latter construction won't
> work. TPM_ALG_HASH_MAX will get set to the previous value plus one.
>
> You can see this with the test programme:
>
> ---
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
>
> enum tpm_alg_hash {
> TPM_ALG_SHA1 = 0x0004,
> TPM_ALG_SHA256 = 0x000B,
> TPM_ALG_SHA384 = 0x000C,
> TPM_ALG_SHA512 = 0x000D,
> TPM_ALG_SM3_256 = 0x0012,
> TPM_ALG_HASH_MAX,
> };
>
> int main()
> {
> printf("TPM_ALG_HASH_MAX = %d\n", TPM_ALG_HASH_MAX);
> }
> ---
>
> Which gives
>
> jejb@jarvis> ./a.out
> TPM_ALG_HASH_MAX = 19
>
> Which is clearly the wrong value (it's 0x12 + 1).
>
> That being so, is there any reason to separate up the algorithms enum?
>
> James
No, my bad.
/Jarkko
next prev parent reply other threads:[~2020-09-15 11:24 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-17 21:35 [PATCH v4 0/1] add sysfs exports for TPM 2 PCR registers James Bottomley
2020-08-17 21:35 ` [PATCH v4 1/1] tpm: add sysfs exports for all banks of " James Bottomley
2020-08-18 16:12 ` Jarkko Sakkinen
2020-08-18 16:19 ` Jarkko Sakkinen
2020-08-18 16:26 ` Jarkko Sakkinen
2020-08-18 16:46 ` Jason Gunthorpe
2020-08-18 18:26 ` Mimi Zohar
2020-08-18 18:36 ` Jason Gunthorpe
2020-08-18 18:55 ` Mimi Zohar
2020-08-19 12:02 ` Jason Gunthorpe
2020-08-19 13:27 ` Mimi Zohar
2020-08-19 14:09 ` Jason Gunthorpe
2020-08-19 14:53 ` Mimi Zohar
2020-08-19 14:55 ` Mimi Zohar
2020-08-19 22:16 ` Jarkko Sakkinen
2020-08-19 22:48 ` Jerry Snitselaar
2020-08-19 23:26 ` Jason Gunthorpe
2020-08-20 15:46 ` Jarkko Sakkinen
2020-08-19 14:56 ` Serge E. Hallyn
2020-08-19 22:15 ` Jarkko Sakkinen
2020-08-19 15:17 ` James Bottomley
2020-08-19 16:18 ` Jason Gunthorpe
2020-08-19 16:57 ` Mimi Zohar
2020-08-19 17:17 ` Jason Gunthorpe
2020-08-19 20:09 ` James Bottomley
2020-08-19 23:21 ` Jason Gunthorpe
2020-08-20 16:14 ` James Bottomley
2020-08-20 16:55 ` Serge E. Hallyn
2020-08-21 17:41 ` Jarkko Sakkinen
2020-08-21 19:38 ` Jason Gunthorpe
2020-08-24 19:44 ` Jarkko Sakkinen
2020-08-24 20:20 ` James Bottomley
2020-08-25 15:27 ` Jarkko Sakkinen
2020-08-25 15:33 ` James Bottomley
2020-08-26 13:15 ` Jarkko Sakkinen
2020-08-26 13:19 ` Jarkko Sakkinen
2020-08-24 21:57 ` Jason Gunthorpe
2020-08-19 22:14 ` Jarkko Sakkinen
2020-08-18 19:03 ` James Bottomley
2020-08-19 22:13 ` Jarkko Sakkinen
2020-08-19 22:01 ` Jarkko Sakkinen
2020-08-18 16:44 ` James Bottomley
2020-08-18 17:17 ` Jason Gunthorpe
2020-08-18 18:49 ` James Bottomley
2020-08-19 21:53 ` Jarkko Sakkinen
2020-08-19 22:46 ` James Bottomley
2020-08-20 15:22 ` Jarkko Sakkinen
2020-08-19 21:33 ` Jarkko Sakkinen
2020-09-14 17:41 ` Jarkko Sakkinen
2020-09-14 19:19 ` James Bottomley
2020-09-15 11:22 ` Jarkko Sakkinen [this message]
2020-10-08 11:45 ` Petr Vorel
2020-10-08 14:29 ` James Bottomley
2020-10-09 16:12 ` Jarkko Sakkinen
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=20200915112206.GA896555@linux.intel.com \
--to=jarkko.sakkinen@linux.intel.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-integrity@vger.kernel.org \
--cc=zohar@linux.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.