- Fixed size of clean
diff --git a/library/cipher.c b/library/cipher.c
index 85c74ab..0d1258b 100644
--- a/library/cipher.c
+++ b/library/cipher.c
@@ -260,7 +260,7 @@
if( NULL == cipher_info || NULL == ctx )
return POLARSSL_ERR_CIPHER_BAD_INPUT_DATA;
- memset( ctx, 0, sizeof( ctx ) );
+ memset( ctx, 0, sizeof( cipher_context_t ) );
if( NULL == ( ctx->cipher_ctx = cipher_info->base->ctx_alloc_func() ) )
return POLARSSL_ERR_CIPHER_ALLOC_FAILED;
diff --git a/library/md.c b/library/md.c
index d15bf1d..96065c9 100644
--- a/library/md.c
+++ b/library/md.c
@@ -152,11 +152,10 @@
int md_init_ctx( md_context_t *ctx, const md_info_t *md_info )
{
- if( md_info == NULL )
+ if( md_info == NULL || ctx == NULL )
return POLARSSL_ERR_MD_BAD_INPUT_DATA;
- if( ctx == NULL || ctx->md_ctx != NULL )
- return POLARSSL_ERR_MD_BAD_INPUT_DATA;
+ memset( ctx, 0, sizeof( md_context_t ) );
if( ( ctx->md_ctx = md_info->ctx_alloc_func() ) == NULL )
return POLARSSL_ERR_MD_ALLOC_FAILED;