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:
@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user