mbedtls_mpi_safe_cond_assign() function
Perform a safe conditional copy of MPI which doesn't reveal whether the condition was true or not.
Arguments
X
The MPI to conditionally assign to. This must point to an initialized MPI.
Y
The MPI to be assigned from. This must point to an initialized MPI.
assign
The condition deciding whether to perform the assignment or not. Possible values: * \c 1: Perform the assignment `X = Y`. * \c 0: Keep the original value of \p X.
Return value
\c 0 if successful. #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed. Another negative error code on other kinds of failure.
Notes
This function is equivalent to `if( assign ) mbedtls_mpi_copy( X, Y );` except that it avoids leaking any information about whether the assignment was done or not (the above code may leak information through branch prediction and/or memory access patterns analysis).
Functions calling mbedtls_mpi_safe_cond_assign()
Functions called by mbedtls_mpi_safe_cond_assign()
mbedtls_mpi_safe_cond_assign()
Data read by mbedtls_mpi_safe_cond_assign()
Data written by mbedtls_mpi_safe_cond_assign()
mbedtls_mpi_safe_cond_assign()::ret mbedtls_mpi_safe_cond_assign()::i all items filtered out
mbedtls_mpi_safe_cond_assign()
mbedtls_mpi_safe_cond_assign()::ret mbedtls_mpi_safe_cond_assign()::i all items filtered out
Type of mbedtls_mpi_safe_cond_assign()
mbedtls_mpi_safe_cond_assign()
size_t all items filtered out