From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: linux-integrity@vger.kernel.org
Cc: Mimi Zohar <zohar@linux.ibm.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
linux-api@vger.kernel.org
Subject: [PATCH v5 0/2] add sysfs exports for TPM 2 PCR registers
Date: Wed, 13 Jan 2021 15:26:32 -0800 [thread overview]
Message-ID: <20210113232634.23242-1-James.Bottomley@HansenPartnership.com> (raw)
This represents v5 which has the spelling mistake fixed and the WARN
on unrecognized TPM hash algorithm becoming a dev_err.
We've had a fairly extensive discussion and iterated to agreement on
the output format, which becomes our ABI being one single compact hex
representation of the hash value per file according to sysfs rules,
with the file hierarchy going under
/sys/class/tpm/tmp<x>/pcr-<hash>/<pcr number>
So to get the value of PCR 7 in the sha256 bank of the default TPM I'd do
cat /sys/class/tpm/tpm0/pcr-sha256/7
2ED93F199692DC6788EFA6A1FE74514AB9760B2A6CEEAEF6C808C13E4ABB0D42
If you need the binary hash of a set of PCRs, as is required for TPM
policy statements that lock to PCRs, you'd use something like:
cat /sys/class/tpm/tpm0/pcr-sha256/{1,6,7}|xxd -r -p|sha256sum
Which produces the binary hash of PCRs 1, 6 and 7 in that order.
Note that this patch also adds the sha1 bank for TPM 1.2 in the same
manner (one file per PCR) but does not remove the existing pcrs file
which has the space separated all PCRs in one file format of
PCR-00: 7D 29 CB 08 0C 0F C4 16 7A 0E 9A F7 C6 D3 97 CD C1 21 A7 69
PCR-01: 9C B6 79 4C E4 4B 62 97 4C AB 55 13 1A 2F 7E AE 09 B3 30 BE
...
James
---
James Bottomley (2):
tpm: add sysfs exports for all banks of PCR registers
ABI: add sysfs description for tpm exports of PCR registers
Documentation/ABI/stable/sysfs-class-tpm | 14 ++
drivers/char/tpm/tpm-sysfs.c | 179 +++++++++++++++++++++++
include/linux/tpm.h | 9 +-
3 files changed, 201 insertions(+), 1 deletion(-)
--
2.26.2
next reply other threads:[~2021-01-14 1:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-13 23:26 James Bottomley [this message]
2021-01-13 23:26 ` [PATCH v5 1/2] tpm: add sysfs exports for all banks of PCR registers James Bottomley
2021-01-14 7:59 ` Greg KH
2021-01-15 0:21 ` James Bottomley
2021-01-15 6:55 ` Jarkko Sakkinen
2021-01-15 17:10 ` James Bottomley
2021-01-15 13:54 ` Greg KH
2021-01-15 17:26 ` James Bottomley
2021-01-15 18:07 ` James Bottomley
2021-01-15 20:48 ` Joe Perches
2021-01-15 21:06 ` James Bottomley
2021-01-15 21:14 ` Joe Perches
2021-01-15 20:32 ` Joe Perches
2021-01-15 6:48 ` Jarkko Sakkinen
2021-01-13 23:26 ` [PATCH v5 2/2] ABI: add sysfs description for tpm exports " James Bottomley
2021-01-15 6:40 ` Jarkko Sakkinen
-- strict thread matches above, loose matches on Subject: below --
2021-01-13 23:18 [PATCH v5 0/2] add sysfs exports for TPM 2 " James Bottomley
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=20210113232634.23242-1-James.Bottomley@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=jarkko@kernel.org \
--cc=linux-api@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).