Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delta update: check sha digest of base image #520

Merged
merged 3 commits into from
Nov 22, 2024

Conversation

danielinux
Copy link
Member

@danielinux danielinux commented Nov 21, 2024

Only allow delta update if the sha digest of the base image matches the expected value. This is to prevent the delta update from being applied to an image that is not the expected base image, even if the version matches.

The mismatch should never happen in real-life scenarios, but it is adviseable to check for false positives during integration, testing and development.

Only allow delta update if the sha digest of the base image matches the
expected value. This is to prevent the delta update from being applied
to an image that is not the expected base image, even if the version
matches.

The mismatch should never happen in real-life scenarios, but it is to check
for false positives during integration, testing and development.
return -1;
}
cur_v = wolfBoot_current_firmware_version();
upd_v = wolfBoot_update_firmware_version();
delta_base_v = wolfBoot_get_diffbase_version(PART_UPDATE);

if (delta_base_hash_sz != WOLFBOOT_SHA_DIGEST_SIZE) {
wolfBoot_printf("Delta update: Base hash size mismatch"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have some type of backwards compatibility when the delta_base_v is not found? Delta update: Base hash size mismatch (size: 0 expected 20)

git checkout master
git distclean
make distclean
cp config/examples/sim-delta-update.config .config
make -C tools/keytools && make -C tools/bin-assemble
make clean && make test-sim-internal-flash-with-delta-update
git checkout delta-base-hash
make wolfboot.elf
./wolfboot.elf update_trigger get_version
./wolfboot.elf success get_version

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Also added a (documented) option --no-base-sha for sign.
No SHA is not fatal now for wolfBoot.
Also added a test to prove that.

+ Added --no-base-sha option to sign
@danielinux danielinux requested a review from dgarske November 22, 2024 11:08
@dgarske dgarske merged commit 2cdc1f5 into wolfSSL:master Nov 22, 2024
101 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.

2 participants