1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Add ecp_keypair struct, init/free and constants

This commit is contained in:
Manuel Pégourié-Gonnard
2013-07-01 13:40:52 +02:00
parent 7c8934ea0e
commit b8c6e0e3e9
2 changed files with 67 additions and 0 deletions

View File

@ -90,6 +90,20 @@ void ecp_group_init( ecp_group *grp )
grp->modp = NULL;
}
/*
* Initialize (the components of) a key pair
*/
void ecp_keypair_init( ecp_keypair *key )
{
if ( key == NULL )
return;
ecp_group_init( &key->grp );
mpi_init( &key->d );
ecp_point_init( &key->Q );
key->alg = POLARSSL_ECP_KEY_ALG_UNRESTRICTED;
}
/*
* Unallocate (the components of) a point
*/
@ -117,6 +131,20 @@ void ecp_group_free( ecp_group *grp )
mpi_free( &grp->N );
}
/*
* Unallocate (the components of) a key pair
*/
void ecp_keypair_free( ecp_keypair *key )
{
if ( key == NULL )
return;
ecp_group_free( &key->grp );
mpi_free( &key->d );
ecp_point_free( &key->Q );
key->alg = POLARSSL_ECP_KEY_ALG_UNRESTRICTED;
}
/*
* Set point to zero
*/