MTB CAT1 Peripheral driver library

General Description

Functions

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_ProcessBlock (CRYPTOLITE_Type *base, cy_stc_cryptolite_aes_state_t *aesState, uint32_t *dstBlock, uint32_t const *srcBlock)
 Performs the AES block cipher. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Init (CRYPTOLITE_Type *base, uint8_t const *key, cy_stc_cryptolite_aes_state_t *aesState, cy_stc_cryptolite_aes_buffers_t *aesBuffers)
 Sets AES key and the buffers. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Free (CRYPTOLITE_Type *base, cy_stc_cryptolite_aes_state_t *aesState)
 Clears AES operation context. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ecb (CRYPTOLITE_Type *base, uint8_t *dst, uint8_t const *src, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES operation on one block. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ecb_Setup (CRYPTOLITE_Type *base, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES ECB setup operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ecb_Update (CRYPTOLITE_Type *base, uint32_t srcSize, uint8_t *dst, uint8_t const *src, uint32_t *dstLength, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES ECB Multistage update operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ecb_Finish (CRYPTOLITE_Type *base, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES ECB finish operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cbc (CRYPTOLITE_Type *base, uint32_t srcSize, uint8_t *ivPtr, uint8_t *dst, uint8_t const *src, cy_stc_cryptolite_aes_state_t *aesState)
 Performs AES operation on a plain text with Cipher Block Chaining (CBC). More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cbc_Setup (CRYPTOLITE_Type *base, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES CBC setup operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cbc_Set_IV (CRYPTOLITE_Type *base, uint8_t const *iv, cy_stc_cryptolite_aes_state_t *aesState)
 Function to set AES CBC IV. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cbc_Update (CRYPTOLITE_Type *base, uint32_t srcSize, uint8_t *dst, uint8_t const *src, uint32_t *dstLength, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES CBC Multistage update operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cbc_Finish (CRYPTOLITE_Type *base, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES CBC finish operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_CbcMac_Setup (CRYPTOLITE_Type *base, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES CBC MAC setup operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_CbcMac_Update (CRYPTOLITE_Type *base, uint32_t srcSize, uint8_t const *src, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES CBC MAC Multistage update operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_CbcMac_Finish (CRYPTOLITE_Type *base, uint8_t *mac, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES CBC MAC finish operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cfb (CRYPTOLITE_Type *base, cy_en_cryptolite_dir_mode_t dirMode, uint32_t srcSize, uint8_t *ivPtr, uint8_t *dst, uint8_t const *src, cy_stc_cryptolite_aes_state_t *aesState)
 Performs AES operation on a plain text with the Cipher Feedback Block method (CFB). More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cfb_Setup (CRYPTOLITE_Type *base, cy_en_cryptolite_dir_mode_t dirMode, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES CFB setup operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cfb_Set_IV (CRYPTOLITE_Type *base, uint8_t const *iv, cy_stc_cryptolite_aes_state_t *aesState)
 Sets IV for AES CFB mode. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cfb_Update (CRYPTOLITE_Type *base, uint32_t srcSize, uint8_t *dst, uint8_t const *src, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES CFB Multistage update operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cfb_Finish (CRYPTOLITE_Type *base, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES CFB finish operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ctr (CRYPTOLITE_Type *base, uint32_t srcSize, uint32_t *srcOffset, uint8_t *ivPtr, uint8_t *dst, uint8_t const *src, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES operation on a plain text using the counter method (CTR). More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ctr_Setup (CRYPTOLITE_Type *base, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES CTR setup operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ctr_Set_IV (CRYPTOLITE_Type *base, const uint8_t *iv, cy_stc_cryptolite_aes_state_t *aesState)
 Sets IV for the AES CTR operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ctr_Update (CRYPTOLITE_Type *base, uint32_t srcSize, uint8_t *dst, uint8_t const *src, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES CTR Multistage update operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ctr_Finish (CRYPTOLITE_Type *base, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES CTR Finish operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ctr_Zeropad (CRYPTOLITE_Type *base, uint32_t srcSize, uint8_t *ivPtr, uint8_t *dst, uint8_t const *src, cy_stc_cryptolite_aes_state_t *aesState)
 Performs an AES operation on a plain text using the counter method (CTR). More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Init (CRYPTOLITE_Type *base, cy_stc_cryptolite_aes_ccm_buffers_t *aesCcm_buffer, cy_stc_cryptolite_aes_ccm_state_t *aesCcmState)
 Performs an AES CCM Init operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_SetKey (CRYPTOLITE_Type *base, uint8_t const *key, cy_stc_cryptolite_aes_ccm_state_t *aesCcmState)
 Sets AES CCM Key for the operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Set_Length (CRYPTOLITE_Type *base, uint32_t aadSize, uint32_t textSize, uint32_t tagLength, cy_stc_cryptolite_aes_ccm_state_t *aesCcmState)
 Sets the length for Additional authentication data, plain text and Tag for AES CCM operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Start (CRYPTOLITE_Type *base, cy_en_cryptolite_dir_mode_t dirMode, uint32_t ivSize, uint8_t const *iv, cy_stc_cryptolite_aes_ccm_state_t *aesCcmState)
 Function to set IV for the AES CCM operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Update_Aad (CRYPTOLITE_Type *base, uint32_t aadSize, uint8_t const *aad, cy_stc_cryptolite_aes_ccm_state_t *aesCcmState)
 Performs an AES CCM update AAD Multistage operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Update (CRYPTOLITE_Type *base, uint32_t srcSize, uint8_t *dst, uint8_t const *src, cy_stc_cryptolite_aes_ccm_state_t *aesCcmState)
 Performs an AES CCM Update Multistage update operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Finish (CRYPTOLITE_Type *base, uint8_t *tag, cy_stc_cryptolite_aes_ccm_state_t *aesCcmState)
 Performs an AES CCM finish operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Encrypt_Tag (CRYPTOLITE_Type *base, uint32_t ivSize, uint8_t const *iv, uint32_t aadSize, uint8_t const *aad, uint32_t srcSize, uint8_t *cipherTxt, uint8_t const *plainTxt, uint32_t tagSize, uint8_t *tag, cy_stc_cryptolite_aes_ccm_state_t *aesCcmState)
 Performs an AES CCM Encrypt operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Decrypt (CRYPTOLITE_Type *base, uint32_t ivSize, uint8_t const *iv, uint32_t aadSize, uint8_t const *aad, uint32_t srcSize, uint8_t *plainTxt, uint8_t const *cipherTxt, uint32_t tagSize, uint8_t *tag, cy_en_cryptolite_ccm_auth_result_t *isValid, cy_stc_cryptolite_aes_ccm_state_t *aesCcmState)
 Performs an AES CCM Decrypt operation. More...
 
cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Free (CRYPTOLITE_Type *base, cy_stc_cryptolite_aes_ccm_state_t *aesCcmState)
 Clears AES CCM operation context. More...
 

Function Documentation

◆ Cy_Cryptolite_Aes_ProcessBlock()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_ProcessBlock ( CRYPTOLITE_Type *  base,
cy_stc_cryptolite_aes_state_t aesState,
uint32_t *  dstBlock,
uint32_t const *  srcBlock 
)

Performs the AES block cipher.

Parameters
baseThe pointer to the CRYPTOLITE instance.
aesStatethe pointer to the cy_stc_cryptolite_aes_state_t structure that stores all internal variables for Cryptolite driver.
dstBlockThe pointer to the cipher text.
srcBlockThe pointer to the plain text. Must be 4-Byte aligned!
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Init()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Init ( CRYPTOLITE_Type *  base,
uint8_t const *  key,
cy_stc_cryptolite_aes_state_t aesState,
cy_stc_cryptolite_aes_buffers_t aesBuffers 
)

Sets AES key and the buffers.

Parameters
baseThe pointer to the CRYPTOLITE instance.
keyThe pointer to the encryption/decryption key. The key must align in 4 byte boundary.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
aesBuffersThe pointer to the memory buffers storage.
Returns
cy_en_cryptolite_status_t
Function Usage
/* AES 128 bit key */
CY_ALIGN(4) uint8_t AesEcbKey128[] =
{
0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c
};
/* 16 byte plain text */
CY_ALIGN(4) uint8_t AesEcb128PlainTxtRef[16] =
{
0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a
};
CY_ALIGN(4) uint8_t AesEcbCipherTxt[16]={0};
status = Cy_Cryptolite_Aes_Init(CRYPTOLITE, AesEcbKey128, &aes_state, &aesBuffers);
/* ... check for errors... */
/* Encrypt the message with AES ECB */
status = Cy_Cryptolite_Aes_Ecb(CRYPTOLITE, AesEcbCipherTxt, AesEcb128PlainTxtRef, &aes_state);
/* ... check for errors... */
status = Cy_Cryptolite_Aes_Free(CRYPTOLITE, &aes_state);
/* ... check for errors... */

◆ Cy_Cryptolite_Aes_Free()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Free ( CRYPTOLITE_Type *  base,
cy_stc_cryptolite_aes_state_t aesState 
)

Clears AES operation context.

Parameters
baseThe pointer to the CRYPTOLITE instance.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t
Function Usage
/* AES 128 bit key */
CY_ALIGN(4) uint8_t AesEcbKey128[] =
{
0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c
};
/* 16 byte plain text */
CY_ALIGN(4) uint8_t AesEcb128PlainTxtRef[16] =
{
0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a
};
CY_ALIGN(4) uint8_t AesEcbCipherTxt[16]={0};
status = Cy_Cryptolite_Aes_Init(CRYPTOLITE, AesEcbKey128, &aes_state, &aesBuffers);
/* ... check for errors... */
/* Encrypt the message with AES ECB */
status = Cy_Cryptolite_Aes_Ecb(CRYPTOLITE, AesEcbCipherTxt, AesEcb128PlainTxtRef, &aes_state);
/* ... check for errors... */
status = Cy_Cryptolite_Aes_Free(CRYPTOLITE, &aes_state);
/* ... check for errors... */

◆ Cy_Cryptolite_Aes_Ecb()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ecb ( CRYPTOLITE_Type *  base,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES operation on one block.

Parameters
baseThe pointer to the CRYPTOLITE instance.
dstThe pointer to a destination cipher block.
srcThe pointer to a source block.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t
Function Usage
/* AES 128 bit key */
CY_ALIGN(4) uint8_t AesEcbKey128[] =
{
0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c
};
/* 16 byte plain text */
CY_ALIGN(4) uint8_t AesEcb128PlainTxtRef[16] =
{
0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a
};
CY_ALIGN(4) uint8_t AesEcbCipherTxt[16]={0};
status = Cy_Cryptolite_Aes_Init(CRYPTOLITE, AesEcbKey128, &aes_state, &aesBuffers);
/* ... check for errors... */
/* Encrypt the message with AES ECB */
status = Cy_Cryptolite_Aes_Ecb(CRYPTOLITE, AesEcbCipherTxt, AesEcb128PlainTxtRef, &aes_state);
/* ... check for errors... */
status = Cy_Cryptolite_Aes_Free(CRYPTOLITE, &aes_state);
/* ... check for errors... */

◆ Cy_Cryptolite_Aes_Ecb_Setup()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ecb_Setup ( CRYPTOLITE_Type *  base,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES ECB setup operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ecb_Update()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ecb_Update ( CRYPTOLITE_Type *  base,
uint32_t  srcSize,
uint8_t *  dst,
uint8_t const *  src,
uint32_t *  dstLength,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES ECB Multistage update operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
srcSizeThe size of the source block.
dstThe pointer to a destination cipher block.
srcThe pointer to a source block.
dstLengthThe size of the calculated cipher block.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ecb_Finish()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ecb_Finish ( CRYPTOLITE_Type *  base,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES ECB finish operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Cbc()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cbc ( CRYPTOLITE_Type *  base,
uint32_t  srcSize,
uint8_t *  ivPtr,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs AES operation on a plain text with Cipher Block Chaining (CBC).

Parameters
baseThe pointer to the CRYPTOLITE instance.
srcSizeThe size of the source plain text.
ivPtrThe pointer to the initial vector.
dstThe pointer to a destination cipher text.
srcThe pointer to a source plain text.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t
Function Usage
/* AES 128 bit key */
CY_ALIGN(4) uint8_t AesCbcKey128[] =
{
0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c
};
/* 16 byte plain text */
CY_ALIGN(4) uint8_t AesCbc128PlainTxtRef[16] =
{
0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a
};
CY_ALIGN(4) uint8_t AesCbcIV[] =
{
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
};
CY_ALIGN(4) uint8_t AesCbcCipherTxt[16]={0};
status = Cy_Cryptolite_Aes_Init(CRYPTOLITE, AesCbcKey128, &aes_state, &aesBuffers);
/* ... check for errors... */
/* Encrypt the message with AES CBC */
status = Cy_Cryptolite_Aes_Cbc(CRYPTOLITE, sizeof(AesCbc128PlainTxtRef), AesCbcIV, AesCbcCipherTxt, AesCbc128PlainTxtRef, &aes_state);
/* ... check for errors... */
status = Cy_Cryptolite_Aes_Free(CRYPTOLITE, &aes_state);
/* ... check for errors... */

◆ Cy_Cryptolite_Aes_Cbc_Setup()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cbc_Setup ( CRYPTOLITE_Type *  base,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES CBC setup operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Cbc_Set_IV()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cbc_Set_IV ( CRYPTOLITE_Type *  base,
uint8_t const *  iv,
cy_stc_cryptolite_aes_state_t aesState 
)

Function to set AES CBC IV.

Parameters
baseThe pointer to the CRYPTOLITE instance.
ivThe pointer to the IV.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Cbc_Update()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cbc_Update ( CRYPTOLITE_Type *  base,
uint32_t  srcSize,
uint8_t *  dst,
uint8_t const *  src,
uint32_t *  dstLength,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES CBC Multistage update operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
srcSizeThe size of the source block.
dstThe pointer to a destination cipher block.
srcThe pointer to a source block.
dstLengthThe size of the calculated dst block.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Cbc_Finish()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cbc_Finish ( CRYPTOLITE_Type *  base,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES CBC finish operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_CbcMac_Setup()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_CbcMac_Setup ( CRYPTOLITE_Type *  base,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES CBC MAC setup operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_CbcMac_Update()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_CbcMac_Update ( CRYPTOLITE_Type *  base,
uint32_t  srcSize,
uint8_t const *  src,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES CBC MAC Multistage update operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
srcSizeThe size of the source block.
srcThe pointer to a source block.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_CbcMac_Finish()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_CbcMac_Finish ( CRYPTOLITE_Type *  base,
uint8_t *  mac,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES CBC MAC finish operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
macThe pointer to store the calculated mac.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Cfb()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cfb ( CRYPTOLITE_Type *  base,
cy_en_cryptolite_dir_mode_t  dirMode,
uint32_t  srcSize,
uint8_t *  ivPtr,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs AES operation on a plain text with the Cipher Feedback Block method (CFB).

Parameters
baseThe pointer to the CRYPTOLITE instance.
dirModecy_en_cryptolite_dir_mode_t
srcSizeThe size of the source plain text.
ivPtrThe pointer to the initial vector.
dstThe pointer to a destination cipher text.
srcThe pointer to a source plain text.
aesStateThe pointer to the AES state structure allocated by the user. The user must must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t
Function Usage
/* AES 128 bit key */
CY_ALIGN(4) uint8_t AesCfbKey128[] =
{
0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c
};
/* 16 byte plain text */
CY_ALIGN(4) uint8_t AesCfb128PlainTxtRef[16] =
{
0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a
};
CY_ALIGN(4) uint8_t AesCfbIV[] =
{
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
};
CY_ALIGN(4) uint8_t AesCfbCipherTxt[16]={0};
status = Cy_Cryptolite_Aes_Init(CRYPTOLITE, AesCfbKey128, &aes_state, &aesBuffers);
/* ... check for errors... */
/* Encrypt the message with AES CFB */
status = Cy_Cryptolite_Aes_Cfb(CRYPTOLITE,
CY_CRYPTOLITE_ENCRYPT, sizeof(AesCfb128PlainTxtRef), AesCfbIV, AesCfbCipherTxt, AesCfb128PlainTxtRef, &aes_state);
/* ... check for errors... */
status = Cy_Cryptolite_Aes_Free(CRYPTOLITE, &aes_state);
/* ... check for errors... */

◆ Cy_Cryptolite_Aes_Cfb_Setup()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cfb_Setup ( CRYPTOLITE_Type *  base,
cy_en_cryptolite_dir_mode_t  dirMode,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES CFB setup operation.

Parameters
baseThe pointer to the CRYPTO instance.
dirModeCan be CY_CRYPTOLITE_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_cryptolite_dir_mode_t).
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Cfb_Set_IV()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cfb_Set_IV ( CRYPTOLITE_Type *  base,
uint8_t const *  iv,
cy_stc_cryptolite_aes_state_t aesState 
)

Sets IV for AES CFB mode.

Parameters
baseThe pointer to the CRYPTO instance.
ivThe pointer to iv.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Cfb_Update()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cfb_Update ( CRYPTOLITE_Type *  base,
uint32_t  srcSize,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES CFB Multistage update operation.

Parameters
baseThe pointer to the CRYPTO instance.
srcSizeThe size of the source block.
dstThe pointer to a destination cipher block.
srcThe pointer to a source block.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Cfb_Finish()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Cfb_Finish ( CRYPTOLITE_Type *  base,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES CFB finish operation.

Parameters
baseThe pointer to the CRYPTO instance.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ctr()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ctr ( CRYPTOLITE_Type *  base,
uint32_t  srcSize,
uint32_t *  srcOffset,
uint8_t *  ivPtr,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES operation on a plain text using the counter method (CTR).

Parameters
baseThe pointer to the CRYPTOLITE instance.
srcSizeThe size of a source plain text.
srcOffsetThe size of an offset within the current block stream for resuming within the current cipher stream.
ivPtrThe 128-bit initial vector that contains a 64-bit nonce and 64-bit counter.
dstThe pointer to a destination cipher text.
srcThe pointer to a source plain text. Must be 4-Byte aligned.
aesStateThe pointer to the AES state structure allocated by the user. The user must must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t
Function Usage
/* AES 128 bit key */
CY_ALIGN(4) uint8_t AesCtrKey128[] =
{
0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c
};
/* 16 byte plain text */
CY_ALIGN(4) uint8_t AesCtr128PlainTxtRef[16] =
{
0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a
};
CY_ALIGN(4) uint8_t AesCtrIV[] =
{
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
};
CY_ALIGN(4) uint32_t srcOffset;
CY_ALIGN(4) uint8_t AesCtrCipherTxt[16]={0};
status = Cy_Cryptolite_Aes_Init(CRYPTOLITE, AesCtrKey128, &aes_state, &aesBuffers);
/* ... check for errors... */
/* Encrypt the message with AES Ctr */
status = Cy_Cryptolite_Aes_Ctr(CRYPTOLITE, sizeof(AesCtr128PlainTxtRef), &srcOffset, AesCtrIV, AesCtrCipherTxt, AesCtr128PlainTxtRef, &aes_state);
/* ... check for errors... */
status = Cy_Cryptolite_Aes_Free(CRYPTOLITE, &aes_state);
/* ... check for errors... */

◆ Cy_Cryptolite_Aes_Ctr_Setup()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ctr_Setup ( CRYPTOLITE_Type *  base,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES CTR setup operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_crypto_status_t

◆ Cy_Cryptolite_Aes_Ctr_Set_IV()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ctr_Set_IV ( CRYPTOLITE_Type *  base,
const uint8_t *  iv,
cy_stc_cryptolite_aes_state_t aesState 
)

Sets IV for the AES CTR operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
ivThe pointer to iv.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ctr_Update()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ctr_Update ( CRYPTOLITE_Type *  base,
uint32_t  srcSize,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES CTR Multistage update operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
srcSizeThe size of the source block.
dstThe pointer to a destination cipher block.
srcThe pointer to a source block.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ctr_Finish()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ctr_Finish ( CRYPTOLITE_Type *  base,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES CTR Finish operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ctr_Zeropad()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ctr_Zeropad ( CRYPTOLITE_Type *  base,
uint32_t  srcSize,
uint8_t *  ivPtr,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_cryptolite_aes_state_t aesState 
)

Performs an AES operation on a plain text using the counter method (CTR).

Parameters
baseThe pointer to the CRYPTOLITE instance.
srcSizeThe size of a source plain text.
ivPtrThe 128-bit initial vector that contains a 64-bit nonce and 64-bit counter.
dstThe pointer to a destination cipher text.
srcThe pointer to a source plain text. Must be 4-Byte aligned.
aesStateThe pointer to the AES state structure allocated by the user. The user must must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ccm_Init()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Init ( CRYPTOLITE_Type *  base,
cy_stc_cryptolite_aes_ccm_buffers_t aesCcm_buffer,
cy_stc_cryptolite_aes_ccm_state_t aesCcmState 
)

Performs an AES CCM Init operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
aesCcm_bufferThe buffers should be a SAHB mapped addresses. The pointer to the memory buffers storage.
aesCcmStateThe pointer to the AES CCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ccm_SetKey()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_SetKey ( CRYPTOLITE_Type *  base,
uint8_t const *  key,
cy_stc_cryptolite_aes_ccm_state_t aesCcmState 
)

Sets AES CCM Key for the operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
keyThe pointer to the CCM key.
aesCcmStateThe pointer to the AES CCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ccm_Set_Length()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Set_Length ( CRYPTOLITE_Type *  base,
uint32_t  aadSize,
uint32_t  textSize,
uint32_t  tagLength,
cy_stc_cryptolite_aes_ccm_state_t aesCcmState 
)

Sets the length for Additional authentication data, plain text and Tag for AES CCM operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
aadSizeThe Size of the Additional Authentication Data.
textSizeThe Size of the Text.
tagLengthThe Size of the Tag.
aesCcmStateThe pointer to the AES CCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ccm_Start()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Start ( CRYPTOLITE_Type *  base,
cy_en_cryptolite_dir_mode_t  dirMode,
uint32_t  ivSize,
uint8_t const *  iv,
cy_stc_cryptolite_aes_ccm_state_t aesCcmState 
)

Function to set IV for the AES CCM operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
dirModeCan be CY_CRYPTOLITE_ENCRYPT or CY_CRYPTOLITE_DECRYPT (cy_en_cryptolite_dir_mode_t)
ivSizeThe size of the IV.
ivThe pointer to the IV.
aesCcmStateThe pointer to the AES CCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ccm_Update_Aad()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Update_Aad ( CRYPTOLITE_Type *  base,
uint32_t  aadSize,
uint8_t const *  aad,
cy_stc_cryptolite_aes_ccm_state_t aesCcmState 
)

Performs an AES CCM update AAD Multistage operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
aadSizeThe size of the AAD.
aadThe pointer to a AAD.
aesCcmStateThe pointer to the AES CCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ccm_Update()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Update ( CRYPTOLITE_Type *  base,
uint32_t  srcSize,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_cryptolite_aes_ccm_state_t aesCcmState 
)

Performs an AES CCM Update Multistage update operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
srcSizeThe size of the source block.
dstThe pointer to a destination block.
srcThe pointer to a source block.
aesCcmStateThe pointer to the AES CCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ccm_Finish()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Finish ( CRYPTOLITE_Type *  base,
uint8_t *  tag,
cy_stc_cryptolite_aes_ccm_state_t aesCcmState 
)

Performs an AES CCM finish operation.

Parameters
baseThe pointer to the CRYPTOLITE instance.
tagThe pointer to the CCM Tag.
aesCcmStateThe pointer to the AES CCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ccm_Encrypt_Tag()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Encrypt_Tag ( CRYPTOLITE_Type *  base,
uint32_t  ivSize,
uint8_t const *  iv,
uint32_t  aadSize,
uint8_t const *  aad,
uint32_t  srcSize,
uint8_t *  cipherTxt,
uint8_t const *  plainTxt,
uint32_t  tagSize,
uint8_t *  tag,
cy_stc_cryptolite_aes_ccm_state_t aesCcmState 
)

Performs an AES CCM Encrypt operation.

Note
Cy_Cryptolite_Aes_Ccm_Init() and Cy_Cryptolite_Aes_Ccm_SetKey() should be called before calling this function
Parameters
baseThe pointer to the CRYPTOLITE instance.
ivSizeThe size of the IV.
ivThe pointer to the IV.
aadSizeThe size of the AAD.
aadThe pointer to a AAD.
srcSizeThe size of the source block.
cipherTxtThe pointer to a cipher text block.
plainTxtThe pointer to a plain text block.
tagSizeThe size of the Tag.
tagThe pointer to the tags.
aesCcmStateThe pointer to the AES CCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ccm_Decrypt()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Decrypt ( CRYPTOLITE_Type *  base,
uint32_t  ivSize,
uint8_t const *  iv,
uint32_t  aadSize,
uint8_t const *  aad,
uint32_t  srcSize,
uint8_t *  plainTxt,
uint8_t const *  cipherTxt,
uint32_t  tagSize,
uint8_t *  tag,
cy_en_cryptolite_ccm_auth_result_t isValid,
cy_stc_cryptolite_aes_ccm_state_t aesCcmState 
)

Performs an AES CCM Decrypt operation.

Note
Cy_Cryptolite_Aes_Ccm_Init() and Cy_Cryptolite_Aes_Ccm_SetKey() should be called before calling this function
Parameters
baseThe pointer to the CRYPTOLITE instance.
ivSizeThe size of the IV.
ivThe pointer to the IV.
aadSizeThe size of the AAD.
aadThe pointer to a AAD.
srcSizeThe size of the source block.
plainTxtThe pointer to a plain text block.
cipherTxtThe pointer to a cipher text block.
tagSizeThe size of the Tag.
tagThe pointer to the tags.
isValidThe pointer Store the authentication status.
aesCcmStateThe pointer to the AES CCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t

◆ Cy_Cryptolite_Aes_Ccm_Free()

cy_en_cryptolite_status_t Cy_Cryptolite_Aes_Ccm_Free ( CRYPTOLITE_Type *  base,
cy_stc_cryptolite_aes_ccm_state_t aesCcmState 
)

Clears AES CCM operation context.

Parameters
baseThe pointer to the CRYPTOLITE instance.
aesCcmStateThe pointer to the AES CCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_cryptolite_status_t