MCUX CLNS MCUX Crypto Library Normal Secure |

Functions
mcuxClCss_Aead_Functions
mcuxClCss » mcuxClCss_Aead

Defines all functions of mcuxClCss_Aead. More...

## Functions

MCUXCLCSS_API mcuxClCss_Status_Protected_t | mcuxClCss_Aead_Init_Async (mcuxClCss_AeadOption_t options, mcuxClCss_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, uint8_t const *pIV, size_t ivLength, uint8_t *pAeadCtx)
| AES-GCM initialization. More...
MCUXCLCSS_API mcuxClCss_Status_Protected_t | mcuxClCss_Aead_PartialInit_Async (mcuxClCss_AeadOption_t options, mcuxClCss_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, uint8_t const *pIV, size_t ivLength, uint8_t *pAeadCtx)
| AES-GCM partial initialization. More...
MCUXCLCSS_API mcuxClCss_Status_Protected_t | mcuxClCss_Aead_UpdateAad_Async (mcuxClCss_AeadOption_t options, mcuxClCss_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, uint8_t const *pAad, size_t aadLength, uint8_t *pAeadCtx)
| AES-GCM update of the Additional Authenticated Data (AAD) More...
MCUXCLCSS_API mcuxClCss_Status_Protected_t | mcuxClCss_Aead_UpdateData_Async (mcuxClCss_AeadOption_t options, mcuxClCss_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, uint8_t const *pInput, size_t inputLength, uint8_t *pOutput, uint8_t *pAeadCtx)
| AES-GCM update of the encrypted data. More...
MCUXCLCSS_API mcuxClCss_Status_Protected_t | mcuxClCss_Aead_Finalize_Async (mcuxClCss_AeadOption_t options, mcuxClCss_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, size_t aadLength, size_t dataLength, uint8_t *pTag, uint8_t *pAeadCtx)
| AES-GCM final encryption/decryption. More...

## Detailed Description

Defines all functions of mcuxClCss_Aead.

## Function Documentation

## ◆ mcuxClCss_Aead_Init_Async()

MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_Init_Async | ( | mcuxClCss_AeadOption_t | options,
|  | mcuxClCss_KeyIndex_t | keyIdx,
|  | uint8_t const * | pKey,
|  | size_t | keyLength,
|  | uint8_t const * | pIV,
|  | size_t | ivLength,
|  | uint8_t * | pAeadCtx
| ) |  |

AES-GCM initialization.

This is the first stage of AEAD encryption/decryption. This generates the initial context out of the IV `pIV` and the key (`pKey` or `keyIdx`).

Call mcuxClCss_WaitForOperation to complete the operation.

Parameters

  [in] | options | The AEAD command options. For more information, see mcuxClCss_AeadOption_t.
  [in] | keyIdx | Index of the key inside the CSSv2 keystore
  [in] | pKey | Pointer to the key
  [in] | keyLength | Size of `pKey` in bytes
  [in] | pIV | Pointer to memory area that contains the IV
  [in] | ivLength | Size of `pIV` in bytes, with padding
  [out] | pAeadCtx | Pointer to the memory area that receives the AEAD context structure. Must be at least MCUXCLCSS_AEAD_CONTEXT_SIZE bytes long.

The properties of some parameters change with respect to selected options.

Parameter properties
  `options.extkey` == MCUXCLCSS_AEAD_EXTERN_KEY

    `keyIdx` is ignored.

    `pKey` must be a valid AES key and `keyLength` a valid AES key size (see MCUXCLCSS_CIPHER_KEY_SIZE_AES_).

  `options.extkey` == MCUXCLCSS_AEAD_INTERN_KEY

    `keyIdx` must be a valid key index with the correct usage rights.

    `pKey` and `keyLength` are ignored.

Returns
  An error code that can be any error code in MCUXCLCSS_STATUS_, see individual documentation for more information

Return values

  MCUXCLCSS_STATUS_SW_INVALID_PARAM | if invalid parameters were specified
  MCUXCLCSS_STATUS_SW_CANNOT_INTERRUPT | if a running operation prevented the request
  MCUXCLCSS_STATUS_OK_WAIT | on successful request

## ◆ mcuxClCss_Aead_PartialInit_Async()

MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_PartialInit_Async | ( | mcuxClCss_AeadOption_t | options,
|  | mcuxClCss_KeyIndex_t | keyIdx,
|  | uint8_t const * | pKey,
|  | size_t | keyLength,
|  | uint8_t const * | pIV,
|  | size_t | ivLength,
|  | uint8_t * | pAeadCtx
| ) |  |

