MCUX CLNS
MCUX Crypto Library Normal Secure
mcuxCsslMemory_Copy Function Definitions

mcuxCsslMemory_Copy Function Definitions More...

Functions

mcuxCsslMemory_CopyResult_t mcuxCsslMemory_Copy (mcuxCsslParamIntegrity_Checksum_t chk, void const *src, void *dst, size_t dst_size, size_t cnt)
 Copies cnt bytes of data from src to dst. More...
 

Detailed Description

mcuxCsslMemory_Copy Function Definitions

Function Documentation

◆ mcuxCsslMemory_Copy()

mcuxCsslMemory_CopyResult_t mcuxCsslMemory_Copy ( mcuxCsslParamIntegrity_Checksum_t  chk,
void const *  src,
void *  dst,
size_t  dst_size,
size_t  cnt 
)

Copies cnt bytes of data from src to dst.

The implementation is secure in the following aspects:

  • Constant execution time: If src and dst have the same offset to the nearest 16-byte boundary, and if cnt is the same, the execution sequence of the code is always identical.
  • Parameter integrity protection: An incorrect parameter checksum makes the function return immediately.
  • Code flow protection: The function call is protected. Additionally, the result depends on all steps of the calculation.
  • Buffer overflow protection: No data is written to dst beyond dst_size bytes.
Parameters
[in]chkThe parameter checksum, generated with mcuxCsslParamIntegrity_Protect.
[in]srcThe data to be copied. Must not be NULL. Must not overlap with dst.
[out]dstThe destination pointer. Must not be NULL. Must not overlap with src.
[in]dst_sizeThe size of the destination data buffer in bytes.
[in]cntThe number of bytes to copy. Must be different from zero.
Returns
A status code encapsulated in a flow-protection type.
Return values
MCUXCSSLMEMORY_COPY_SUCCESSIf the contents of src and dst are equal.
MCUXCSSLMEMORY_COPY_INVALID_PARAMETERIf one of the parameters was invalid (i.e. src or dst was NULL or cnt was zero).
MCUXCSSLMEMORY_COPY_FAULTIf a fault was detected.