ECDH: Fix context initialization
diff --git a/library/ecdh.c b/library/ecdh.c
index 9c4ddce..4f50e6e 100644
--- a/library/ecdh.c
+++ b/library/ecdh.c
@@ -186,6 +186,7 @@
 void mbedtls_ecdh_init( mbedtls_ecdh_context *ctx )
 {
     ECDH_VALIDATE( ctx != NULL );
+    memset( ctx, 0, sizeof( mbedtls_ecdh_context ) );
 
 #if defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
     ecdh_init_internal( ctx );
@@ -193,8 +194,6 @@
     mbedtls_ecp_point_init( &ctx->Vf  );
     mbedtls_mpi_init( &ctx->_d );
 #else
-    memset( ctx, 0, sizeof( mbedtls_ecdh_context ) );
-
     ctx->var = MBEDTLS_ECDH_VARIANT_NONE;
 #endif
     ctx->point_format = MBEDTLS_ECP_PF_UNCOMPRESSED;