bignum_mod: Renamed m -> N in mbedtls_mpi_mod_modulus_free

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

View File

@ -71,33 +71,35 @@ void mbedtls_mpi_mod_modulus_init( mbedtls_mpi_mod_modulus *N )
N->int_rep = MBEDTLS_MPI_MOD_REP_INVALID;
}
void mbedtls_mpi_mod_modulus_free(mbedtls_mpi_mod_modulus *m)
void mbedtls_mpi_mod_modulus_free( mbedtls_mpi_mod_modulus *N )
{
if (m == NULL) {
if (N == NULL) {
return;
}
switch (m->int_rep) {
switch( N->int_rep )
{
case MBEDTLS_MPI_MOD_REP_MONTGOMERY:
if (m->rep.mont.rr != NULL) {
mbedtls_platform_zeroize((mbedtls_mpi_uint *) m->rep.mont.rr,
m->limbs * sizeof(mbedtls_mpi_uint));
mbedtls_free((mbedtls_mpi_uint *) m->rep.mont.rr);
m->rep.mont.rr = NULL;
if (N->rep.mont.rr != NULL)
{
mbedtls_platform_zeroize( (mbedtls_mpi_uint *) N->rep.mont.rr,
N->limbs * sizeof(mbedtls_mpi_uint) );
mbedtls_free( (mbedtls_mpi_uint *)N->rep.mont.rr );
N->rep.mont.rr = NULL;
}
m->rep.mont.mm = 0;
N->rep.mont.mm = 0;
break;
case MBEDTLS_MPI_MOD_REP_OPT_RED:
mbedtls_free(m->rep.ored);
mbedtls_free( N->rep.ored );
break;
case MBEDTLS_MPI_MOD_REP_INVALID:
break;
}
m->p = NULL;
m->limbs = 0;
m->bits = 0;
m->int_rep = MBEDTLS_MPI_MOD_REP_INVALID;
N->p = NULL;
N->limbs = 0;
N->bits = 0;
N->int_rep = MBEDTLS_MPI_MOD_REP_INVALID;
}
static int set_mont_const_square(const mbedtls_mpi_uint **X,

View File

@ -216,9 +216,9 @@ int mbedtls_mpi_mod_modulus_setup( mbedtls_mpi_mod_modulus *N,
* mbedtls_mpi_mod_modulus_setup() only removes the reference to it,
* making it safe to free or to use it again.
*
* \param[in,out] m The address of the modulus structure to free.
* \param[in,out] N The address of the modulus structure to free.
*/
void mbedtls_mpi_mod_modulus_free(mbedtls_mpi_mod_modulus *m);
void mbedtls_mpi_mod_modulus_free( mbedtls_mpi_mod_modulus *N );
/* BEGIN MERGE SLOT 1 */