From dbe0f892b343a0a3ee3e32a8790e2f6523b1d86f Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Wed, 3 Nov 2021 16:13:32 +0100 Subject: [PATCH] Fix documentation and comments Signed-off-by: Gabor Mezei --- include/mbedtls/constant_time.h | 2 +- library/constant_time.c | 6 +++--- library/constant_time_internal.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/mbedtls/constant_time.h b/include/mbedtls/constant_time.h index b7f9a861d..c5de57a01 100644 --- a/include/mbedtls/constant_time.h +++ b/include/mbedtls/constant_time.h @@ -25,7 +25,7 @@ /** 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. * * This function can be used to write constant-time code by replacing branches diff --git a/library/constant_time.c b/library/constant_time.c index 651bbcb15..b0e5ddec7 100644 --- a/library/constant_time.c +++ b/library/constant_time.c @@ -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. */ @@ -240,7 +240,7 @@ unsigned mbedtls_ct_uint_if( unsigned condition, #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 * operations in order to avoid branches. @@ -258,7 +258,7 @@ static int mbedtls_ct_cond_select_sign( unsigned char condition, int if1, 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 * by taking advantage of the fact that if1 and if0 are either +1 or -1. */ unsigned uif1 = if1 + 1; diff --git a/library/constant_time_internal.h b/library/constant_time_internal.h index 61681084b..69cd09209 100644 --- a/library/constant_time_internal.h +++ b/library/constant_time_internal.h @@ -171,7 +171,7 @@ void mbedtls_ct_mpi_uint_cond_assign( size_t n, /** 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. * * \param dest The pointer to conditionally copy to.