1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00

Merge pull request #6656 from tom-cosgrove-arm/bignum_pr_6225-updated

Bignum: add mod_raw_add
This commit is contained in:
Janos Follath
2022-11-25 17:53:31 +00:00
committed by GitHub
4 changed files with 137 additions and 2 deletions

View File

@ -129,7 +129,16 @@ void mbedtls_mpi_mod_raw_sub( mbedtls_mpi_uint *X,
/* END MERGE SLOT 4 */
/* BEGIN MERGE SLOT 5 */
void mbedtls_mpi_mod_raw_add( mbedtls_mpi_uint *X,
const mbedtls_mpi_uint *A,
const mbedtls_mpi_uint *B,
const mbedtls_mpi_mod_modulus *N )
{
mbedtls_mpi_uint 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, (unsigned) ( carry ^ borrow ) );
}
/* END MERGE SLOT 5 */
/* BEGIN MERGE SLOT 6 */