mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 08:42:50 +00:00
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
@ -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,
|
void mbedtls_mpi_mod_raw_add( mbedtls_mpi_uint *X,
|
||||||
mbedtls_mpi_uint const *A,
|
mbedtls_mpi_uint const *A,
|
||||||
mbedtls_mpi_uint const *B,
|
mbedtls_mpi_uint const *B,
|
||||||
const mbedtls_mpi_uint *N,
|
const mbedtls_mpi_mod_modulus *N )
|
||||||
size_t limbs )
|
|
||||||
{
|
{
|
||||||
size_t carry, borrow = 0;
|
size_t carry, borrow = 0;
|
||||||
carry = mbedtls_mpi_core_add( X, A, B, limbs );
|
carry = mbedtls_mpi_core_add( X, A, B, N->limbs );
|
||||||
borrow = mbedtls_mpi_core_sub( X, X, N, limbs);
|
borrow = mbedtls_mpi_core_sub( X, X, N->p, N->limbs );
|
||||||
(void) mbedtls_mpi_core_add_if( X, N, limbs, ( carry < borrow ) );
|
(void) mbedtls_mpi_core_add_if( X, N->p, N->limbs, ( carry < borrow ) );
|
||||||
}
|
}
|
||||||
/* END MERGE SLOT 5 */
|
/* 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[out] X The result of the modular addition.
|
||||||
* \param[in] A Little-endian presentation of the left operand. This
|
* \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
|
* \param[in] B Little-endian presentation of the right operand. This
|
||||||
* must be smaller than \p N.
|
* must be smaller than \p N, and have the same number of
|
||||||
* \param[in] N Little-endian presentation of the modulus.
|
* limbs.
|
||||||
* \param limbs Number of limbs of \p X, \p A, \p B and \p N.
|
* \param[in] N The address of the modulus.
|
||||||
*/
|
*/
|
||||||
void mbedtls_mpi_mod_raw_add( mbedtls_mpi_uint *X,
|
void mbedtls_mpi_mod_raw_add( mbedtls_mpi_uint *X,
|
||||||
mbedtls_mpi_uint const *A,
|
mbedtls_mpi_uint const *A,
|
||||||
mbedtls_mpi_uint const *B,
|
mbedtls_mpi_uint const *B,
|
||||||
const mbedtls_mpi_uint *N,
|
const mbedtls_mpi_mod_modulus *N );
|
||||||
size_t limbs );
|
|
||||||
/* END MERGE SLOT 5 */
|
/* END MERGE SLOT 5 */
|
||||||
|
|
||||||
/* BEGIN MERGE SLOT 6 */
|
/* BEGIN MERGE SLOT 6 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user