MCUX CLNS MCUX Crypto Library Normal Secure |

Functions
mcuxCsslMemory_Copy Function Definitions
MCUX CSSL &ndash; API » mcuxCssl Memory API » mcuxCssl Memory Copy

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] | chk | The parameter checksum, generated with mcuxCsslParamIntegrity_Protect.
  [in] | src | The data to be copied. Must not be NULL. Must not overlap with `dst`.
  [out] | dst | The destination pointer. Must not be NULL. Must not overlap with `src`.
  [in] | dst_size | The size of the destination data buffer in bytes.
  [in] | cnt | The number of bytes to copy. Must be different from zero.

Returns
  A status code encapsulated in a flow-protection type.

Return values

  MCUXCSSLMEMORY_COPY_SUCCESS | If the contents of `src` and `dst` are equal.
  MCUXCSSLMEMORY_COPY_INVALID_PARAMETER | If one of the parameters was invalid (i.e. `src` or `dst` was NULL or `cnt` was zero).
  MCUXCSSLMEMORY_COPY_FAULT | If a fault was detected.