nrf_cc310_bl crypto library

The nrf_cc310_bl library is a software library to interface with Arm CryptoCell CC310 hardware accelerator that is available on the nRF52840 SoC and the nRF9160 SiP. The library adds hardware support for cryptographic algorithms to be used in a bootloader-specific use cases.

The nrf_cc310_bl library supports the following cryptographic algorithms:

  • ECDSA verify using NIST curve secp256r1
  • SHA-256

Initializing the library

The library must be initialized before the APIs can be used.

Initializing the nrf_cc310_bl library
if (nrf_cc310_bl_init() != 0) {
        /** nrf_cc310_bl failed to initialize. */
        return -1;
}

Enabling/Disabling the CryptoCell the hardware

The CryptoCell CC310 hardware must be manually enabled/disabled prior to the API calls in the nrf_cc310_bl library.

Note

CryptoCell consumes power when the hardware is enabled even if there is no ongoing operation.

Enabling the CryptoCell hardware

The hardware is enabled by writing to a specific register.

Enabling the CryptoCell hardware
NRF_CRYPTOCELL->ENABLE=1;

Disabling the CryptoCell hardware

The hardware is disabled by writing to a specific register.

Disabling the CryptoCell hardware
NRF_CRYPTOCELL->ENABLE=0;

Note

Note that the structure type for the CryptoCell hardware register is called NRF_CRYPTOCELL_S in nRF9160 due to the hardware only being accessible from the Secure Processing Environment in the Cortex-M33 architecture.