parallaxsecond / rust-tss-esapi

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

Incorrect handling of FFI `size_t` in marshalling and unmarshalling trait implementation. #469

Closed Superhepper closed 9 months ago

Superhepper commented 10 months ago

For the Linux and MacOS systems it seems as the generated bindgen code defines size_t = std::os::raw::c_ulong. But this is not something that can be taken for granted because size_t in C is an implementation defined typedef, so it will be dependant on the compiler what it is defined as. When generating bindings on windows (MSVC) as an example it dets defined as size_t = std::os::raw::c_ulonglong. I think it would be better to expose usize to the user and do all the conversion handling internally.