mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-24 00:06:32 +01:00
Add ecp_keypair struct, init/free and constants
This commit is contained in:
parent
7c8934ea0e
commit
b8c6e0e3e9
2 changed files with 67 additions and 0 deletions
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue