missing Name for 'SignHandle' parameter
- Dominant language
- Go
- Stars
- 673
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
Description
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](https://github.com/google/go-tpm/blob/main/tpm2/structures.go#L133) to the include `TPMIDHSavedTransientClear` in the Empty Buffer return, the error goes away and the service runs as expected.
```
func (h TPMHandle) KnownName() *TPM2BName {
switch (TPMHT)(h >> 24) {
case TPMHTPCR, TPMHTHMACSession, TPMHTPolicySession, TPMHTPermanent:
result := make([]byte, 4)
binary.BigEndian.PutUint32(result, h.HandleValue())
return &TPM2BName{Buffer: result}
case TPMHTTransient:
// The Name of a sequence object is an Empty Buffer
// See part 1: Architecture, section 32.4.5
if h == TPMIDHSavedSequence || h == TPMIDHSavedTransientClear {
return &TPM2BName{
Buffer: []byte{},
}
}
}
return nil
}
```
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?
Contributor guide
Research direction
Start with tpm2/tpm_test.go at line 59 and tpm2/tpm.go at line 1081, then inspect KnownName in tpm2/structures.go. Run the attestor and verifier with make attestor and make verifier, and compare the remote call with the unit-test path. Done means determining the correct handling of TPMIDHSavedTransientClear and documenting or testing the cause of the differing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, grpc
- Domain
- api, backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100