Use modulus structure in mbedtls_mpi_mod_raw_add
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
This commit is contained in:
parent
0eea827cbd
commit
9fa91ebcb9
2 changed files with 10 additions and 11 deletions
|
@ -122,13 +122,12 @@ int mbedtls_mpi_mod_raw_write( const mbedtls_mpi_uint *A,
|
|||
void mbedtls_mpi_mod_raw_add( mbedtls_mpi_uint *X,
|
||||
mbedtls_mpi_uint const *A,
|
||||
mbedtls_mpi_uint const *B,
|
||||
const mbedtls_mpi_uint *N,
|
||||
size_t limbs )
|
||||
const mbedtls_mpi_mod_modulus *N )
|
||||
{
|
||||
size_t carry, borrow = 0;
|
||||
carry = mbedtls_mpi_core_add( X, A, B, limbs );
|
||||
borrow = mbedtls_mpi_core_sub( X, X, N, limbs);
|
||||
(void) mbedtls_mpi_core_add_if( X, N, limbs, ( carry < borrow ) );
|
||||
carry = mbedtls_mpi_core_add( X, A, B, N->limbs );
|
||||
borrow = mbedtls_mpi_core_sub( X, X, N->p, N->limbs );
|
||||
(void) mbedtls_mpi_core_add_if( X, N->p, N->limbs, ( carry < borrow ) );
|
||||
}
|
||||
/* END MERGE SLOT 5 */
|
||||
|
||||
|
|
|
@ -162,17 +162,17 @@ int mbedtls_mpi_mod_raw_write( const mbedtls_mpi_uint *A,
|
|||
*
|
||||
* \param[out] X The result of the modular addition.
|
||||
* \param[in] A Little-endian presentation of the left operand. This
|
||||
* must be smaller than \p N.
|
||||
* must be smaller than \p N, and have the same number of
|
||||
* limbs.
|
||||
* \param[in] B Little-endian presentation of the right operand. This
|
||||
* must be smaller than \p N.
|
||||
* \param[in] N Little-endian presentation of the modulus.
|
||||
* \param limbs Number of limbs of \p X, \p A, \p B and \p N.
|
||||
* must be smaller than \p N, and have the same number of
|
||||
* limbs.
|
||||
* \param[in] N The address of the modulus.
|
||||
*/
|
||||
void mbedtls_mpi_mod_raw_add( mbedtls_mpi_uint *X,
|
||||
mbedtls_mpi_uint const *A,
|
||||
mbedtls_mpi_uint const *B,
|
||||
const mbedtls_mpi_uint *N,
|
||||
size_t limbs );
|
||||
const mbedtls_mpi_mod_modulus *N );
|
||||
/* END MERGE SLOT 5 */
|
||||
|
||||
/* BEGIN MERGE SLOT 6 */
|
||||
|
|
Loading…
Reference in a new issue