Clean up some comments

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2020-06-09 10:39:38 +02:00
parent 08fd43c4f6
commit de719d5d69

View File

@ -1264,7 +1264,7 @@ cleanup:
return( ret ); return( ret );
} }
/* /**
* Helper for mbedtls_mpi subtraction. * Helper for mbedtls_mpi subtraction.
* *
* Calculate d - s where d and s have the same size. * Calculate d - s where d and s have the same size.
@ -1274,7 +1274,7 @@ cleanup:
* \param n Number of limbs of \p d and \p s. * \param n Number of limbs of \p d and \p s.
* \param[in,out] d On input, the left operand. * \param[in,out] d On input, the left operand.
* On output, the result of the subtraction: * On output, the result of the subtraction:
* \param[s] The right operand. * \param[in] s The right operand.
* *
* \return 1 if `d < s`. * \return 1 if `d < s`.
* 0 if `d >= s`. * 0 if `d >= s`.
@ -1308,9 +1308,6 @@ int mbedtls_mpi_sub_abs( mbedtls_mpi *X, const mbedtls_mpi *A, const mbedtls_mpi
MPI_VALIDATE_RET( A != NULL ); MPI_VALIDATE_RET( A != NULL );
MPI_VALIDATE_RET( B != NULL ); MPI_VALIDATE_RET( B != NULL );
/* if( mbedtls_mpi_cmp_abs( A, B ) < 0 ) */
/* return( MBEDTLS_ERR_MPI_NEGATIVE_VALUE ); */
mbedtls_mpi_init( &TB ); mbedtls_mpi_init( &TB );
if( X == B ) if( X == B )
@ -1979,7 +1976,7 @@ static void mpi_montmul( mbedtls_mpi *A, const mbedtls_mpi *B, const mbedtls_mpi
/* Copy the n least significant limbs of d to A, so that /* Copy the n least significant limbs of d to A, so that
* A = d if d < N (recall that N has n limbs). */ * A = d if d < N (recall that N has n limbs). */
memcpy( A->p, d, n * ciL ); memcpy( A->p, d, n * ciL );
/* If d >= N then we want to set A to N - d. To prevent timing attacks, /* If d >= N then we want to set A to d - N. To prevent timing attacks,
* do the calculation without using conditional tests. */ * do the calculation without using conditional tests. */
/* Set d to d0 + (2^biL)^n - N where d0 is the current value of d. */ /* Set d to d0 + (2^biL)^n - N where d0 is the current value of d. */
d[n] += 1; d[n] += 1;