mbedtls_mpi_core_exp_mod_unsafe() function
Perform a modular exponentiation with public or secret exponent: X = A^E mod N, where \p A is already in Montgomery form. \warning This function is not constant time with respect to \p E (the exponent). \p X may be aliased to \p A, but not to \p RR or \p E, even if \p E_limbs == \p AN_limbs.
Arguments
X
The destination MPI, as a little endian array of length \p AN_limbs.
A
The base MPI, as a little endian array of length \p AN_limbs. Must be in Montgomery form.
N
The modulus, as a little endian array of length \p AN_limbs.
AN_limbs
The number of limbs in \p X, \p A, \p N, \p RR.
E
The exponent, as a little endian array of length \p E_limbs.
E_limbs
The number of limbs in \p E.
RR
The precomputed residue of 2^{2*biL} modulo N, as a little endian array of length \p AN_limbs.
T
Temporary storage of at least the number of limbs returned by `mbedtls_mpi_core_exp_mod_working_limbs()`. Its initial content is unused and its final content is indeterminate. It must not alias or otherwise overlap any of the other parameters. It is up to the caller to zeroize \p T when it is no longer needed, and before freeing it if it was dynamically allocated.
![]()
mbedtls_mpi_core_exp_mod_unsafe(X->p, X->p, N->p, N->n, E->p, E->n, RR.p, T);
mbedtls_mpi_core_exp_mod_unsafe() is called by 1 function and calls 1 function:
![]()
mbedtls_mpi_core_exp_mod_unsafe()
mbedtls_mpi_core_exp_mod_unsafe():
![]()
mbedtls_mpi_core_exp_mod_unsafe()