-
Notifications
You must be signed in to change notification settings - Fork 129
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
Calculate end of bootloader to update SHA256 #716
Conversation
88a72ae
to
e767ecd
Compare
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.
Briefly looking at your changes and argumentation, they look good to me! Ill wait until the PR is ready for review and Ill do a more thorough review and some testing.
Thanks for contributting to espflash!
e767ecd
to
db05d51
Compare
I left some print statements in there mostly to illustrate the issue. Do you want those removed? Are there any plans to add logging crates? I briefly looked into creating some tests. Are there any existing test |
db05d51
to
0ba42b5
Compare
Not sure what you mean, |
0ba42b5
to
eab6916
Compare
eab6916
to
83159a9
Compare
log line added:
|
83159a9
to
7a83fc7
Compare
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.
Thanks for working on this! Did some testing and review and everything seems to be working, left some minor comments!
espflash/src/image_format.rs
Outdated
@@ -4,6 +4,7 @@ use std::{borrow::Cow, io::Write, iter::once, mem::size_of}; | |||
|
|||
use bytemuck::{bytes_of, from_bytes, Pod, Zeroable}; | |||
use esp_idf_part::{Partition, PartitionTable, Type}; | |||
use log; |
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.
use log; | |
use log::debug; |
To be consisten with other places of the code.
7a83fc7
to
53824f4
Compare
The current implementation uses the last 32 bytes of the bootloader file. When Secure Boot V2 is enabled, the bootloader is padded. The new implementation walks through the segments to find the end and adds the 16-byte aligned 1-byte checksum to update the SHA256 instead of incorrectly updating the padding. Closes esp-rs#715
53824f4
to
052217d
Compare
Ok it should be good now. I used esp32c3 because that's what the links point to in the header docs in the beginning of image_format.rs. I also reworded the comment to be more clear and aligned with how the docs define it. |
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.
LGTM! Thanks for sticking with me through the review!
The current implementation uses the last 32 bytes of the bootloader file. When Secure Boot V2 is enabled, the bootloader is padded. The new implementation walks through the segments to find the end and adds the 16-byte aligned 1-byte checksum to update the SHA256 instead of incorrectly updating the padding.
Closes #715