From d8c45d5550f072991fd2c5c5bf6f92e137353d71 Mon Sep 17 00:00:00 2001 From: "Christoph M. Wintersteiger" Date: Wed, 20 Feb 2019 17:16:53 +0000 Subject: [PATCH] Revert "ECDH: Fix context initialization" This reverts commit 4a43d14146220e8550d6ad87cb798f74ce9ee209. --- library/ecdh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/ecdh.c b/library/ecdh.c index 4f50e6ef1..9c4ddce9c 100644 --- a/library/ecdh.c +++ b/library/ecdh.c @@ -186,7 +186,6 @@ static void ecdh_init_internal( mbedtls_ecdh_context_mbed *ctx ) 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 ); @@ -194,6 +193,8 @@ void mbedtls_ecdh_init( mbedtls_ecdh_context *ctx ) 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;