From c9faea0f70f5810dff223ecc341493ec40b37a08 Mon Sep 17 00:00:00 2001 From: Janos Follath Date: Mon, 19 Feb 2024 10:49:18 +0000 Subject: [PATCH] Bignum: Remove/update obsolete comments - We have moved to fixed window exponentiation and the algorithm used is properly documented and referenced in core already, no need for duplication. - A comment on mbedtls_mpi_copy states that mbedtls_mpi_exp_mod relies on it not to shrink X. This is not the case anymore, however we should probably still state that some functions might rely on this property as we don't know it for sure and it is safer to keep it that way. Signed-off-by: Janos Follath --- library/bignum.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/library/bignum.c b/library/bignum.c index 9b8591bbe7..8a00ff5bf5 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -288,8 +288,7 @@ static int mbedtls_mpi_resize_clear(mbedtls_mpi *X, size_t limbs) * This function is not constant-time. Leading zeros in Y may be removed. * * Ensure that X does not shrink. This is not guaranteed by the public API, - * but some code in the bignum module relies on this property, for example - * in mbedtls_mpi_exp_mod(). + * but some code in the bignum module might still rely on this property. */ int mbedtls_mpi_copy(mbedtls_mpi *X, const mbedtls_mpi *Y) { @@ -1598,9 +1597,6 @@ int mbedtls_mpi_mod_int(mbedtls_mpi_uint *r, const mbedtls_mpi *A, mbedtls_mpi_s return 0; } -/* - * Sliding-window exponentiation: X = A^E mod N (HAC 14.85) - */ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, const mbedtls_mpi *E, const mbedtls_mpi *N, mbedtls_mpi *prec_RR)