18#if defined(CONFIG_GAZELL_PAIRING_USER_CONFIG_ENABLE)
19#include CONFIG_GAZELL_PAIRING_USER_CONFIG_FILE
42#define GZP_PAIRING_PIPE 0
44#define GZP_DATA_PIPE 1
46#define GZP_TX_RX_TRANS_DELAY 10
48#define GZP_SYSTEM_ADDRESS_WIDTH 4
52#define GZP_VALIDATION_ID {0x32, 0x53, 0x66}
54#define GZP_VALIDATION_ID_LENGTH 3
56#define GZP_HOST_ID_LENGTH 5
58#define GZP_SESSION_TOKEN_LENGTH GZP_HOST_ID_LENGTH
60#define GZP_DYN_KEY_LENGTH (16 - GZP_VALIDATION_ID_LENGTH)
63#define GZP_HOST_RX_POWER_THRESHOLD -64
75#define GZP_CMD_HOST_ADDRESS_REQ_PAYLOAD_LENGTH 1
78#define GZP_CMD_HOST_ADDRESS_FETCH_PAYLOAD_LENGTH 1
81#define GZP_CMD_HOST_ID_REQ_SESSION_TOKEN 1
83#define GZP_CMD_HOST_ID_REQ_PAYLOAD_LENGTH (GZP_CMD_HOST_ID_REQ_SESSION_TOKEN + \
84 GZP_SESSION_TOKEN_LENGTH)
86#if (GZP_CMD_HOST_ID_REQ_PAYLOAD_LENGTH > 17)
87#error GZP_SESSION_TOKEN_LENGTH too long.
91#define GZP_CMD_HOST_ID_FETCH_VALIDATION_ID 1
93#define GZP_CMD_HOST_ID_FETCH_PAYLOAD_LENGTH (GZP_CMD_HOST_ID_FETCH_VALIDATION_ID + \
94 GZP_VALIDATION_ID_LENGTH)
96#if (GZP_CMD_HOST_ID_FETCH_PAYLOAD_LENGTH > 17)
97#error GZP_VALIDATION_ID_LENGTH set too long.
101#define GZP_CMD_KEY_UPDATE_PREPARE_PAYLOAD_LENGTH 1
104#define GZP_CMD_KEY_UPDATE_VALIDATION_ID 1
106#define GZP_CMD_KEY_UPDATE_NEW_KEY (GZP_CMD_KEY_UPDATE_VALIDATION_ID + GZP_VALIDATION_ID_LENGTH)
108#define GZP_CMD_KEY_UPDATE_PAYLOAD_LENGTH (GZP_CMD_KEY_UPDATE_NEW_KEY + GZP_DYN_KEY_LENGTH)
110#if (GZP_CMD_KEY_UPDATE_PAYLOAD_LENGTH > 17)
111#error Sum (GZP_VALIDATION_ID_LENGTH + GZP_DYN_KEY_LENGTH) too high.
116#define GZP_CMD_ENCRYPTED_USER_DATA_VALIDATION_ID 1
118#define GZP_CMD_ENCRYPTED_USER_DATA_PAYLOAD (GZP_CMD_ENCRYPTED_USER_DATA_VALIDATION_ID + \
119 GZP_VALIDATION_ID_LENGTH)
121#define GZP_ENCRYPTED_USER_DATA_PACKET_OVERHEAD (GZP_CMD_ENCRYPTED_USER_DATA_VALIDATION_ID + \
122 GZP_VALIDATION_ID_LENGTH)
124#define GZP_ENCRYPTED_USER_DATA_MAX_LENGTH (17 - GZP_ENCRYPTED_USER_DATA_PACKET_OVERHEAD)
126#if (GZP_MAX_FW_PAYLOAD_LENGTH < 17)
127#error GZP_MAX_FW_PAYLOAD_LENGTH must be greater or equal to 17.
131#define GZP_CMD_FETCH_RESP_PAYLOAD_LENGTH 1
143#define GZP_CMD_HOST_ADDRESS_RESP_ADDRESS 1
145#define GZP_CMD_HOST_ADDRESS_RESP_PAYLOAD_LENGTH (GZP_CMD_HOST_ADDRESS_RESP_ADDRESS + \
146 GZP_SYSTEM_ADDRESS_WIDTH)
148#if (GZP_MAX_ACK_PAYLOAD_LENGTH < GZP_CMD_HOST_ADDRESS_RESP_PAYLOAD_LENGTH)
149#error GZP_MAX_ACK_PAYLOAD_LENGTH must be greater or equal to \
150 GZP_CMD_HOST_ADDRESS_RESP_PAYLOAD_LENGTH.
155#define GZP_CMD_HOST_ID_FETCH_RESP_VALIDATION_ID 1
157#define GZP_CMD_HOST_ID_FETCH_RESP_STATUS (GZP_CMD_HOST_ID_FETCH_RESP_VALIDATION_ID + \
158 GZP_VALIDATION_ID_LENGTH)
160#define GZP_CMD_HOST_ID_FETCH_RESP_HOST_ID (GZP_CMD_HOST_ID_FETCH_RESP_STATUS + 1)
162#define GZP_CMD_HOST_ID_FETCH_RESP_PAYLOAD_LENGTH (GZP_CMD_HOST_ID_FETCH_RESP_HOST_ID + \
165#if (GZP_MAX_ACK_PAYLOAD_LENGTH < GZP_CMD_HOST_ID_FETCH_RESP_PAYLOAD_LENGTH)
166#error GZP_MAX_ACK_PAYLOAD_LENGTH must be greater or equal to \
167 GZP_CMD_HOST_ID_FETCH_RESP_PAYLOAD_LENGTH.
172#define GZP_CMD_KEY_UPDATE_PREPARE_RESP_SESSION_TOKEN 1
174#define GZP_CMD_KEY_UPDATE_PREPARE_RESP_PAYLOAD_LENGTH \
175 (GZP_CMD_KEY_UPDATE_PREPARE_RESP_SESSION_TOKEN + \
176 GZP_SESSION_TOKEN_LENGTH)
178#if (GZP_MAX_ACK_PAYLOAD_LENGTH < GZP_CMD_KEY_UPDATE_PREPARE_RESP_PAYLOAD_LENGTH)
179#error GZP_MAX_ACK_PAYLOAD_LENGTH must be greater or equal to \
180 GZP_CMD_KEY_UPDATE_PREPARE_RESP_PAYLOAD_LENGTH.
185#define GZP_CMD_ENCRYPTED_USER_DATA_RESP_SESSION_TOKEN 1
187#define GZP_CMD_ENCRYPTED_USER_DATA_RESP_VALIDATION_ID \
188 (GZP_CMD_ENCRYPTED_USER_DATA_RESP_SESSION_TOKEN + \
189 GZP_SESSION_TOKEN_LENGTH)
191#define GZP_CMD_ENCRYPTED_USER_DATA_RESP_PAYLOAD_LENGTH \
192 (GZP_CMD_ENCRYPTED_USER_DATA_RESP_VALIDATION_ID + \
193 GZP_VALIDATION_ID_LENGTH)
195#if (GZP_MAX_ACK_PAYLOAD_LENGTH < GZP_CMD_ENCRYPTED_USER_DATA_RESP_PAYLOAD_LENGTH)
196#error GZP_MAX_ACK_PAYLOAD_LENGTH must be greater or equal to \
197 GZP_CMD_ENCRYPTED_USER_DATA_RESP_PAYLOAD_LENGTH.
200#if (GZP_VALIDATION_ID_LENGTH > GZP_HOST_ID_LENGTH)
201#error GZP_HOST_ID_LENGTH should be greater or equal to \
202 GZP_VALIDATION_ID_LENGTH.
205#if (GZP_SESSION_TOKEN_LENGTH != GZP_HOST_ID_LENGTH)
206#error GZP_SESSION_TOKEN_LENGTH must equal GZP_HOST_ID_LENGTH.
294 const nrf_gzll_device_tx_info_t *tx_info);
402void gzp_crypt(uint8_t *dst,
const uint8_t *src, uint8_t length);
470void gzp_xor_cipher(uint8_t *dst,
const uint8_t *src,
const uint8_t *pad, uint8_t length);
void gzp_erase_pairing_data(void)
void gzp_id_req_send_async(gzp_id_req_callback callback, void *context)
void(* gzp_tx_result_callback)(bool success, uint32_t pipe, const nrf_gzll_device_tx_info_t *tx_info)
Definition gzp.h:292
bool gzp_address_exchanged(void)
gzp_key_select
Enumerator used for selecting the key to be used for encryption.
Definition gzp.h:223
@ GZP_DATA_EXCHANGE
Definition gzp.h:229
@ GZP_ID_EXCHANGE
Definition gzp.h:225
@ GZP_KEY_EXCHANGE
Definition gzp.h:227
void gzp_crypt_get_dyn_key(uint8_t *dst_key)
bool gzp_validate_id(const uint8_t *src_id)
void gzp_xor_cipher(uint8_t *dst, const uint8_t *src, const uint8_t *pad, uint8_t length)
void gzp_tx_result_callback_register(gzp_tx_result_callback callback)
enum gzp_id_req_res gzp_id_req_send(void)
void gzp_generate_channels(uint8_t *ch_dst, const uint8_t *address, uint8_t channel_set_size)
bool gzp_crypt_data_send(const uint8_t *src, uint8_t length)
void gzp_address_req_send_async(gzp_address_req_callback callback, void *context)
void gzp_set_host_id(const uint8_t *src)
void gzp_id_req_grant(void)
void gzp_get_host_id(uint8_t *dst)
bool gzp_id_req_received(void)
bool gzp_update_radio_params(const uint8_t *system_address)
bool gzp_crypt_user_data_read(uint8_t *dst, uint8_t *length)
void gzp_random_numbers_generate(uint8_t *dst, uint8_t n)
void nrf_gzp_flush_rx_fifo(uint32_t pipe)
gzp_id_req_res
Enumerator used to identify the state of the current Host ID request.
Definition gzp.h:271
@ GZP_ID_RESP_REJECTED
Definition gzp.h:277
@ GZP_ID_RESP_GRANTED
Definition gzp.h:275
@ GZP_ID_RESP_FAILED
Definition gzp.h:279
@ GZP_ID_RESP_NO_REQUEST
Definition gzp.h:281
@ GZP_ID_RESP_PENDING
Definition gzp.h:273
void nrf_gzp_disable_gzll(void)
void gzp_crypt_select_key(enum gzp_key_select key_select)
void gzp_id_req_reject(void)
void(* gzp_crypt_data_send_callback)(bool result, void *context)
Definition gzp.h:321
void gzp_id_req_cancel(void)
void gzp_pairing_enable(bool enable)
gzp_cmd
Enumerator used in the first payload byte of each packet to indicate the packet type.
Definition gzp.h:238
@ GZP_CMD_HOST_ADDRESS_RESP
Definition gzp.h:256
@ GZP_CMD_ENCRYPTED_USER_DATA
Definition gzp.h:252
@ GZP_CMD_KEY_UPDATE_PREPARE_RESP
Definition gzp.h:260
@ GZP_CMD_KEY_UPDATE
Definition gzp.h:250
@ GZP_CMD_HOST_ID_FETCH_RESP
Definition gzp.h:258
@ GZP_CMD_HOST_ID_REQ
Definition gzp.h:244
@ GZP_CMD_HOST_ID_FETCH
Definition gzp.h:246
@ GZP_CMD_FETCH_RESP
Definition gzp.h:254
@ GZP_CMD_HOST_ADDRESS_REQ
Definition gzp.h:240
@ GZP_CMD_KEY_UPDATE_PREPARE
Definition gzp.h:248
@ GZP_CMD_HOST_ADDRESS_FETCH
Definition gzp.h:242
@ GZP_CMD_ENCRYPTED_USER_DATA_RESP
Definition gzp.h:262
void gzp_crypt(uint8_t *dst, const uint8_t *src, uint8_t length)
void(* gzp_id_req_callback)(enum gzp_id_req_res result, void *context)
Definition gzp.h:312
void gzp_crypt_set_dyn_key(const uint8_t *dyn_key)
bool gzp_crypt_user_data_received(void)
void(* gzp_address_req_callback)(bool result, void *context)
Definition gzp.h:303
void gzp_crypt_get_session_token(uint8_t *dst_token)
void gzp_crypt_data_send_async(const uint8_t *src, uint8_t length, gzp_crypt_data_send_callback callback, void *context)
int8_t gzp_get_pairing_status(void)
void gzp_crypt_set_session_token(const uint8_t *token)
void gzp_host_execute(void)
bool gzp_address_req_send(void)
void gzp_add_validation_id(uint8_t *dst_id)