mbedtls_mpi_core_to_mont_rep() function
Convert an MPI into Montgomery form. \p X may be aliased to \p A, but may not otherwise overlap it. \p X may not alias \p N (it is in canonical form, so must be strictly less than \p N). Nor may it alias or overlap \p rr (this is unlikely to be required in practice.) This function is a thin wrapper around `mbedtls_mpi_core_montmul()` that is an alternative to calling `mbedtls_mpi_mod_raw_to_mont_rep()` when we don't want to allocate memory.
Arguments
X
The result of the conversion. Must have the same number of limbs as \p A.
A
The MPI to convert into Montgomery form. Must have the same number of limbs as the modulus.
N
The address of the modulus, which gives the size of the base `R` = 2^(biL*N->limbs).
AN_limbs
The number of limbs in \p X, \p A, \p N and \p rr.
mm
The Montgomery constant for \p N: -N^-1 mod 2^biL. This can be determined by calling `mbedtls_mpi_core_montmul_init()`.
rr
The residue for `2^{2*n*biL} mod N`.
T
Temporary storage of size at least `mbedtls_mpi_core_montmul_working_limbs(AN_limbs)` limbs. Its initial content is unused and its final content is indeterminate. It must not alias or otherwise overlap any of the other parameters.
![]()
mbedtls_mpi_core_to_mont_rep(X->p, X->p, N->p, N->n, mm, RR.p, T);![]()
mbedtls_mpi_core_to_mont_rep(T->p, T->p, N->p, nlimbs, mm, RR.p, M_T.p);
mbedtls_mpi_core_to_mont_rep() is called by 2 functions and calls 1 function:
![]()
mbedtls_mpi_core_to_mont_rep()
mbedtls_mpi_core_to_mont_rep():
![]()
mbedtls_mpi_core_to_mont_rep()