mirror of
https://github.com/ARMmbed/mbedtls.git
synced 2025-06-25 22:56:35 +08:00
Rename mbedtls_ct_bool_xor to mbedtls_ct_bool_ne
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
89a9bd5887
commit
1cfc43c77b
@ -83,7 +83,7 @@ int mbedtls_mpi_lt_mpi_ct(const mbedtls_mpi *X,
|
|||||||
* That is if X is negative (X_is_negative == 1), then X < Y is true and it
|
* That is if X is negative (X_is_negative == 1), then X < Y is true and it
|
||||||
* is false if X is positive (X_is_negative == 0).
|
* is false if X is positive (X_is_negative == 0).
|
||||||
*/
|
*/
|
||||||
different_sign = mbedtls_ct_bool_xor(X_is_negative, Y_is_negative); // non-zero if different sign
|
different_sign = mbedtls_ct_bool_ne(X_is_negative, Y_is_negative); // true if different sign
|
||||||
result = mbedtls_ct_bool_and(different_sign, X_is_negative);
|
result = mbedtls_ct_bool_and(different_sign, X_is_negative);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -407,8 +407,8 @@ static inline mbedtls_ct_condition_t mbedtls_ct_uint_le(mbedtls_ct_uint_t x,
|
|||||||
return ~mbedtls_ct_uint_gt(x, y);
|
return ~mbedtls_ct_uint_gt(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline mbedtls_ct_condition_t mbedtls_ct_bool_xor(mbedtls_ct_condition_t x,
|
static inline mbedtls_ct_condition_t mbedtls_ct_bool_ne(mbedtls_ct_condition_t x,
|
||||||
mbedtls_ct_condition_t y)
|
mbedtls_ct_condition_t y)
|
||||||
{
|
{
|
||||||
return (mbedtls_ct_condition_t) (x ^ y);
|
return (mbedtls_ct_condition_t) (x ^ y);
|
||||||
}
|
}
|
||||||
|
@ -194,11 +194,11 @@ static inline mbedtls_ct_condition_t mbedtls_ct_uint_ge(mbedtls_ct_uint_t x,
|
|||||||
static inline mbedtls_ct_condition_t mbedtls_ct_uint_le(mbedtls_ct_uint_t x,
|
static inline mbedtls_ct_condition_t mbedtls_ct_uint_le(mbedtls_ct_uint_t x,
|
||||||
mbedtls_ct_uint_t y);
|
mbedtls_ct_uint_t y);
|
||||||
|
|
||||||
/** Boolean "xor" operation.
|
/** Boolean not-equals operation.
|
||||||
*
|
*
|
||||||
* Functionally equivalent to:
|
* Functionally equivalent to:
|
||||||
*
|
*
|
||||||
* \p x ^ \p y
|
* \p x != \p y
|
||||||
*
|
*
|
||||||
* \param x The first value to analyze.
|
* \param x The first value to analyze.
|
||||||
* \param y The second value to analyze.
|
* \param y The second value to analyze.
|
||||||
@ -206,11 +206,11 @@ static inline mbedtls_ct_condition_t mbedtls_ct_uint_le(mbedtls_ct_uint_t x,
|
|||||||
* \note This is more efficient than mbedtls_ct_uint_ne if both arguments are
|
* \note This is more efficient than mbedtls_ct_uint_ne if both arguments are
|
||||||
* mbedtls_ct_condition_t.
|
* mbedtls_ct_condition_t.
|
||||||
*
|
*
|
||||||
* \return MBEDTLS_CT_TRUE if \p x ^ \p y,
|
* \return MBEDTLS_CT_TRUE if \p x != \p y,
|
||||||
* otherwise MBEDTLS_CT_FALSE.
|
* otherwise MBEDTLS_CT_FALSE.
|
||||||
*/
|
*/
|
||||||
static inline mbedtls_ct_condition_t mbedtls_ct_bool_xor(mbedtls_ct_condition_t x,
|
static inline mbedtls_ct_condition_t mbedtls_ct_bool_ne(mbedtls_ct_condition_t x,
|
||||||
mbedtls_ct_condition_t y);
|
mbedtls_ct_condition_t y);
|
||||||
|
|
||||||
/** Boolean "and" operation.
|
/** Boolean "and" operation.
|
||||||
*
|
*
|
||||||
|
@ -77,8 +77,8 @@ void mbedtls_ct_bool_xxx(char *x_str, char *y_str)
|
|||||||
expected = x1 <= y1 ? MBEDTLS_CT_TRUE : MBEDTLS_CT_FALSE;
|
expected = x1 <= y1 ? MBEDTLS_CT_TRUE : MBEDTLS_CT_FALSE;
|
||||||
TEST_EQUAL(mbedtls_ct_uint_le(x, y), expected);
|
TEST_EQUAL(mbedtls_ct_uint_le(x, y), expected);
|
||||||
|
|
||||||
expected = (!!x1) ^ (!!y1) ? MBEDTLS_CT_TRUE : MBEDTLS_CT_FALSE;
|
expected = (!!x1) != (!!y1) ? MBEDTLS_CT_TRUE : MBEDTLS_CT_FALSE;
|
||||||
TEST_EQUAL(mbedtls_ct_bool_xor(mbedtls_ct_bool(x), mbedtls_ct_bool(y)), expected);
|
TEST_EQUAL(mbedtls_ct_bool_ne(mbedtls_ct_bool(x), mbedtls_ct_bool(y)), expected);
|
||||||
|
|
||||||
expected = (!!x1) && (!!y1) ? MBEDTLS_CT_TRUE : MBEDTLS_CT_FALSE;
|
expected = (!!x1) && (!!y1) ? MBEDTLS_CT_TRUE : MBEDTLS_CT_FALSE;
|
||||||
TEST_EQUAL(mbedtls_ct_bool_and(mbedtls_ct_bool(x), mbedtls_ct_bool(y)), expected);
|
TEST_EQUAL(mbedtls_ct_bool_and(mbedtls_ct_bool(x), mbedtls_ct_bool(y)), expected);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user