CONFIG_HW_UNIQUE_KEY_LOAD does not work with CONFIG_DISABLE_FLASH_PATCH

I am using nRF Connect SDK 1.9.0 and the NRF52840.

When building samples/keys/hw_unique_key you get this warning:

----------------------------------------------------------
--- WARNING: To maintain the integrity of secure boot, ---
--- enable CONFIG_DISABLE_FLASH_PATCH in production. ---
----------------------------------------------------------

If you turn on CONFIG_DISABLE_FLASH_PATCH for b0, it breaks the sample and you can never boot. This is because CONFIG_HW_UNIQUE_KEY_LOAD only allows one boot for the application to load the HUK. CONFIG_DISABLE_FLASH_PATCH needs to reboot b0 when running the first time. This means we can never boot to the app.

So what is the best solution, should you use CONFIG_DISABLE_FLASH_PATCH in production and not use CONFIG_HW_UNIQUE_KEY_LOAD?

The sample works without CONFIG_HW_UNIQUE_KEY_LOAD, so what is the benefit of using CONFIG_HW_UNIQUE_KEY_LOAD?

Is there a fix that can be made to allow both CONFIG_DISABLE_FLASH_PATCH and CONFIG_HW_UNIQUE_KEY_LOAD?

Parents Reply
  • Hi,

    I am sorry for the late update. What is happening is essentially this:

    1. (b0 PRE_KERNEL2) Bootloader sees that a key is not written, and writes its own flag in flash to keep track of this. It now assumes the app will be booted and will write a HUK.
    2. (b0 POST_KERNEL) Flash patch is disabled and the device is rebooted for the configuration to take effect.
    3. (b0 PRE_KERNEL2) Bootloader sees that a key is not written, and that it has written the flag. It assumes the app was unsuccessful in writing a HUK so it throws an error.

    The team is made aware of this now and will look into hw to do handle this properly.

Children
No Data
Related