Clean up mpi_mod_init/free

Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
Janos Follath 2022-07-19 13:14:36 +01:00
parent 5005edb36c
commit 281ccda8a5
2 changed files with 13 additions and 7 deletions

View file

@ -56,8 +56,12 @@ typedef enum
MBEDTLS_MPI_MOD_REP_OPT_RED
} mbedtls_mpi_mod_rep_selector;
#define MBEDTLS_MPI_MOD_EXT_REP_LE 0x1
#define MBEDTLS_MPI_MOD_EXT_REP_BE 0x2
typedef enum
{
MBEDTLS_MPI_MOD_EXT_REP_INVALID = 0,
MBEDTLS_MPI_MOD_EXT_REP_LE,
MBEDTLS_MPI_MOD_EXT_REP_BE
} mbedtls_mpi_mod_ext_rep;
void mbedtls_mpi_mod_residue_release( mbedtls_mpi_mod_residue *r );

View file

@ -114,7 +114,11 @@ void mbedtls_mpi_mod_modulus_init( mbedtls_mpi_mod_modulus *m )
if ( m == NULL )
return;
m->rep.mont = 0;
m->p = NULL;
m->n = 0;
m->plen = 0;
m->ext_rep = MBEDTLS_MPI_MOD_EXT_REP_INVALID;
m->int_rep = MBEDTLS_MPI_MOD_REP_INVALID;
}
void mbedtls_mpi_mod_modulus_free( mbedtls_mpi_mod_modulus *m )
@ -125,10 +129,8 @@ void mbedtls_mpi_mod_modulus_free( mbedtls_mpi_mod_modulus *m )
m->p = NULL;
m->n = 0;
m->plen = 0;
m->ext_rep = 0;
m->int_rep = 0;
m->rep.mont = NULL;
m->rep.ored = NULL;
m->ext_rep = MBEDTLS_MPI_MOD_EXT_REP_INVALID;
m->int_rep = MBEDTLS_MPI_MOD_REP_INVALID;
}
int mbedtls_mpi_mod_modulus_setup( mbedtls_mpi_mod_modulus *m,