From 1e8c8ecd9509121e6a024c564373a6cb4be82392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Wed, 31 Oct 2012 19:24:21 +0100 Subject: [PATCH] Implemented ecp_{point,group}_free() --- library/ecp.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/library/ecp.c b/library/ecp.c index 1caf0c6dd..7f157377f 100644 --- a/library/ecp.c +++ b/library/ecp.c @@ -36,6 +36,31 @@ #include "polarssl/ecp.h" +/* + * Unallocate (the components of) a point + */ +void ecp_point_free( ecp_point *pt ) +{ + if( pt == NULL ) + return; + + mpi_free( &( pt->X ) ); + mpi_free( &( pt->Y ) ); +} + +/* + * Unallocate (the components of) a group + */ +void ecp_group_free( ecp_group *grp ) +{ + if( grp == NULL ) + return; + + mpi_free( &( grp->P ) ); + mpi_free( &( grp->B ) ); + mpi_free( &( grp->N ) ); + ecp_point_free( &( grp->G ) ); +} #if defined(POLARSSL_SELF_TEST)