Homogenize coding patterns

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
Manuel Pégourié-Gonnard 2021-06-17 13:25:03 +02:00
parent 7576f55f19
commit c94b6b07dc

View File

@ -340,7 +340,7 @@ int mbedtls_mpi_safe_cond_assign( mbedtls_mpi *X, const mbedtls_mpi *Y, unsigned
#endif #endif
/* make sure assign is 0 or 1 in a time-constant manner */ /* make sure assign is 0 or 1 in a time-constant manner */
assign = (assign | (unsigned char)-assign) >> 7; assign = (assign | (unsigned char)-assign) >> (sizeof( assign ) * 8 - 1);
/* all-bits 1 if assign is 1, all-bits 0 if assign is 0 */ /* all-bits 1 if assign is 1, all-bits 0 if assign is 0 */
limb_mask = -assign; limb_mask = -assign;
@ -387,7 +387,7 @@ int mbedtls_mpi_safe_cond_swap( mbedtls_mpi *X, mbedtls_mpi *Y, unsigned char sw
#endif #endif
/* make sure swap is 0 or 1 in a time-constant manner */ /* make sure swap is 0 or 1 in a time-constant manner */
swap = (swap | (unsigned char)-swap) >> 7; swap = (swap | (unsigned char)-swap) >> (sizeof( swap ) * 8 - 1);
/* all-bits 1 if swap is 1, all-bits 0 if swap is 0 */ /* all-bits 1 if swap is 1, all-bits 0 if swap is 0 */
limb_mask = -swap; limb_mask = -swap;
@ -2223,7 +2223,7 @@ static size_t mbedtls_mpi_cf_bool_eq( size_t x, size_t y )
#endif #endif
/* diff_msb's most significant bit is equal to x != y */ /* diff_msb's most significant bit is equal to x != y */
const size_t diff_msb = ( diff | -diff ); const size_t diff_msb = ( diff | (size_t) -diff );
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma warning( pop ) #pragma warning( pop )