mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-07 06:42:56 +03:00
Create ecdh_context structure
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
* References:
|
||||
*
|
||||
* SEC1 http://www.secg.org/index.php?action=secg,docs_secg
|
||||
* RFC 4492
|
||||
*/
|
||||
|
||||
#include "polarssl/config.h"
|
||||
@@ -74,6 +75,34 @@ cleanup:
|
||||
return( ret );
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize context
|
||||
*/
|
||||
void ecdh_init( ecdh_context *ctx )
|
||||
{
|
||||
ecp_group_init( &ctx->grp );
|
||||
mpi_init ( &ctx->d );
|
||||
ecp_point_init( &ctx->Q );
|
||||
ecp_point_init( &ctx->Qp );
|
||||
mpi_init ( &ctx->z );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free context
|
||||
*/
|
||||
void ecdh_free( ecdh_context *ctx )
|
||||
{
|
||||
if( ctx == NULL )
|
||||
return;
|
||||
|
||||
ecp_group_free( &ctx->grp );
|
||||
mpi_free ( &ctx->d );
|
||||
ecp_point_free( &ctx->Q );
|
||||
ecp_point_free( &ctx->Qp );
|
||||
mpi_free ( &ctx->z );
|
||||
}
|
||||
|
||||
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
|
||||
|
Reference in New Issue
Block a user