AES-GCM partial initialization.

This is the first stage of AEAD encryption/decryption. This generates the initial context out of the IV `pIV` and the key (`pKey` or `keyIdx`).

Call mcuxClCss_WaitForOperation to complete the operation.

Parameters

  [in] | options | The AEAD command options. For more information, see mcuxClCss_AeadOption_t.
  [in] | keyIdx | Index of the key inside the CSSv2 keystore
  [in] | pKey | Pointer to the key
  [in] | keyLength | Size of `pKey` in bytes
  [in] | pIV | Pointer to memory area that contains the IV
  [in] | ivLength | Size of `pIV` in bytes, with padding
  [out] | pAeadCtx | Pointer to the memory area that receives the AEAD context structure. Must be at least MCUXCLCSS_AEAD_CONTEXT_SIZE bytes long.

The properties of some parameters change with respect to selected options.

Parameter properties
  `options.extkey` == MCUXCLCSS_AEAD_EXTERN_KEY

    `keyIdx` is ignored.

    `pKey` must be a valid AES key and `keyLength` a valid AES key size (see MCUXCLCSS_CIPHER_KEY_SIZE_AES_).

  `options.extkey` == MCUXCLCSS_AEAD_INTERN_KEY

    `keyIdx` must be a valid key index with the correct usage rights.

    `pKey` and `keyLength` are ignored.

  `options.msgendw`
    This field is ignored

Returns
  An error code that can be any error code in MCUXCLCSS_STATUS_, see individual documentation for more information

Return values

  MCUXCLCSS_STATUS_SW_INVALID_PARAM | if invalid parameters were specified
  MCUXCLCSS_STATUS_SW_CANNOT_INTERRUPT | if a running operation prevented the request
  MCUXCLCSS_STATUS_OK_WAIT | on successful request

## ◆ mcuxClCss_Aead_UpdateAad_Async()

MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_UpdateAad_Async | ( | mcuxClCss_AeadOption_t | options,
|  | mcuxClCss_KeyIndex_t | keyIdx,
|  | uint8_t const * | pKey,
|  | size_t | keyLength,
|  | uint8_t const * | pAad,
|  | size_t | aadLength,
|  | uint8_t * | pAeadCtx
| ) |  |

AES-GCM update of the Additional Authenticated Data (AAD)

This is the second stage of AEAD encryption/decryption. This updates the internal authentication tag with the AAD.

mcuxClCss_Aead_Init_Async must have been called before calling this function.

Call mcuxClCss_WaitForOperation to complete the operation.

Parameters

  [in] | options | The AEAD command options. For more information, see mcuxClCss_AeadOption_t.
  [in] | keyIdx | Index of the key inside the CSSv2 keystore
  [in] | pKey | Pointer to the key
  [in] | keyLength | Size of `pKey` in bytes
  [in] | pAad | Memory area that contains the AAD
  [in] | aadLength | Length of the `pAad` in bytes with padding
  [in,out] | pAeadCtx | Pointer to the AEAD context structure. Must be at least MCUXCLCSS_AEAD_CONTEXT_SIZE bytes long.

The properties of some parameters change with respect to selected options.

Parameter properties
  `options.extkey` == MCUXCLCSS_AEAD_EXTERN_KEY

    `keyIdx` is ignored.

    `pKey` must be a valid AES key and `keyLength` a valid AES key size (see MCUXCLCSS_CIPHER_KEY_SIZE_AES_).

  `options.extkey` == MCUXCLCSS_AEAD_INTERN_KEY

    `keyIdx` must be a valid key index with the correct usage rights.

    `pKey` and `keyLength` are ignored.

  `options.msgendw`
    This field is ignored

Returns
  An error code that can be any error code in MCUXCLCSS_STATUS_, see individual documentation for more information

Return values

  MCUXCLCSS_STATUS_SW_INVALID_PARAM | if invalid parameters were specified
  MCUXCLCSS_STATUS_SW_CANNOT_INTERRUPT | if a running operation prevented the request
  MCUXCLCSS_STATUS_OK_WAIT | on successful request

## ◆ mcuxClCss_Aead_UpdateData_Async()

MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_UpdateData_Async | ( | mcuxClCss_AeadOption_t | options,
|  | mcuxClCss_KeyIndex_t | keyIdx,
|  | uint8_t const * | pKey,
|  | size_t | keyLength,
|  | uint8_t const * | pInput,
|  | size_t | inputLength,
|  | uint8_t * | pOutput,
|  | uint8_t * | pAeadCtx
| ) |  |

AES-GCM update of the encrypted data.

