mbedtls_mpi_core_cond_swap() function
Perform a safe conditional swap of two MPIs which doesn't reveal whether the swap was done or not.
Arguments
X
The address of the first MPI. This must be initialized.
Y
The address of the second MPI. This must be initialized.
limbs
The number of limbs of \p X and \p Y.
swap
The condition deciding whether to perform the swap or not.
Notes
This function avoids leaking any information about whether the swap was done or not.
![]()
mbedtls_mpi_core_cond_swap(X->p, Y->p, X->n, do_swap);
mbedtls_mpi_core_cond_swap() is called by 1 function and calls 1 function:
![]()
mbedtls_mpi_core_cond_swap()
mbedtls_mpi_core_cond_swap():
![]()
mbedtls_mpi_core_cond_swap()