Hi
I am currently developing a custom dfu in my app in background through LTE communication. I am working with nRF5 SDK 17.0.2, softdevice s132 7.2.0 and nRF52832.
I'm using nrfutil to generate dfu package .zip. The version of nrfutil I'm using seems to be v6 (from command "nrfutil list" because "nrfutil version" is unknown command")
So far I've used nrf_dfu_req_handler module to make dfu requests with the following sequence complying with DFU protocol :
- Call nrf_dfu_req_handler_init() to init module
- MTU GET request
- CREATE OBJECT request
- WRITE command for Init Packet
- Compare CRC and EXECUTE request
At this point the validation fails with error code 0x8542 (NRF_ERROR_CRYPTO_ECDSA_INVALID_SIGNATURE). See the following logs :
<debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (command) <debug> nrf_dfu_validation: PB: Init packet data len: 65 <info> nrf_dfu_validation: Signature required. Checking signature. <info> nrf_dfu_validation: Calculating hash (len: 65) <info> nrf_dfu_validation: Verify signature <error> nrf_dfu_validation: Signature failed (err_code: 0x8542) <debug> nrf_dfu_validation: Signature: <debug> nrf_dfu_validation: 5F 39 76 57 79 A3 B0 4E|_9vWy..N <debug> nrf_dfu_validation: 08 FC 08 4D A4 EB 8C 9E|...M.... <debug> nrf_dfu_validation: EB 5F AC 12 DE FA 7D E7|._....}. <debug> nrf_dfu_validation: 2F 96 B9 68 51 47 00 B5|/..hQG.. <debug> nrf_dfu_validation: BC AB F7 3B 49 9C 6E 72|...;I.nr <debug> nrf_dfu_validation: 28 FD 73 C2 76 69 71 07|(.s.viq. <debug> nrf_dfu_validation: 9A 82 94 4D F9 9D DB 37|...M...7 <debug> nrf_dfu_validation: 63 87 96 CF C6 3F 9D 91|c....?.. <debug> nrf_dfu_validation: Hash: <debug> nrf_dfu_validation: CA 29 E5 7E D4 2A 75 9E|.).~.*u. <debug> nrf_dfu_validation: A8 E8 7B 24 09 F6 50 58|..{$ .PX <debug> nrf_dfu_validation: DF 7A 22 0F 96 28 10 A1|.z"..(.. <debug> nrf_dfu_validation: A1 A1 32 F2 D0 A5 DE E3|..2..... <debug> nrf_dfu_validation: Public Key: <debug> nrf_dfu_validation: 2E 90 78 A1 CB 77 FF 6B|..x..w.k <debug> nrf_dfu_validation: F9 14 72 25 E6 35 13 20|..r%.5. <debug> nrf_dfu_validation: 59 17 F4 D2 70 64 A2 3E|Y...pd.> <debug> nrf_dfu_validation: 80 EC EE B0 5B 96 30 19|....[.0. <debug> nrf_dfu_validation: DF 79 F0 8B 14 D2 29 71|.y....)q <debug> nrf_dfu_validation: 4E 35 C5 D0 84 5B 54 DC|N5...[T. <debug> nrf_dfu_validation: 2B 0B FA 7E CD 8D 54 E0|+..~..T. <debug> nrf_dfu_validation: C0 97 E1 9B C5 48 B6 50|.....H.P <warning> nrf_dfu_validation: Prevalidation failed. <debug> nrf_dfu_validation: Init command: <debug> nrf_dfu_validation: 08 90 4E 10 34 1A 02 81|..N.4... <debug> nrf_dfu_validation: 02 20 00 28 00 30 00 38|. .(.0.8 <debug> nrf_dfu_validation: D0 EF 13 42 24 08 03 12|...B$... <debug> nrf_dfu_validation: 20 D6 B5 00 AC 42 06 6A| ....B.j <debug> nrf_dfu_validation: 0A 72 1B 86 0D 5E 7B 21|.r...^{! <debug> nrf_dfu_validation: 1F DC 32 83 8A E8 DC F0|..2..... <debug> nrf_dfu_validation: EC 30 5A E4 48 64 18 93|.0Z.Hd.. <debug> nrf_dfu_validation: F0 48 00 52 04 08 01 12|.H.R.... <debug> nrf_dfu_validation: 00 |. <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x5 <error> app: Request 4 returned error 5! <info> app: NRF_DFU_EVT_DFU_FAILED
I have displayed the signature of the package .zip I generated with nrfutil by typing :
nrfutil pkg display [filename.zip]
and it corresponds to the signature in the logs but with first and last halves switched.
How do I solve this issue ?
Also in the logs above there is a line "nrf_dfu_validation: PB: Init packet data len: 65". However the init packet I write with WRITE request is 142 bytes long. The write request response confirms that size (=offset) of 142 bytes. I wonder if this has something to do with my issue above.