-
Notifications
You must be signed in to change notification settings - Fork 7.9k
mgmt: mcumgr: grp: img_mgmt: Add support for SHA512 in images #95332
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
mgmt: mcumgr: grp: img_mgmt: Add support for SHA512 in images #95332
Conversation
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.
Pull Request Overview
This PR adds support for SHA512 hash verification in the MCUmgr image management subsystem. The change enables the system to handle images signed with SHA512 instead of being limited to SHA256.
- Introduces conditional compilation to support both SHA256 and SHA512 based on MCUboot configuration
- Updates hash buffer sizes and TLV type checks throughout the image management code
- Increases main stack size to accommodate larger hash processing requirements
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
img_mgmt_priv.h | Adds conditional macros for SHA algorithm selection and hash length based on MCUboot configuration |
img_mgmt_state.c | Updates hash buffer declarations and length checks to use new SHA-agnostic macros |
img_mgmt.c | Replaces hardcoded SHA256 references with configurable SHA macros in hash processing functions |
prj.conf | Increases main stack size to handle additional memory requirements for SHA512 processing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
uint8_t hash[IMAGE_HASH_LEN]; /* SHA256 hash */ | ||
struct zcbor_string zhash = { .value = hash, .len = IMAGE_HASH_LEN }; | ||
uint8_t hash[IMAGE_SHA_LEN]; | ||
struct zcbor_string zhash = { .value = hash, .len = IMAGE_SHA_LEN}; |
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.
[nitpick] Missing space before the closing brace. Should be IMAGE_SHA_LEN };
for consistency with coding style.
Copilot uses AI. Check for mistakes.
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.
Fixed
Adds support for images signed with SHA512. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no> Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Increase stack size as support for SHA512 requires more data. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no> Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
|
Adds support for images signed with SHA512.