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

May decrypt the image header data when copy image data from the secondary to the primary slot #2030

Open
aaronpu opened this issue Aug 2, 2024 · 0 comments

Comments

@aaronpu
Copy link

aaronpu commented Aug 2, 2024

blk_sz = tlv_off - abs_off;

here maybe decrypt the image header data if the the size of image header is very short, for example.
in my test case ,i pack an encrypted image with the header size is 32 bytes, it will decrypt the header data ,and verify the decrypted image in the primary slot fail!.
https://github.com/mcu-tools/mcuboot/blob/v2.1.0/boot/bootutil/src/loader.c

so I try to fix it :

if(abs_off < hdr->ih_hdr_size)
{
blk_sz = tlv_off - hdr->ih_hdr_size + abs_off;
}else{
blk_sz = tlv_off - abs_off;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant