parallaxsecond / rust-tss-esapi

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

Non sized buffers are not checked for exact size. #485

Open Superhepper opened 8 months ago

Superhepper commented 8 months ago

The sized buffers are TPM2B types which can contain data of different length (such as TPM2B_NAME or TPM2B_DIGEST). The current macro handles them well by checking that when the native type is created the size of the data does not exceed the maximum size.

But for other buffer types (such as TPM2B_SENSITIVE_DATA) they usually have a fixed size so the macro that creates them should probably behave differently by checking that the size of the data equals the expected size and if it does not it is an error.