boot_set_confirmed_multi() skips setting trailer "set/confirm" flag if currently in "unset" state

nRF NCS 1.9.x , nrf52840dk

The use-case is I want to set the confirm flag in the local firmware after certain conditions have been met.
On every boot up I check the boot_is_img_confirmed() and if false, firmware does certain checks and then sets the flag using boot_write_img_confirmed().
However it seems like the flag is not being set. I dug deeper and found:

boot_is_img_confirmed() only returns true if flag value is set to BOOT_FLAG_SET
boot_write_img_confirmed() however skips setting the flag if it is set to "UNSET"
This PR is to change the behavior of boot_write_img_confirmed() to set the flag in the case that it is unset.

I may be missing something in the API/usage, but this was my only way to initiate the conversation as creating issues are closed/restricted.

I created a pull request to initiate a fix for this issue, please add a reviewer or if I'm missing something in the API please educate me.

https://github.com/nrfconnect/sdk-mcuboot/pull/234

Related