nRF51 SDK
|
Macros | |
#define | SOURCE_FILE NRF_SOURCE_FILE_GZP |
File identifer for asserts. | |
Global variables | |
static const uint8_t | pairing_base_address [4] = { GZP_ADDRESS } |
static const uint8_t | pairing_address_prefix_byte = 0 |
static const uint8_t | gzp_validation_id [GZP_VALIDATION_ID_LENGTH] = GZP_VALIDATION_ID |
static const uint8_t | gzp_secret_key [16] = GZP_SECRET_KEY |
static gzp_key_select_t | gzp_key_select |
Misc. external variables. | |
static uint8_t | gzp_session_token [GZP_SESSION_TOKEN_LENGTH] |
static uint8_t | gzp_dyn_key [GZP_DYN_KEY_LENGTH] |
Implementation common internal GZP functions | |
bool | gzp_update_radio_params (const uint8_t *system_address) |
void | gzp_generate_channels (uint8_t *ch_dst, const uint8_t *system_address, uint8_t channel_tab_size) |
__INLINE void | nrf_gzp_disable_gzll (void) |
void | gzp_xor_cipher (uint8_t *dst, const uint8_t *src, const uint8_t *pad, uint8_t length) |
bool | gzp_validate_id (const uint8_t *id) |
void | gzp_add_validation_id (uint8_t *dst) |
void | gzp_crypt_set_session_token (const uint8_t *token) |
void | gzp_crypt_set_dyn_key (const uint8_t *key) |
void | gzp_crypt_get_session_token (uint8_t *dst_token) |
void | gzp_crypt_get_dyn_key (uint8_t *dst_key) |
void | gzp_crypt_select_key (gzp_key_select_t key_select) |
void | gzp_crypt (uint8_t *dst, const uint8_t *src, uint8_t length) |
void | gzp_random_numbers_generate (uint8_t *dst, uint8_t n) |
Implementation of nRF51 specific GZP functions | |
static void | nrf_gzp_set_primask (uint32_t primask) |
Function for setting the Primask variable. Only necessary if ARMCC compiler skips __set_PRIMASK at high optimization levels. More... | |
void | nrf_gzp_flush_rx_fifo (uint32_t pipe) |
bool gzp_update_radio_params | ( | const uint8_t * | system_address | ) |
Update the channel table and the system address.
The channel table is updated to pseudo-random set generated using the system address. The channel table still includes GZP_CHANNEL_MAX and GZP_CHANNEL_MIN. The system address is applied to base address 1 and therefore applies to pipes 1-7.
system_address | Pointer to the system_address to set. |
true | If theradio parameters were updated successfully. |
false | If there was an error updated the radio parameters. |
void gzp_generate_channels | ( | uint8_t * | ch_dst, |
const uint8_t * | address, | ||
uint8_t | channel_set_size | ||
) |
Generate a set of channels from a 4 byte address.
ch_dst | Destination to write the channel set to. The channel set includes GZP_CHANNEL_MAX and GZP_CHANNEL_MIN. |
address | Four byte address to generate the channel set from. |
channel_set_size | Size of the channel set to generate. |
__INLINE void nrf_gzp_disable_gzll | ( | void | ) |
Disable Gazell and sleep while waiting for nrf_gzll_disabled callback.
void gzp_xor_cipher | ( | uint8_t * | dst, |
const uint8_t * | src, | ||
const uint8_t * | pad, | ||
uint8_t | length | ||
) |
Perform an XOR on two byte strings.
dst | Destination to write the result to. Should be of size length. |
src | |
pad | |
length | Number of bytes to perform the XOR operation on. |
bool gzp_validate_id | ( | const uint8_t * | src_id | ) |
Compare the *src_id with a pre-defined validation ID.
src_id | Pointer to the source validation ID to compare to. |
true | If *src_id equals the pre-defined ID. |
false | If *src_id does not equal the pre-defined ID. |
void gzp_add_validation_id | ( | uint8_t * | dst_id | ) |
Add the pre-defined validation ID to dst_id. GZP_VALIDATION_ID_LENGTH bytes will be added.
dst_id | Pointer to add the GZP validation ID to. |
void gzp_crypt_set_session_token | ( | const uint8_t * | token | ) |
Set the session token.
token | Pointer to the session token to set. |
void gzp_crypt_set_dyn_key | ( | const uint8_t * | dyn_key | ) |
Set the dynamic key.
dyn_key | Pointer to the dynamic key to set. |
void gzp_crypt_get_session_token | ( | uint8_t * | dst_token | ) |
Get the session token.
dst_token | Pointer to write the session token. |
void gzp_crypt_get_dyn_key | ( | uint8_t * | dst_key | ) |
Get the dynamic key.
dst_key | Pointer to write the dynamic key too. |
void gzp_crypt_select_key | ( | gzp_key_select_t | key_select | ) |
Selecting what key-set that should be used when encrypting data using gzp_crypt().
key_select | Key-set to use. |
void gzp_crypt | ( | uint8_t * | dst, |
const uint8_t * | src, | ||
uint8_t | length | ||
) |
Encypt / decrypt data.
The current "session token" will be used as initialization vector (IV). The AES key to be used is selected by gzp_crypt_select_key(). AES is a symmetric encryption scheme, this function can be used to perform both encryption and decryption.
dst | Destination to write encrypted data to. Should be 16 bytes long. |
src | Source data to encrypt. |
length | Length in bytes of src. |
void gzp_random_numbers_generate | ( | uint8_t * | dst, |
uint8_t | n | ||
) |
Generate random bytes.
dst | Destination to write the random bytes to. |
n | Number of bytes to generate. |
|
static |
primask | The primask value. 1 to disable interrupts, 0 otherwise. |
void nrf_gzp_flush_rx_fifo | ( | uint32_t | pipe | ) |
Flush the GZLL RX FIFO for a specific pipe while GZLL is disabled.
pipe | Pipe. |
|
static |
Constant holding base address part of the pairing address.
|
static |
Constant holding prefix byte of the pairing address.
|
static |
Constant holding pre-defined "validation ID".
|
static |
Constant holding pre-defined "secret key".
|
static |
Variable used for AES key selection