parallaxsecond / rust-tss-esapi

TSS 2.0 Enhanced System API (ESAPI) Rust wrapper
https://docs.rs/tss-esapi/
Apache License 2.0
90 stars 53 forks source link

Add marshaling/unmarshaling methods for types that support it #291

Open ionut-arm opened 3 years ago

ionut-arm commented 3 years ago

As mentioned here and here, it would be useful to have types on the interface of, for example, Public to marshal and unmarshal the underlying FFI type (e.g. TPM2B_PUBLIC). This would allow data to be moved between different machines that need to work with the same TPM-specific data structures.

These methods would defer to Tss2_MU_... functions exposed by the tss2-mu library (for which you can see the spec here), and so we can implement them for the types supported by this spec:

I expect these new methods to simply be extensions of the existing types, so adding them won't break the API.

Superhepper commented 3 years ago

In #293 I added traits for this that I also implemented for the Attest type in order to make things easier if one wishes to make a generic function for types that can be marshalled or unmarshalled.