This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SMP Server Sample with CONFIG_MCUMGR_SMP_BT_AUTHEN=y

Hello everyone!

I have an issue about upgrading firmware over Bluetooth LE with a mandatory pairing of devices. I want only paired devices to have the ability to upgrade firmware over Bluetooth LE, and not all merely connected ones. Thus, I consider your example SMP Server Sample. In its current state, it allows all unauthenticated device to try to upgrade the firmware and only checking the image signature will forbid to run an intruder's image. As I guess, I have to set CONFIG_MCUMGR_SMP_BT_AUTHEN=y https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_MCUMGR_SMP_BT_AUTHEN.html and modify your example. For some unknown reasons, the provided example doesn't work for me with set CONFIG_MCUMGR_CMD_FS_MGMT, so I commented out a line with CONFIG_MCUMGR_CMD_FS_MGMT=y. Otherwise, it just reboots repeatedly after jumping to the first image slot from MCUBoot. All other modifications are related to adding required authentication callbacks and registering them. Also, I added a security_changed callback. And after it I built and flashed the image:

west build -b nrf52840dk_nrf52840 . -- -DOVERLAY_CONFIG=overlay-bt.conf
west flash --bin-file build/zephyr/app_update.bin --erase


And when I try to upgrade the firmware using nRF Connect for Android everything was merely "frozen" without any progress.



Although the devices were paired successfully, as it seems:

...
[00:00:52.611,663] <inf> smp_bt_sample: Connected
[00:01:20.849,884] <inf> smp_bt_sample: Pairing confirmed: 5a:3c:d2:fb:bc:2d (random).
[00:01:21.269,958] <inf> smp_bt_sample: Security changed: 5a:3c:d2:fb:bc:2d (random) level 2.
[00:01:21.285,949] <inf> smp_bt_sample: Pairing completed: 20:47:da:12:f4:e8 (public), bonded: 1.
[00:01:22.514,953] <inf> smp_bt_sample: Security changed: 20:47:da:12:f4:e8 (public) level 2.


And there's nothing further in UART logs. The new firmware didn't upload at all. And it's the same with both stable and master branches of nRF Connect SDK. And I run it using nRF52840 DK. Can you explain to me how to implement firmware upgrade over the Bluetooth with mandatory device pairing?

In an attachment you can find a modified SMP Server Sample with described above pairing features.

7345.smp_svr_with_auth.zip

So, please, tell me, how to properly modify this example to make it workable with CONFIG_MCUMGR_SMP_BT_AUTHEN=y?

Related