Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new tests do not exercise the address-zero regression, and hash update or finalization failures leave initialized contexts without cleanup.
2 open issues
What changed in this PR
This PR corrects DICE measurement of wolfBoot when flash starts at address zero, so the first block is included in the digest.
Changes:
- Copies the address-zero block into a temporary buffer before hashing.
- Checks hash initialization, update, and finalization results.
- Adds host-array tests for whole-region hashing, partial final blocks, and first-byte changes.
| File | Description |
|---|---|
tools/unit-tests/unit-dice-measure.c |
Adds measurement tests using a host-array flash fixture. |
tools/unit-tests/Makefile |
Registers and builds the new measurement test. |
src/dice/dice.c |
Handles address-zero input and propagates hash failures. |
Review effort: Balanced
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.

wolfboot_hash_region() passes the flash address as the buffer pointer on
memory-mapped flash. With ARCH_FLASH_OFFSET=0x0 the first block's pointer is NULL; wc_Sha*Update() rejects it and its return value was not checked, so the first
WOLFBOOT_SHA_BLOCK_SIZE bytes were silently left out of the wolfBoot
measurement.