From ccc302692ac2c659b560b4f40532c5d25c1705b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= <mpg@elzevir.fr>
Date: Mon, 11 May 2015 12:04:55 +0200
Subject: [PATCH] Fix bug introduced when splitting init functions

---
 library/ccm.c       | 4 ----
 library/ctr_drbg.c  | 1 -
 library/gcm.c       | 4 ----
 library/hmac_drbg.c | 8 --------
 4 files changed, 17 deletions(-)

diff --git a/library/ccm.c b/library/ccm.c
index 957fda9eae..109927e4c0 100644
--- a/library/ccm.c
+++ b/library/ccm.c
@@ -74,10 +74,6 @@ int mbedtls_ccm_setkey( mbedtls_ccm_context *ctx,
     int ret;
     const mbedtls_cipher_info_t *cipher_info;
 
-    memset( ctx, 0, sizeof( mbedtls_ccm_context ) );
-
-    mbedtls_cipher_init( &ctx->cipher_ctx );
-
     cipher_info = mbedtls_cipher_info_from_values( cipher, keysize, MBEDTLS_MODE_ECB );
     if( cipher_info == NULL )
         return( MBEDTLS_ERR_CCM_BAD_INPUT );
diff --git a/library/ctr_drbg.c b/library/ctr_drbg.c
index 54feb71c99..00b50d26bc 100644
--- a/library/ctr_drbg.c
+++ b/library/ctr_drbg.c
@@ -82,7 +82,6 @@ int mbedtls_ctr_drbg_seed_entropy_len(
     int ret;
     unsigned char key[MBEDTLS_CTR_DRBG_KEYSIZE];
 
-    memset( ctx, 0, sizeof(mbedtls_ctr_drbg_context) );
     memset( key, 0, MBEDTLS_CTR_DRBG_KEYSIZE );
 
     mbedtls_aes_init( &ctx->aes_ctx );
diff --git a/library/gcm.c b/library/gcm.c
index 58cb4f2838..39648b4c63 100644
--- a/library/gcm.c
+++ b/library/gcm.c
@@ -167,10 +167,6 @@ int mbedtls_gcm_setkey( mbedtls_gcm_context *ctx,
     int ret;
     const mbedtls_cipher_info_t *cipher_info;
 
-    memset( ctx, 0, sizeof(mbedtls_gcm_context) );
-
-    mbedtls_cipher_init( &ctx->cipher_ctx );
-
     cipher_info = mbedtls_cipher_info_from_values( cipher, keysize, MBEDTLS_MODE_ECB );
     if( cipher_info == NULL )
         return( MBEDTLS_ERR_GCM_BAD_INPUT );
diff --git a/library/hmac_drbg.c b/library/hmac_drbg.c
index 02fcc7d00f..5c4ee6def3 100644
--- a/library/hmac_drbg.c
+++ b/library/hmac_drbg.c
@@ -105,10 +105,6 @@ int mbedtls_hmac_drbg_seed_buf( mbedtls_hmac_drbg_context *ctx,
 {
     int ret;
 
-    memset( ctx, 0, sizeof( mbedtls_hmac_drbg_context ) );
-
-    mbedtls_md_init( &ctx->md_ctx );
-
     if( ( ret = mbedtls_md_setup( &ctx->md_ctx, md_info, 1 ) ) != 0 )
         return( ret );
 
@@ -179,10 +175,6 @@ int mbedtls_hmac_drbg_seed( mbedtls_hmac_drbg_context *ctx,
     int ret;
     size_t entropy_len, md_size;
 
-    memset( ctx, 0, sizeof( mbedtls_hmac_drbg_context ) );
-
-    mbedtls_md_init( &ctx->md_ctx );
-
     if( ( ret = mbedtls_md_setup( &ctx->md_ctx, md_info, 1 ) ) != 0 )
         return( ret );