This is the third stage of AEAD encryption/decryption. This updates the internal authentication tag with the AAD and outputs the ciphertext (in case of encryption) or plaintext (in case of decryption).

mcuxClCss_Aead_Init_Async, mcuxClCss_Aead_UpdateAad_Async must have been called before calling this function.

Call mcuxClCss_WaitForOperation to complete the operation.

Parameters

  [in] | options | The AEAD command options. For more information, see mcuxClCss_AeadOption_t.
  [in] | keyIdx | Index of the key inside the CSSv2 keystore
  [in] | pKey | Pointer to the key
  [in] | keyLength | Size of `pKey` in bytes
  [in] | pInput | Pointer to the memory location of the data to be processed
  [in] | inputLength | Size of `pInput` in bytes with padding
  [out] | pOutput | Pointer to the processed data memory location
  [in,out] | pAeadCtx | Pointer to the AEAD context structure. Must be at least MCUXCLCSS_AEAD_CONTEXT_SIZE bytes long.

The properties of some parameters change with respect to selected options.

Parameter properties
  `options.extkey` == MCUXCLCSS_AEAD_EXTERN_KEY

    `keyIdx` is ignored.

    `pKey` must be a valid AES key and `keyLength` a valid AES key size (see MCUXCLCSS_CIPHER_KEY_SIZE_AES_).

  `options.extkey` == MCUXCLCSS_AEAD_INTERN_KEY

    `keyIdx` must be a valid key index with the correct usage rights.

    `pKey` and `keyLength` are ignored.

  `options.msgendw`
    This field is ignored

Returns
  An error code that can be any error code in MCUXCLCSS_STATUS_, see individual documentation for more information

Return values

  MCUXCLCSS_STATUS_SW_INVALID_PARAM | if invalid parameters were specified
  MCUXCLCSS_STATUS_SW_CANNOT_INTERRUPT | if a running operation prevented the request
  MCUXCLCSS_STATUS_OK_WAIT | on successful request

## ◆ mcuxClCss_Aead_Finalize_Async()

MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_Finalize_Async | ( | mcuxClCss_AeadOption_t | options,
|  | mcuxClCss_KeyIndex_t | keyIdx,
|  | uint8_t const * | pKey,
|  | size_t | keyLength,
|  | size_t | aadLength,
|  | size_t | dataLength,
|  | uint8_t * | pTag,
|  | uint8_t * | pAeadCtx
| ) |  |

AES-GCM final encryption/decryption.

This is the fourth stage of AEAD encryption/decryption. This updates the authentication tag with the final data length block and outputs the tag at the desired location.

mcuxClCss_Aead_Init_Async, mcuxClCss_Aead_UpdateAad_Async and mcuxClCss_Aead_UpdateData_Async must have been called before calling this function.

Call mcuxClCss_WaitForOperation to complete the operation.

Parameters

  [in] | options | The AEAD command options. For more information, see mcuxClCss_AeadOption_t.
  [in] | keyIdx | Index of the key inside the CSSv2 keystore
  [in] | pKey | Pointer to the key
  [in] | keyLength | Size of `pKey` in bytes
  [in] | aadLength | Length of the complete Additional Authenticated Data (AAD) in bytes, without padding.
  [in] | dataLength | Length of the complete plaintext/ciphertext in bytes, without padding.
  [out] | pTag | Pointer where the resulting tag will be stored
  [in] | pAeadCtx | Pointer to the AEAD context structure. Must be at least MCUXCLCSS_AEAD_CONTEXT_SIZE bytes long.

The properties of some parameters change with respect to selected options.

Parameter properties
  `options.extkey` == MCUXCLCSS_AEAD_EXTERN_KEY

    `keyIdx` is ignored.

    `pKey` must be a valid AES key and `keyLength` a valid AES key size (see MCUXCLCSS_CIPHER_KEY_SIZE_AES_).

  `options.extkey` == MCUXCLCSS_AEAD_INTERN_KEY

    `keyIdx` must be a valid key index with the correct usage rights.

    `pKey` and `keyLength` are ignored.

  `options.msgendw`
    This field has to be set to the size of the last data block (plain/cipher text) in bytes, without padding

Returns
  An error code that can be any error code in MCUXCLCSS_STATUS_, see individual documentation for more information

Return values

  MCUXCLCSS_STATUS_SW_INVALID_PARAM | if invalid parameters were specified
  MCUXCLCSS_STATUS_SW_CANNOT_INTERRUPT | if a running operation prevented the request
  MCUXCLCSS_STATUS_OK_WAIT | on successful request