NordicSemiconductor / IOS-nRF-Connect-Device-Manager

A mobile management library for devices supporting nRF Connect Device Manager.
https://www.nordicsemi.com/Software-and-tools/Software/nRF-Connect-SDK
Apache License 2.0
90 stars 41 forks source link

Do not trucate hash #90

Closed nordicjm closed 1 year ago

nordicjm commented 1 year ago

The hash can optionally be used for image verification and should not be truncated.

Note that I have no way to test this.

dinesharjani commented 1 year ago

@philips77 can you check this?

philips77 commented 1 year ago

Let's wait with this PR until https://github.com/zephyrproject-rtos/zephyr/pull/52413 is resolved one way of the other. Thanks @nordicjm for your contribution to Android and iOS! ;)

nordicjm commented 1 year ago

@philips77 The aforementioned PR has been merged, can you test this and https://github.com/NordicSemiconductor/Android-nRF-Connect-Device-Manager/pull/81 to check that they build and work and merge them please?

dinesharjani commented 1 year ago

I implemented this and tested it, seems like it works with prior versions of mcumgr images. I think we're good to go

nordicjm commented 1 year ago

It seems there is a merge conflict, if this is resolved, is this good to merge?

dinesharjani commented 1 year ago

@philips77 is the boss

philips77 commented 1 year ago

What's the status of the PR in NCS? Could we get a fw (hex) to test the feature?

nordicjm commented 1 year ago

It should be fully supported in ncs (main), would just need to build a sample which supports firmware update with the CONFIG_IMG_ENABLE_IMAGE_CHECK Kconfig enabled and the final packet should contain the "match" response

nordicjm commented 1 year ago

Here is a hex for nrf52840dk_nrf52840: merged.zip

mcumgr with debug shows this:

00000060  41 47 4e 76 5a 6d 59 61  41 41 4d 7a 37 58 45 7a  |AGNvZmYaAAMz7XEz| 
DEBU[2023-04-28 12:26:17.977] Tx serial
00000000  0a                                                |.| 
 204.98 KiB / 205.30 KiB [=======================================================================================]  99.84% 2.87 KiB/sDEBU[2023-04-28 12:26:18.321] Rx serial:
00000000  06 09 41 42 77 44 41 41  41 53 41 41 47 79 41 62  |..ABwDAAASAAGyAb|
00000010  39 6a 62 32 5a 6d 47 67  41 44 4e 54 4e 6c 62 57  |9jb2ZmGgADNTNlbW|
00000020  46 30 59 32 6a 31 2f 78  76 51                    |F0Y2j1/xvQ| 
DEBU[2023-04-28 12:26:18.321] Decoded input:
00000000  03 00 00 12 00 01 b2 01  bf 63 6f 66 66 1a 00 03  |.........coff...|
00000010  35 33 65 6d 61 74 63 68  f5 ff                    |53ematch..| 
DEBU[2023-04-28 12:26:18.321] rx nmp response: 00000000  03 00 00 12 00 01 b2 01  bf 63 6f 66 66 1a 00 03  |.........coff...|
00000010  35 33 65 6d 61 74 63 68  f5 ff                    |53ematch..| 
DEBU[2023-04-28 12:26:18.321] Received nmp rsp: &{NmpBase:{hdr:{Op:3 Flags:0 Len:18 Group:1 Seq:178 Id:1}} Rc:0 Off:210227} 
DEBU[2023-04-28 12:26:18.321] {remove-nmp-listener} [serial_sesn.go:213] seq=178 

Which translates to:

{"off": 210227, "match": true}
nordicjm commented 1 year ago

Here is a dfu update zip which has 1 string different to the hex above and should be able to be loaded via DFU: dfu_application.zip

nordicjm commented 1 year ago

bump @philips77

dinesharjani commented 1 year ago

bump @philips77

I'll do this today. Will probably make a new PR and link it here.

dinesharjani commented 1 year ago

Implemented error when 'match' is present and false here https://github.com/NordicSemiconductor/IOS-nRF-Connect-Device-Manager/pull/109