We have noticed that generating LE Secure keys [nrf_ble_lesc_keypair_generate() ] takes 2.5s. That causes our external, 1s watchdog to trigger. Is there any way to improve performance of the key generation?
Thanks,
J
We have noticed that generating LE Secure keys [nrf_ble_lesc_keypair_generate() ] takes 2.5s. That causes our external, 1s watchdog to trigger. Is there any way to improve performance of the key generation?
Thanks,
J
Hi,
That is not expected. I tested the ble_app_hrs with a nRF52 DK in SDK 17.1.0 and toggled a GPIO before and after the call to nrf_ble_lesc_keypair_generate() in nrf_ble_lesc_init() in components\ble\peer_manager\nrf_ble_lesc.c. With the default configuration this took 25 ms. To experiment I also chagned NRF_CRYPTO_BACKEND_NRF_HW_RNG_MBEDTLS_CTR_DRBG_ENABLED to 0 in sdk_config.h to see if that could explain what you saw, but that just increased the time to 44 ms.
How have you verified that this takes 2.5s? Which nrf_crypto backend do you use? Could there be other things happening here as well?
We use MBED-TLS – Optimization level 0
After switching to
Oberon – Optimization 0/1 we are down to ~45ms
Ah, I never thought to test without optimization. Oberon is distributed as a prebuilt binary, so in that case it will always be built with optimization (by us) regardless of how you build your app.