Fix documentation and comments

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
Gabor Mezei 2021-11-03 16:13:32 +01:00
parent c0ae1cf45a
commit dbe0f892b3
No known key found for this signature in database
GPG key ID: 106F5A41ECC305BD
3 changed files with 5 additions and 5 deletions

View file

@ -25,7 +25,7 @@
/** Constant-time buffer comparison without branches. /** Constant-time buffer comparison without branches.
* *
* This is equivalent to the standard memncmp function, but is likely to be * This is equivalent to the standard memcmp function, but is likely to be
* compiled to code using bitwise operation rather than a branch. * compiled to code using bitwise operation rather than a branch.
* *
* This function can be used to write constant-time code by replacing branches * This function can be used to write constant-time code by replacing branches

View file

@ -18,7 +18,7 @@
*/ */
/* /*
* The following functiona are implemented without using comparison operators, as those * The following functions are implemented without using comparison operators, as those
* might be translated to branches by some compilers on some platforms. * might be translated to branches by some compilers on some platforms.
*/ */
@ -240,7 +240,7 @@ unsigned mbedtls_ct_uint_if( unsigned condition,
#if defined(MBEDTLS_BIGNUM_C) #if defined(MBEDTLS_BIGNUM_C)
/** Select between two sign values witout branches. /** Select between two sign values without branches.
* *
* This is functionally equivalent to `condition ? if1 : if0` but uses only bit * This is functionally equivalent to `condition ? if1 : if0` but uses only bit
* operations in order to avoid branches. * operations in order to avoid branches.
@ -258,7 +258,7 @@ static int mbedtls_ct_cond_select_sign( unsigned char condition,
int if1, int if1,
int if0 ) int if0 )
{ {
/* In order to avoid questions about what we can reasonnably assume about /* In order to avoid questions about what we can reasonably assume about
* the representations of signed integers, move everything to unsigned * the representations of signed integers, move everything to unsigned
* by taking advantage of the fact that if1 and if0 are either +1 or -1. */ * by taking advantage of the fact that if1 and if0 are either +1 or -1. */
unsigned uif1 = if1 + 1; unsigned uif1 = if1 + 1;

View file

@ -171,7 +171,7 @@ void mbedtls_ct_mpi_uint_cond_assign( size_t n,
/** Conditional memcpy without branches. /** Conditional memcpy without branches.
* *
* This is equivalent to `if ( c1 == c2 ) memcpy(dst, src, len)`, but is likely * This is equivalent to `if ( c1 == c2 ) memcpy(dest, src, len)`, but is likely
* to be compiled to code using bitwise operation rather than a branch. * to be compiled to code using bitwise operation rather than a branch.
* *
* \param dest The pointer to conditionally copy to. * \param dest The pointer to conditionally copy to.