-
Notifications
You must be signed in to change notification settings - Fork 45
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
[Feedback] Function tr_from_tpmpublic is not easy enough to discover #298
Comments
tpm2_readpublic can make sensible assumptions about it's arguments , I don't think we can using ESAPI.
I'm not able to reproduce this issue, which version/from which commit are you using? Also could you try: from tpm2_pytss.internal import type_mapping If it's OK, you should not get an error.
I think adding some examples would be better (outside the method documentation that is.
While we don't have any tests using tr_from_tpmpublic for a NV index, there is test_evict_control in test/test_esapi.py |
All right,
I reported the issue in another GitHub issue (#299), which was fixed in #300.
Great!
I can work on extending a test using NV index (such as |
In order to read a NV index from a "TPM index", the function `tr_from_tpmpublic` needs to be used first. Add such a use-case in the test suite. This was discussed in tpm2-software#298. Signed-off-by: Nicolas Iooss <[email protected]>
Hello,
Here is some feedback about what it felt like to use tpm2-pytss 1.0.0-rc0 to perform operations such as reading a SRK or a NV index. Let's start with trying to read a Storage Root Key stored at
0x81000000
. In a shell, this is easy:But with tpm2-pytss, this is not as straightforward:
Reading the documentation of
read_public
does not help. And it is actually wrong!tpm2-pytss/tpm2_pytss/ESAPI.py
Lines 888 to 907 in f79d3be
This documentation describes args
in_private
andin_public
, which do not exist, and does not describeobject_handle
.After more research, I discovered that tpm2-tss uses internal resource handlers and that
tr_from_tpmpublic
can be used to map a TPM handle to such a resource:The
type
andobjectAttributes
field contain wrong values (and I do not know why, but my intuition tells me this feels like a use-after-free issue) but I managed to recover my SRK in Python.On the same TPM, I also have an EK certificate stored at NV index
0x01c00002
. To read it usingectx.nv_read_public
andectx.nv_read
, I also needed to callectx.tr_from_tpmpublic(0x01c00002)
first.How are users of tpm2-pytss expected to discover they need to call
tr_from_tpmpublic
(andtr_close
) when using objects through TPM handles? Currently neither the code, the documentation nor the tests contain references to these use-cases, which seem natural for people coming from tpm2-tools.I suggest adding some words about this use-case in the documentation of functions
read_public
andnv_read_public
(and maybe in everynv_...
function too), such as:I also suggest adding a test case which defines a SRK at a defined handle (such as
0x81000000
) and reads it usingectx.tr_from_tpmpublic
, and another one which does the same with a NV index. What do you think?The text was updated successfully, but these errors were encountered: