12#include "fsl_common.h"
58#define FSL_DCP_DRIVER_VERSION (MAKE_VERSION(2, 1, 6))
123 kDCP_KeyByteSwap = 0x40000U,
124 kDCP_KeyWordSwap = 0x80000U,
125 kDCP_InputByteSwap = 0x100000U,
126 kDCP_InputWordSwap = 0x200000U,
127 kDCP_OutputByteSwap = 0x400000U,
128 kDCP_OutputWordSwap = 0x800000U,
134 uint32_t nextCmdAddress;
137 uint32_t sourceBufferAddress;
138 uint32_t destinationBufferAddress;
140 uint32_t payloadPointer;
157 uint32_t x[208 /
sizeof(uint32_t)];
172#ifndef DCP_USE_DCACHE
173#define DCP_USE_DCACHE 1
189#define DCP_AES_BLOCK_SIZE 16
206#define DCP_HASH_CAVP_COMPATIBLE
217#define DCP_SHA_BLOCK_SIZE 128U
218#define DCP_HASH_BLOCK_SIZE DCP_SHA_BLOCK_SIZE
221#define DCP_HASH_CTX_SIZE 64
236#if defined(__cplusplus)
338 DCP_Type *base,
dcp_handle_t *handle,
const uint8_t *plaintext, uint8_t *ciphertext,
size_t size);
354 DCP_Type *base,
dcp_handle_t *handle,
const uint8_t *ciphertext, uint8_t *plaintext,
size_t size);
372 const uint8_t *plaintext,
375 const uint8_t iv[16]);
393 const uint8_t *ciphertext,
396 const uint8_t iv[16]);
423 const uint8_t *plaintext,
444 const uint8_t *ciphertext,
466 const uint8_t *plaintext,
489 const uint8_t *ciphertext,
567 const uint8_t *input,
576#if defined(__cplusplus)
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.
Definition: fsl_dcp.c:316
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.
Definition: fsl_dcp.c:686
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).
Definition: fsl_dcp.c:379
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.
Definition: fsl_dcp.c:575
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).
Definition: fsl_dcp.c:477
status_t DCP_HASH(DCP_Type *base, dcp_handle_t *handle, dcp_hash_algo_t algo, const uint8_t *input, size_t inputSize, uint8_t *output, size_t *outputSize)
Create HASH on given data.
Definition: fsl_dcp.c:1435
status_t DCP_HASH_Update(DCP_Type *base, dcp_hash_ctx_t *ctx, const uint8_t *input, size_t inputSize)
Add data to current HASH.
Definition: fsl_dcp.c:1253
status_t DCP_HASH_Finish(DCP_Type *base, dcp_hash_ctx_t *ctx, uint8_t *output, size_t *outputSize)
Finalize hashing.
Definition: fsl_dcp.c:1323
enum _dcp_hash_algo_t dcp_hash_algo_t
Supported cryptographic block cipher functions for HASH creation.
#define DCP_HASH_CTX_SIZE
DCP HASH Context size.
Definition: fsl_dcp.h:221
_dcp_hash_algo_t
Supported cryptographic block cipher functions for HASH creation.
Definition: fsl_dcp.h:210
struct _dcp_hash_ctx_t dcp_hash_ctx_t
Storage type used to save hash context.
status_t DCP_HASH_Init(DCP_Type *base, dcp_handle_t *handle, dcp_hash_ctx_t *ctx, dcp_hash_algo_t algo)
Initialize HASH context.
Definition: fsl_dcp.c:1201
@ kDCP_Crc32
Definition: fsl_dcp.h:213
@ kDCP_Sha1
Definition: fsl_dcp.h:211
@ kDCP_Sha256
Definition: fsl_dcp.h:212
void DCP_Deinit(DCP_Type *base)
Disable DCP clock.
Definition: fsl_dcp.c:852
_dcp_channel
DCP channel selection.
Definition: fsl_dcp.h:96
status_t DCP_WaitForChannelComplete(DCP_Type *base, dcp_handle_t *handle)
Poll and wait on DCP channel.
Definition: fsl_dcp.c:872
bool enableContextSwitching
Definition: fsl_dcp.h:165
void DCP_GetDefaultConfig(dcp_config_t *config)
Gets the default configuration structure.
Definition: fsl_dcp.c:795
uint8_t enableChannel
Definition: fsl_dcp.h:166
enum _dcp_ch_int_enable _dcp_ch_int_enable_t
DCP interrupt enable.
dcp_key_slot_t keySlot
Definition: fsl_dcp.h:148
_dcp_status
DCP status return codes.
Definition: fsl_dcp.h:63
enum _dcp_channel dcp_channel_t
DCP channel selection.
_dcp_ch_int_enable
DCP interrupt enable.
Definition: fsl_dcp.h:84
struct _dcp_work_packet dcp_work_packet_t
DCP's work packet.
struct _dcp_handle dcp_handle_t
Specify DCP's key resource and DCP channel.
enum _dcp_key_slot dcp_key_slot_t
DCP key slot selection.
dcp_channel_t channel
Definition: fsl_dcp.h:147
bool gatherResidualWrites
Definition: fsl_dcp.h:163
enum _dcp_swap dcp_swap_t
DCP key, input & output swap options.
void DCP_Init(DCP_Type *base, const dcp_config_t *config)
Enables clock to and enables DCP.
Definition: fsl_dcp.c:820
struct _dcp_config dcp_config_t
DCP's configuration structure.
_dcp_ch_enable
DCP channel enable.
Definition: fsl_dcp.h:71
uint32_t swapConfig
Definition: fsl_dcp.h:149
struct _dcp_context dcp_context_t
DCP's context buffer, used by DCP for context switching between channels.
_dcp_key_slot
DCP key slot selection.
Definition: fsl_dcp.h:107
enum _dcp_ch_enable _dcp_ch_enable_t
DCP channel enable.
_dcp_swap
DCP key, input & output swap options.
Definition: fsl_dcp.h:121
bool enableContextCaching
Definition: fsl_dcp.h:164
uint8_t enableChannelInterrupt
Definition: fsl_dcp.h:167
@ kDCP_Channel2
Definition: fsl_dcp.h:99
@ kDCP_Channel0
Definition: fsl_dcp.h:97
@ kDCP_Channel3
Definition: fsl_dcp.h:100
@ kDCP_Channel1
Definition: fsl_dcp.h:98
@ kStatus_DCP_Again
Definition: fsl_dcp.h:64
@ kDCP_ch1IntEnable
Definition: fsl_dcp.h:87
@ kDCP_ch2IntEnable
Definition: fsl_dcp.h:88
@ kDCP_ch0IntEnable
Definition: fsl_dcp.h:86
@ kDCP_ch3IntEnable
Definition: fsl_dcp.h:89
@ kDCP_chIntDisable
Definition: fsl_dcp.h:85
@ kDCP_chDisable
Definition: fsl_dcp.h:72
@ kDCP_ch0Enable
Definition: fsl_dcp.h:73
@ kDCP_ch3Enable
Definition: fsl_dcp.h:76
@ kDCP_ch2Enable
Definition: fsl_dcp.h:75
@ kDCP_chEnableAll
Definition: fsl_dcp.h:77
@ kDCP_ch1Enable
Definition: fsl_dcp.h:74
@ kDCP_OtpUniqueKey
Definition: fsl_dcp.h:113
@ kDCP_PayloadKey
Definition: fsl_dcp.h:114
@ kDCP_KeySlot0
Definition: fsl_dcp.h:108
@ kDCP_KeySlot1
Definition: fsl_dcp.h:109
@ kDCP_OtpKey
Definition: fsl_dcp.h:112
@ kDCP_KeySlot3
Definition: fsl_dcp.h:111
@ kDCP_KeySlot2
Definition: fsl_dcp.h:110
status_t DCP_AES_DecryptCbcNonBlocking(DCP_Type *base, dcp_handle_t *handle, dcp_work_packet_t *dcpPacket, const uint8_t *ciphertext, uint8_t *plaintext, size_t size, const uint8_t *iv)
Decrypts AES using CBC block mode.
Definition: fsl_dcp.c:733
status_t DCP_AES_EncryptCbcNonBlocking(DCP_Type *base, dcp_handle_t *handle, dcp_work_packet_t *dcpPacket, const uint8_t *plaintext, uint8_t *ciphertext, size_t size, const uint8_t *iv)
Encrypts AES using CBC block mode.
Definition: fsl_dcp.c:622
status_t DCP_AES_DecryptEcbNonBlocking(DCP_Type *base, dcp_handle_t *handle, dcp_work_packet_t *dcpPacket, const uint8_t *ciphertext, uint8_t *plaintext, size_t size)
Decrypts AES using ECB block mode.
Definition: fsl_dcp.c:519
status_t DCP_AES_EncryptEcbNonBlocking(DCP_Type *base, dcp_handle_t *handle, dcp_work_packet_t *dcpPacket, const uint8_t *plaintext, uint8_t *ciphertext, size_t size)
Encrypts AES using the ECB block mode.
Definition: fsl_dcp.c:421
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
#define MAKE_STATUS(group, code)
Construct a status code value from a group and code number.
Definition: fsl_common.h:47
@ kStatusGroup_DCP
Definition: fsl_common.h:139
Definition: MIMXRT1052.h:12361
DCP's configuration structure.
Definition: fsl_dcp.h:162
DCP's context buffer, used by DCP for context switching between channels.
Definition: fsl_dcp.h:156
Specify DCP's key resource and DCP channel.
Definition: fsl_dcp.h:146
Storage type used to save hash context.
Definition: fsl_dcp.h:225
DCP's work packet.
Definition: fsl_dcp.h:133
Definition: deflate.c:114