diff --git a/library/bignum_mod_raw.h b/library/bignum_mod_raw.h index f8638a63ed..05c46b96b4 100644 --- a/library/bignum_mod_raw.h +++ b/library/bignum_mod_raw.h @@ -173,21 +173,31 @@ void mbedtls_mpi_mod_raw_sub( mbedtls_mpi_uint *X, /** \brief Multiply two MPIs, returning the residue modulo the specified * modulus. * - * The size of the operation is determined by \p N. \p A and \p B must have - * the same number of limbs as \p N. + * \note Currently handles the case when `m->int_rep` is + * MBEDTLS_MPI_MOD_REP_MONTGOMERY. + * + * The size of the operation is determined by \p N. \p A, \p B and \p X must + * all be associated with the modulus \p N and must all have the same number + * of limbs as \p N. * * \p X may be aliased to \p A or \p B, or even both, but may not overlap - * either otherwise. + * either otherwise. They may not alias \p N (since they must be in canonical + * form, they cannot == \p N). * - * \param[out] X The address of the result MPI. - * This must be initialized. Must have enough limbs to - * store the full value of the result. - * \param[in] A The address of the first MPI. This must be initialized. - * \param[in] B The address of the second MPI. This must be initialized. + * \param[out] X The address of the result MPI. Must have the same + * number of limbs as \p N. + * On successful completion, \p X contains the result of + * the multiplication `A * B * R^-1` mod N where + * `R = 2^(biL * N->limbs)`. + * \param[in] A The address of the first MPI. + * \param[in] B The address of the second MPI. * \param[in] N The address of the modulus. Used to perform a modulo - * operation on the result of the subtraction. - * \param[in] T The address of an MPI used by the multiplication - * as a temp variable. + * operation on the result of the multiplication. + * \param[in,out] T Temporary storage of size at least 2 * AN_limbs + 1 + * limbs. Its initial content is unused and + * its final content is indeterminate. + * It must not alias or otherwise overlap any of the + * other parameters. */ void mbedtls_mpi_mod_raw_mul( mbedtls_mpi_uint *X, const mbedtls_mpi_uint *A,