Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
ccmLIB.h File Reference
CCM Library API. More...
Go to the source code of this file.
Data Structures | |
struct | ccm_globals_t |
CCM global structure. The structure is used for configuring NONCE, adata and data before calling ccm_process_run(). More... | |
Functions | |
bool | ccm_sec_init (ccm_globals_t *ccm_context, uint8_t sec_level, const uint8_t *ccm_key, uint8_t mode, uint8_t ccm_l) |
A function to initialize the CCM context. | |
int8_t | ccm_process_run (ccm_globals_t *ccm_params) |
A function to run the configured CCM process. | |
void | ccm_free (ccm_globals_t *ccm_params) |
A function to free aes context. |
Detailed Description
CCM Library API.
CCM Library API:
- ccm_sec_init(), A function to init CCM context.
- ccm_process_run(), A function to run configured CCM process.
CCM process sequence:
1. Init CCM context by, ccm key, ccm_sec_init()
- security level
- 128-bit CCM key
- mode: AES_CCM_ENCRYPT or AES_CCM_DECRYPT
- CCM L parameter: 2 or 3 depending on the nonce length (802.15.4 use 2 and TLS security use 3) 2. Define ADATA pointer and length, if returned global structure mic_len field is > 0 3. Set data pointer and length 4. Do configured CCM process ccm_process_run() 5. Check return value: -If 0 Process ok -< 0 MIC fail or parameter fail
Definition in file ccmLIB.h.
Function Documentation
void ccm_free | ( | ccm_globals_t * | ccm_params ) |
A function to free aes context.
Call only if ccm_process_run() is not called
- Parameters:
-
ccm_params CCM parameters
Definition at line 147 of file ccm_security.c.
int8_t ccm_process_run | ( | ccm_globals_t * | ccm_params ) |
A function to run the configured CCM process.
When AES_CCM_ENCRYPT mode is selected and MIC is needed, the library saves MIC right after the encrypted data.
- Parameters:
-
ccm_params CCM parameters
- Returns:
- 0 CCM process OK and when AES_CCM_DECRYPT mode was selected also MIC was correct.
- -1 Init not called or data or adata pointers or lengths are zero.
- -2 Null pointer given to function.
A function to run the configured CCM process.
- Parameters:
-
sec_level Used CCM security level (0-7). ccm_key pointer to 128-key. mode AES_CCM_ENCRYPT or AES_CCM_DECRYPT ccm_l cuold be 2 or 3. 2 when NONCE length is 13 and 3 when length is 12. (NONCE Len= (15-ccm_l))
- Returns:
- 0 CCM process OK and when AES_CCM_DECRYPT mode was selectected also MIC was correct.
- -1 Init have not called or data or adata pointers or lengths are zero.
- -2 Null pointer given to function
Definition at line 94 of file ccm_security.c.
bool ccm_sec_init | ( | ccm_globals_t * | ccm_context, |
uint8_t | sec_level, | ||
const uint8_t * | ccm_key, | ||
uint8_t | mode, | ||
uint8_t | ccm_l | ||
) |
A function to initialize the CCM context.
- Parameters:
-
ccm_context pointer to initialized XXM context sec_level Used CCM security level (0-7). ccm_key Pointer to 128-key. mode AES_CCM_ENCRYPT or AES_CCM_DECRYPT. ccm_l Can be 2 or 3. 2 when NONCE length is 13 and 3 when 12. (NONCE length = (15-ccm_l))
- Returns:
- true when AES context allocation is OK and given parameters.
- false CCM parameters or AES context allocation fail.
A function to initialize the CCM context.
- Parameters:
-
sec_level Used CCM security level (0-7). ccm_key pointer to 128-key. mode AES_CCM_ENCRYPT or AES_CCM_DECRYPT ccm_l cuold be 2 or 3. 2 when NONCE length is 13 and 3 when length is 12. (NONCE Len= (15-ccm_l))
- Returns:
- Pointer to Global CCM paramameter buffer.
- 0 When parameter fail or CCM is Busy.
Definition at line 63 of file ccm_security.c.
Generated on Tue Jul 12 2022 13:55:06 by
