Add mbedtls_platform_memmove() as a secured memcmp()

Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
This commit is contained in:
Piotr Nowicki
2020-06-05 16:33:24 +02:00
parent 478b05c34c
commit 5d5841f450
5 changed files with 61 additions and 5 deletions

View File

@@ -198,6 +198,22 @@ void *mbedtls_platform_memset( void *ptr, int value, size_t num );
*/
void *mbedtls_platform_memcpy( void *dst, const void *src, size_t num );
/**
* \brief Secure memmove
*
* This is a constant-time version of memmove(). It is based on
* the double use of the mbedtls_platform_memcpy() function secured
* against side-channel attacks.
*
* \param dst Destination buffer where the data is being moved to.
* \param src Source buffer where the data is being moved from.
* \param num The length of the buffers in bytes.
*
* \return 0 if the operation was successful or -1 if memory allocation
* failed.
*/
int mbedtls_platform_memmove( void *dst, const void *src, size_t num );
/**
* \brief Secure memcmp
*