nRF5 SDK v17.1.0
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
ANT encryption configuration

Encryption configuration for the ANT stack and channels. More...

Modules

 Cryptographic ANT stack configuration configuration
 

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_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.
 

Detailed Description

Encryption configuration for the ANT stack and channels.

Macro Definition Documentation

#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_IDPointer to the encryption ID of the device (4 bytes).
[in]P_USER_INFOPointer to the user information string (19 bytes).
[in]P_RAND_NUM_SEEDPointer 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.

Parameters
[in]NAMEName of the settings instance.
#define ANT_ENCRYPT_STACK_SETTINGS_BASE_DEF (   NAME,
  P_KEY,
  P_ENC_ID 
)
Value:
ant_encrypt_adv_burst_settings_t NAME##_ant_enc_adv_burst_set = \
{ \
.required_feature = 0, \
.optional_feature = 0 \
}; \
uint8_t * pp_##NAME##_key[1] = {P_KEY}; \
ant_encrypt_stack_settings_t NAME ## _ant_crypto_settings = \
{ \
.info = ANT_CRYPTO_INFO_SETTINGS_INIT(P_ENC_ID, NULL, NULL), \
.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]NAMEName for the created data instance.
[in]P_KEYPointer to the cryptographic key (16 bytes).
[in]P_ENC_IDPointer to the encryption ID (4 bytes).

Enumeration Type Documentation

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 Documentation

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.

Parameters
[in]channel_typeANT channel type: CHANNEL_TYPE_SLAVE or CHANNEL_TYPE_MASTER.
[in]channel_numANT channel number.
[in]p_crypto_configPointer to the encryption configuration.
Return values
NRF_SUCCESSIf the function completed successfully.
NRF_ERROR_INVALID_PARAMIf the channel type is invalid.
NRF_ERROR_MODULE_NOT_INITIALIZEDIf the stack is not configured for encryption.
OtherOtherwise, 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.

Parameters
[in]channel_numberANT channel number.
[in]p_crypto_configPointer to the encryption configuration.
Returns
Value returned by sd_ant_crypto_channel_enable (for example, NRF_SUCCESS if the configuration was successful).
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.

Parameters
[in]p_handlerPointer to a handler function.
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.

Parameters
[in]p_crypto_info_setPointer to the settings.

Documentation feedback | Developer Zone | Subscribe | Updated