mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-25 15:05:45 +01:00
Fix constant flow mask maths
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
6f69d4c7e2
commit
490c5d4628
@ -110,7 +110,9 @@ static void mbedtls_base64_cond_assign_uchar(unsigned char * dest, const unsigne
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Generate bitmask from condition, mask will either be 0xFFFFFFFF or 0 */
|
/* Generate bitmask from condition, mask will either be 0xFFFFFFFF or 0 */
|
||||||
unsigned char mask = -( unsigned char )( ( condition | -condition ) >> 7 );
|
unsigned char mask = ( condition | -condition );
|
||||||
|
mask >>= 7;
|
||||||
|
mask = -mask;
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning( pop )
|
#pragma warning( pop )
|
||||||
@ -133,7 +135,9 @@ static void mbedtls_base64_cond_assign_uint32(uint32_t * dest, const uint32_t sr
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Generate bitmask from condition, mask will either be 0xFFFFFFFF or 0 */
|
/* Generate bitmask from condition, mask will either be 0xFFFFFFFF or 0 */
|
||||||
uint32_t mask = -( uint32_t )( ( condition | -condition ) >> 31 );
|
uint32_t mask = ( condition | -condition );
|
||||||
|
mask >>= 31;
|
||||||
|
mask = -mask;
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning( pop )
|
#pragma warning( pop )
|
||||||
@ -142,7 +146,6 @@ static void mbedtls_base64_cond_assign_uint32(uint32_t * dest, const uint32_t sr
|
|||||||
*dest = ( src & mask ) | ( ( *dest ) & ~mask );
|
*dest = ( src & mask ) | ( ( *dest ) & ~mask );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constant flow check for equality
|
* Constant flow check for equality
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user