FMFU segments SHA

We are currently working on a custom modem firmware update. For this, we would like to use the CBO file you provided. Updating the segments with the CBO file is working so far. However, we have some questions regarding the SHA of the segments. When we read the SHA for the segments from the firmware, we get the same result as in firmware.update.image.digest.txt. However, if we calculate the SHA using the binary data of the segments, we get a different result. The question is now how you calculate the SHA from the binary segments.

The following logs are based on the file mfw-nr+_nrf91x1_1.0.2.cbor

firmware.update.image.digest.txt with
SHA256 of all ranges in ascending address order: 337BAFF20F63F4CA9E897BE505F662134F523DAE14947386FAC8D88FA304A5DA
Range: 0x00006000--0x0000FFFF SHA256:            6BAA1B103E6690618B50A3C526E17B8905BFAF7810FBACAEB5A91C7D7DD5F27D
Range: 0x00038000--0x000B3FFF SHA256:            7D90AE6D6753C5B7774F455A359032EC1FEABE62A23DAD086BDC4FBE51F1A415
Range: 0x0027C000--0x0027FFFF SHA256:            9811C05B95FE6AFC46572E260E8A6228BC2439F7E101011BE1419A3B8A1136C4


Verifying segment 3/5: 0x6000 - 0xFFFF
Expected SHA256: 381f4d5f573f49fe4997248fe48a2a4d195957b3f084857e1a63091a18629d53
Readout  SHA256: 6baa1b103e6690618b50a3c526e17b8905bfaf7810fbacaeb5a91c7d7dd5f27d

Verifying segment 4/5: 0x38000 - 0xB3FFF
Expected SHA256: ddc13d26c04af3a63f07adf4929a76ce0807e8f7af83bfd278a31ee5c9396a7d
Readout  SHA256: 7d90ae6d6753c5b7774f455a359032ec1feabe62a23dad086bdc4fbe51f1a415

Verifying segment 5/5: 0x27C000 - 0x27FFFF
Expected SHA256: 7ad69832acf0460b4eac112677839c0b0db184f4acc5fdc777a55aae1dd0a8ab
Readout  SHA256: 9811c05b95fe6afc46572e260e8a6228bc2439f7e101011be1419a3b8a1136c4

Parents
  • My calculated sha of the segments at mfw-nr+_nrf91x1_1.0.2.cbor are:

    Segment 3/5: 0x6000 - 0xFFFF
    Expected SHA256: ddc883e1ef382344fba5601684ecbe7fcd7a57a313afa9a0f828c15915a5621c


    Segment 4/5: 0x38000 - 0xB3FFF
    Expected SHA256: d7fbe7d35810491d4e834a3cf885f7c65a9ce193c26b1ad1151eba79773bb0af

    Segment 5/5: 0x27C000 - 0x27FFFF
    Expected SHA256: 83932f5f9a35cce7ae2990cc48402b4d011233d0cfe54b89c45d2c8951b69d1c 

    and here is a small simplified snippet of how I implemented the whole thing in python

    bootloader_size = 0x000018B0 + 0x0000039C
    segment_length = 0x0000A000
    segment_data = blob_data[bootloader_size : bootloader_size + segment_length]
    expected_sha = sha256(segment_data).digest()

Reply
  • My calculated sha of the segments at mfw-nr+_nrf91x1_1.0.2.cbor are:

    Segment 3/5: 0x6000 - 0xFFFF
    Expected SHA256: ddc883e1ef382344fba5601684ecbe7fcd7a57a313afa9a0f828c15915a5621c


    Segment 4/5: 0x38000 - 0xB3FFF
    Expected SHA256: d7fbe7d35810491d4e834a3cf885f7c65a9ce193c26b1ad1151eba79773bb0af

    Segment 5/5: 0x27C000 - 0x27FFFF
    Expected SHA256: 83932f5f9a35cce7ae2990cc48402b4d011233d0cfe54b89c45d2c8951b69d1c 

    and here is a small simplified snippet of how I implemented the whole thing in python

    bootloader_size = 0x000018B0 + 0x0000039C
    segment_length = 0x0000A000
    segment_data = blob_data[bootloader_size : bootloader_size + segment_length]
    expected_sha = sha256(segment_data).digest()

Children
No Data
Related