nRF5 SDK v15.2.0
Modules | Functions
LESC module

Module for handling LESC related events. More...

Modules

 Le Secure Connection configuration
 

Functions

ret_code_t nrf_ble_lesc_init (void)
 Function for initializing the LESC module. More...
 
ret_code_t nrf_ble_lesc_keypair_generate (void)
 Function for generating ECC keypair used for the LESC procedure. More...
 
ble_gap_lesc_p256_pk_tnrf_ble_lesc_public_key_get (void)
 Function for accessing the ECC public key used for LESC DH key generation. More...
 
ret_code_t nrf_ble_lesc_request_handler (void)
 Function for responding to a DH key requests. More...
 
void nrf_ble_lesc_on_ble_evt (ble_evt_t const *p_ble_evt)
 Function for handling BLE stack events. More...
 

Detailed Description

Module for handling LESC related events.

Function Documentation

ret_code_t nrf_ble_lesc_init ( void  )

Function for initializing the LESC module.

This function initializes the nrf_crypto for ECC and ECDH calculations, which are required to handle LESC authentication procedures.

Return values
NRF_SUCCESSIf the operation was successful.
OtherOther error codes might be returned by the nrf_crypto_init or nrf_ble_lesc_keypair_generate functions.
ret_code_t nrf_ble_lesc_keypair_generate ( void  )

Function for generating ECC keypair used for the LESC procedure.

This function generates an ECC key pair, which consists of a private and public key. Keys are generated using ECC and are used to create LESC DH key during authentication procedures.

Return values
NRF_SUCCESSIf the operation was successful.
NRF_ERROR_BUSYIf any pending request needs to be processed by nrf_ble_lesc_request_handler.
OtherOther error codes might be returned by the nrf_crypto_ecc_key_pair_generate, nrf_crypto_ecc_public_key_to_raw and nrf_crypto_ecc_byte_order_invert functions.
void nrf_ble_lesc_on_ble_evt ( ble_evt_t const *  p_ble_evt)

Function for handling BLE stack events.

This function handles events from the BLE stack that are of interest to the module.

Parameters
[in]p_ble_evtEvent received from the BLE stack.
ble_gap_lesc_p256_pk_t* nrf_ble_lesc_public_key_get ( void  )

Function for accessing the ECC public key used for LESC DH key generation.

This function can be used to access the ECC public key, which is required to generate a LESC DH key at the peer side.

Returns
Pointer to the generated public key or NULL if the key has not been generated yet.
ret_code_t nrf_ble_lesc_request_handler ( void  )

Function for responding to a DH key requests.

This function calculates DH keys and supplies them to the SoftDevice if there are any pending requests for keys.

Note
This function should be called systematically (e.g. in the main application loop) to handle any pending DH key requests.
Return values
NRF_SUCCESSIf the operation was successful.
NRF_ERROR_INTERNALIf the LESC module encountered an internal error. The only way to recover from this type of error is to reset the application.
OtherOther error codes might be returned by the nrf_crypto_ecdh_compute, nrf_crypto_ecc_byte_order_invert, and sd_ble_gap_lesc_dhkey_reply functions.

Documentation feedback | Developer Zone | Subscribe | Updated