High-level security tool box.
Copyright (c) 2018 Microchip Technology Inc. and its subsidiaries.
stb_ccm_t stb_ccm_secure |
( |
uint8_t * |
buffer, |
|
|
uint8_t |
nonce[AES_BLOCKSIZE], |
|
|
uint8_t * |
key, |
|
|
uint8_t |
hdr_len, |
|
|
uint8_t |
pld_len, |
|
|
uint8_t |
sec_level, |
|
|
uint8_t |
aes_dir |
|
) |
| |
Secure one block with CCM*.
This functions secures one block with CCM* according to 802.15.4.
- Parameters
-
[in,out] | buffer | Input: plaintext header and payload concatenated; for encryption: MUST HAVE 'AES_BLOCKSIZE' BYTES SPACE AT THE END FOR THE MIC! Output: frame secured (with MIC at end)/unsecured |
[in] | nonce | The nonce: Initialization Vector (IV) as used in cryptography; the ZigBee nonce (13 bytes long) are the bytes 2...14 of this nonce |
[in] | key | The key to be used; if NULL, use the current key |
[in] | hdr_len | Length of plain text header (will not be encrypted) |
[in] | pld_len | Length of payload to be encrypted; if 0, then only MIC authentication implies |
[in] | sec_level | Security level according to IEEE 802.15.4, 7.6.2.2.1, Table 95:
- the value may be 0 ... 7;
- the two LSBs contain the MIC length in bytes (0, 4, 8 or 16);
- bit 2 indicates whether encryption applies or not
|
[in] | aes_dir | AES_DIR_ENCRYPT if secure, AES_DIR_DECRYPT if unsecured |
- Returns
- STB CCM Status
References ADATA, AES_BLOCKSIZE, AES_DIR_ENCRYPT, AES_KEYSIZE, AES_MODE_ECB, compute_mic(), encrypt_pldmic(), ENCRYPTION_NOT_REQD, ENCRYPTION_REQD, key_change, last_key, LEN_FIELD, LEN_MIC_00, LEN_MIC_128, LEN_MIC_32, LEN_MIC_64, PHY_Wakeup(), PLAINTEXT_FLAG, prev_trx_status, sal_aes_clean_up, sal_aes_restart(), sal_aes_setup(), SECURITY_00_LEVEL, SECURITY_01_LEVEL, SECURITY_02_LEVEL, SECURITY_03_LEVEL, SECURITY_04_LEVEL, SECURITY_05_LEVEL, SECURITY_06_LEVEL, SECURITY_07_LEVEL, STB_CCM_ILLPARM, STB_CCM_KEYMISS, STB_CCM_MICERR, STB_CCM_OK, stb_restart_required, tal_trx_status, and TRX_SLEEP.