Skip to content

Introduce plumbing traits rather than block-only algorithms#18

Merged
chrysn merged 3 commits intomainfrom
use-plumbing
Feb 10, 2026
Merged

Introduce plumbing traits rather than block-only algorithms#18
chrysn merged 3 commits intomainfrom
use-plumbing

Conversation

@chrysn
Copy link
Member

@chrysn chrysn commented Jan 23, 2026

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.

@chrysn chrysn requested a review from WilliamTakeshi January 23, 2026 09:34
Copy link
Collaborator

@jschneider-bensch jschneider-bensch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator

@WilliamTakeshi WilliamTakeshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@chrysn chrysn merged commit cdd218c into main Feb 10, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants