mirror of
https://github.com/ARMmbed/mbedtls.git
synced 2025-05-12 01:42:21 +08:00
Improve variable name in mbedtls_mpi_lt_mpi_ct
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
926d8da47e
commit
1f39f037bf
@ -61,7 +61,7 @@ int mbedtls_mpi_lt_mpi_ct(const mbedtls_mpi *X,
|
|||||||
const mbedtls_mpi *Y,
|
const mbedtls_mpi *Y,
|
||||||
unsigned *ret)
|
unsigned *ret)
|
||||||
{
|
{
|
||||||
mbedtls_ct_condition_t cond, X_is_negative, Y_is_negative, result;
|
mbedtls_ct_condition_t different_sign, X_is_negative, Y_is_negative, result;
|
||||||
|
|
||||||
MPI_VALIDATE_RET(X != NULL);
|
MPI_VALIDATE_RET(X != NULL);
|
||||||
MPI_VALIDATE_RET(Y != NULL);
|
MPI_VALIDATE_RET(Y != NULL);
|
||||||
@ -83,8 +83,8 @@ 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).
|
||||||
*/
|
*/
|
||||||
cond = mbedtls_ct_bool_xor(X_is_negative, Y_is_negative); // non-zero if different sign
|
different_sign = mbedtls_ct_bool_xor(X_is_negative, Y_is_negative); // non-zero if different sign
|
||||||
result = mbedtls_ct_bool_and(cond, X_is_negative);
|
result = mbedtls_ct_bool_and(different_sign, X_is_negative);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assuming signs are the same, compare X and Y. We switch the comparison
|
* Assuming signs are the same, compare X and Y. We switch the comparison
|
||||||
@ -98,10 +98,11 @@ int mbedtls_mpi_lt_mpi_ct(const mbedtls_mpi *X,
|
|||||||
mbedtls_ct_condition_t lt = mbedtls_mpi_core_lt_ct(p[i], p[i ^ 1], X->n);
|
mbedtls_ct_condition_t lt = mbedtls_mpi_core_lt_ct(p[i], p[i ^ 1], X->n);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Store in result iff the signs are the same (i.e., iff cond == false). If
|
* Store in result iff the signs are the same (i.e., iff different_sign == false). If
|
||||||
* the signs differ, result has already been set, so we don't change it.
|
* the signs differ, result has already been set, so we don't change it.
|
||||||
*/
|
*/
|
||||||
result = mbedtls_ct_bool_or(result, mbedtls_ct_bool_and(mbedtls_ct_bool_not(cond), lt));
|
result = mbedtls_ct_bool_or(result,
|
||||||
|
mbedtls_ct_bool_and(mbedtls_ct_bool_not(different_sign), lt));
|
||||||
|
|
||||||
*ret = mbedtls_ct_uint_if0(result, 1);
|
*ret = mbedtls_ct_uint_if0(result, 1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user