Adapt ecp_group_free() to static constants

parent 73cc01d7
...@@ -136,7 +136,7 @@ typedef struct ...@@ -136,7 +136,7 @@ typedef struct
mpi N; /*!< 1. the order of G, or 2. unused */ mpi N; /*!< 1. the order of G, or 2. unused */
size_t pbits; /*!< number of bits in P */ size_t pbits; /*!< number of bits in P */
size_t nbits; /*!< number of bits in 1. P, or 2. private keys */ size_t nbits; /*!< number of bits in 1. P, or 2. private keys */
unsigned int h; /*!< unused */ unsigned int h; /*!< internal: 1 if the constants are static */
int (*modp)(mpi *); /*!< function for fast reduction mod P */ int (*modp)(mpi *); /*!< function for fast reduction mod P */
int (*t_pre)(ecp_point *, void *); /*!< unused */ int (*t_pre)(ecp_point *, void *); /*!< unused */
int (*t_post)(ecp_point *, void *); /*!< unused */ int (*t_post)(ecp_point *, void *); /*!< unused */
......
...@@ -277,18 +277,17 @@ void ecp_group_free( ecp_group *grp ) ...@@ -277,18 +277,17 @@ void ecp_group_free( ecp_group *grp )
{ {
size_t i; size_t i;
/* FIXME WIP */
if( grp->id != 0 )
return;
if( grp == NULL ) if( grp == NULL )
return; return;
mpi_free( &grp->P ); if( grp->h != 1 )
mpi_free( &grp->A ); {
mpi_free( &grp->B ); mpi_free( &grp->P );
ecp_point_free( &grp->G ); mpi_free( &grp->A );
mpi_free( &grp->N ); mpi_free( &grp->B );
ecp_point_free( &grp->G );
mpi_free( &grp->N );
}
if( grp->T != NULL ) if( grp->T != NULL )
{ {
......
...@@ -485,6 +485,8 @@ static int ecp_group_load( ecp_group *grp, ...@@ -485,6 +485,8 @@ static int ecp_group_load( ecp_group *grp,
grp->pbits = mpi_msb( &grp->P ); grp->pbits = mpi_msb( &grp->P );
grp->nbits = mpi_msb( &grp->N ); grp->nbits = mpi_msb( &grp->N );
grp->h = 1;
return( 0 ); return( 0 );
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment