Open jeremyhahn opened 5 months ago
Thanks for filing this @jeremyhahn! I suspect you've found an edge-case in object naming that's not handled well by KnownName
. Let me see if I can reproduce your error and come to a working theory of the issue.
Is your device/TPM undergoing any type of power state transition?
The tests are using the simulator but I get the same error on a real TPM. No power state transitions.
@jeremyhahn you may have been seeing a false positive in the test related to #370.
In your example you need to use a NamedHandle
or AuthHandle
to provide the Name
because CreateLoadedResponse
returns a transient handle, which means that the Name
is calculated and not known based on the Most Significant Octet of the handle. Since it is calculated (Part 1 Architecture Section 16 Table 3) you must provide it from the response, hence the CreateLoadedResponse.Name
field.
I'm running into strange behavior. I'm getting this error when I invoke my remote attestation process via grpc to issue a quote, but when I run the same method the grpc service is calling via a unit test, it passes without the error.
The test is here: https://github.com/jeremyhahn/go-trusted-platform/blob/fdcdbf0f626afb7c9a80311fbdcd2ccb3bcb3a55/tpm2/tpm_test.go#L59
The quote method is here: https://github.com/jeremyhahn/go-trusted-platform/blob/fdcdbf0f626afb7c9a80311fbdcd2ccb3bcb3a55/tpm2/tpm.go#L1081
To run the remote attestation service, from the project root:
Attestor
make attestor
Verifier
make verifier
Verifier log:
rpc error: code = Unknown desc = missing Name for 'SignHandle' parameter
If I change the KnownName() method in tpm2/structures.go to the include
TPMIDHSavedTransientClear
in the Empty Buffer return, the error goes away and the service runs as expected.I'm just getting my feet wet with the tpm2 library and don't fully understand the implications of this change. It appears this code is intentionally ignoring transient handles with the stClear attribute set (which seems to make sense). I've scoured the internet and TCG docs trying to find anything that specifies whether the stClear attribute should also default to an Empty Buffer but I haven't had any luck.
Is this a bug in the KnownName method that needs to be fixed or am I barking up the wrong tree? Any insights into why the code works fine in the unit tests but fails during the grpc calls?