-
Notifications
You must be signed in to change notification settings - Fork 58
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
Implement PCR Extend #120
Comments
as mentioned, you could set up a sandbox and just do this in your own we will need to think about captureing the return output. Previously we were marshalling this into YAML, but I don't know how we should approach this yet with the esapi create. We might need a helper function here to serialise output of calls to the tss, @puiterwijk will have some ideas here. |
Thanks for this clear write-up, @lukehinds . Edit: I made this small example and will implement the Python function next. |
@lukehinds The ESAPI |
Closing as this is implemented by the ESAPI and already used here. |
PCR Extend performs a hash extend operation into the TPM.
A PCR is a platform configuration register
Let’s explore PCRs a bit more.
A Platform Configuration Register is a value that can only be set by the TPM and is a recorded measurement of a system object (by object we could mean file, firmware, bootloader, kernel, etc).
One of the main functions of a PCR is the extend operation.
tpm2_pcrextend 10:sha256=b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c
The above command asks the TPM to extend the hash b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c into PCR 10
Each time an extend is made the following mathematical operation occurs:
PCR New Value = Digest of (PCR old value || data to extend)
Here is an example in python
This is a one way hash. A one-way hash function is designed in such a way that it is hard to reverse the process, that is, to find a string that hashes to a given value (hence the name one-way.) A hash function also makes it hard to find two strings that would produce the same hash value.
To play with this using the tools, first install the tools:
dnf install tpm2-tools
you can then use
tpm2_pcrread
to look at the valuesand extend it:
tpm2_pcrextend 10:sha256=b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae49abc
We will need to implement this as a function as can be seen in the python code
https://github.com/keylime/keylime/blob/1ef444e2c1f18815dde9826accc4e36da7ba3fd6/keylime/tpm/tpm2.py#L1151-L1155
To do this you can use the
pcrextend
function in the ESAPI wrapper here:https://github.com/parallaxsecond/rust-tss-esapi/blob/b74837ceb229a0010c05f6149efa65c4f41f9426/src/context.rs#L774
Check out the existing code to see how you can get a context in my PR #113
The text was updated successfully, but these errors were encountered: