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

Feature Request: Decode TIS streams #25

Closed
SharkOverBite opened this issue Jul 16, 2024 · 2 comments
Closed

Feature Request: Decode TIS streams #25

SharkOverBite opened this issue Jul 16, 2024 · 2 comments

Comments

@SharkOverBite
Copy link

SharkOverBite commented Jul 16, 2024

While playing with low-level code for interacting with the TPM, I found it useful to sniff the on-the-wire traffic sent via tpm2_* commands to the TPM. It's sometimes much easier to figure out what goes where that way, then by decrypting the specification. There also other applications where having this capability would be useful (such as reverse engineering and security research).

However, on the bus, the byte stream is not a pure CommandResponseStream, but also includes the communication interface between the host and the TPM. The spec supports both TIS (which my chip uses, over SPI) and CRB. TIS is basically a small register interface which is used to communicate the number of bytes which can be written/read from the fifo - the bytes which constitute the actual CommandResponseStream.

Extracting the stream from TIS isn't particularly difficult (you just need to isolate all writes and reads to the register address which represents the FIFO), but it can be laborious and somewhat useless. It seems like something tpmstream should quietly handle on my behalf.

If you're amenable, I'm more than happy to provide some sample captures for devel and testing.

The Spec is TCG PC Client-Specific TPM Interface Specification (TIS).

(*) TIS itself can be layered on top of several possible physical bus types - SPI, LPC (and perhaps I2C). SPI is all I have experience with and what I care about. There may be some protocol details which differ from one to another (such as how flow control works).

@joholl
Copy link
Owner

joholl commented Aug 20, 2024

I feel you, been there, done that.

I don't think tpmstream is the right tool for the job. However, sigrok (a logic analyser framework) has a decoder for TIS based on SPI and I2C - it's just not merged yet.

sigrokproject/libsigrokdecode#88

If you want to use sigrok and your logic analyzer is supported, I encourage you to give it a try. As a UI, I recommend PulseView. You should be able to just add the decoder scripts before starting sigrok/PulseView.

@SharkOverBite
Copy link
Author

Thank you, that'll be very useful.

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