1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-10-23 01:52:40 +03:00

Be explicit about modinv output range

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
Manuel Pégourié-Gonnard
2025-09-11 09:58:45 +02:00
parent c18eea6d43
commit c6b28b31ef

View File

@@ -63,7 +63,8 @@ int mbedtls_mpi_exp_mod_unsafe(mbedtls_mpi *X, const mbedtls_mpi *A,
* \param[out] G The GCD of \p A and \p N. * \param[out] G The GCD of \p A and \p N.
* This may be NULL, to only compute I. * This may be NULL, to only compute I.
* \param[out] I The inverse of \p A modulo \p N if it exists (that is, * \param[out] I The inverse of \p A modulo \p N if it exists (that is,
* if \p G above is 1 on exit); indeterminate otherwise. * if \p G above is 1 on exit), in the range [1, \p N);
* indeterminate otherwise.
* This may be NULL, to only compute G. * This may be NULL, to only compute G.
* \param[in] A The 1st operand of GCD and number to invert. * \param[in] A The 1st operand of GCD and number to invert.
* This value must be less than or equal to \p N. * This value must be less than or equal to \p N.
@@ -83,8 +84,8 @@ int mbedtls_mpi_gcd_modinv_odd(mbedtls_mpi *G,
/** /**
* \brief Modular inverse: X = A^-1 mod N with N odd * \brief Modular inverse: X = A^-1 mod N with N odd
* *
* \param[out] X The inverse of \p A modulo \p N on success, * \param[out] X The inverse of \p A modulo \p N in the range [1, \p N)
* indeterminate otherwise. * on success; indeterminate otherwise.
* \param[in] A The number to invert. * \param[in] A The number to invert.
* \param[in] N The modulus. Must be odd and greater than 1. * \param[in] N The modulus. Must be odd and greater than 1.
* *
@@ -102,8 +103,8 @@ int mbedtls_mpi_inv_mod_odd(mbedtls_mpi *X,
* \brief Modular inverse: X = A^-1 mod N with N even, * \brief Modular inverse: X = A^-1 mod N with N even,
* A odd and 1 < A < N. * A odd and 1 < A < N.
* *
* \param[out] X The inverse of \p A modulo \p N on success, * \param[out] X The inverse of \p A modulo \p N in the range [1, \p N)
* indeterminate otherwise. * on success; indeterminate otherwise.
* \param[in] A The number to invert. Must be odd, greated than 1 * \param[in] A The number to invert. Must be odd, greated than 1
* and less than \p N. * and less than \p N.
* \param[in] N The modulus. Must be even and greater than 1. * \param[in] N The modulus. Must be even and greater than 1.