Encryption configuration for the ANT stack and channels.
More...
Encryption configuration for the ANT stack and channels.
#define ANT_CRYPTO_INFO_SETTINGS_INIT |
( |
|
P_ENC_ID, |
|
|
|
P_USER_INFO, |
|
|
|
P_RAND_NUM_SEED |
|
) |
| |
Value:{ \
.items = \
{ \
.p_encryption_id = P_ENC_ID, \
.p_user_info = P_USER_INFO, \
.p_random_num_seed = P_RAND_NUM_SEED \
} \
}
Macro for initializing an ANT encryption information structure.
- Parameters
-
[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) |
#define ANT_ENCRYPT_STACK_SETTINGS_BASE_DEF |
( |
|
NAME, |
|
|
|
P_KEY, |
|
|
|
P_ENC_ID |
|
) |
| |
Value:
{ \
.required_feature = 0, \
.optional_feature = 0 \
}; \
uint8_t * pp_##NAME##_key[1] = {P_KEY};
\
{ \
.pp_key = pp_##NAME##_key, \
.key_number = 1, \
.p_adv_burst_config = &NAME##_ant_enc_adv_burst_set \
}
Macro for declaring the basic cryptographic configuration for the ANT stack.
This macro configures the following settings:
- Cryptographic key
- Encryption ID
- Advanced burst mode with the maximum RF payload size
Use ANT_ENCRYPT_STACK_SETTINGS_BASE to access the created configuration instance.
- Parameters
-
[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). |
ANT encryption negotiation events.
Enumerator |
---|
ANT_ENC_EVT_NEGOTIATION_SUCCESS |
Negotiation success.
|
ANT_ENC_EVT_NEGOTIATION_FAIL |
Negotiation failure.
|
ANT_ENC_EVT_CHANNEL_LOST |
Lost a channel. It's relevant only for slave channels.
|
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.
- Parameters
-
[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. |
- Return values
-
NRF_SUCCESS | If the function completed successfully. |
NRF_ERROR_INVALID_PARAM | If the channel type is invalid. |
NRF_ERROR_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. |
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.
- Parameters
-
[in] | channel_number | ANT channel number. |
[in] | p_crypto_config | Pointer to the encryption configuration. |
- Returns
- Value returned by sd_ant_crypto_channel_enable (for example, NRF_SUCCESS if the configuration was successful).
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.
- Parameters
-
[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.
- Parameters
-
[in] | p_ant_evt | Pointer to the ANT stack event message structure. |
Function for configuring the cryptographic settings of the ANT stack.
- Parameters
-
[in] | p_crypto_info_set | Pointer to the settings. |