PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

Functions
Functions
PDL API Reference » Crypto (Cryptography) » Direct Crypto Core Access » Symmetric Key Algorithms (AES, GCM, DES, TDES)

## 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 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.

When D-Cache is enabled parameters key must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  key | The pointer to the encryption/decryption key.
  keyLength | cy_en_crypto_aes_key_length_t
  aesState | The 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_stc_crypto_aes_state_t aesState;
  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,
  CY_CRYPTO_ENCRYPT,
  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_stc_crypto_aes_state_t
  Definition: cy_crypto_common.h:768
  cy_en_crypto_status_t
  cy_en_crypto_status_t
  Errors of the Crypto block.
  Definition: cy_crypto_common.h:532
  CY_CRYPTO_KEY_AES_128
  @ CY_CRYPTO_KEY_AES_128
  The AES key size is 128 bits.
  Definition: cy_crypto_common.h:474
  CY_CRYPTO_ENCRYPT
  @ CY_CRYPTO_ENCRYPT
  The forward mode, plain text will be encrypted into cipher text.
  Definition: cy_crypto_common.h:484
  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.
  Definition: cy_crypto_core_aes.h:275
  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.
  Definition: cy_crypto_core_aes.h:223
  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.
  Definition: cy_crypto_core_aes.h:124
  CY_CRYPTO_AES_128_KEY_SIZE
  #define CY_CRYPTO_AES_128_KEY_SIZE
  Defines the Crypto AES_128 key maximum size (in bytes)
  Definition: cy_crypto_common.h:139
  CY_CRYPTO_AES_BLOCK_SIZE
  #define CY_CRYPTO_AES_BLOCK_SIZE
  Defines the Crypto AES block size (in bytes)
  Definition: cy_crypto_common.h:136

## ◆ 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

  base | The pointer to the CRYPTO instance.
  key | The pointer to the encryption/decryption key.
  keyLength | cy_en_crypto_aes_key_length_t
  aesState | The pointer to the AES state structure allocated by the user. The user must not modify anything in this structure.
  aesBuffers | The 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

  base | The pointer to the CRYPTO instance.
  aesState | The 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_stc_crypto_aes_state_t aesState;
  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,
  CY_CRYPTO_ENCRYPT,
  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.

When D-Cache is enabled parameters src & dst must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  dirMode | Can be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t).
  dst | The pointer to the destination cipher block.
  src | The pointer to the source block.
  aesState | The 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_stc_crypto_aes_state_t aesState;
  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,
  CY_CRYPTO_ENCRYPT,
  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

  base | The pointer to the CRYPTO instance.
  dirMode | Can be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t).
  aesState | The 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.

When D-Cache is enabled parameters src & dst must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  srcSize | The size of the source block.
  dst | The pointer to a destination cipher block.
  src | The pointer to a source block.
  aesState | The 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

  base | The pointer to the CRYPTO instance.
  aesState | The 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

  base | The pointer to the CRYPTO instance.
  dirMode | Can be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t)
  srcSize | The size of the source plain text.
  ivPtr | The pointer to the initial vector.
  dst | The pointer to the destination cipher text.
  src | The pointer to the source plain text.
  aesState | The 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

  base | The pointer to the CRYPTO instance.
  dirMode | Can be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t).
  aesState | The 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.

When D-Cache is enabled parameters iv must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  iv | The pointer to the IV.
  aesState | The 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.

When D-Cache is enabled parameters src & dst must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  srcSize | The size of the source block.
  dst | The pointer to a destination cipher block.
  src | The pointer to a source block.
  aesState | The 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

  base | The pointer to the CRYPTO instance.
  aesState | The 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

  base | The pointer to the CRYPTO instance.
  aesState | The 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.

When D-Cache is enabled parameters src must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  srcSize | The size of the source block.
  src | The pointer to a source block.
  aesState | The 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.

When D-Cache is enabled parameters mac must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  mac | The pointer to the cbc-mac.
  aesState | The 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

  base | The pointer to the CRYPTO instance.
  dirMode | Can be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t)
  srcSize | The size of the source plain text.
  ivPtr | The pointer to the initial vector.
  dst | The pointer to the destination cipher text.
  src | The pointer to the source plain text.
  aesState | The 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

  base | The pointer to the CRYPTO instance.
  dirMode | Can be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t).
  aesState | The 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.

