1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00

Generalise mbedtls_ct_error_if to mbedtls_ct_int_if

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman
2023-09-21 19:22:43 +01:00
parent cc3c670670
commit f81b2a14f2
2 changed files with 10 additions and 11 deletions

View File

@ -411,7 +411,7 @@ static inline unsigned char mbedtls_ct_uchar_in_range_if(unsigned char low,
unsigned char c,
unsigned char t);
/** Choose between two error values. The values must be zero or negative.
/** Choose between two int values.
*
* Functionally equivalent to:
*
@ -423,23 +423,22 @@ static inline unsigned char mbedtls_ct_uchar_in_range_if(unsigned char low,
*
* \return \c if1 if \p condition == MBEDTLS_CT_TRUE, otherwise \c if0.
*/
static inline int mbedtls_ct_error_if(mbedtls_ct_condition_t condition, int if1, int if0);
static inline int mbedtls_ct_int_if(mbedtls_ct_condition_t condition, int if1, int if0);
/** Choose between an error value and 0. The error value must be zero or negative.
/** Choose between an int value and 0.
*
* Functionally equivalent to:
*
* condition ? if1 : 0.
*
* Functionally equivalent to mbedtls_ct_error_if(condition, if1, 0) but
* results in smaller code size.
* Functionally equivalent to mbedtls_ct_int_if(condition, if1, 0).
*
* \param condition Condition to test.
* \param if1 Value to use if \p condition == MBEDTLS_CT_TRUE.
*
* \return \c if1 if \p condition == MBEDTLS_CT_TRUE, otherwise 0.
*/
static inline int mbedtls_ct_error_if_else_0(mbedtls_ct_condition_t condition, int if1);
static inline int mbedtls_ct_int_if_else_0(mbedtls_ct_condition_t condition, int if1);
/* ============================================================================
* Block memory operations