Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading command invocation nvram.md/sealing #22

Open
SharkOverBite opened this issue Jul 1, 2024 · 5 comments
Open

Misleading command invocation nvram.md/sealing #22

SharkOverBite opened this issue Jul 1, 2024 · 5 comments

Comments

@SharkOverBite
Copy link

SharkOverBite commented Jul 1, 2024

The "Sealing" section of nvram.md demonstrates the following command sequence:

$ tpm2_pcrread -o srtm.pcrvalues sha256:0,1,2,3
$ tpm2_createpolicy --policy-pcr -l sha256:0,1,2,3 -f srtm.pcrvalues -L srtm.policy
$ tpm2_nvdefine 0x1500019 -C o -s 32 -L srtm.policy -a "policyread|policywrite"
$ tpm2_nvwrite 0x1500019 -C 0x1500019 -P pcr:sha256:0,1,2,3=srtm.pcrvalues -i testfile
$ tpm2_nvread 0x1500019 -C 0x1500019 -P pcr:sha256:0,1,2,3=srtm.pcrvalues 

You don't have to provide a file for tpm2_createpolicy, it will implicitly use the current values of the specified PCRs.
But you show a more general case, and that's fine.

However, the inclusion of "=srtm.pcrvalues" in arguments for the last two tpm2_nvwrite and tpm2_nvread commands is totally bogus,
and arguably should raise an error from the tpm2-tools parser. Obviously, when invoking those commands with a PCR policy, the contents of that are irrelevant. The source of the PCR values is (and must be) only the current state of the specified PCRs, on the device.

@iolivergithub
Copy link
Collaborator

iolivergithub commented Jul 1, 2024 via email

@SharkOverBite
Copy link
Author

SharkOverBite commented Jul 1, 2024

I understand. There's still, after all these years, a great lack of good, well-written (I can't bold that enough), procedural documentation about TPM. This one is better than most, though quite focused on attestation use-cases (which I care less about).

I have verified that the commands work without specifying the file (as logically, they must - what are the semantics of attaching the file??). Since I've opened an issue on tpm2-tools, we'll have to see what they have to say about it.

Good luck with the book (when and if). If it's well-written, I'd love to read it.

@iolivergithub
Copy link
Collaborator

iolivergithub commented Jul 1, 2024 via email

@SharkOverBite
Copy link
Author

SharkOverBite commented Jul 2, 2024

Looking forward to the fruits of your many labors. 👍

@SharkOverBite
Copy link
Author

tpm2-software/tpm2-tools say I'm wrong, that it's not an error but an optimization which supposedly saves another step by the device IIUC. I don't understand their response to be honest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants