bignum_mod: Renamed m -> N in mbedtls_mpi_mod_read()

Signed-off-by: Mihir Raj Singh <mihirrajsingh123@gmail.com>
This commit is contained in:
Mihir Raj Singh 2023-01-11 20:32:59 +05:30
parent 928a07ba49
commit fdc314b6fe
2 changed files with 22 additions and 22 deletions

View file

@ -351,30 +351,30 @@ int mbedtls_mpi_mod_random(mbedtls_mpi_mod_residue *X,
/* END MERGE SLOT 6 */ /* END MERGE SLOT 6 */
/* BEGIN MERGE SLOT 7 */ /* BEGIN MERGE SLOT 7 */
int mbedtls_mpi_mod_read(mbedtls_mpi_mod_residue *r, int mbedtls_mpi_mod_read( mbedtls_mpi_mod_residue *r,
const mbedtls_mpi_mod_modulus *m, const mbedtls_mpi_mod_modulus *N,
const unsigned char *buf, const unsigned char *buf,
size_t buflen, size_t buflen,
mbedtls_mpi_mod_ext_rep ext_rep) mbedtls_mpi_mod_ext_rep ext_rep )
{ {
int ret = MBEDTLS_ERR_MPI_BAD_INPUT_DATA; int ret = MBEDTLS_ERR_MPI_BAD_INPUT_DATA;
/* Do our best to check if r and m have been set up */ /* Do our best to check if r and m have been set up */
if (r->limbs == 0 || m->limbs == 0) { if (r->limbs == 0 || N->limbs == 0) {
goto cleanup; goto cleanup;
} }
if (r->limbs != m->limbs) { if (r->limbs != N->limbs) {
goto cleanup; goto cleanup;
} }
ret = mbedtls_mpi_mod_raw_read(r->p, m, buf, buflen, ext_rep); ret = mbedtls_mpi_mod_raw_read(r->p, N, buf, buflen, ext_rep);
if (ret != 0) { if (ret != 0) {
goto cleanup; goto cleanup;
} }
r->limbs = m->limbs; r->limbs = N->limbs;
ret = mbedtls_mpi_mod_raw_canonical_to_modulus_rep(r->p, m); ret = mbedtls_mpi_mod_raw_canonical_to_modulus_rep( r->p, N );
cleanup: cleanup:
return ret; return ret;

View file

@ -401,16 +401,16 @@ int mbedtls_mpi_mod_random(mbedtls_mpi_mod_residue *X,
/** Read a residue from a byte buffer. /** Read a residue from a byte buffer.
* *
* The residue will be automatically converted to the internal representation * The residue will be automatically converted to the internal representation
* based on the value of the `m->int_rep` field. * based on the value of the `N->int_rep` field.
* *
* The modulus \p m will be the modulus associated with \p r. The residue \p r * The modulus \p N will be the modulus associated with \p r. The residue \p r
* should only be used in operations where the modulus is \p m or a modulus * should only be used in operations where the modulus is \p N or a modulus
* equivalent to \p m (in the sense that all their fields or memory pointed by * equivalent to \p N (in the sense that all their fields or memory pointed by
* their fields hold the same value). * their fields hold the same value).
* *
* \param[out] r The address of the residue. It must have exactly the same * \param[out] r The address of the residue. It must have exactly the same
* number of limbs as the modulus \p m. * number of limbs as the modulus \p N.
* \param[in] m The address of the modulus. * \param[in] N The address of the modulus.
* \param[in] buf The input buffer to import from. * \param[in] buf The input buffer to import from.
* \param buflen The length in bytes of \p buf. * \param buflen The length in bytes of \p buf.
* \param ext_rep The endianness of the number in the input buffer. * \param ext_rep The endianness of the number in the input buffer.
@ -419,13 +419,13 @@ int mbedtls_mpi_mod_random(mbedtls_mpi_mod_residue *X,
* \return #MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL if \p r isn't * \return #MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL if \p r isn't
* large enough to hold the value in \p buf. * large enough to hold the value in \p buf.
* \return #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if \p ext_rep * \return #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if \p ext_rep
* is invalid or the value in the buffer is not less than \p m. * is invalid or the value in the buffer is not less than \p N.
*/ */
int mbedtls_mpi_mod_read(mbedtls_mpi_mod_residue *r, int mbedtls_mpi_mod_read( mbedtls_mpi_mod_residue *r,
const mbedtls_mpi_mod_modulus *m, const mbedtls_mpi_mod_modulus *N,
const unsigned char *buf, const unsigned char *buf,
size_t buflen, size_t buflen,
mbedtls_mpi_mod_ext_rep ext_rep); mbedtls_mpi_mod_ext_rep ext_rep );
/** Write a residue into a byte buffer. /** Write a residue into a byte buffer.
* *