MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
DCP AES blocking driver

Overview

This section describes the programming interface of the DCP AES blocking driver.

Macros

#define DCP_AES_BLOCK_SIZE   16
 AES block size in bytes.
 

Functions

status_t DCP_AES_SetKey (DCP_Type *base, dcp_handle_t *handle, const uint8_t *key, size_t keySize)
 Set AES key to dcp_handle_t struct and optionally to DCP. More...
 
status_t DCP_AES_EncryptEcb (DCP_Type *base, dcp_handle_t *handle, const uint8_t *plaintext, uint8_t *ciphertext, size_t size)
 Encrypts AES on one or multiple 128-bit block(s). More...
 
status_t DCP_AES_DecryptEcb (DCP_Type *base, dcp_handle_t *handle, const uint8_t *ciphertext, uint8_t *plaintext, size_t size)
 Decrypts AES on one or multiple 128-bit block(s). More...
 
status_t DCP_AES_EncryptCbc (DCP_Type *base, dcp_handle_t *handle, const uint8_t *plaintext, uint8_t *ciphertext, size_t size, const uint8_t iv[16])
 Encrypts AES using CBC block mode. More...
 
status_t DCP_AES_DecryptCbc (DCP_Type *base, dcp_handle_t *handle, const uint8_t *ciphertext, uint8_t *plaintext, size_t size, const uint8_t iv[16])
 Decrypts AES using CBC block mode. More...
 

Function Documentation

status_t DCP_AES_SetKey ( DCP_Type *  base,
dcp_handle_t handle,
const uint8_t *  key,
size_t  keySize 
)

Sets the AES key for encryption/decryption with the dcp_handle_t structure. The dcp_handle_t input argument specifies keySlot. If the keySlot is kDCP_OtpKey, the function will check the OTP_KEY_READY bit and will return it's ready to use status. For other keySlot selections, the function will copy and hold the key in dcp_handle_t struct. If the keySlot is one of the four DCP SRAM-based keys (one of kDCP_KeySlot0, kDCP_KeySlot1, kDCP_KeySlot2, kDCP_KeySlot3), this function will also load the supplied key to the specified keySlot in DCP.

Parameters
baseDCP peripheral base address.
handleHandle used for the request.
key0-mod-4 aligned pointer to AES key.
keySizeAES key size in bytes. Shall equal 16.
Returns
status from set key operation
status_t DCP_AES_EncryptEcb ( DCP_Type *  base,
dcp_handle_t handle,
const uint8_t *  plaintext,
uint8_t *  ciphertext,
size_t  size 
)

Encrypts AES. The source plaintext and destination ciphertext can overlap in system memory.

Parameters
baseDCP peripheral base address
handleHandle used for this request.
plaintextInput plain text to encrypt
[out]ciphertextOutput cipher text
sizeSize of input and output data in bytes. Must be multiple of 16 bytes.
Returns
Status from encrypt operation
status_t DCP_AES_DecryptEcb ( DCP_Type *  base,
dcp_handle_t handle,
const uint8_t *  ciphertext,
uint8_t *  plaintext,
size_t  size 
)

Decrypts AES. The source ciphertext and destination plaintext can overlap in system memory.

Parameters
baseDCP peripheral base address
handleHandle used for this request.
ciphertextInput plain text to encrypt
[out]plaintextOutput cipher text
sizeSize of input and output data in bytes. Must be multiple of 16 bytes.
Returns
Status from decrypt operation
status_t DCP_AES_EncryptCbc ( DCP_Type *  base,
dcp_handle_t handle,
const uint8_t *  plaintext,
uint8_t *  ciphertext,
size_t  size,
const uint8_t  iv[16] 
)

Encrypts AES using CBC block mode. The source plaintext and destination ciphertext can overlap in system memory.

Parameters
baseDCP peripheral base address
handleHandle used for this request.
plaintextInput plain text to encrypt
[out]ciphertextOutput cipher text
sizeSize of input and output data in bytes. Must be multiple of 16 bytes.
ivInput initial vector to combine with the first input block.
Returns
Status from encrypt operation
status_t DCP_AES_DecryptCbc ( DCP_Type *  base,
dcp_handle_t handle,
const uint8_t *  ciphertext,
uint8_t *  plaintext,
size_t  size,
const uint8_t  iv[16] 
)

Decrypts AES using CBC block mode. The source ciphertext and destination plaintext can overlap in system memory.

Parameters
baseDCP peripheral base address
handleHandle used for this request.
ciphertextInput cipher text to decrypt
[out]plaintextOutput plain text
sizeSize of input and output data in bytes. Must be multiple of 16 bytes.
ivInput initial vector to combine with the first input block.
Returns
Status from decrypt operation