Encryption configuration for the ANT stack and channels. More...
Data Structures | |
struct | ant_encrypt_channel_settings_t |
ANT channel cryptographic configuration. More... | |
union | ant_encrypt_info_settings_t |
ANT encryption information. More... | |
struct | ant_encrypt_adv_burst_settings_t |
Advanced burst settings used by the encrypted channel. More... | |
struct | ant_encrypt_stack_settings_t |
ANT stack cryptographic configuration. More... | |
Macros | |
#define | ANT_CRYPTO_INFO_SETTINGS_INIT(P_ENC_ID, P_USER_INFO, P_RAND_NUM_SEED) |
Macro for initializing an ANT encryption information structure. More... | |
#define | ANT_ENCRYPT_STACK_SETTINGS_BASE_DEF(NAME, P_KEY, P_ENC_ID) |
Macro for declaring the basic cryptographic configuration for the ANT stack. More... | |
#define | ANT_ENCRYPT_STACK_SETTINGS_BASE(NAME) (NAME##_ant_crypto_settings) |
Macro for accessing the configuration instance created by ANT_ENCRYPT_STACK_SETTINGS_BASE_DEF. More... | |
Typedefs | |
typedef void(* | ant_encryp_user_handler_t )(uint8_t channel, ant_encrypt_user_evt_t event) |
Event handler for ANT encryption user events. | |
Enumerations | |
enum | ant_encrypt_user_evt_t { ANT_ENC_EVT_NEGOTIATION_SUCCESS, ANT_ENC_EVT_NEGOTIATION_FAIL, ANT_ENC_EVT_CHANNEL_LOST } |
ANT encryption negotiation events. More... | |
Functions | |
ret_code_t | ant_channel_encrypt_config_perform (uint8_t channel_number, ant_encrypt_channel_settings_t *p_crypto_config) |
Function for applying an encryption configuration to a slave channel. More... | |
ret_code_t | ant_channel_encrypt_config (uint8_t channel_type, uint8_t channel_num, ant_encrypt_channel_settings_t *p_crypto_config) |
Function for applying an encryption configuration to a master or slave channel. More... | |
ret_code_t | ant_stack_encryption_config (ant_encrypt_stack_settings_t const *const p_crypto_info_set) |
Function for configuring the cryptographic settings of the ANT stack. More... | |
void | ant_encrypt_event_handler (ant_evt_t *p_ant_evt) |
Function for handling ANT encryption events. More... | |
void | ant_enc_event_handler_register (ant_encryp_user_handler_t p_handler) |
Function for registering an event handler for ANT encryption events. More... | |
Advanced burst configuration for encryption modules | |
#define | ADV_BURST_CFG_MIN_SIZE 8 |
Minimum size of the advance burst configuration data. | |
#define | ADV_BURST_CFG_PACKET_SIZE_INDEX 1 |
Index of the packet size field in the configuration data. | |
#define | ADV_BURST_CFG_REQUIRED_FEATURES 2 |
Index of the required features field in the configuration data. | |
#define | ADV_BURST_CFG_OPTIONAL_FEATURES 5 |
Index of the optional features field in the configuration data. | |
Encryption configuration for the ANT stack and channels.
#define ANT_CRYPTO_INFO_SETTINGS_INIT | ( | P_ENC_ID, | |
P_USER_INFO, | |||
P_RAND_NUM_SEED | |||
) |
Macro for initializing an ANT encryption information structure.
[in] | P_ENC_ID | Pointer to the encryption ID of the device (4 bytes). |
[in] | P_USER_INFO | Pointer to the user information string (19 bytes). |
[in] | P_RAND_NUM_SEED | Pointer to the random number seed (16 bytes). |
#define ANT_ENCRYPT_STACK_SETTINGS_BASE | ( | NAME | ) | (NAME##_ant_crypto_settings) |
Macro for accessing the configuration instance created by ANT_ENCRYPT_STACK_SETTINGS_BASE_DEF.
[in] | NAME | Name of the settings instance. |
#define ANT_ENCRYPT_STACK_SETTINGS_BASE_DEF | ( | NAME, | |
P_KEY, | |||
P_ENC_ID | |||
) |
Macro for declaring the basic cryptographic configuration for the ANT stack.
This macro configures the following settings:
Use ANT_ENCRYPT_STACK_SETTINGS_BASE to access the created configuration instance.
[in] | NAME | Name for the created data instance. |
[in] | P_KEY | Pointer to the cryptographic key (16 bytes). |
[in] | P_ENC_ID | Pointer to the encryption ID (4 bytes). |
ret_code_t ant_channel_encrypt_config | ( | uint8_t | channel_type, |
uint8_t | channel_num, | ||
ant_encrypt_channel_settings_t * | p_crypto_config | ||
) |
Function for applying an encryption configuration to a master or slave channel.
When called for a master channel, this function enables encryption for that channel. When called for a slave channel, it saves the encryption configuration for future use.
This function should be used by the ANT channel configuration module.
[in] | channel_type | ANT channel type: CHANNEL_TYPE_SLAVE or CHANNEL_TYPE_MASTER. |
[in] | channel_num | ANT channel number. |
[in] | p_crypto_config | Pointer to the encryption configuration. |
NRF_SUCCESS | If the function completed successfully. |
NRF_ERROR_INVALID_PARAM | If the channel type is invalid. |
MODULE_NOT_INITIALZED | If the stack is not configured for encryption. |
Other | Otherwise, the error value returned by the ant_channel_encrypt_config_perform function is returned. |
ret_code_t ant_channel_encrypt_config_perform | ( | uint8_t | channel_number, |
ant_encrypt_channel_settings_t * | p_crypto_config | ||
) |
Function for applying an encryption configuration to a slave channel.
This function enables encryption on a channel.
This function should be used by the ANT encryption negotiation module and this module.
[in] | channel_number | ANT channel number. |
[in] | p_crypto_config | Pointer to the encryption configuration. |
void ant_enc_event_handler_register | ( | ant_encryp_user_handler_t | p_handler | ) |
Function for registering an event handler for ANT encryption events.
The event handler should support all of the events in ant_encrypt_user_evt_t.
[in] | p_handler | Pointer to a handler function. |
void ant_encrypt_event_handler | ( | ant_evt_t * | p_ant_evt | ) |
Function for handling ANT encryption events.
This function should be used directly in the ANT event dispatching process. It serves the ANT encryption events to the registered event handler. If ANT encryption negotiation is used, this function is required.
This function should be used by the ANT encryption configuration module.
[in] | p_ant_evt | Pointer to the ANT stack event message structure. |
ret_code_t ant_stack_encryption_config | ( | ant_encrypt_stack_settings_t const *const | p_crypto_info_set | ) |
Function for configuring the cryptographic settings of the ANT stack.
[in] | p_crypto_info_set | Pointer to the settings. |