Make const-time test not depend on internal knowledge of mbedtls_ct_condition_t
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
ad9e5b9abe
commit
04a334af55
1 changed files with 3 additions and 3 deletions
|
@ -77,13 +77,13 @@ void mbedtls_ct_bool_xxx(char *x_str, char *y_str)
|
|||
expected = x1 <= y1 ? MBEDTLS_CT_TRUE : MBEDTLS_CT_FALSE;
|
||||
TEST_EQUAL(mbedtls_ct_bool_le(x, y), expected);
|
||||
|
||||
expected = mbedtls_ct_bool(x1) ^ mbedtls_ct_bool(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);
|
||||
|
||||
expected = mbedtls_ct_bool(x1) & mbedtls_ct_bool(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);
|
||||
|
||||
expected = mbedtls_ct_bool(x1) | mbedtls_ct_bool(y1) ? MBEDTLS_CT_TRUE : MBEDTLS_CT_FALSE;
|
||||
expected = (!!x1) || (!!y1) ? MBEDTLS_CT_TRUE : MBEDTLS_CT_FALSE;
|
||||
TEST_EQUAL(mbedtls_ct_bool_or(mbedtls_ct_bool(x), mbedtls_ct_bool(y)), expected);
|
||||
|
||||
TEST_CF_PUBLIC(&x, sizeof(x));
|
||||
|
|
Loading…
Reference in a new issue