1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

bignum_mod_raw: Refactored Montgomery conversion functions

This patch updates the `mbedtls_mpi_mod_raw_conv_xx()` methods
as follows:

* Renamed for simplicity: conv_fwd -> from_mont_rep, conv_inv -> to_mont_rep.
* Uncoupled the dependency on the legaly bignum interface.
* `mbedtls_mpi` is no longer used for temporary buffer allocation.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
Minos Galanakis
2022-11-01 16:19:07 +00:00
parent 5ad4a93596
commit d9299c388e
2 changed files with 39 additions and 23 deletions

View File

@@ -163,25 +163,29 @@ int mbedtls_mpi_mod_raw_write( const mbedtls_mpi_uint *A,
/* END MERGE SLOT 6 */
/* BEGIN MERGE SLOT 7 */
/** Convert from internal to public (little endian) data presentation
/** Convert an MPI into Montgomery form.
*
* \param X The address of the MPI.
* \param m The address of a modulus.
* Must have the same number of limbs as \p m.
* \param m The address of the modulus, which gives the size of
* the base `R` = 2^(biL*m->limbs).
*
* \return \c 0 if successful.
*/
int mbedtls_mpi_mod_raw_conv_inv( mbedtls_mpi_uint *X,
const mbedtls_mpi_mod_modulus *modulus );
int mbedtls_mpi_mod_raw_to_mont_rep( mbedtls_mpi_uint *X,
const mbedtls_mpi_mod_modulus *m );
/** Convert from public (little endian) to internal data presentation.
/** Convert an MPI back from Montgomery representation.
*
* \param X The address of the MPI.
* \param m The address of a modulus.
* Must have the same number of limbs as \p m.
* \param m The address of the modulus, which gives the size of
* the base `R`= 2^(biL*m->limbs).
*
* \return \c 0 if successful.
*/
int mbedtls_mpi_mod_raw_conv_fwd( mbedtls_mpi_uint *X,
const mbedtls_mpi_mod_modulus *modulus );
int mbedtls_mpi_mod_raw_from_mont_rep( mbedtls_mpi_uint *X,
const mbedtls_mpi_mod_modulus *m );
/* END MERGE SLOT 7 */
/* BEGIN MERGE SLOT 8 */