mbedtls_ct_memcpy_offset() function
Copy data from a secret position. Functionally equivalent to: memcpy(dst, src + offset, len) This function copies \p len bytes from \p src + \p offset to \p dst, with a code flow and memory access pattern that does not depend on \p offset, but only on \p offset_min, \p offset_max and \p len.
Arguments
dest
Secret. The destination buffer. This must point to a writable buffer of at least \p len bytes.
src
Secret. The base of the source buffer. This must point to a readable buffer of at least \p offset_max + \p len bytes. Shouldn't overlap with \p dest
offset
Secret. The offset in the source buffer from which to copy. This must be no less than \p offset_min and no greater than \p offset_max.
offset_min
The minimal value of \p offset.
offset_max
The maximal value of \p offset.
len
The number of bytes to copy.
Notes
This function reads from \p dest, but the value that is read does not influence the result and this function's behavior is well-defined regardless of the contents of the buffers. This may result in false positives from static or dynamic analyzers, especially if \p dest is not initialized.
mbedtls_ct_memcpy_offset() is called by 1 function and calls 2 functions:
![]()
mbedtls_ct_memcpy_offset()
mbedtls_ct_memcpy_offset():
![]()
mbedtls_ct_memcpy_offset()