From abddad4af88b2aa9c2e6c09448112efd529a18a7 Mon Sep 17 00:00:00 2001 From: Tom Cosgrove Date: Thu, 24 Nov 2022 15:54:16 +0000 Subject: [PATCH] Add note about aliasing of operands for mbedtls_mpi_mod_raw_add() Signed-off-by: Tom Cosgrove --- library/bignum_mod_raw.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/library/bignum_mod_raw.h b/library/bignum_mod_raw.h index bcb4a1596c..56a9f860d6 100644 --- a/library/bignum_mod_raw.h +++ b/library/bignum_mod_raw.h @@ -158,15 +158,19 @@ int mbedtls_mpi_mod_raw_write( const mbedtls_mpi_uint *A, /** * \brief Perform a known-size modular addition. * - * Calculate `A + B modulo N` where \p A, \p B, and \p N have the same size. + * Calculate `A + B modulo N`. + * + * The number of limbs in each operand, and the result, is given by the + * modulus \p N. + * + * \p X may be aliased to \p A or \p B, or even both, but may not overlap + * either otherwise. * * \param[out] X The result of the modular addition. * \param[in] A Little-endian presentation of the left operand. This - * must be smaller than \p N, and have the same number of - * limbs. + * must be smaller than \p N. * \param[in] B Little-endian presentation of the right operand. This - * must be smaller than \p N, and have the same number of - * limbs. + * must be smaller than \p N. * \param[in] N The address of the modulus. */ void mbedtls_mpi_mod_raw_add( mbedtls_mpi_uint *X,