mbedtls_mpi_core_add_if() function
Conditional addition of two fixed-size large unsigned integers, returning the carry. Functionally equivalent to ``` if( cond ) X += A; return carry; ``` This function operates modulo `2^(biL*limbs)`. \warning If \p cond is neither 0 nor 1, the result of this function is unspecified, and the resulting value in \p X might be neither its original value nor \p X + \p A.
Arguments
X
The pointer to the (little-endian) array representing the bignum to accumulate onto.
A
The pointer to the (little-endian) array representing the bignum to conditionally add to \p X. This may be aliased to \p X but may not overlap otherwise.
limbs
Number of limbs of \p X and \p A.
cond
Condition bit dictating whether addition should happen or not. This must be \c 0 or \c 1.
Return value
1 if `X + cond * A >= 2^(biL*limbs)`, 0 otherwise.
mbedtls_mpi_core_add_if() calls 2 functions:
![]()
mbedtls_mpi_core_add_if()
mbedtls_mpi_core_add_if():
![]()
mbedtls_mpi_core_add_if()