Address review comments for documentation

This commit is contained in:
Jarno Lamsa 2019-10-04 15:42:39 +03:00
parent 1881ef53b7
commit c4315e6d5e

View file

@ -167,12 +167,11 @@ void mbedtls_platform_zeroize( void *buf, size_t len );
/** /**
* \brief Secure memset * \brief Secure memset
* *
* This function is meant to provide a more secure way to do * This is a constant-time version of memset(). If
* memset. It starts by initialising the given memory area * MBEDTLS_ENTROPY_HARDWARE_ALT is defined, the buffer is
* from random tail location with random data. After tail is * initialised with random data and the order is also
* initialised, the remaining head of the buffer is initialised * randomised using the hardware RNG in order to further harden
* with random data. After initialisation, the original memset * against side-channel attacks.
* is performed
* *
* \param ptr Buffer to be set. * \param ptr Buffer to be set.
* \param value Value to be used when setting the buffer. * \param value Value to be used when setting the buffer.
@ -185,12 +184,11 @@ void *mbedtls_platform_memset( void *ptr, int value, size_t num );
/** /**
* \brief Secure memcpy * \brief Secure memcpy
* *
* This function is meant to provide a more secure way to do * This is a constant-time version of memcpy(). If
* memcpy. It starts by initialising the given memory area * MBEDTLS_ENTROPY_HARDWARE_ALT is defined, the buffer is
* with random data. After initialisation, the original memcpy * initialised with random data and the order is also
* is performed by starting first copying from random tail * randomised using the hardware RNG in order to further harden
* location of the buffer. After tail has been copied, the * against side-channel attacks.
* remaining head is copied as well.
* *
* \param dst Destination buffer where the data is being copied to. * \param dst Destination buffer where the data is being copied to.
* \param src Source buffer where the data is being copied from. * \param src Source buffer where the data is being copied from.
@ -203,18 +201,17 @@ void *mbedtls_platform_memcpy( void *dst, const void *src, size_t num );
/** /**
* \brief Secure memcmp * \brief Secure memcmp
* *
* This function is meant to provide a more secure way to do * This is a constant-time version of memcmp(). If
* memcmp. It starts comparing from a random offset and goes * MBEDTLS_ENTROPY_HARDWARE_ALT is defined, the order is also
* through the tail part of buffers first byte by byte. After * randomised using the hardware RNG in order to further harden
* that it starts going through the head part of buffer. In the * against side-channel attacks.
* end, the number of equal bytes is compared to the length of the
* buffers, thus making the function a fixed time memcmp.
* *
* \param buf1 First buffer to compare. * \param buf1 First buffer to compare.
* \param buf2 Second buffer to compare against. * \param buf2 Second buffer to compare against.
* \param num The length of the buffers in bytes. * \param num The length of the buffers in bytes.
* *
* \return 0 if the buffers were equal. * \return 0 if the buffers were equal or an unspecified non-zero value
* otherwise.
*/ */
int mbedtls_platform_memcmp( const void *buf1, const void *buf2, size_t num ); int mbedtls_platform_memcmp( const void *buf1, const void *buf2, size_t num );