-
Notifications
You must be signed in to change notification settings - Fork 44
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
Unmarshalling a complete TPM request/response #322
Comments
You need to unmarshal the command and then unmarshal the paramters. Their is no library support for this at the moment, but if you look at the C code in tpm2_send (tpm2-tools project), you'll see an example of breaking apart the command stream. FYI wireshark if you use the pcap TCTI can break this apart for you, but not the parameters. |
I looked inside the tpm2_send.c file, I guess you are talking about these function for example: tpm2_command_header_get_code, tpm2_command_header_get_tag, ....? If I understand correctly, my hexstream is basically like that: TPM2_HEADER | TPM2_PARAMETERS, right ? |
Yeah the beginning of every TPM command has a fixed length header, then the parameters. The command spec shows the layouts of the parameters and the header IIRC: https://trustedcomputinggroup.org/wp-content/uploads/TCG_TPM2_r1p59_Part3_Commands_pub.pdf |
For information, the format of the serialized commands is documented in "Trusted Platform Module Library Family "2.0" Specification - Part 3: Commands, Revision 1.38" specification available at https://trustedcomputinggroup.org/resource/tpm-library-specification/ For example For your information, in this table, the seperators between |
That's the piece I was missing, thanks @niooss-ledger and @williamcroberts ! |
@fer9898 i'd take a method for this in the python code where you give it a hex stream and returns all the pieces. |
Yeah it would be great, but I don't know if I can do this, as @niooss-ledger said
I didn't looked it up yet, but I guess there is a lot of cases to cover |
The header is common, and then the per-command data structures. But something like a command code to 'deserializing' map could be made. Just getting the framework started and then folks could help you populate that decoder map for all commands. |
Hello,
I got a question about this library:
Suppose I have a complete hexstream of a TPM request/response (let's say a TPM2_CREATE command), how can I do to unmarshal everything at once ? I know I can umarshall some bits of this hexstream separetly, but I don't know how can I do everything at once.
Here is an example of such hex stream:
In this hex stream I got multiple different structure, for example at the end I got a
TPM2B_SENSITIVE_CREATE
structure, is there a structure that is above all of them so I can umarshall in this type ?The text was updated successfully, but these errors were encountered: