Module for handling LESC DHKey requests. More...
Functions |
|
| ret_code_t | ble_lesc_init (void) |
|
Function to initialize the ble_lesc module.
More...
|
|
| ret_code_t | ble_lesc_ecc_keypair_generate_and_set (void) |
|
Function to generate a ECC key pair to use in LESC.
More...
|
|
| ret_code_t | ble_lesc_ecc_local_public_key_get ( ble_gap_lesc_p256_pk_t const **pp_lesc_public_key) |
|
Function to get the current LESC ECC local public key.
More...
|
|
| ret_code_t | ble_lesc_service_request_handler (void) |
|
Function to service LESC ECDH calculations.
More...
|
|
Detailed Description
Module for handling LESC DHKey requests.
Function Documentation
| ret_code_t ble_lesc_ecc_keypair_generate_and_set | ( | void | ) |
Function to generate a ECC key pair to use in LESC.
This function initializes the crypto system by calling nrf_crypto_init and nrf_crypto_rng_init before calling the required functions to generate the ECC key pair. If the key generation was successful this function sets the LESC local public key in peer manager by calling pm_lesc_public_key_set .
- Note
- Run ble_lesc_init before calling this API.
- Return values
-
NRF_SUCCESS Generating ECC key pair was successful.
- Returns
- Any error code form nrf_crypto_ecc_key_pair_generate .
- Any error code from nrf_crypto_ecc_public_key_to_raw .
- Any error code from nrf_crypto_ecc_byte_order_invert .
- Any error code reported by pm_lesc_public_key_set .
| ret_code_t ble_lesc_ecc_local_public_key_get | ( | ble_gap_lesc_p256_pk_t const ** | pp_lesc_public_key | ) |
Function to get the current LESC ECC local public key.
This function gets the current ECC local public key used LESC pairing procedure the format of this key is in a type usable by peer manager, NFC (OOB) and SoftDevice.
- Note
- Run ble_lesc_ecc_keypair_generate_and_set before calling this function.
- Return values
-
NRF_SUCCESS Getting the local public key was successful. NRF_ERROR_NULL pp_lesc_public_key was NULL. NRF_ERROR_INVALID_STATE No ECC keypair was generated prior to this call
| ret_code_t ble_lesc_init | ( | void | ) |
Function to initialize the ble_lesc module.
This function initializes the nrf_crypto for key generation and ECDH calculations.
- Return values
-
NRF_SUCCESS Initalization was successful.
- Returns
- Any error code reported by nrf_crypto_init .
- Any error code reported by nrf_crypto_rng_init .
| ret_code_t ble_lesc_service_request_handler | ( | void | ) |
Function to service LESC ECDH calculations.
This function will calculate a LESC ECDH key (also known as shared secret) as long as BLE_GAP_EVT_LESC_DHKEY_REQUEST event has been received from SoftDevice.
- Note
- This function should be run in a low interrupt priority like an idle-loop in the main application context.
- Warning
- Any error code reported by this function that is not NRF_SUCCESS is critical and should be handled by aborting all ongoing BLE operations and resetting the device. Failure to do is a security risk.
- Return values
-
NRF_SUCCESS Service operation was successful.
- Returns
- Any other error code than NRF_SUCCESS which indicates that the device is in a critical state and must be restarted.