Some more init calls

This commit is contained in:
Manuel Pégourié-Gonnard 2015-06-23 11:39:01 +02:00
parent 496f24e949
commit 96fb685e31

View file

@ -78,7 +78,12 @@
/* shared by all GCM ciphers */ /* shared by all GCM ciphers */
static void *gcm_ctx_alloc( void ) static void *gcm_ctx_alloc( void )
{ {
return mbedtls_calloc( 1, sizeof( mbedtls_gcm_context ) ); void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_gcm_context ) );
if( ctx != NULL )
mbedtls_gcm_init( (mbedtls_gcm_context *) ctx );
return( ctx );
} }
static void gcm_ctx_free( void *ctx ) static void gcm_ctx_free( void *ctx )
@ -92,7 +97,12 @@ static void gcm_ctx_free( void *ctx )
/* shared by all CCM ciphers */ /* shared by all CCM ciphers */
static void *ccm_ctx_alloc( void ) static void *ccm_ctx_alloc( void )
{ {
return mbedtls_calloc( 1, sizeof( mbedtls_ccm_context ) ); void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_ccm_context ) );
if( ctx != NULL )
mbedtls_ccm_init( (mbedtls_ccm_context *) ctx );
return( ctx );
} }
static void ccm_ctx_free( void *ctx ) static void ccm_ctx_free( void *ctx )