Topic

FAQ
Login Register
Example/clarification of AES CCM API
Feb 20, 2024 23:12

/

A

/A

Hi, I am using version V4.0.1.3_patch0001 f the 827x SDK. Under the file "algorithm/aes_ccm/aes_ccm.h" there is an API for AES CCM. However, this API seems very confusing and there does not appear to be any examples on how to use it anywhere. In particular, it appears that the API requires data related to BLE packets, but I do not wish to involve BLE in my use of it.


/**
 * @brief       this function is used to initialize the aes_ccm initial value
 * @param[in]   ltk - encryption key, LTK
 * @param[in]   skdm -
 * @param[in]   skds -
 * @param[in]   ivm -
 * @param[in]   ivs -
 * @param[in]   pd - Reference structure ble_crypt_para_t
 * @return      none
 */
void aes_ll_ccm_encryption_init (u8 *ltk, u8 *skdm, u8 *skds, u8 *ivm, u8 *ivs, ble_crypt_para_t *pd);


/**
 * @brief       this function is used to encrypt the aes_ccm value, version2
 * @param[in]   pd - Reference structure leCryptCtrl_t
 * @return      none
 */
void aes_ll_ccm_encryption(llPhysChnPdu_t *pllPhysChnPdu, u8 role, u8 ll_type, ble_crypt_para_t *pd);


/**
 * @brief       this function is used to decrypt the aes_ccm value, version2
 * @param[in]   pd - Reference structure leCryptCtrl_t
 * @return      0: decryption succeeded; 1: decryption failed
 */
int aes_ll_ccm_decryption(llPhysChnPdu_t *pllPhysChnPdu, u8 role, u8 ll_type, ble_crypt_para_t *pd);


In constrast, here is the API for regular AES which is very simple.


/**
 * @brief       This function servers to perform aes_128 encryption for 16-Byte input data
 *              with specific 16-Byte key
 * @param[in]   Key the pointer to the 16-Byte Key
 * @param[in]   Data the pointer to the 16-Byte plain text
 * @param[out]  Result the pointer to the encryption result cipher text
 * @return      0: success;
 *              not 0: failure
 */
extern int aes_encrypt(unsignedchar* Key, unsignedchar* Data, unsignedchar* Result);


/**
 * @brief       This function servers to perform aes_128 decryption for 16-Byte input data
 *              with specific 16-Byte key
 * @param[in]   Key the pointer to the 16-Byte Key
 * @param[in]   Data the pointer to the 16-Byte cipher text
 * @param[out]  Result the pointer to the decryption result plain text
 * @return      0: success;
 *              not 0: failure
 */
extern int aes_decrypt(unsignedchar* Key, unsignedchar* Data, unsignedchar* Result);


Can you please provide some guidance on how to use AES CCM in my project?


Thanks


1 replies
TL_Soyo Feb 22, 2024 11:26
0
/A

Hi,

  for AES ,please refer to https://wiki.telink-semi.cn/tools_and_sdk/Driver/doc/kite/html/md__project_1__table_of__content_05__t_s_i__a_e_s__features.html

and download Driver SDK http://wiki.telink-semi.cn/wiki/chip-series/TLSR825x-Series/

  AES CCM in SDK is used for lib,if you need ,please serach online and implement your own functions.