On Tue, Aug 18, 2020 at 07:26:30PM +0300, Jarkko Sakkinen wrote: > On Tue, Aug 18, 2020 at 07:19:57PM +0300, Jarkko Sakkinen wrote: > > On Tue, Aug 18, 2020 at 07:12:09PM +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. > > > > > > > > Signed-off-by: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> > > > > Reviewed-by: Jerry Snitselaar <jsnitsel@xxxxxxxxxx> > > > > Tested-by: Thiago Jung Bauermann <bauerman@xxxxxxxxxxxxx> > > > > > > I have hard time understanding why this is required. > > > > > > You can grab the information through /dev/tpm0 just fine. > > > > I just think it is principally wrong to add sysfs files if they don't > > have any measurable value other than perhaps some convenience. > > > > It is trival to write only a libc dependent program that outputs PCRs. > > > > I think this is essentially an user space problem that is getting sorted > > out with kernel code. > > Jason, what do you make of this? I recall that it was you who I > discussed with about this topic when TPM 2.0 support was first > upstreamed. TPM 2.0 broke all the userspace so it made sense to get rid of the non-conforming sysfs files from TPM v1.x time as part of the userspace API. That was the main reason to not continue forward with PCR in userspace. As far as doing it properly as this patch does.. I agree with you that sysfs files should have some reason to be added, espcially if it causes quite big code cost as this does. eg to drive a udev rule decision. Why is PCRs so special it needs to be in sysfs? What is userspace going to do with this information? Jason