Closed Superhepper closed 7 months ago
Yes you understand it correctly.
Calculating the size for versions >= 4.0.0 is just using the way that the specification says it should be done.
11.1.14 TPM2B_SENSITIVE_DATA
This buffer wraps the TPMU_SENSITIVE_CREATE structure.
Parameter Type Description size UINT16 buffer[size]{: sizeof(TPMU_SENSITIVE_CREATE)} BYTE symmetric data for a created object or the label and context for a derived object
But in earlier versions that structure is not available so it will be manually calculated by removing the size of the size variable.
Actually using the buffer macro for TPM2B types that are not sized buffers is not great. Because for other types the size is fixed and any other size then the specified one should be an error while for sized buffers the size just needs to be lower or equal to the max size.
Thanks for the explainer. I think it's worth having your knowledge captured in some persistent media (like a comment here). 🙇♂️
Thanks for the explainer. I think it's worth having your knowledge captured in some persistent media (like a comment here). 🙇♂️
Fixed it. Added a comment that summarize what I wrote above.
@ionut-arm Could you please have a look at this as well.
This fixes #481