-
Notifications
You must be signed in to change notification settings - Fork 58
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
Conversation
db2ae9a
to
b19c421
Compare
Signed-off-by: Lily Sturmann <[email protected]> Co-authored-by: Patrick Uiterwijk <[email protected]>
@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! |
// 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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this 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!
Fixes #192
Also fixes #194 with many thanks to @puiterwijk for debugging
### Please start with reviewing this PR before the others!