Rust bindings #3
Open
josephlr wants to merge 2 commits into
Open
Conversation
crocomegan
reviewed
May 15, 2026
Collaborator
crocomegan
left a comment
There was a problem hiding this comment.
Overall, the changes LGTM. A few architectural thoughts:
- Since our ultimate goal is to phase out the C FFIs in favor of native Rust functions, we should avoid calling ExecuteCommand() with raw pointers directly in the long term. Instead, we should introduce a Rust dispatcher (shim wrapper). The wrapper will route commands to our Rust logic as it gets implemented while gracefully falling back to the legacy C FFIs for unimplemented paths.
- Ideally we want more Rust code in tpm-rs. I would recommend adding the Rust dispatcher and these high-level traits defined in platform.rs directly into the tpm-rs repo.
- In that case, I would also like to see more integration tests added to the tpm-rs repo instead of the tests/basic.rs.
Signed-off-by: Joe Richey <joerichey@google.com>
Member
Author
Agreed. However, the wrapper should live in
Agreed, moved everything into a single
Agreed, removed all tests except a linking-based test in |
Signed-off-by: Joe Richey <joerichey@google.com>
crocomegan
approved these changes
May 22, 2026
|
|
||
| pub use platform::*; | ||
|
|
||
| pub const MAX_RESPONSE_SIZE: u32 = 0x1000 - 0x80; |
Collaborator
There was a problem hiding this comment.
Can you add a comment about how this is calculated. Or we can also extern this value from C (if any).
crocomegan
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This uses 5
extern "C"entrypoint functions and a singlePlatformtrait to bind the the reference C code.TODO: Add instructions on publishing crate.