ESP32: RSA, SHA fixes#5592
Conversation
|
/hil full --test crypto |
|
I will reorganize the tests in a later PR to prevent similar issues, this PR is minimal for backporting reasons. |
|
Triggered full HIL run for #5592. Run: https://github.com/esp-rs/esp-hal/actions/runs/26277245978 Status update: ❌ HIL (full) run failed (conclusion: failure). |
There was a problem hiding this comment.
Pull request overview
This PR addresses incorrect multi-block SHA digests on ESP32 by ensuring the SHA peripheral is not powered down between work-queue operations when a digest context relies on the hardware’s internal state (since ESP32 can’t restore saved hash state). It also adjusts the SHA HIL test to avoid holding the SHA peripheral resources in a way that could mask the bug.
Changes:
- ESP32: introduce an
Esp32Hasherwrapper so a hardware-backed context holds aGenericPeripheralGuardto keep SHA powered while the context is alive. - ESP32: update
ShaContextto useEsp32Hasher(hardware vs software fallback) and gate update/finalize accordingly. - HIL test: drop the
Shadriver from the testContextbefore starting aShaBackend, allowing the backend to manage peripheral resources.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
esp-hal/src/sha.rs |
Adds an ESP32-specific hasher wrapper that keeps the SHA peripheral clock enabled for hardware-backed contexts to preserve internal hash state across operations. |
hil-test/src/bin/crypto/sha.rs |
Drops the Sha driver in the interleaving test to ensure the backend can release/acquire SHA resources as intended during the test. |
|
/hil esp32 --test crypto |
|
Triggered HIL run for #5592 (chips: esp32). Run: https://github.com/esp-rs/esp-hal/actions/runs/26443574290 Status update: ✅ HIL (per-chip) run succeeded. |
|
Created backport PR for
Please cherry-pick the changes locally and resolve any conflicts. git fetch origin backport-5592-to-esp-hal-1.1.x
git worktree add --checkout .worktree/backport-5592-to-esp-hal-1.1.x backport-5592-to-esp-hal-1.1.x
cd .worktree/backport-5592-to-esp-hal-1.1.x
git reset --hard HEAD^
git cherry-pick -x 72d44d0721677f07b35bcdcb716943f56e7b66f6
git push --force-with-lease |
* Prevent ESP32 SHA powering down mid-operation * Only clear HW accelerator flag if the hardware-using context is dropped * Rename field * Fix RSA on ESP32 * Allow large enum variant lint
Fixes #5584 and applies #5443 for ESP32 as well
Changelog
esp-hal/SHA
esp-hal/RSA