diff --git a/library/bignum_mod.c b/library/bignum_mod.c index c42ffbf05c..13354aec66 100644 --- a/library/bignum_mod.c +++ b/library/bignum_mod.c @@ -380,37 +380,38 @@ cleanup: return ret; } -int mbedtls_mpi_mod_write(const mbedtls_mpi_mod_residue *r, - const mbedtls_mpi_mod_modulus *m, - unsigned char *buf, - size_t buflen, - mbedtls_mpi_mod_ext_rep ext_rep) +int mbedtls_mpi_mod_write( const mbedtls_mpi_mod_residue *r, + const mbedtls_mpi_mod_modulus *N, + unsigned char *buf, + size_t buflen, + mbedtls_mpi_mod_ext_rep ext_rep ) { int ret = MBEDTLS_ERR_MPI_BAD_INPUT_DATA; /* 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; } - if (r->limbs != m->limbs) { + if (r->limbs != N->limbs) { goto cleanup; } - if (m->int_rep == MBEDTLS_MPI_MOD_REP_MONTGOMERY) { - ret = mbedtls_mpi_mod_raw_from_mont_rep(r->p, m); + if (N->int_rep == MBEDTLS_MPI_MOD_REP_MONTGOMERY) { + ret = mbedtls_mpi_mod_raw_from_mont_rep(r->p, N); if (ret != 0) { goto cleanup; } } - ret = mbedtls_mpi_mod_raw_write(r->p, m, buf, buflen, ext_rep); + ret = mbedtls_mpi_mod_raw_write( r->p, N, buf, buflen, ext_rep ); - if (m->int_rep == MBEDTLS_MPI_MOD_REP_MONTGOMERY) { + if( N->int_rep == MBEDTLS_MPI_MOD_REP_MONTGOMERY ) + { /* If this fails, the value of r is corrupted and we want to return * this error (as opposed to the error code from the write above) to * let the caller know. If it succeeds, we want to return the error * code from write above. */ - int conv_ret = mbedtls_mpi_mod_raw_to_mont_rep(r->p, m); + int conv_ret = mbedtls_mpi_mod_raw_to_mont_rep(r->p, N); if (ret == 0) { ret = conv_ret; } diff --git a/library/bignum_mod.h b/library/bignum_mod.h index 84f4e63795..0bc55947d2 100644 --- a/library/bignum_mod.h +++ b/library/bignum_mod.h @@ -429,22 +429,22 @@ int mbedtls_mpi_mod_read( mbedtls_mpi_mod_residue *r, /** Write a residue into a byte buffer. * - * The modulus \p m must be the modulus associated with \p r (see + * The modulus \p N must be the modulus associated with \p r (see * mbedtls_mpi_mod_residue_setup() and mbedtls_mpi_mod_read()). * * The residue will be automatically converted from the internal representation - * based on the value of `m->int_rep` field. + * based on the value of `N->int_rep` field. * - * \warning If the buffer is smaller than `m->bits`, the number of + * \warning If the buffer is smaller than `N->bits`, the number of * leading zeroes is leaked through timing. If \p r is * secret, the caller must ensure that \p buflen is at least - * (`m->bits`+7)/8. + * (`N->bits`+7)/8. * * \param[in] r The address of the residue. It must have the same number of - * limbs as the modulus \p m. (\p r is an input parameter, but + * limbs as the modulus \p N. (\p r is an input parameter, but * its value will be modified during execution and restored * before the function returns.) - * \param[in] m The address of the modulus associated with \r. + * \param[in] N The address of the modulus associated with \r. * \param[out] buf The output buffer to export to. * \param buflen The length in bytes of \p buf. * \param ext_rep The endianness in which the number should be written into @@ -459,11 +459,11 @@ int mbedtls_mpi_mod_read( mbedtls_mpi_mod_residue *r, * memory for conversion. Can occur only for moduli with * MBEDTLS_MPI_MOD_REP_MONTGOMERY. */ -int mbedtls_mpi_mod_write(const mbedtls_mpi_mod_residue *r, - const mbedtls_mpi_mod_modulus *m, - unsigned char *buf, - size_t buflen, - mbedtls_mpi_mod_ext_rep ext_rep); +int mbedtls_mpi_mod_write( const mbedtls_mpi_mod_residue *r, + const mbedtls_mpi_mod_modulus *N, + unsigned char *buf, + size_t buflen, + mbedtls_mpi_mod_ext_rep ext_rep ); /* END MERGE SLOT 7 */ /* BEGIN MERGE SLOT 8 */