When D-Cache is enabled parameters iv must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  iv | The pointer to iv.
  aesState | The 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.

When D-Cache is enabled parameters src & dst must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  srcSize | The size of the source block.
  dst | The pointer to a destination cipher block.
  src | The pointer to a source block.
  aesState | The 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

  base | The pointer to the CRYPTO instance.
  aesState | The 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.

When D-Cache is enabled parameters iv must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  srcSize | The size of the source plain text.
  srcOffset | The size of an offset within the current block stream for resuming within the current cipher stream.
  ivPtr | The 128-bit initial vector that contains a 64-bit nonce and 64-bit counter.
  streamBlock | The saved stream-block for resuming. Is over-written by the function.
  dst | The pointer to the destination cipher text.
  src | The pointer to the source plain text. Must be 4-Byte aligned.
  aesState | The 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

  base | The pointer to the CRYPTO instance.
  aesState | The 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

  base | The pointer to the CRYPTO instance.
  iv | The pointer to iv.
  aesState | The 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.

When D-Cache is enabled parameters src & dst must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  srcSize | The size of the source block.
  dst | The pointer to a destination cipher block.
  src | The pointer to a source block.
  aesState | The 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

  base | The pointer to the CRYPTO instance.
  aesState | The 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

  base | The pointer to the CRYPTO instance.
  aesGCMBuffers | The pointer to the AES GCM buffer provided by the user. The user must not modify anything in this structure.
  aesGCMctx | The 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_state_t aesGCMctx = {0};
  cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
  cy_en_crypto_status_t status = CY_CRYPTO_BAD_PARAMS;
  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_stc_crypto_aes_gcm_buffers_t
  The structure for storing the AES GCM state.
  Definition: cy_crypto_common.h:863
  cy_stc_crypto_aes_gcm_state_t
  Definition: cy_crypto_common.h:883
  CY_CRYPTO_BAD_PARAMS
  @ CY_CRYPTO_BAD_PARAMS
  The Crypto operation parameters are incorrect.
  Definition: cy_crypto_common.h:564

## ◆ 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.

When D-Cache is enabled parameters aeskey must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  aesKey | The pointer to the AES key.
  keyLength | cy_en_crypto_aes_key_length_t
  aesGCMctx | The 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_state_t aesGCMctx = {0};
  cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
  cy_en_crypto_status_t status = CY_CRYPTO_BAD_PARAMS;
  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.

When D-Cache is enabled parameters iv must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  mode | cy_en_crypto_dir_mode_t
  iv | The pointer to the Initialization vector.
  ivSize | The length of the iv.
  aesGCMctx | The 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_state_t aesGCMctx = {0};
  cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
  cy_en_crypto_status_t status = CY_CRYPTO_BAD_PARAMS;
  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.

When D-Cache is enabled parameters aad must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  aad | The pointer to the Additional Authentication Data.
  aadSize | The length of the Additional Authentication Data
  aesGCMctx | The 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_state_t aesGCMctx = {0};
  cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
  cy_en_crypto_status_t status = CY_CRYPTO_BAD_PARAMS;
  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 When D-Cache is enabled parameters input & output must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  input | The pointer to the input data to be encrypted/decrypted.
  inputSize | The length of the input data.
  output | The pointer to the encrypted/decrypted output data.
  aesGCMctx | The 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_state_t aesGCMctx = {0};
  cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
  cy_en_crypto_status_t status = CY_CRYPTO_BAD_PARAMS;
  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.

When D-Cache is enabled parameters p_tag must align and end in 32 byte boundary.

Parameters

  base | The pointer to the CRYPTO instance.
  p_tag | The pointer to the buffer for storing tag.
  tagSize | The length of the p_tag.
  aesGCMctx | The 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_state_t aesGCMctx = {0};
  cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
  cy_en_crypto_status_t status = CY_CRYPTO_BAD_PARAMS;
  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

  base | The pointer to the CRYPTO instance.
  aesGCMctx | The 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_state_t aesGCMctx = {0};
  cy_stc_crypto_aes_gcm_buffers_t aesGCMBuffers = {0};
  cy_en_crypto_status_t status = CY_CRYPTO_BAD_PARAMS;
  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

  base | The pointer to the CRYPTO instance.
  aesKey | The pointer to the AES key.
  keyLength | cy_en_crypto_aes_key_length_t
  iv | The pointer to the Initialization vector.
  ivSize | The length of the iv.
  aad | The pointer to the Additional Authentication Data.
  aadSize | The length of the additional Authentication Data
  input | The pointer to the input data to be encrypted/decrypted.
  inputSize | The length of the input data.
  output | The pointer to the encrypted/decrypted output data.
  tag | The pointer to the tag.
  tagSize | The 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_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 d...
  Definition: cy_crypto_core_aes.h:1781

