mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 08:42:50 +00:00
bignum_mod_raw: Added conversion methods for internal/public data representation
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
parent
9f1ecadc40
commit
5ad4a93596
@ -127,7 +127,28 @@ int mbedtls_mpi_mod_raw_write( const mbedtls_mpi_uint *A,
|
|||||||
/* END MERGE SLOT 6 */
|
/* END MERGE SLOT 6 */
|
||||||
|
|
||||||
/* BEGIN MERGE SLOT 7 */
|
/* BEGIN MERGE SLOT 7 */
|
||||||
|
int mbedtls_mpi_mod_raw_conv_inv( mbedtls_mpi_uint *X,
|
||||||
|
const mbedtls_mpi_mod_modulus *modulus )
|
||||||
|
{
|
||||||
|
mbedtls_mpi_uint one = 1;
|
||||||
|
mbedtls_mpi T;
|
||||||
|
mbedtls_mpi_init( &T );
|
||||||
|
mbedtls_mpi_core_montmul( X, X, &one, 1, m->p, m->limbs,
|
||||||
|
m->rep.mont.mm, T.p );
|
||||||
|
mbedtls_mpi_free( &T );
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
int mbedtls_mpi_mod_raw_conv_fwd( mbedtls_mpi_uint *X,
|
||||||
|
const mbedtls_mpi_mod_modulus *modulus )
|
||||||
|
{
|
||||||
|
mbedtls_mpi T;
|
||||||
|
mbedtls_mpi_init( &T );
|
||||||
|
mbedtls_mpi_core_montmul( X, X, m->rep.mont.rr, 1, m->p, m->limbs,
|
||||||
|
m->rep.mont.mm, T.p );
|
||||||
|
mbedtls_mpi_free( &T );
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
/* END MERGE SLOT 7 */
|
/* END MERGE SLOT 7 */
|
||||||
|
|
||||||
/* BEGIN MERGE SLOT 8 */
|
/* BEGIN MERGE SLOT 8 */
|
||||||
|
@ -163,7 +163,25 @@ int mbedtls_mpi_mod_raw_write( const mbedtls_mpi_uint *A,
|
|||||||
/* END MERGE SLOT 6 */
|
/* END MERGE SLOT 6 */
|
||||||
|
|
||||||
/* BEGIN MERGE SLOT 7 */
|
/* BEGIN MERGE SLOT 7 */
|
||||||
|
/** Convert from internal to public (little endian) data presentation
|
||||||
|
*
|
||||||
|
* \param X The address of the MPI.
|
||||||
|
* \param m The address of a modulus.
|
||||||
|
*
|
||||||
|
* \return \c 0 if successful.
|
||||||
|
*/
|
||||||
|
int mbedtls_mpi_mod_raw_conv_inv( mbedtls_mpi_uint *X,
|
||||||
|
const mbedtls_mpi_mod_modulus *modulus );
|
||||||
|
|
||||||
|
/** Convert from public (little endian) to internal data presentation.
|
||||||
|
*
|
||||||
|
* \param X The address of the MPI.
|
||||||
|
* \param m The address of a modulus.
|
||||||
|
*
|
||||||
|
* \return \c 0 if successful.
|
||||||
|
*/
|
||||||
|
int mbedtls_mpi_mod_raw_conv_fwd( mbedtls_mpi_uint *X,
|
||||||
|
const mbedtls_mpi_mod_modulus *modulus );
|
||||||
/* END MERGE SLOT 7 */
|
/* END MERGE SLOT 7 */
|
||||||
|
|
||||||
/* BEGIN MERGE SLOT 8 */
|
/* BEGIN MERGE SLOT 8 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user