mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-29 12:32:48 +00:00
Add mod_raw_mul function
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
parent
9fa4897839
commit
979d34ca7d
@ -120,6 +120,16 @@ void mbedtls_mpi_mod_raw_sub( mbedtls_mpi_uint *X,
|
||||
(void) mbedtls_mpi_core_add_if( X, N->p, N->limbs, (unsigned) c );
|
||||
}
|
||||
|
||||
void mbedtls_mpi_mod_raw_mul( mbedtls_mpi_uint *X,
|
||||
const mbedtls_mpi_uint *A,
|
||||
const mbedtls_mpi_uint *B,
|
||||
const mbedtls_mpi_mod_modulus *N,
|
||||
mbedtls_mpi_uint *T )
|
||||
{
|
||||
mbedtls_mpi_core_montmul( X, A, B, N->limbs, N->p, N->limbs,
|
||||
N->rep.mont.mm, T );
|
||||
}
|
||||
|
||||
/* END MERGE SLOT 2 */
|
||||
|
||||
/* BEGIN MERGE SLOT 3 */
|
||||
|
@ -170,6 +170,31 @@ void mbedtls_mpi_mod_raw_sub( mbedtls_mpi_uint *X,
|
||||
const mbedtls_mpi_uint *B,
|
||||
const mbedtls_mpi_mod_modulus *N );
|
||||
|
||||
/** \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.
|
||||
*
|
||||
* \p X may be aliased to \p A or \p B, or even both, but may not overlap
|
||||
* either otherwise.
|
||||
*
|
||||
* \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[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.
|
||||
*/
|
||||
void mbedtls_mpi_mod_raw_mul( mbedtls_mpi_uint *X,
|
||||
const mbedtls_mpi_uint *A,
|
||||
const mbedtls_mpi_uint *B,
|
||||
const mbedtls_mpi_mod_modulus *N,
|
||||
mbedtls_mpi_uint *T );
|
||||
|
||||
/* END MERGE SLOT 2 */
|
||||
|
||||
/* BEGIN MERGE SLOT 3 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user