## ◆ 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

  base | The pointer to the CRYPTO instance.
  aesKey | The pointer to the AES key.
  keyLength | cy_en_crypto_aes_key_length_t
  iv | The pointer to the Initialization vector.
  ivSize | The length of the iv.
  aad | The pointer to the Additional Authentication Data.
  aadSize | The length of the additional Authentication Data
  input | The pointer to the input data to be encrypted/decrypted.
  inputSize | The length of the input data.
  tag | The pointer to the tag.
  tagSize | The length of the p_tag.
  output | The pointer to the encrypted/decrypted output data.
  isVerified | The 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_KEY_AES_256
  @ CY_CRYPTO_KEY_AES_256
  The AES key size is 256 bits.
  Definition: cy_crypto_common.h:476

## ◆ 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

  base | The pointer to the CRYPTO instance.
  aesCcmBuffer | The buffers should be a SAHB mapped addresses. The pointer to the memory buffers storage.
  aesCcmState | The 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

  base | The pointer to the CRYPTO instance.
  key | The pointer to the CCM key.
  keyLength | cy_en_crypto_aes_key_length_t
  aesCcmState | The 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

  base | The pointer to the CRYPTO instance.
  aadSize | The Size of the Additional Authentication Data.
  textSize | The Size of the Text.
  tagLength | The Size of the Tag.
  aesCcmState | The 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

  base | The pointer to the CRYPTO instance.
  dirMode | Can be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t)
  ivSize | The size of the IV.
  iv | The pointer to the IV.
  aesCcmState | The 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

  base | The pointer to the CRYPTO instance.
  aadSize | The size of the AAD.
  aad | The pointer to a AAD.
  aesCcmState | The 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

  base | The pointer to the CRYPTO instance.
  srcSize | The size of the source block.
  dst | The pointer to a destination block.
  src | The pointer to a source block.
  aesCcmState | The 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

  base | The pointer to the CRYPTO instance.
  tag | The pointer to the CCM Tag.
  aesCcmState | The 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

  base | The pointer to the CRYPTO instance.
  ivSize | The size of the IV.
  iv | The pointer to the IV.
  aadSize | The size of the AAD.
  aad | The pointer to a AAD.
  srcSize | The size of the source block.
  cipherTxt | The pointer to a cipher text block.
  plainTxt | The pointer to a plain text block.
  tagSize | The size of the Tag.
  tag | The pointer to the tags.
  aesCcmState | The 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

  base | The pointer to the CRYPTO instance.
  ivSize | The size of the IV.
  iv | The pointer to the IV.
  aadSize | The size of the AAD.
  aad | The pointer to a AAD.
  srcSize | The size of the source block.
  plainTxt | The pointer to a plain text block.
  cipherTxt | The pointer to a cipher text block.
  tagSize | The size of the Tag.
  tag | The pointer to the tags.
  isValid | The pointer Store the authentication status.
  aesCcmState | The 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

  base | The pointer to the CRYPTO instance.
  aesCcmState | The 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

  base | The pointer to the CRYPTO instance.
  dirMode | Can be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t)
  key | The pointer to the encryption/decryption key.
  dst | The pointer to the destination cipher block.
  src | The 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,
  CY_CRYPTO_ENCRYPT,
  desKey, /* Pointer to key */
  encString, /* Destination string */
  msgString); /* Source String */
  /* ... check for errors... */
  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.
  Definition: cy_crypto_core_des.h:89

## ◆ 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

  base | The pointer to the CRYPTO instance.
  dirMode | Can be CY_CRYPTO_ENCRYPT or CY_CRYPTO_DECRYPT (cy_en_crypto_dir_mode_t)
  key | The pointer to the encryption/decryption keys.
  dst | The pointer to the destination cipher block.
  src | The 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,
  CY_CRYPTO_ENCRYPT,
  tdesKey, /* Pointer to keys */
  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.
  Definition: cy_crypto_core_des.h:144
  #