Skip to content

DICE: measure the first block of flash mapped at address 0 - #1008

Open
kojo1 wants to merge 3 commits into
wolfSSL:masterfrom
kojo1:measure-flash
Open

kojo1 wants to merge 3 commits into
wolfSSL:masterfrom
kojo1:measure-flash

Conversation

@kojo1

@kojo1 kojo1 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

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.

Copilot AI balanced review requested due to automatic review settings November 30, 2026 00:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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

Comment thread src/dice/dice.c Resolved
Comment thread src/dice/dice.c Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block the fix for DICE measurement on targets with flash mapped at address zero.

1 open issue
1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the fix to include address-zero flash data in DICE measurements.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

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.

2 participants