Interfaces to perform Cipher operations. More...
Interfaces to perform Cipher operations.
| mcuxClCipher_Status_t mcuxClCipher_encrypt | ( | 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 function.
This function performs an encryption operation in one shot. The algorithm to be used will be determined based on the key and mode that are provided.
For example, to perform an AES encryption operation with a 128-bit key in CBC mode on padded data, the following needs to be provided:
| session | Handle for the current CL session. | |
| key | Key to be used to encrypt the data (word-aligned). | |
| mode | Cipher mode that should be used during the encryption operation. | |
| [in] | pIv | Pointer to the buffer that contains the IV or salt, if needed for the chosen mode, otherwise ignored. |
| ivLength | Number of bytes of data in the pIv buffer. | |
| [in] | pIn | Pointer to the input buffer that contains the plain data that needs to be encrypted. |
| inLength | Number of bytes of plain data in the pIn buffer. | |
| [out] | pOut | Pointer to the output buffer where the encrypted data needs to be written. |
| [out] | pOutLength | Will be set to the number of bytes of encrypted data that have been written to the pOut buffer. |
| MCUXCLCIPHER_STATUS_OK | Cipher operation successful |
| MCUXCLCIPHER_STATUS_ERROR | Error occurred during Cipher operation |
| MCUXCLCIPHER_STATUS_FAILURE | Functional failure ocurred during Cipher operation |
| MCUXCLCIPHER_STATUS_INVALID_INPUT | An invalid parameter was given to the function |
| MCUXCLCIPHER_STATUS_FAULT_ATTACK | Fault attack detected |
| MCUXCLSGI_STATUS_UNWRAP_ERROR | Error during RFC3394 Key Unwrap detected. An SGI reset or FULL_FLUSH needs to be performed. |
| mcuxClCipher_Status_t mcuxClCipher_decrypt | ( | 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 decryption function.
This function performs a decryption operation in one shot. The algorithm to be used will be determined based on the key and mode that are provided.
For example, to perform an AES decryption operation with a 128-bit key in CBC mode on padded data, the following needs to be provided::
| session | Handle for the current CL session. | |
| key | Key to be used to decrypt the data (word-aligned). | |
| mode | Cipher mode that should be used during the decryptionu operation. | |
| [in] | pIv | Pointer to the buffer that contains the IV or salt, if needed for the chosen mode, otherwise ignored. |
| ivLength | Number of bytes of data in the pIv buffer. | |
| [in] | pIn | Pointer to the input buffer that contains the encrypted data that needs to be decrypted. |
| inLength | Number of bytes of encrypted data in the pIn buffer. | |
| [out] | pOut | Pointer to the output buffer where the plain data needs to be written. |
| [out] | pOutLength | Will be set to the number of bytes of plain data that have been written to the pOut buffer. |
| MCUXCLCIPHER_STATUS_OK | Cipher operation successful |
| MCUXCLCIPHER_STATUS_ERROR | Error occurred during Cipher operation |
| MCUXCLCIPHER_STATUS_FAILURE | Functional failure ocurred during Cipher operation |
| MCUXCLCIPHER_STATUS_INVALID_INPUT | An invalid parameter was given to the function |
| MCUXCLCIPHER_STATUS_FAULT_ATTACK | Fault attack detected |
| MCUXCLSGI_STATUS_UNWRAP_ERROR | Error during RFC3394 Key Unwrap detected. An SGI reset or FULL_FLUSH needs to be performed. |
| mcuxClCipher_Status_t mcuxClCipher_init_encrypt | ( | 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 initialization function.
This function performs the initialization for a multi part encryption operation. The algorithm to be used will be determined based on the key that is provided. After init operation, a pointer to the whole key handle is stored in context. The user of the Crypto Library needs to keep the keyHandle alive until the mcuxClCipher_finish phase of cipher multipart operation.
| session | Handle for the current CL session. | |
| pContext | Cipher context which is used to maintain the state and store other relevant information about the operation (word-aligned). | |
| key | Key to be used to encrypt the data (word-aligned). | |
| mode | Cipher mode that should be used during the encryption operation. | |
| [in] | pIv | Pointer to the buffer that contains the IV, if needed for the chosen mode, otherwise ignored. |
| ivLength | Number of bytes of data in the pIv buffer. |
| MCUXCLCIPHER_STATUS_OK | Cipher operation successful |
| MCUXCLCIPHER_STATUS_ERROR | Error occurred during Cipher operation |
| MCUXCLCIPHER_STATUS_FAILURE | Functional failure ocurred during Cipher operation |
| MCUXCLCIPHER_STATUS_INVALID_INPUT | An invalid parameter was given to the function |
| MCUXCLCIPHER_STATUS_FAULT_ATTACK | Fault attack detected |
| MCUXCLSGI_STATUS_UNWRAP_ERROR | Error during RFC3394 Key Unwrap detected. An SGI reset or FULL_FLUSH needs to be performed. |
| mcuxClCipher_Status_t mcuxClCipher_init_decrypt | ( | 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 decryption initialization function.
This function performs the initialization for a multi part decryption operation. The algorithm to be used will be determined based on the key that is provided. After init operation, a pointer to the whole key handle is stored in context. The user of the Crypto Library needs to keep the keyHandle alive until the mcuxClCipher_finish phase of cipher multipart operation.
| session | Handle for the current CL session. | |
| pContext | Cipher context which is used to maintain the state and store other relevant information about the operation (word-aligned). | |
| key | Key to be used to encrypt the data (word-aligned). | |
| mode | Cipher mode that should be used during the encryption operation. | |
| [in] | pIv | Pointer to the buffer that contains the IV, if needed for the chosen mode, otherwise ignored. |
| ivLength | Number of bytes of data in the pIv buffer. |
| MCUXCLCIPHER_STATUS_OK | Cipher operation successful |
| MCUXCLCIPHER_STATUS_ERROR | Error occurred during Cipher operation |
| MCUXCLCIPHER_STATUS_FAILURE | Functional failure ocurred during Cipher operation |
| MCUXCLCIPHER_STATUS_INVALID_INPUT | An invalid parameter was given to the function |
| MCUXCLCIPHER_STATUS_FAULT_ATTACK | Fault attack detected |
| MCUXCLSGI_STATUS_UNWRAP_ERROR | Error during RFC3394 Key Unwrap detected. An SGI reset or FULL_FLUSH needs to be performed. |
| 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. The user of the Crypto Library needs to keep the keyHandle alive until the mcuxClCipher_finish phase of cipher multipart operation. Data is processed in full blocks only. Remaining data is stored in the context to be handled in later process or finish calls.
| session | Handle for the current CL session. | |
| pContext | Cipher context which is used to maintain the state and store other relevant information about the operation (word-aligned). | |
| [in] | pIn | Pointer to the input buffer that contains the data that needs to be processed. |
| inLength | Number of bytes of data in the pIn buffer. | |
| [out] | pOut | Pointer to the output buffer where the processed data needs to be written. |
| [out] | pOutLength | Will be set to the number of bytes of processed data that have been written to the pOut buffer. |
| MCUXCLCIPHER_STATUS_OK | Cipher operation successful |
| MCUXCLCIPHER_STATUS_ERROR | Error occurred during Cipher operation |
| MCUXCLCIPHER_STATUS_FAILURE | Functional failure ocurred during Cipher operation |
| MCUXCLCIPHER_STATUS_INVALID_INPUT | An invalid parameter was given to the function |
| MCUXCLCIPHER_STATUS_FAULT_ATTACK | Fault attack detected |
| 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. The user of the Crypto Library needs to keep the keyHandle alive until the mcuxClCipher_finish phase of cipher multipart operation. No new data is accepted but remaining data in the context is processed.
| session | Handle for the current CL session. | |
| pContext | Cipher context which is used to maintain the state and store other relevant information about the operation (word-aligned). | |
| [out] | pOut | Pointer to the output buffer where the processed data needs to be written. |
| [out] | pOutLength | Will be set to the number of bytes of processed data that have been written to the pOut buffer. |
| MCUXCLCIPHER_STATUS_OK | Cipher operation successful |
| MCUXCLCIPHER_STATUS_ERROR | Error occurred during Cipher operation |
| MCUXCLCIPHER_STATUS_FAILURE | Functional failure ocurred during Cipher operation |
| MCUXCLCIPHER_STATUS_INVALID_INPUT | An invalid parameter was given to the function |
| MCUXCLCIPHER_STATUS_FAULT_ATTACK | Fault attack detected |