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

Memory-allocation abstraction layer and buffer-based allocator added

This commit is contained in:
Paul Bakker
2013-07-03 13:37:05 +02:00
parent f863485fea
commit 6e339b52e8
18 changed files with 818 additions and 103 deletions

View File

@ -37,6 +37,14 @@
#if defined(POLARSSL_ECP_C)
#include "polarssl/ecp.h"
#if defined(POLARSSL_MEMORY_C)
#include "polarssl/memory.h"
#else
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <limits.h>
#include <stdlib.h>
@ -793,7 +801,7 @@ static int ecp_normalize_many( const ecp_group *grp,
if( t_len < 2 )
return( ecp_normalize( grp, T ) );
if( ( c = (mpi *) malloc( t_len * sizeof( mpi ) ) ) == NULL )
if( ( c = (mpi *) polarssl_malloc( t_len * sizeof( mpi ) ) ) == NULL )
return( POLARSSL_ERR_ECP_GENERIC );
mpi_init( &u ); mpi_init( &Zi ); mpi_init( &ZZi );
@ -848,7 +856,7 @@ cleanup:
mpi_free( &u ); mpi_free( &Zi ); mpi_free( &ZZi );
for( i = 0; i < t_len; i++ )
mpi_free( &c[i] );
free( c );
polarssl_free( c );
return( ret );
}