Tidy up, remove MPI_CORE(), and apply the naming convention

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
Tom Cosgrove 2022-08-25 08:39:07 +01:00
parent d9b2348d8f
commit f7ff4c9a11
2 changed files with 19 additions and 19 deletions

View file

@ -590,16 +590,17 @@ cleanup:
/* BEGIN MERGE SLOT 3 */ /* BEGIN MERGE SLOT 3 */
mbedtls_mpi_uint MPI_CORE(sub_int)( mbedtls_mpi_uint *d, mbedtls_mpi_uint mbedtls_mpi_core_sub_int( mbedtls_mpi_uint *X,
const mbedtls_mpi_uint *l, const mbedtls_mpi_uint *A,
mbedtls_mpi_uint c, size_t n ) mbedtls_mpi_uint c, /* doubles as carry */
size_t limbs )
{ {
for( size_t i = 0; i < n; i++ ) for( size_t i = 0; i < limbs; i++ )
{ {
mbedtls_mpi_uint s, t; mbedtls_mpi_uint s = A[i];
s = l[i]; mbedtls_mpi_uint t = s - c;
t = s - c; c = ( t > s ); c = ( t > s );
d[i] = t; X[i] = t;
} }
return( c ); return( c );

View file

@ -504,23 +504,22 @@ int mbedtls_mpi_core_fill_random( mbedtls_mpi_uint *X, size_t X_limbs,
/* BEGIN MERGE SLOT 3 */ /* BEGIN MERGE SLOT 3 */
#define MPI_CORE(func) mbedtls_mpi_core_ ## func ## _minimal
/** /**
* \brief Subtract unsigned integer from known-size large unsigned integers. * \brief Subtract unsigned integer from known-size large unsigned integers.
* Return the borrow. * Return the borrow.
* *
* \param[out] d The result of the subtraction. * \param[out] X The result of the subtraction.
* \param[in] l The left operand. * \param[in] A The left operand.
* \param[in] r The unsigned scalar to subtract. * \param b The unsigned scalar to subtract.
* \param n Number of limbs of \p d and \p l. * \param limbs Number of limbs of \p X and \p A.
* *
* \return 1 if `l < r`. * \return 1 if `A < b`.
* 0 if `l >= r`. * 0 if `A >= b`.
*/ */
mbedtls_mpi_uint MPI_CORE(sub_int)( mbedtls_mpi_uint *d, mbedtls_mpi_uint mbedtls_mpi_core_sub_int( mbedtls_mpi_uint *X,
const mbedtls_mpi_uint *l, const mbedtls_mpi_uint *A,
mbedtls_mpi_uint r, size_t n ); mbedtls_mpi_uint b,
size_t limbs );
/* END MERGE SLOT 3 */ /* END MERGE SLOT 3 */