ivila opened a new pull request, #340: URL: https://github.com/apache/teaclave-trustzone-sdk/pull/340
The old Time struct was a plain Rust value with public seconds and millis fields, and every clock helper cast &mut Time directly to *mut TEE_Time. That assumed the Rust layout matched the C TEE_Time layout without any #[repr(C)] guarantee, so a layout change could make the FFI calls read or write the wrong offsets. The public fields also allowed millis >= 1000, and the &mut out-parameter style plus the raw u32 timeout made the API easy to misuse. Model Time as a #[repr(transparent)] wrapper around TEE_Time with private fields and a checked from_parts constructor. Expose seconds(), millis() and total_millis(), replace the in-place clock methods with now(), ree_now() and ta_now(), and pass the inner TEE_Time directly to the C functions. Add checked_add/checked_sub/duration_since and split waiting into wait(Option<Duration>) and wait_millis(u32) so the infinite sentinel is not a raw magic value. Update rustls_provider and the client_pool/time examples to the new API, and add tests for the millis invariant, arithmetic boundaries, clock reads, TEE error propagation, and timeout mapping. Update the time example's serial-output check for the new Display format. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
