ANT Encryption Library

Functions

ant_err_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
  • channel_number[in] ANT channel number.

  • p_crypto_config[in] Pointer to the encryption configuration.

Returns

Value returned by ant_crypto_channel_enable (for example, NRF_SUCCESS if the configuration was successful).

ant_err_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
  • channel_type[in] ANT channel type: CHANNEL_TYPE_SLAVE or CHANNEL_TYPE_MASTER.

  • channel_num[in] ANT channel number.

  • p_crypto_config[in] Pointer to the encryption configuration.

Return values
  • 0 – If the function completed successfully.

  • NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED – If the channel type is invalid.

  • NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE – If the stack is not configured for encryption.

  • Other – Otherwise, the error value returned by the ant_channel_encrypt_config_perform function is returned.

ant_err_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

p_crypto_info_set[in] Pointer to the settings.

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

p_ant_evt[in] Pointer to the ANT stack event message structure.

void ant_enc_event_handler_register(ant_encrypt_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

p_handler[in] Pointer to a handler function.

Functions

void ant_channel_encrypt_tracking_state_set(uint8_t channel_number, ant_encrypt_tracking_state_t state)

Function for setting the encryption negotiation state of a slave ANT channel.

This function should be used by the ANT encryption configuration module.

Parameters
  • channel_number[in] ANT channel number.

  • state[in] State to set.

ant_encrypt_tracking_state_t ant_channel_encrypt_tracking_state_get(uint8_t channel_number)

Function for getting the encryption negotiation state of a slave ANT channel.

Parameters

channel_number[in] ANT channel number.

void ant_channel_encrypt_negotiation_slave_init(void)

Function for initializing the module.

This function initializes internal states of the module. It should only be used by the ANT encryption configuration module.

void ant_slave_channel_encrypt_config(uint8_t channel_number, ant_encrypt_channel_settings_t const *const p_crypto_config)

Function for setting the configuration for the slave channel.

This function saves the channel’s encryption configuration to a lookup table (LUT) for future usage. The configuration can then be used to enable encryption.

This function is intended to be used by the ANT encryption configuration module.

Parameters
  • channel_number[in] ANT channel number.

  • p_crypto_config[in] Pointer to the encryption configuration.

void ant_slave_encrypt_negotiation(ant_evt_t *p_ant_evt)

Function for handling ANT encryption negotiation on slave nodes.

This function should be used directly in the ANT event dispatching process. It tries to enable slave channel encryption for all slave channels that are declared as encrypted channels (if appropriate master channels are found).

This function should be used by the ANT encryption configuration module.

Parameters

p_ant_evt[in] Pointer to the ANT stack event message structure.