MTB CAT1 Peripheral driver library

General Description

Functions

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Init (CRYPTO_Type *base, uint8_t const *key, cy_en_crypto_aes_key_length_t keyLength, cy_stc_crypto_aes_state_t *aesState)
 Initializes AES mode of operation and prepares an inverse key. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_InitContext (CRYPTO_Type *base, uint8_t const *key, cy_en_crypto_aes_key_length_t keyLength, cy_stc_crypto_aes_state_t *aesState, cy_stc_crypto_aes_buffers_t *aesBuffers)
 Initializes AES mode of operation and prepares an inverse key within a user specified buffer. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Free (CRYPTO_Type *base, cy_stc_crypto_aes_state_t *aesState)
 Clears AES operation context. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ecb (CRYPTO_Type *base, cy_en_crypto_dir_mode_t dirMode, uint8_t *dst, uint8_t const *src, cy_stc_crypto_aes_state_t *aesState)
 Performs the AES operation on a single block. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ecb_Setup (CRYPTO_Type *base, cy_en_crypto_dir_mode_t dirMode, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES ECB init operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ecb_Update (CRYPTO_Type *base, uint32_t srcSize, uint8_t *dst, uint8_t const *src, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES ECB Multistage update operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ecb_Finish (CRYPTO_Type *base, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES ECB finish operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cbc (CRYPTO_Type *base, cy_en_crypto_dir_mode_t dirMode, uint32_t srcSize, uint8_t *ivPtr, uint8_t *dst, uint8_t const *src, cy_stc_crypto_aes_state_t *aesState)
 Performs the AES-CBC operation defined in the dirMode parameter on a plain text defined in the src parameter. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cbc_Setup (CRYPTO_Type *base, cy_en_crypto_dir_mode_t dirMode, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES CBC setup operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cbc_Set_IV (CRYPTO_Type *base, uint8_t const *iv, cy_stc_crypto_aes_state_t *aesState)
 Function to set AES CBC IV. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cbc_Update (CRYPTO_Type *base, uint32_t srcSize, uint8_t *dst, uint8_t const *src, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES CBC Multistage update operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cbc_Finish (CRYPTO_Type *base, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES CBC finish operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_CbcMac_Setup (CRYPTO_Type *base, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES CBC MAC setup operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_CbcMac_Update (CRYPTO_Type *base, uint32_t srcSize, uint8_t const *src, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES CBC MAC Multistage update operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_CbcMac_Finish (CRYPTO_Type *base, uint8_t *mac, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES CBC finish operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cfb (CRYPTO_Type *base, cy_en_crypto_dir_mode_t dirMode, uint32_t srcSize, uint8_t *ivPtr, uint8_t *dst, uint8_t const *src, cy_stc_crypto_aes_state_t *aesState)
 Performs the AES-CFB operation defined in the dirMode parameter on a plain text defined in the SRC parameter. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cfb_Setup (CRYPTO_Type *base, cy_en_crypto_dir_mode_t dirMode, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES CFB setup operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cfb_Set_IV (CRYPTO_Type *base, uint8_t const *iv, cy_stc_crypto_aes_state_t *aesState)
 Sets IV for AES CFB mode. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cfb_Update (CRYPTO_Type *base, uint32_t srcSize, uint8_t *dst, uint8_t const *src, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES CFB Multistage update operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cfb_Finish (CRYPTO_Type *base, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES CFB finish operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ctr (CRYPTO_Type *base, uint32_t srcSize, uint32_t *srcOffset, uint8_t *ivPtr, uint8_t *streamBlock, uint8_t *dst, uint8_t const *src, cy_stc_crypto_aes_state_t *aesState)
 Performs the AES-CTR operation on a plain text defined in the src parameter. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ctr_Setup (CRYPTO_Type *base, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES CTR Multistage update operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ctr_Set_IV (CRYPTO_Type *base, const uint8_t *iv, cy_stc_crypto_aes_state_t *aesState)
 Sets IV for the AES CTR operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ctr_Update (CRYPTO_Type *base, uint32_t srcSize, uint8_t *dst, uint8_t const *src, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES CTR Multistage update operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ctr_Finish (CRYPTO_Type *base, cy_stc_crypto_aes_state_t *aesState)
 Performs an AES CTR Finish operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Init (CRYPTO_Type *base, cy_stc_crypto_aes_gcm_buffers_t *aesGCMBuffers, cy_stc_crypto_aes_gcm_state_t *aesGCMctx)
 The function to initialize AES GCM operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_SetKey (CRYPTO_Type *base, uint8_t const *aesKey, cy_en_crypto_aes_key_length_t keyLength, cy_stc_crypto_aes_gcm_state_t *aesGCMctx)
 The function to set AES GCM Key. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Start (CRYPTO_Type *base, cy_en_crypto_dir_mode_t mode, uint8_t const *iv, uint32_t ivSize, cy_stc_crypto_aes_gcm_state_t *aesGCMctx)
 The function to start AES GCM operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_AAD_Update (CRYPTO_Type *base, uint8_t *aad, uint32_t aadSize, cy_stc_crypto_aes_gcm_state_t *aesGCMctx)
 The function to update the Additional Authentication Data. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Update (CRYPTO_Type *base, const uint8_t *input, uint32_t inputSize, uint8_t *output, cy_stc_crypto_aes_gcm_state_t *aesGCMctx)
 The function to update the data For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters input & output must align and end in 32 byte boundary. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Finish (CRYPTO_Type *base, uint8_t *p_tag, uint32_t tagSize, cy_stc_crypto_aes_gcm_state_t *aesGCMctx)
 The function to finish the AES GCM operation and to calculate the tag. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Free (CRYPTO_Type *base, cy_stc_crypto_aes_gcm_state_t *aesGCMctx)
 The function to finish the encryption process and calculate tag. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Encrypt_Tag (CRYPTO_Type *base, uint8_t const *aesKey, cy_en_crypto_aes_key_length_t keyLength, uint8_t const *iv, uint32_t ivSize, uint8_t *aad, uint32_t aadSize, const uint8_t *input, uint32_t inputSize, uint8_t *output, uint8_t *tag, uint32_t tagSize)
 Performs the AES GCM encryption operation on the input data, iv & aad data, generates the encrypted data and TAG. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Decrypt_Tag (CRYPTO_Type *base, uint8_t const *aesKey, cy_en_crypto_aes_key_length_t keyLength, uint8_t const *iv, uint32_t ivSize, uint8_t *aad, uint32_t aadSize, const uint8_t *input, uint32_t inputSize, uint8_t *tag, uint32_t tagSize, uint8_t *output, cy_en_crypto_aesgcm_tag_verify_result_t *isVerified)
 Performs the AES GCM decryption operation on the input data and verifies the TAG. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Init (CRYPTO_Type *base, cy_stc_crypto_aes_ccm_buffers_t *aesCcmBuffer, cy_stc_crypto_aes_ccm_state_t *aesCcmState)
 Performs an AES CCM Init operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_SetKey (CRYPTO_Type *base, uint8_t const *key, cy_en_crypto_aes_key_length_t keyLength, cy_stc_crypto_aes_ccm_state_t *aesCcmState)
 Sets AES CCM Key for the operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Set_Length (CRYPTO_Type *base, uint32_t aadSize, uint32_t textSize, uint32_t tagLength, cy_stc_crypto_aes_ccm_state_t *aesCcmState)
 Sets the length for Additional authentication data, plain text and Tag for AES CCM operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Start (CRYPTO_Type *base, cy_en_crypto_dir_mode_t dirMode, uint32_t ivSize, uint8_t const *iv, cy_stc_crypto_aes_ccm_state_t *aesCcmState)
 Function to set IV for the AES CCM operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Update_Aad (CRYPTO_Type *base, uint32_t aadSize, uint8_t const *aad, cy_stc_crypto_aes_ccm_state_t *aesCcmState)
 Performs an AES CCM update AAD Multistage operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Update (CRYPTO_Type *base, uint32_t srcSize, uint8_t *dst, uint8_t const *src, cy_stc_crypto_aes_ccm_state_t *aesCcmState)
 Performs an AES CCM Update Multistage update operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Finish (CRYPTO_Type *base, uint8_t *tag, cy_stc_crypto_aes_ccm_state_t *aesCcmState)
 Performs an AES CCM finish operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Encrypt_Tag (CRYPTO_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_crypto_aes_ccm_state_t *aesCcmState)
 Performs an AES CCM Encrypt operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Decrypt (CRYPTO_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 const *tag, cy_en_crypto_aesccm_tag_verify_result_t *isValid, cy_stc_crypto_aes_ccm_state_t *aesCcmState)
 Performs an AES CCM Decrypt operation. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Free (CRYPTO_Type *base, cy_stc_crypto_aes_ccm_state_t *aesCcmState)
 Clears AES CCM operation context. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Des (CRYPTO_Type *base, cy_en_crypto_dir_mode_t dirMode, uint8_t const *key, uint8_t *dst, uint8_t const *src)
 Performs the DES operation on a single block. More...
 
__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Tdes (CRYPTO_Type *base, cy_en_crypto_dir_mode_t dirMode, uint8_t const *key, uint8_t *dst, uint8_t const *src)
 Performs the TDES operation on a single block. More...
 

Function Documentation

◆ Cy_Crypto_Core_Aes_Init()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Init ( CRYPTO_Type *  base,
uint8_t const *  key,
cy_en_crypto_aes_key_length_t  keyLength,
cy_stc_crypto_aes_state_t aesState 
)

Initializes AES mode of operation and prepares an inverse key.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters key must align and end in 32 byte boundary.

Parameters
baseThe pointer to the CRYPTO instance.
keyThe pointer to the encryption/decryption key.
keyLengthcy_en_crypto_aes_key_length_t
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
Function Usage
uint8_t aesKey[CY_CRYPTO_AES_128_KEY_SIZE] = {
0x2Bu, 0x7Eu, 0x15u, 0x16u, 0x28u, 0xAEu, 0xD2u, 0xA6u,
0xABu, 0xF7u, 0x15u, 0x88u, 0x09u, 0xCFu, 0x4Fu, 0x3Cu
};
uint8_t aesEcbPlainText[CY_CRYPTO_AES_BLOCK_SIZE] = {
0x6Bu, 0xC0u, 0xBCu, 0xE1u, 0x2Au, 0x45u, 0x99u, 0x91u,
0xE1u, 0x34u, 0x74u, 0x1Au, 0x7Fu, 0x9Eu, 0x19u, 0x25u
};
uint8_t aesEcbCipherText[CY_CRYPTO_AES_BLOCK_SIZE] = {0};
cy_en_crypto_status_t cryptoStatus;
/* Initialize Crypto AES functionality */
cryptoStatus = Cy_Crypto_Core_Aes_Init(
CRYPTO_HW,
aesKey, /* Pointer to key */
CY_CRYPTO_KEY_AES_128, /* Key size */
&aesState); /* pointer to AES state structure */
/* ... check for errors... */
/* Encrypt one block (16 Bytes) by AES128 */
cryptoStatus = Cy_Crypto_Core_Aes_Ecb(
CRYPTO_HW,
aesEcbCipherText, /* destination block */
aesEcbPlainText, /* source block */
&aesState);
/* ... check for errors... */
/* Clear AES operation context */
cryptoStatus = Cy_Crypto_Core_Aes_Free(
CRYPTO_HW,
&aesState);
/* ... check for errors... */

◆ Cy_Crypto_Core_Aes_InitContext()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_InitContext ( CRYPTO_Type *  base,
uint8_t const *  key,
cy_en_crypto_aes_key_length_t  keyLength,
cy_stc_crypto_aes_state_t aesState,
cy_stc_crypto_aes_buffers_t aesBuffers 
)

Initializes AES mode of operation and prepares an inverse key within a user specified buffer.

Parameters
baseThe pointer to the CRYPTO instance.
keyThe pointer to the encryption/decryption key.
keyLengthcy_en_crypto_aes_key_length_t
aesStateThe pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
aesBuffersThe pointer to the AES buffer provided by the user. The user must not modify anything in this buffer during operation.
Returns
cy_en_crypto_status_t

◆ Cy_Crypto_Core_Aes_Free()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Free ( CRYPTO_Type *  base,
cy_stc_crypto_aes_state_t aesState 
)

Clears AES operation context.

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_crypto_status_t
Function Usage
uint8_t aesKey[CY_CRYPTO_AES_128_KEY_SIZE] = {
0x2Bu, 0x7Eu, 0x15u, 0x16u, 0x28u, 0xAEu, 0xD2u, 0xA6u,
0xABu, 0xF7u, 0x15u, 0x88u, 0x09u, 0xCFu, 0x4Fu, 0x3Cu
};
uint8_t aesEcbPlainText[CY_CRYPTO_AES_BLOCK_SIZE] = {
0x6Bu, 0xC0u, 0xBCu, 0xE1u, 0x2Au, 0x45u, 0x99u, 0x91u,
0xE1u, 0x34u, 0x74u, 0x1Au, 0x7Fu, 0x9Eu, 0x19u, 0x25u
};
uint8_t aesEcbCipherText[CY_CRYPTO_AES_BLOCK_SIZE] = {0};
cy_en_crypto_status_t cryptoStatus;
/* Initialize Crypto AES functionality */
cryptoStatus = Cy_Crypto_Core_Aes_Init(
CRYPTO_HW,
aesKey, /* Pointer to key */
CY_CRYPTO_KEY_AES_128, /* Key size */
&aesState); /* pointer to AES state structure */
/* ... check for errors... */
/* Encrypt one block (16 Bytes) by AES128 */
cryptoStatus = Cy_Crypto_Core_Aes_Ecb(
CRYPTO_HW,
aesEcbCipherText, /* destination block */
aesEcbPlainText, /* source block */
&aesState);
/* ... check for errors... */
/* Clear AES operation context */
cryptoStatus = Cy_Crypto_Core_Aes_Free(
CRYPTO_HW,
&aesState);
/* ... check for errors... */

◆ Cy_Crypto_Core_Aes_Ecb()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ecb ( CRYPTO_Type *  base,
cy_en_crypto_dir_mode_t  dirMode,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_crypto_aes_state_t aesState 
)

Performs the AES operation on a single block.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters src & dst must align and end in 32 byte boundary.

Parameters
baseThe pointer to the CRYPTO instance.
dirModeCan be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t).
dstThe pointer to the destination cipher block.
srcThe pointer to the 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_crypto_status_t
Function Usage
uint8_t aesKey[CY_CRYPTO_AES_128_KEY_SIZE] = {
0x2Bu, 0x7Eu, 0x15u, 0x16u, 0x28u, 0xAEu, 0xD2u, 0xA6u,
0xABu, 0xF7u, 0x15u, 0x88u, 0x09u, 0xCFu, 0x4Fu, 0x3Cu
};
uint8_t aesEcbPlainText[CY_CRYPTO_AES_BLOCK_SIZE] = {
0x6Bu, 0xC0u, 0xBCu, 0xE1u, 0x2Au, 0x45u, 0x99u, 0x91u,
0xE1u, 0x34u, 0x74u, 0x1Au, 0x7Fu, 0x9Eu, 0x19u, 0x25u
};
uint8_t aesEcbCipherText[CY_CRYPTO_AES_BLOCK_SIZE] = {0};
cy_en_crypto_status_t cryptoStatus;
/* Initialize Crypto AES functionality */
cryptoStatus = Cy_Crypto_Core_Aes_Init(
CRYPTO_HW,
aesKey, /* Pointer to key */
CY_CRYPTO_KEY_AES_128, /* Key size */
&aesState); /* pointer to AES state structure */
/* ... check for errors... */
/* Encrypt one block (16 Bytes) by AES128 */
cryptoStatus = Cy_Crypto_Core_Aes_Ecb(
CRYPTO_HW,
aesEcbCipherText, /* destination block */
aesEcbPlainText, /* source block */
&aesState);
/* ... check for errors... */
/* Clear AES operation context */
cryptoStatus = Cy_Crypto_Core_Aes_Free(
CRYPTO_HW,
&aesState);
/* ... check for errors... */

◆ Cy_Crypto_Core_Aes_Ecb_Setup()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ecb_Setup ( CRYPTO_Type *  base,
cy_en_crypto_dir_mode_t  dirMode,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES ECB init operation.

Parameters
baseThe pointer to the CRYPTO instance.
dirModeCan be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ecb_Update()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ecb_Update ( CRYPTO_Type *  base,
uint32_t  srcSize,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES ECB Multistage update operation.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters src & dst must align and end in 32 byte boundary.

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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ecb_Finish()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ecb_Finish ( CRYPTO_Type *  base,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES ECB 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Cbc()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cbc ( CRYPTO_Type *  base,
cy_en_crypto_dir_mode_t  dirMode,
uint32_t  srcSize,
uint8_t *  ivPtr,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_crypto_aes_state_t aesState 
)

Performs the AES-CBC operation defined in the dirMode parameter on a plain text defined in the src parameter.

Parameters
baseThe pointer to the CRYPTO instance.
dirModeCan be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t)
srcSizeThe size of the source plain text.
ivPtrThe pointer to the initial vector.
dstThe pointer to the destination cipher text.
srcThe pointer to the 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Cbc_Setup()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cbc_Setup ( CRYPTO_Type *  base,
cy_en_crypto_dir_mode_t  dirMode,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES CBC setup operation.

Parameters
baseThe pointer to the CRYPTO instance.
dirModeCan be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Cbc_Set_IV()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cbc_Set_IV ( CRYPTO_Type *  base,
uint8_t const *  iv,
cy_stc_crypto_aes_state_t aesState 
)

Function to set AES CBC IV.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters iv must align and end in 32 byte boundary.

Parameters
baseThe pointer to the CRYPTO 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Cbc_Update()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cbc_Update ( CRYPTO_Type *  base,
uint32_t  srcSize,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES CBC Multistage update operation.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters src & dst must align and end in 32 byte boundary.

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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Cbc_Finish()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cbc_Finish ( CRYPTO_Type *  base,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES CBC 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_CbcMac_Setup()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_CbcMac_Setup ( CRYPTO_Type *  base,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES CBC MAC setup 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_CbcMac_Update()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_CbcMac_Update ( CRYPTO_Type *  base,
uint32_t  srcSize,
uint8_t const *  src,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES CBC MAC Multistage update operation.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters src must align and end in 32 byte boundary.

Parameters
baseThe pointer to the CRYPTO 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_CbcMac_Finish()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_CbcMac_Finish ( CRYPTO_Type *  base,
uint8_t *  mac,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES CBC finish operation.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters mac must align and end in 32 byte boundary.

Parameters
baseThe pointer to the CRYPTO instance.
macThe pointer to the cbc-mac.
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_Crypto_Core_Aes_Cfb()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cfb ( CRYPTO_Type *  base,
cy_en_crypto_dir_mode_t  dirMode,
uint32_t  srcSize,
uint8_t *  ivPtr,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_crypto_aes_state_t aesState 
)

Performs the AES-CFB operation defined in the dirMode parameter on a plain text defined in the SRC parameter.

Parameters
baseThe pointer to the CRYPTO instance.
dirModeCan be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t)
srcSizeThe size of the source plain text.
ivPtrThe pointer to the initial vector.
dstThe pointer to the destination cipher text.
srcThe pointer to the 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Cfb_Setup()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cfb_Setup ( CRYPTO_Type *  base,
cy_en_crypto_dir_mode_t  dirMode,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES CFB setup operation.

Parameters
baseThe pointer to the CRYPTO instance.
dirModeCan be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Cfb_Set_IV()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cfb_Set_IV ( CRYPTO_Type *  base,
uint8_t const *  iv,
cy_stc_crypto_aes_state_t aesState 
)

Sets IV for AES CFB mode.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters iv must align and end in 32 byte boundary.

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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Cfb_Update()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cfb_Update ( CRYPTO_Type *  base,
uint32_t  srcSize,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES CFB Multistage update operation.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters src & dst must align and end in 32 byte boundary.

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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Cfb_Finish()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Cfb_Finish ( CRYPTO_Type *  base,
cy_stc_crypto_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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ctr()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ctr ( CRYPTO_Type *  base,
uint32_t  srcSize,
uint32_t *  srcOffset,
uint8_t *  ivPtr,
uint8_t *  streamBlock,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_crypto_aes_state_t aesState 
)

Performs the AES-CTR operation on a plain text defined in the src parameter.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters iv must align and end in 32 byte boundary.

Parameters
baseThe pointer to the CRYPTO instance.
srcSizeThe size of the 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.
streamBlockThe saved stream-block for resuming. Is over-written by the function.
dstThe pointer to the destination cipher text.
srcThe pointer to the source plain text. Must be 4-Byte aligned.
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_Crypto_Core_Aes_Ctr_Setup()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ctr_Setup ( CRYPTO_Type *  base,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES CTR Multistage update 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ctr_Set_IV()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ctr_Set_IV ( CRYPTO_Type *  base,
const uint8_t *  iv,
cy_stc_crypto_aes_state_t aesState 
)

Sets IV for the AES CTR operation.

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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ctr_Update()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ctr_Update ( CRYPTO_Type *  base,
uint32_t  srcSize,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES CTR Multistage update operation.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters src & dst must align and end in 32 byte boundary.

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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ctr_Finish()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ctr_Finish ( CRYPTO_Type *  base,
cy_stc_crypto_aes_state_t aesState 
)

Performs an AES CTR 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_GCM_Init()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Init ( CRYPTO_Type *  base,
cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers,
cy_stc_crypto_aes_gcm_state_t aesGCMctx 
)

The function to initialize AES GCM operation.

Parameters
baseThe pointer to the CRYPTO instance.
aesGCMBuffersThe pointer to the AES GCM buffer provided by the user. The user must not modify anything in this structure.
aesGCMctxThe pointer to the AES GCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_crypto_status_t
Function Usage
cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
uint8_t aes_key[] = {0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, };
uint8_t plain_txt[] = {0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 0xba, 0x63, 0x7b, 0x39};
uint8_t iv[12] = {0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8, 0x88};
uint8_t aad[] = {0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xab, 0xad, 0xda, 0xd2};
uint8_t encrypted_data[sizeof(plain_txt)] = {0};
uint8_t tag[16] = {0};
status = Cy_Crypto_Core_V2_Aes_GCM_Init(CRYPTO_HW, &aesGCMBuffers, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_SetKey(CRYPTO_HW, aes_key, CY_CRYPTO_KEY_AES_128, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Start(CRYPTO_HW, CY_CRYPTO_ENCRYPT, iv, sizeof(iv), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_AAD_Update(CRYPTO_HW, aad, sizeof(aad), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Update(CRYPTO_HW, plain_txt, sizeof(plain_txt), encrypted_data, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Finish(CRYPTO_HW, tag, sizeof(tag), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Free(CRYPTO_HW, &aesGCMctx);
/* ... check for errors... */

◆ Cy_Crypto_Core_Aes_GCM_SetKey()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_SetKey ( CRYPTO_Type *  base,
uint8_t const *  aesKey,
cy_en_crypto_aes_key_length_t  keyLength,
cy_stc_crypto_aes_gcm_state_t aesGCMctx 
)

The function to set AES GCM Key.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters aeskey must align and end in 32 byte boundary.

Parameters
baseThe pointer to the CRYPTO instance.
aesKeyThe pointer to the AES key.
keyLengthcy_en_crypto_aes_key_length_t
aesGCMctxThe pointer to the AES GCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_crypto_status_t
Function Usage
cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
uint8_t aes_key[] = {0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, };
uint8_t plain_txt[] = {0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 0xba, 0x63, 0x7b, 0x39};
uint8_t iv[12] = {0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8, 0x88};
uint8_t aad[] = {0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xab, 0xad, 0xda, 0xd2};
uint8_t encrypted_data[sizeof(plain_txt)] = {0};
uint8_t tag[16] = {0};
status = Cy_Crypto_Core_V2_Aes_GCM_Init(CRYPTO_HW, &aesGCMBuffers, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_SetKey(CRYPTO_HW, aes_key, CY_CRYPTO_KEY_AES_128, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Start(CRYPTO_HW, CY_CRYPTO_ENCRYPT, iv, sizeof(iv), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_AAD_Update(CRYPTO_HW, aad, sizeof(aad), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Update(CRYPTO_HW, plain_txt, sizeof(plain_txt), encrypted_data, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Finish(CRYPTO_HW, tag, sizeof(tag), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Free(CRYPTO_HW, &aesGCMctx);
/* ... check for errors... */

◆ Cy_Crypto_Core_Aes_GCM_Start()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Start ( CRYPTO_Type *  base,
cy_en_crypto_dir_mode_t  mode,
uint8_t const *  iv,
uint32_t  ivSize,
cy_stc_crypto_aes_gcm_state_t aesGCMctx 
)

The function to start AES GCM operation.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters iv must align and end in 32 byte boundary.

Parameters
baseThe pointer to the CRYPTO instance.
modecy_en_crypto_dir_mode_t
ivThe pointer to the Initialization vector.
ivSizeThe length of the iv.
aesGCMctxThe pointer to the AES GCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_crypto_status_t
Function Usage
cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
uint8_t aes_key[] = {0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, };
uint8_t plain_txt[] = {0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 0xba, 0x63, 0x7b, 0x39};
uint8_t iv[12] = {0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8, 0x88};
uint8_t aad[] = {0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xab, 0xad, 0xda, 0xd2};
uint8_t encrypted_data[sizeof(plain_txt)] = {0};
uint8_t tag[16] = {0};
status = Cy_Crypto_Core_V2_Aes_GCM_Init(CRYPTO_HW, &aesGCMBuffers, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_SetKey(CRYPTO_HW, aes_key, CY_CRYPTO_KEY_AES_128, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Start(CRYPTO_HW, CY_CRYPTO_ENCRYPT, iv, sizeof(iv), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_AAD_Update(CRYPTO_HW, aad, sizeof(aad), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Update(CRYPTO_HW, plain_txt, sizeof(plain_txt), encrypted_data, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Finish(CRYPTO_HW, tag, sizeof(tag), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Free(CRYPTO_HW, &aesGCMctx);
/* ... check for errors... */

◆ Cy_Crypto_Core_Aes_GCM_AAD_Update()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_AAD_Update ( CRYPTO_Type *  base,
uint8_t *  aad,
uint32_t  aadSize,
cy_stc_crypto_aes_gcm_state_t aesGCMctx 
)

The function to update the Additional Authentication Data.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters aad must align and end in 32 byte boundary.

Parameters
baseThe pointer to the CRYPTO instance.
aadThe pointer to the Additional Authentication Data.
aadSizeThe length of the Additional Authentication Data
aesGCMctxThe pointer to the AES GCM state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_crypto_status_t
Function Usage
cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
uint8_t aes_key[] = {0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, };
uint8_t plain_txt[] = {0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 0xba, 0x63, 0x7b, 0x39};
uint8_t iv[12] = {0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8, 0x88};
uint8_t aad[] = {0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xab, 0xad, 0xda, 0xd2};
uint8_t encrypted_data[sizeof(plain_txt)] = {0};
uint8_t tag[16] = {0};
status = Cy_Crypto_Core_V2_Aes_GCM_Init(CRYPTO_HW, &aesGCMBuffers, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_SetKey(CRYPTO_HW, aes_key, CY_CRYPTO_KEY_AES_128, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Start(CRYPTO_HW, CY_CRYPTO_ENCRYPT, iv, sizeof(iv), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_AAD_Update(CRYPTO_HW, aad, sizeof(aad), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Update(CRYPTO_HW, plain_txt, sizeof(plain_txt), encrypted_data, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Finish(CRYPTO_HW, tag, sizeof(tag), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Free(CRYPTO_HW, &aesGCMctx);
/* ... check for errors... */

◆ Cy_Crypto_Core_Aes_GCM_Update()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Update ( CRYPTO_Type *  base,
const uint8_t *  input,
uint32_t  inputSize,
uint8_t *  output,
cy_stc_crypto_aes_gcm_state_t aesGCMctx 
)

The function to update the data For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters input & output must align and end in 32 byte boundary.

Parameters
baseThe pointer to the CRYPTO instance.
inputThe pointer to the input data to be encrypted/decrypted.
inputSizeThe length of the input data.
outputThe pointer to the encrypted/decrypted output data.
aesGCMctxThe pointer to the AES GCm state structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_crypto_status_t
Function Usage
cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
uint8_t aes_key[] = {0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, };
uint8_t plain_txt[] = {0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 0xba, 0x63, 0x7b, 0x39};
uint8_t iv[12] = {0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8, 0x88};
uint8_t aad[] = {0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xab, 0xad, 0xda, 0xd2};
uint8_t encrypted_data[sizeof(plain_txt)] = {0};
uint8_t tag[16] = {0};
status = Cy_Crypto_Core_V2_Aes_GCM_Init(CRYPTO_HW, &aesGCMBuffers, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_SetKey(CRYPTO_HW, aes_key, CY_CRYPTO_KEY_AES_128, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Start(CRYPTO_HW, CY_CRYPTO_ENCRYPT, iv, sizeof(iv), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_AAD_Update(CRYPTO_HW, aad, sizeof(aad), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Update(CRYPTO_HW, plain_txt, sizeof(plain_txt), encrypted_data, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Finish(CRYPTO_HW, tag, sizeof(tag), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Free(CRYPTO_HW, &aesGCMctx);
/* ... check for errors... */

◆ Cy_Crypto_Core_Aes_GCM_Finish()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Finish ( CRYPTO_Type *  base,
uint8_t *  p_tag,
uint32_t  tagSize,
cy_stc_crypto_aes_gcm_state_t aesGCMctx 
)

The function to finish the AES GCM operation and to calculate the tag.

For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters p_tag must align and end in 32 byte boundary.

Parameters
baseThe pointer to the CRYPTO instance.
p_tagThe pointer to the buffer for storing tag.
tagSizeThe length of the p_tag.
aesGCMctxThe pointer to the AES aesGCMctx structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_crypto_status_t
Function Usage
cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
uint8_t aes_key[] = {0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, };
uint8_t plain_txt[] = {0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 0xba, 0x63, 0x7b, 0x39};
uint8_t iv[12] = {0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8, 0x88};
uint8_t aad[] = {0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xab, 0xad, 0xda, 0xd2};
uint8_t encrypted_data[sizeof(plain_txt)] = {0};
uint8_t tag[16] = {0};
status = Cy_Crypto_Core_V2_Aes_GCM_Init(CRYPTO_HW, &aesGCMBuffers, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_SetKey(CRYPTO_HW, aes_key, CY_CRYPTO_KEY_AES_128, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Start(CRYPTO_HW, CY_CRYPTO_ENCRYPT, iv, sizeof(iv), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_AAD_Update(CRYPTO_HW, aad, sizeof(aad), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Update(CRYPTO_HW, plain_txt, sizeof(plain_txt), encrypted_data, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Finish(CRYPTO_HW, tag, sizeof(tag), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Free(CRYPTO_HW, &aesGCMctx);
/* ... check for errors... */

◆ Cy_Crypto_Core_Aes_GCM_Free()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Free ( CRYPTO_Type *  base,
cy_stc_crypto_aes_gcm_state_t aesGCMctx 
)

The function to finish the encryption process and calculate tag.

Parameters
baseThe pointer to the CRYPTO instance.
aesGCMctxThe pointer to the AES aesGCMctx structure allocated by the user. The user must not modify anything in this structure.
Returns
cy_en_crypto_status_t
Function Usage
cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
uint8_t aes_key[] = {0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, };
uint8_t plain_txt[] = {0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 0xba, 0x63, 0x7b, 0x39};
uint8_t iv[12] = {0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8, 0x88};
uint8_t aad[] = {0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xab, 0xad, 0xda, 0xd2};
uint8_t encrypted_data[sizeof(plain_txt)] = {0};
uint8_t tag[16] = {0};
status = Cy_Crypto_Core_V2_Aes_GCM_Init(CRYPTO_HW, &aesGCMBuffers, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_SetKey(CRYPTO_HW, aes_key, CY_CRYPTO_KEY_AES_128, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Start(CRYPTO_HW, CY_CRYPTO_ENCRYPT, iv, sizeof(iv), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_AAD_Update(CRYPTO_HW, aad, sizeof(aad), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Update(CRYPTO_HW, plain_txt, sizeof(plain_txt), encrypted_data, &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Finish(CRYPTO_HW, tag, sizeof(tag), &aesGCMctx);
/* ... check for errors... */
status = Cy_Crypto_Core_V2_Aes_GCM_Free(CRYPTO_HW, &aesGCMctx);
/* ... check for errors... */

◆ Cy_Crypto_Core_Aes_GCM_Encrypt_Tag()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Encrypt_Tag ( CRYPTO_Type *  base,
uint8_t const *  aesKey,
cy_en_crypto_aes_key_length_t  keyLength,
uint8_t const *  iv,
uint32_t  ivSize,
uint8_t *  aad,
uint32_t  aadSize,
const uint8_t *  input,
uint32_t  inputSize,
uint8_t *  output,
uint8_t *  tag,
uint32_t  tagSize 
)

Performs the AES GCM encryption operation on the input data, iv & aad data, generates the encrypted data and TAG.

Parameters
baseThe pointer to the CRYPTO instance.
aesKeyThe pointer to the AES key.
keyLengthcy_en_crypto_aes_key_length_t
ivThe pointer to the Initialization vector.
ivSizeThe length of the iv.
aadThe pointer to the Additional Authentication Data.
aadSizeThe length of the additional Authentication Data
inputThe pointer to the input data to be encrypted/decrypted.
inputSizeThe length of the input data.
outputThe pointer to the encrypted/decrypted output data.
tagThe pointer to the tag.
tagSizeThe length of the p_tag.
Returns
cy_en_crypto_status_t
Function Usage
uint8_t aes_key[] = {0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, };
uint8_t plain_txt[] = {0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 0xba, 0x63, 0x7b, 0x39};
uint8_t iv[12] = {0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8, 0x88};
uint8_t aad[] = {0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xab, 0xad, 0xda, 0xd2};
uint8_t encrypted_data[sizeof(plain_txt)] = {0};
uint8_t tag[16] = {};
cy_en_crypto_status_t cryptoStatus;
/* ... check for errors... */
/* Encrypt AES-128 GCM */
cryptoStatus = Cy_Crypto_Core_Aes_GCM_Encrypt_Tag(CRYPTO_HW, aes_key, CY_CRYPTO_KEY_AES_128, iv, sizeof(iv), aad, sizeof(aad), plain_txt, sizeof(plain_txt), encrypted_data, tag, sizeof(tag));
/* ... check for errors... */

◆ Cy_Crypto_Core_Aes_GCM_Decrypt_Tag()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_GCM_Decrypt_Tag ( CRYPTO_Type *  base,
uint8_t const *  aesKey,
cy_en_crypto_aes_key_length_t  keyLength,
uint8_t const *  iv,
uint32_t  ivSize,
uint8_t *  aad,
uint32_t  aadSize,
const uint8_t *  input,
uint32_t  inputSize,
uint8_t *  tag,
uint32_t  tagSize,
uint8_t *  output,
cy_en_crypto_aesgcm_tag_verify_result_t *  isVerified 
)

Performs the AES GCM decryption operation on the input data and verifies the TAG.

Parameters
baseThe pointer to the CRYPTO instance.
aesKeyThe pointer to the AES key.
keyLengthcy_en_crypto_aes_key_length_t
ivThe pointer to the Initialization vector.
ivSizeThe length of the iv.
aadThe pointer to the Additional Authentication Data.
aadSizeThe length of the additional Authentication Data
inputThe pointer to the input data to be encrypted/decrypted.
inputSizeThe length of the input data.
tagThe pointer to the tag.
tagSizeThe length of the p_tag.
outputThe pointer to the encrypted/decrypted output data.
isVerifiedThe status of the AES GCM verification.
Returns
cy_en_crypto_status_t
Function Usage
uint8_t aes_key[] = { 0x7f, 0x71, 0x68, 0xa4, 0x06, 0xe7, 0xc1, 0xef, 0x0f, 0xd4, 0x7a, 0xc9, 0x22, 0xc5, 0xec, 0x5f, 0x65, 0x97, 0x65, 0xfb, 0x6a, 0xaa, 0x04, 0x8f, 0x70, 0x56, 0xf6, 0xc6, 0xb5, 0xd8, 0x51, 0x3d };
uint8_t cipher_txt[] = {0x8f, 0xad, 0xa0, 0xb8, 0xe7, 0x77, 0xa8, 0x29, 0xca, 0x96, 0x80, 0xd3, 0xbf, 0x4f, 0x35, 0x74, };
uint8_t iv[12] = {0xb8, 0xb5, 0xe4, 0x07, 0xad, 0xc0, 0xe2, 0x93, 0xe3, 0xe7, 0xe9, 0x91, };
uint8_t aad[] = {0xff, 0x76, 0x28, 0xf6, 0x42, 0x7f, 0xbc, 0xef, 0x1f, 0x3b, 0x82, 0xb3, 0x74, 0x04, 0xe1, 0x16, };
uint8_t decrypted_txt[16] = {0};
uint8_t tag[15] = {0xda, 0xca, 0x35, 0x42, 0x77, 0xf6, 0x33, 0x5f, 0xc8, 0xbe, 0xc9, 0x08, 0x86, 0xda, 0x70};
cy_en_crypto_aesgcm_tag_verify_result_t ver_result;
cy_en_crypto_status_t cryptoStatus;
/* Decrypt with AES-256 GCM and verify the tag */
cryptoStatus = Cy_Crypto_Core_V2_Aes_GCM_Decrypt_Tag(CRYPTO_HW, aes_key, CY_CRYPTO_KEY_AES_256, iv, sizeof(iv), aad, sizeof(aad), cipher_txt, sizeof(cipher_txt), tag, sizeof(tag), decrypted_txt, &ver_result);
/* ... check for errors and check ver_result is CY_CRYPTO_TAG_VALID... */

◆ Cy_Crypto_Core_Aes_Ccm_Init()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Init ( CRYPTO_Type *  base,
cy_stc_crypto_aes_ccm_buffers_t aesCcmBuffer,
cy_stc_crypto_aes_ccm_state_t aesCcmState 
)

Performs an AES CCM Init operation.

Parameters
baseThe pointer to the CRYPTO instance.
aesCcmBufferThe 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ccm_SetKey()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_SetKey ( CRYPTO_Type *  base,
uint8_t const *  key,
cy_en_crypto_aes_key_length_t  keyLength,
cy_stc_crypto_aes_ccm_state_t aesCcmState 
)

Sets AES CCM Key for the operation.

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

◆ Cy_Crypto_Core_Aes_Ccm_Set_Length()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Set_Length ( CRYPTO_Type *  base,
uint32_t  aadSize,
uint32_t  textSize,
uint32_t  tagLength,
cy_stc_crypto_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 CRYPTO 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ccm_Start()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Start ( CRYPTO_Type *  base,
cy_en_crypto_dir_mode_t  dirMode,
uint32_t  ivSize,
uint8_t const *  iv,
cy_stc_crypto_aes_ccm_state_t aesCcmState 
)

Function to set IV for the AES CCM operation.

Parameters
baseThe pointer to the CRYPTO instance.
dirModeCan be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ccm_Update_Aad()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Update_Aad ( CRYPTO_Type *  base,
uint32_t  aadSize,
uint8_t const *  aad,
cy_stc_crypto_aes_ccm_state_t aesCcmState 
)

Performs an AES CCM update AAD Multistage operation.

Parameters
baseThe pointer to the CRYPTO 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ccm_Update()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Update ( CRYPTO_Type *  base,
uint32_t  srcSize,
uint8_t *  dst,
uint8_t const *  src,
cy_stc_crypto_aes_ccm_state_t aesCcmState 
)

Performs an AES CCM Update Multistage update operation.

Parameters
baseThe pointer to the CRYPTO 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ccm_Finish()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Finish ( CRYPTO_Type *  base,
uint8_t *  tag,
cy_stc_crypto_aes_ccm_state_t aesCcmState 
)

Performs an AES CCM finish operation.

Parameters
baseThe pointer to the CRYPTO 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ccm_Encrypt_Tag()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Encrypt_Tag ( CRYPTO_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_crypto_aes_ccm_state_t aesCcmState 
)

Performs an AES CCM Encrypt operation.

Note
Cy_Crypto_Core_Aes_Ccm_Init() and Cy_Crypto_Core_Aes_Ccm_SetKey() should be called before calling this function
Parameters
baseThe pointer to the CRYPTO 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ccm_Decrypt()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Decrypt ( CRYPTO_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 const *  tag,
cy_en_crypto_aesccm_tag_verify_result_t isValid,
cy_stc_crypto_aes_ccm_state_t aesCcmState 
)

Performs an AES CCM Decrypt operation.

Note
Cy_Crypto_Core_Aes_Ccm_Init() and Cy_Crypto_Core_Aes_Ccm_SetKey() should be called before calling this function
Parameters
baseThe pointer to the CRYPTO 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_crypto_status_t

◆ Cy_Crypto_Core_Aes_Ccm_Free()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Aes_Ccm_Free ( CRYPTO_Type *  base,
cy_stc_crypto_aes_ccm_state_t aesCcmState 
)

Clears AES CCM operation context.

Parameters
baseThe pointer to the CRYPTO 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_crypto_status_t

◆ Cy_Crypto_Core_Des()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Des ( CRYPTO_Type *  base,
cy_en_crypto_dir_mode_t  dirMode,
uint8_t const *  key,
uint8_t *  dst,
uint8_t const *  src 
)

Performs the DES operation on a single block.

All addresses must be 4-byte aligned. Ciphertext (dst) may overlap with plaintext (src). This function is independent from the previous Crypto state.

Parameters
baseThe pointer to the CRYPTO instance.
dirModeCan be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t)
keyThe pointer to the encryption/decryption key.
dstThe pointer to the destination cipher block.
srcThe pointer to the source block.
Returns
cy_en_crypto_status_t
Function Usage
/* Note: all keys are placed into the one keys array. */
#define STRING_LENGTH 8
uint8_t msgString[STRING_LENGTH] = "Crypto!";
uint8_t encString[STRING_LENGTH];
#define KEY1 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77
uint8_t desKey[] = { KEY1 };
cy_en_crypto_status_t cryptoStatus;
cryptoStatus = Cy_Crypto_Core_Des(
CRYPTO_HW,
desKey, /* Pointer to key */
encString, /* Destination string */
msgString); /* Source String */
/* ... check for errors... */

◆ Cy_Crypto_Core_Tdes()

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Tdes ( CRYPTO_Type *  base,
cy_en_crypto_dir_mode_t  dirMode,
uint8_t const *  key,
uint8_t *  dst,
uint8_t const *  src 
)

Performs the TDES operation on a single block.

All addresses must be 4-byte aligned. Ciphertext (dst) may overlap with plaintext (src). This function is independent from the previous Crypto state.

Parameters
baseThe pointer to the CRYPTO instance.
dirModeCan be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t)
keyThe pointer to the encryption/decryption keys.
dstThe pointer to the destination cipher block.
srcThe pointer to the source data block.
Returns
cy_en_crypto_status_t
Function Usage
/* Note: all keys are placed into the one keys array. */
#define STRING_LENGTH 8
uint8_t msgString[STRING_LENGTH] = "Crypto!";
uint8_t encString[STRING_LENGTH];
#define KEY1 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77
#define KEY2 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
#define KEY3 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08
uint8_t tdesKey[] = { KEY1, KEY2, KEY3 };
cy_en_crypto_status_t cryptoStatus;
cryptoStatus = Cy_Crypto_Core_Tdes(
CRYPTO_HW,
tdesKey, /* Pointer to keys */
encString, /* Destination string */
msgString); /* Source String */
/* ... check for errors... */
#