MCUX CLNS
MCUX Crypto Library Normal Secure
mcuxClCipher_Functions.h File Reference

Top-level API of the mcuxClCipher component. More...

#include <mcuxClConfig.h>
#include <mcuxClSession_Types.h>
#include <mcuxClKey_Types.h>
#include <mcuxClCipher_Types.h>
#include <mcuxClCore_Platform.h>
#include <mcuxClCore_Buffer.h>

Go to the source code of this file.

Functions

mcuxClCipher_Status_t mcuxClCipher_crypt (mcuxClSession_Handle_t session, mcuxClKey_Handle_t key, mcuxClCipher_Mode_t mode, mcuxCl_InputBuffer_t pIv, uint32_t ivLength, mcuxCl_InputBuffer_t pIn, uint32_t inLength, mcuxCl_Buffer_t pOut, uint32_t *const pOutLength)
 One-shot encryption/decryption function. More...
 
mcuxClCipher_Status_t mcuxClCipher_init (mcuxClSession_Handle_t session, mcuxClCipher_Context_t *const pContext, mcuxClKey_Handle_t key, mcuxClCipher_Mode_t mode, mcuxCl_InputBuffer_t pIv, uint32_t ivLength)
 Multi-part encryption/decryption initialization function. More...
 
mcuxClCipher_Status_t mcuxClCipher_process (mcuxClSession_Handle_t session, mcuxClCipher_Context_t *const pContext, mcuxCl_InputBuffer_t pIn, uint32_t inLength, mcuxCl_Buffer_t pOut, uint32_t *const pOutLength)
 Multi-part encryption/decryption processing function. More...
 
mcuxClCipher_Status_t mcuxClCipher_finish (mcuxClSession_Handle_t session, mcuxClCipher_Context_t *const pContext, mcuxCl_Buffer_t pOut, uint32_t *const pOutLength)
 Multi-part encryption/decryption finalization function. More...
 

Detailed Description

Top-level API of the mcuxClCipher component.

Function Documentation

◆ mcuxClCipher_crypt()

mcuxClCipher_Status_t mcuxClCipher_crypt ( mcuxClSession_Handle_t  session,
mcuxClKey_Handle_t  key,
mcuxClCipher_Mode_t  mode,
mcuxCl_InputBuffer_t  pIv,
uint32_t  ivLength,
mcuxCl_InputBuffer_t  pIn,
uint32_t  inLength,
mcuxCl_Buffer_t  pOut,
uint32_t *const  pOutLength 
)

One-shot encryption/decryption function.

This function performs an encryption/decryption operation in one shot. The algorithm to be used will be determined based on the mode that is provided.

For example, to perform an AES encryption/decryption operation with a 128-bit key in CBC mode on padded data, the following needs to be provided:

  • AES128 key
  • CBC mode for encryption, without padding
  • IV, same size as the AES block size
  • Plain input data, size must be a multiple of the AES block size
  • Output data buffer, with the same size as the input data
  • Output size buffer, to store the amount of written bytes
Parameters
sessionHandle for the current CL session.
keyKey to be used to encrypt the data.
modeCipher mode that should be used during the encryption/decryption operation.
[in]pIvPointer to the buffer that contains the IV, if needed for the chosen mode, otherwise ignored.
ivLengthNumber of bytes of data in the pIv buffer.
[in]pInPointer to the input buffer that contains the plain data that needs to be encrypted.
inLengthNumber of bytes of plain data in the pIn buffer.
[out]pOutPointer to the output buffer where the encrypted data needs to be written.
[out]pOutLengthWill be incremented by the number of bytes of encrypted data that have been written to the pOut buffer.
Returns
status

◆ mcuxClCipher_init()

mcuxClCipher_Status_t mcuxClCipher_init ( mcuxClSession_Handle_t  session,
mcuxClCipher_Context_t *const  pContext,
mcuxClKey_Handle_t  key,
mcuxClCipher_Mode_t  mode,
mcuxCl_InputBuffer_t  pIv,
uint32_t  ivLength 
)

Multi-part encryption/decryption initialization function.

This function performs the initialization for a multi part encryption/decryption operation. The algorithm to be used will be determined based on the mode that is provided.

Parameters
sessionHandle for the current CL session.
pContextCipher context which is used to maintain the state and store other relevant information about the operation.
keyKey to be used to encrypt the data.
modeCipher mode that should be used during the encryption/decryption operation.
[in]pIvPointer to the buffer that contains the IV, if needed for the chosen mode, otherwise ignored.
ivLengthNumber of bytes of data in the pIv buffer.
Returns
status

◆ mcuxClCipher_process()

mcuxClCipher_Status_t mcuxClCipher_process ( mcuxClSession_Handle_t  session,
mcuxClCipher_Context_t *const  pContext,
mcuxCl_InputBuffer_t  pIn,
uint32_t  inLength,
mcuxCl_Buffer_t  pOut,
uint32_t *const  pOutLength 
)

Multi-part encryption/decryption processing function.

This function performs the processing of (a part of) a data stream for an encryption/decryption operation. The algorithm and key to be used will be determined based on the context that is provided. Data is processed in full blocks only. Remaining data is stored in the context to be handled in later process or finish calls.

Parameters
sessionHandle for the current CL session.
pContextCipher context which is used to maintain the state and store other relevant information about the operation.
[in]pInPointer to the input buffer that contains the data that needs to be processed.
inLengthNumber of bytes of data in the pIn buffer.
[out]pOutPointer to the output buffer where the processed data needs to be written.
[out]pOutLengthWill be incremented by the number of bytes of processed data that have been written to the pOut buffer.
Returns
status

◆ mcuxClCipher_finish()

mcuxClCipher_Status_t mcuxClCipher_finish ( mcuxClSession_Handle_t  session,
mcuxClCipher_Context_t *const  pContext,
mcuxCl_Buffer_t  pOut,
uint32_t *const  pOutLength 
)

Multi-part encryption/decryption finalization function.

This function performs the finalization of an encryption or decryption operation. The algorithm and key to be used will be determined based on the context that is provided. No new data is accepted but remaining data in the context is processed.

Parameters
sessionHandle for the current CL session.
pContextCipher context which is used to maintain the state and store other relevant information about the operation.
[out]pOutPointer to the output buffer where the processed data needs to be written.
[out]pOutLengthWill be incremented by the number of bytes of processed data that have been written to the pOut buffer.
Returns
status