mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Create mbedtls_cf_size_if function
Add a constant-time function with size_t parameter for choosing between two integer values, like the ?: ternary operator. Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
committed by
Gabor Mezei
parent
b10301d2fc
commit
bc3a288b2c
@ -295,6 +295,12 @@ unsigned mbedtls_cf_uint_if( unsigned cond, unsigned if1, unsigned if0 )
|
||||
return( ( mask & if1 ) | (~mask & if0 ) );
|
||||
}
|
||||
|
||||
size_t mbedtls_cf_size_if( unsigned cond, size_t if1, size_t if0 )
|
||||
{
|
||||
size_t mask = mbedtls_cf_size_mask( cond );
|
||||
return( ( mask & if1 ) | (~mask & if0 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Select between two sign values in constant-time.
|
||||
*
|
||||
|
Reference in New Issue
Block a user