-
Notifications
You must be signed in to change notification settings - Fork 102
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
Conversation
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.
1edc78e
to
adb0204
Compare
src/update_flash.c
Outdated
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" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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.