
Macros | |
| #define | zb_aes128 zb_osif_aes128 |
| Makes one AES128 encryption cycle. More... | |
Functions | |
| void | zb_security_init (const zb_uint8_t *key, zb_uint8_t key_type, zb_uint8_t application_id, zb_uint32_t src_id, const zb_ieee_addr_t src_addr) |
| Initializes the security module. More... | |
| zb_uint32_t | zb_security_encode (const zb_uint8_t *header, const zb_uint8_t *payload, zb_uint8_t header_size, zb_uint8_t payload_size, zb_uint8_t security_level, zb_uint32_t seq_number, zb_uint8_t *result) |
| Encrypts the user packet using a key selected earlier. More... | |
| zb_ret_t | zb_security_decode (zb_uint8_t app_id, zb_uint32_t src_id, const zb_ieee_addr_t ieee_addr, const zb_uint8_t *header, const zb_uint8_t *payload, zb_uint8_t header_size, zb_uint8_t payload_size, zb_uint32_t seq_number, zb_uint32_t mic, zb_uint8_t *result) |
| Decrypts the user packet using a key selected earlier. More... | |
| const zb_uint8_t * | zb_security_get_key () |
| Returns current encryption key. More... | |
| void | zb_security_set_key (const zb_uint8_t *key) |
| Sets current encryption key. More... | |
| zb_uint8_t | zb_security_get_key_type () |
| Returns type of the current encryption key. More... | |
| void | zb_security_set_key_type (zb_uint8_t key_type) |
| Sets type of the current encryption key. More... | |
| void | zb_security_set_initial_key (void) |
| Sets the initial encryption key that was used at startup. More... | |
| void | zb_security_set_initial_key_type (void) |
| Sets the initial key type that was used at startup. More... | |
| zb_uint32_t | zb_security_encode_key_for_commiss (const zb_uint8_t *key_tobe_encoded, zb_uint8_t app_id, zb_uint32_t src_id, const zb_ieee_addr_t ieee_addr, zb_uint8_t *result_key) |
| Performs personal key encryption for commissioning. More... | |
| zb_ret_t | zgpd_decrypt_n_auth_gpd_key (zb_uint8_t app_id, zb_uint32_t src_id, const zb_ieee_addr_t ieee_addr, zb_uint8_t *encrypted_key, zb_uint32_t frame_counter, zb_uint32_t mic, zb_uint8_t *plain_key) |
| Performs GPD key decryption from commissioning reply frame. More... | |
| #define zb_aes128 zb_osif_aes128 |
Makes one AES128 encryption cycle.
| key | Key to be used for encryption |
| msg | Message to be processed |
| c | Buffer for the result |
| void zb_security_init | ( | const zb_uint8_t * | key, |
| zb_uint8_t | key_type, | ||
| zb_uint8_t | application_id, | ||
| zb_uint32_t | src_id, | ||
| const zb_ieee_addr_t | src_addr | ||
| ) |
Initializes the security module.
| key | 16-bytes encryption key to be used for security operations |
| key_type | GPD key type used for GPD frames encryption |
| application_id | Application ID, which defines the GPDF frame format |
| src_id | GPD source ID |
| src_addr | 64-bit source address |
| zb_uint32_t zb_security_encode | ( | const zb_uint8_t * | header, |
| const zb_uint8_t * | payload, | ||
| zb_uint8_t | header_size, | ||
| zb_uint8_t | payload_size, | ||
| zb_uint8_t | security_level, | ||
| zb_uint32_t | seq_number, | ||
| zb_uint8_t * | result | ||
| ) |
Encrypts the user packet using a key selected earlier.
According to Zigbee CCM encryption standard the data to be encrypted consists of two parts: "a" and "m" strings.
| header | "a" string according to CCM description |
| payload | "m" string according to CCM description |
| header_size | Length of the "a" part |
| m_payload_size | Length of the "m" part |
| securiy_level | Levels 2 are 3 valid |
| seq_number | Packet sequential number |
| result | Buffer where the result should be stored to |
References GBOSS_SECURITY_KEY_CAP_L2, and GBOSS_SECURITY_KEY_CAP_L3.
Referenced by zgpd_pkt_send_bidir().
| zb_ret_t zb_security_decode | ( | zb_uint8_t | app_id, |
| zb_uint32_t | src_id, | ||
| const zb_ieee_addr_t | ieee_addr, | ||
| const zb_uint8_t * | header, | ||
| const zb_uint8_t * | payload, | ||
| zb_uint8_t | header_size, | ||
| zb_uint8_t | payload_size, | ||
| zb_uint32_t | seq_number, | ||
| zb_uint32_t | mic, | ||
| zb_uint8_t * | result | ||
| ) |
Decrypts the user packet using a key selected earlier.
According to Zigbee CCM encryption standard the data to be decrypted consists of two parts: "a" and "m" strings.
| app_id | GP device Application ID |
| src_id | GP device's source id (for AppID = 0b000) |
| ieee_addr | GP device's IEEE address (for AppID = 0b010) |
| header | "a" string according to CCM description |
| payload | "m" string according to CCM description |
| header_size | Length of the "a" part |
| m_payload_size | Length of the "m" part |
| seq_number | Packet sequential number |
| mic | Income Message Integrity Code |
| result | Buffer where the result should be stored to |
| const zb_uint8_t* zb_security_get_key | ( | ) |
Returns current encryption key.
| void zb_security_set_key | ( | const zb_uint8_t * | key | ) |
Sets current encryption key.
| const | zb_uint8_t* pointer to the encryption key |
| zb_uint8_t zb_security_get_key_type | ( | ) |
Returns type of the current encryption key.
Referenced by zb_nwk_frame_prepare().
| void zb_security_set_key_type | ( | zb_uint8_t | key_type | ) |
Sets type of the current encryption key.
| key_type | GP device encryption key type |
| void zb_security_set_initial_key | ( | void | ) |
Sets the initial encryption key that was used at startup.
| void zb_security_set_initial_key_type | ( | void | ) |
Sets the initial key type that was used at startup.
| zb_uint32_t zb_security_encode_key_for_commiss | ( | const zb_uint8_t * | key_tobe_encoded, |
| zb_uint8_t | app_id, | ||
| zb_uint32_t | src_id, | ||
| const zb_ieee_addr_t | ieee_addr, | ||
| zb_uint8_t * | result_key | ||
| ) |
Performs personal key encryption for commissioning.
Encryption of commissioning command significantly differs from ordinary packet security. In the commissioning packet only the key should be encrypted instead of full data packet.
| key_tobe_encoded | Device's key to be encoded |
| app_id | GP device Application ID |
| src_id | GP device's source id (for AppID = 0b000) |
| ieee_addr | GP device's IEEE address (for AppID = 0b010) |
| result_key | Buffer where the encoded key should be stored to |
References GBOSS_APP_ID_0, and GBOSS_APP_ID_2.
| zb_ret_t zgpd_decrypt_n_auth_gpd_key | ( | zb_uint8_t | app_id, |
| zb_uint32_t | src_id, | ||
| const zb_ieee_addr_t | ieee_addr, | ||
| zb_uint8_t * | encrypted_key, | ||
| zb_uint32_t | frame_counter, | ||
| zb_uint32_t | mic, | ||
| zb_uint8_t * | plain_key | ||
| ) |
Performs GPD key decryption from commissioning reply frame.
Decryption of GPD key significantly differs from ordinary packet security. In the commissioning reply packet only the key should be decrypted instead of full data packet.
| app_id | GP device Application ID |
| src_id | GP device's source id (for AppID = 0b000) |
| ieee_addr | GP device's IEEE address (for AppID = 0b010) |
| encrypted_key | Pointer to key passed in Commissioning Reply frame |
| frame_counter | Received Commissioning Reply frame counter |
| mic | Commissioning Reply Message Integrity Code |
| plain_key | Buffer where the encoded key should be stored to |