* [PATCH v5 0/2] add sysfs exports for TPM 2 PCR registers
@ 2021-01-13 23:18 James Bottomley
0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2021-01-13 23:18 UTC (permalink / raw)
To: linux-integrity; +Cc: Mimi Zohar, Jarkko Sakkinen, linux-api
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v5 0/2] add sysfs exports for TPM 2 PCR registers
@ 2021-01-13 23:26 James Bottomley
0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2021-01-13 23:26 UTC (permalink / raw)
To: linux-integrity; +Cc: Mimi Zohar, Jarkko Sakkinen, linux-api
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-14 2:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-13 23:18 [PATCH v5 0/2] add sysfs exports for TPM 2 PCR registers James Bottomley
2021-01-13 23:26 James Bottomley
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.