Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_crypto_init finds no backend in SDK15

Hi,

I have the problem, that nrf_crypto_init() does not find any backends and thus is skipping the initialization.

What is the precondition for NRF_CRYPTO_BACKEND_SECTION_ITEM_COUNT to find a backend?

I enabled NRF_CRYPTO_BACKEND_MICRO_ECC_ENABLED and NRF_CRYPTO_BACKEND_NRF_HW_RNG_ENABLED in the sdk_config.h.

I tried the ble_app_multirole_lesc example, where NRF_CRYPTO_BACKEND_OBERON_ENABLED and NRF_CRYPTO_BACKEND_NRF_HW_RNG_ENABLED are enabled.

This returns num_backends=1, but i don't know why this is not working for MicroEcc.

Also should nrf_crypto_init() really return NRF_SUCCESS in this case? It skips the entire initialization if num_backends = 0 but still sets m_state to INITIALIZED;

Best regards,

Niclas

Parents
  • Hi Niclas,

    Section variables are used to register init/uninit functions for backends that require initialization. Registration is done with the CRYPTO_BACKEND_REGISTER() macro. nrf_crypto_init() will then iterate through these and call the init functions that have been registered.

    uECC backend does not require initialization but the NRF HW RNG backend does so I would have expected the number of backends to be '1' in your case. Is nrf_hw_backend_init.c included in your project? This is where the init function gets registered. 

    Best regards,

    Vidar

  • Hi Vidar,

    I don't use CRYPTO_BACKEND_REGISTER() directly and neither does the example, but including nrf_hw_backend_init.c  solved the error.

    Still it is offputting that the init function returns success in this case and neither compiler or linker report errors on the missing include. I had this same problem in SDK14 with the SOC_OBSERVER macro which also was only used inside the sdk and not in my application code.

    What is the intention behind macros used in sdk modules, that are essential to the functionality of those modules, just doing nothing if the right include is missing?

    EDIT: Also why is the legacy RNG required for all crypto functionality? Even the hw_backend_rng needs the legacy RNG.

    Best regards,

    Niclas

Reply
  • Hi Vidar,

    I don't use CRYPTO_BACKEND_REGISTER() directly and neither does the example, but including nrf_hw_backend_init.c  solved the error.

    Still it is offputting that the init function returns success in this case and neither compiler or linker report errors on the missing include. I had this same problem in SDK14 with the SOC_OBSERVER macro which also was only used inside the sdk and not in my application code.

    What is the intention behind macros used in sdk modules, that are essential to the functionality of those modules, just doing nothing if the right include is missing?

    EDIT: Also why is the legacy RNG required for all crypto functionality? Even the hw_backend_rng needs the legacy RNG.

    Best regards,

    Niclas

Children
Related