Introduce plumbing traits rather than block-only algorithms#18
Merged
Conversation
Collaborator
jschneider-bensch
left a comment
There was a problem hiding this comment.
I think this looks good! Thanks for continuously updating the demo implementation as well, that really helps to get an idea of how the traits would be used.
I left some comments on docs.
WilliamTakeshi
approved these changes
Feb 6, 2026
Collaborator
WilliamTakeshi
left a comment
There was a problem hiding this comment.
Sorry for taking so long to review it. I was a bit busy last week.
It looks good to me! I think we can merge and them we can start implement some examples for a couple boards to see how it feels!
This is adjusted from the one suggested in [16]. [16]: #16
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.
From discussions around #16, it became apparent that the interface proposed isn't quite practical for the parties involved -- the software implementation feared having to go through too much runtime dispatch when it's clear at build time that (eg.) the block collection and padding code is specific to the SHA2 accelerator anyway, and the hardware implementations had constraints that that API couldn't express (eg. the weird 68-byte first block of some STM32s).
This is a 2nd go that aims to be easier.
There's some refactoring to be done here and there, including on the traits (like, where should there be witness types? and: should we really have all traits in one bundle, or have a plumbing::get_sha2() associated function that returns something fallible (a bit like
Option<&mut self)>) but using witnesses for positive and negative outcomes to make it dead-code-eliminatable), but that's just Rust API and optimization and shouldn't affect whether or not the API works out for linking hardware and formally verified software.