nRF5 SDK v16.0.0
Modules | Typedefs | Functions
LESC module

Module for handling LESC related events. More...

Modules

 Le Secure Connection configuration
 

Typedefs

typedef ble_gap_lesc_oob_data_t *(* nrf_ble_lesc_peer_oob_data_handler )(uint16_t conn_handle)
 Peer OOB Data handler prototype.
 

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...
 
ret_code_t nrf_ble_lesc_own_oob_data_generate (void)
 Function for generating LESC OOB data. 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...
 
ble_gap_lesc_oob_data_tnrf_ble_lesc_own_oob_data_get (void)
 Function for accessing LESC OOB data. More...
 
void nrf_ble_lesc_peer_oob_data_handler_set (nrf_ble_lesc_peer_oob_data_handler handler)
 Function for setting the handler used to retrieve peer OOB data. 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.
ret_code_t nrf_ble_lesc_own_oob_data_generate ( void  )

Function for generating LESC OOB data.

This function generates LESC OOB data, which can be transmitted Out-Of-Band to the peer device and used during LESC procedure. It is required to generate ECC keypair with nrf_ble_lesc_keypair_generate before calling this function.

Return values
NRF_SUCCESSIf the operation was successful.
NRF_ERROR_INVALID_STATEIf the ECC keypair hasn't been generated or is currently being generated.
ble_gap_lesc_oob_data_t* nrf_ble_lesc_own_oob_data_get ( void  )

Function for accessing LESC OOB data.

This function can be used to access LESC OOB data that is associated with this device. It is required to regenerate LESC OOB data with nrf_ble_lesc_own_oob_data_generate, after each change of ECC keypair with nrf_ble_lesc_keypair_generate.

Returns
Pointer to the LESC OOB data or NULL if the data has not been generated yet or is no no longer valid.
void nrf_ble_lesc_peer_oob_data_handler_set ( nrf_ble_lesc_peer_oob_data_handler  handler)

Function for setting the handler used to retrieve peer OOB data.

Parameters
[in]handlerFunction to retrieve peer OOB data.
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