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

Added support for Matter OTA firmware #815

Merged
merged 2 commits into from
Jan 7, 2025
Merged

Conversation

rhilseth
Copy link
Contributor

@rhilseth rhilseth commented Jan 1, 2025

This PR adds support for detecting Matter OTA firmware (https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/matter/overview/dfu.html#matter_ota_image_structure_and_transfer) and also extracting the firmware payload itself.

Example output for the file https://prod.ota-updates.bosch-smarthome.com/v1/updates/BTH-RAD/BTH-RAD_Prod_2.0.9.ota found via the DCL UI at https://webui.dcl.csa-iot.org/models

The test file in tests/inputs has been created manually with a dummy payload.

--------------------------------------------------------------------------------------------------------------------------------------------
DECIMAL                            HEXADECIMAL                        DESCRIPTION
--------------------------------------------------------------------------------------------------------------------------------------------
0                                  0x0                                Matter OTA firmware, total size: 786644 bytes, tlv header size: 68
                                                                      bytes, vendor id: 0x1209, product id: 0x3012, version: 2.00.09,
                                                                      payload size: 786560 bytes, digest type: 1, payload digest:
                                                                      9d4aac8bf87b4ce519318952a3736973e0427d867f3612d776dcd36340fdb574
760368                             0xB9A30                            CRC32 polynomial table, little endian
--------------------------------------------------------------------------------------------------------------------------------------------

Copy link
Collaborator

@devttys0 devttys0 left a comment

Choose a reason for hiding this comment

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

This looks good to me, aside from the noted sanity checks that should be performed to prevent crashes/exceptions in the event of malformed/corrupted data. Once those are addressed, I'll merge the PR. Thanks!

src/extractors/matter_ota.rs Show resolved Hide resolved
src/structures/matter_ota.rs Outdated Show resolved Hide resolved
src/structures/matter_ota.rs Outdated Show resolved Hide resolved
src/structures/matter_ota.rs Outdated Show resolved Hide resolved
src/structures/matter_ota.rs Outdated Show resolved Hide resolved
src/structures/matter_ota.rs Outdated Show resolved Hide resolved
src/structures/matter_ota.rs Outdated Show resolved Hide resolved
src/structures/matter_ota.rs Outdated Show resolved Hide resolved
@rhilseth rhilseth requested a review from devttys0 January 7, 2025 17:57
Copy link
Collaborator

@devttys0 devttys0 left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@devttys0 devttys0 merged commit ab6636c into ReFirmLabs:master Jan 7, 2025
3 of 4 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