MCUX CLNS
MCUX Crypto Library Normal Secure
mcuxClEls_Cipher_Functions

Defines all functions of mcuxClEls_Cipher. More...

Functions

MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Cipher_Async (mcuxClEls_CipherOption_t options, mcuxClEls_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, uint8_t const *pInput, size_t inputLength, uint8_t *pIV, uint8_t *pOutput)
 Performs AES encryption/decryption. More...
 

Detailed Description

Defines all functions of mcuxClEls_Cipher.

Function Documentation

◆ mcuxClEls_Cipher_Async()

MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Cipher_Async ( mcuxClEls_CipherOption_t  options,
mcuxClEls_KeyIndex_t  keyIdx,
uint8_t const *  pKey,
size_t  keyLength,
uint8_t const *  pInput,
size_t  inputLength,
uint8_t *  pIV,
uint8_t *  pOutput 
)

Performs AES encryption/decryption.

Performs an AES encryption/decryption. Call mcuxClEls_WaitForOperation to complete the operation.

Parameters
[in]optionsEncryption/decryption command options. For detailed information, see mcuxClEls_CipherOption_t.
[in]keyIdxIndex of the key inside the ELS keystore. See parameter properties section in function description.
[in]pKeyMemory area that contains the key. See parameter properties section in function description.
[in]keyLengthSize of pKey in bytes. Must be a valid key size of MCUXCLELS_CIPHER_KEY_SIZE_AES_. See parameter properties section in function description.
[in]pInputPointer to the input data to be encrypted/decrypted. Padding must be already applied.
[in]inputLengthSize of pInput in bytes, must be a multiple of the block size.
[in,out]pIVA pointer to the memory location which contains/receives the IV/state of cipher. See parameter properties section in function description.
[out]pOutputPointer to the output buffer to store encrypted/decrypted data.

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

Parameter properties
options.cphmde == MCUXCLELS_CIPHERPARAM_ALGORITHM_AES_ECB

pIV is ignored.

options.cphmde == MCUXCLELS_CIPHERPARAM_ALGORITHM_AES_CBC

pIV must be set to the IV (when encrypting the first block) or to the last block of the ciphertext of the previous operation. ELS will always read and write to this location.

options.cphsie is ignored.

     @p options.cphsoe is ignored.</dd>

 <dt>@p options.cphmde == #MCUXCLELS_CIPHERPARAM_ALGORITHM_AES_CTR</dt>
     <dd>@p pIV must be set to the IV (when encrypting the first block) or to the state output of the previous
     encryption/decryption operation. ELS will write to this location if @p options.cphsoe == #MCUXCLELS_CIPHER_STATE_OUT_ENABLE.</dd>

 <dt>@p options.extkey == #MCUXCLELS_CIPHER_EXTERNAL_KEY</dt>
     <dd>@p keyIdx is ignored.</dd>

 <dt>@p options.extkey == #MCUXCLELS_CIPHER_INTERNAL_KEY</dt>
     <dd>@p pKey is ignored.

     @p keyLength is ignored.</dd>

Returns
An error code that can be any error code in MCUXCLELS_STATUS_, see individual documentation for more information
Return values
MCUXCLELS_STATUS_SW_CANNOT_INTERRUPTif a running operation prevented the request
MCUXCLELS_STATUS_OK_WAITon successful request
Examples
mcuxClEls_Cipher_Aes128_Cbc_Encrypt_example.c, mcuxClEls_Cipher_Aes128_Ecb_Encrypt_example.c, and mcuxClPsaDriver_keygen_export_public_key_oracle_example.c.