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_t * | nrf_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_t * | nrf_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... | |
Module for handling LESC related events.
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.
NRF_SUCCESS | If the operation was successful. |
Other | Other 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.
NRF_SUCCESS | If the operation was successful. |
NRF_ERROR_BUSY | If any pending request needs to be processed by nrf_ble_lesc_request_handler. |
Other | Other 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.
[in] | p_ble_evt | Event 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.
NRF_SUCCESS | If the operation was successful. |
NRF_ERROR_INVALID_STATE | If 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.
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.
[in] | handler | Function 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.
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.
NRF_SUCCESS | If the operation was successful. |
NRF_ERROR_INTERNAL | If the LESC module encountered an internal error. The only way to recover from this type of error is to reset the application. |
Other | Other 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. |