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

Add marshaling functions for TPM structs #193

Merged
merged 1 commit into from
Jun 14, 2021
Merged

Conversation

lkatalin
Copy link
Contributor

@lkatalin lkatalin commented May 13, 2021

Fixes #192
Also fixes #194 with many thanks to @puiterwijk for debugging

### Please start with reviewing this PR before the others!

Signed-off-by: Lily Sturmann <[email protected]>
Co-authored-by: Patrick Uiterwijk <[email protected]>
@lkatalin lkatalin marked this pull request as ready for review June 7, 2021 14:44
@lkatalin
Copy link
Contributor Author

lkatalin commented Jun 7, 2021

@lukehinds @puiterwijk @ashcrow Not sure if this will ping you since it's been open for a while, but switched from draft because it's ready for review whenever someone has a few moments. Thanks!

@lkatalin lkatalin mentioned this pull request Jun 7, 2021
1 task
// Functions can be created using the following form:
// create_marshal_fn!(name_of_function_to_create, struct_to_be_marshaled, marshaling_function);
//
create_marshal_fn!(pub_to_vec, TPM2B_PUBLIC, Tss2_MU_TPM2B_PUBLIC_Marshal);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confuse myself with macros. Is create_marshal_fn creating pub_to_vec which is used later?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashcrow Yeah, exactly - there are slightly different functions that all have the same basic structure. In all of the functions, some struct TPM2B_something needs to be turned into a vector and has a corresponding marshaling function. The macro can create all of these functions without replicating a bunch of code with only slight variations.

pub_to_vec and the other functions created here are used in the next PR on top of this one.

Copy link
Contributor

@ashcrow ashcrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me!

@lkatalin lkatalin merged commit 158566f into keylime:master Jun 14, 2021
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

Successfully merging this pull request may close these issues.

PCR output file is incorrect Rewrite TPM marshaling functions as macros
4 participants