From 968afaa06fca8e8ab5d84e133dbc9c347dfe492c Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Wed, 9 Jul 2014 11:09:24 +0200
Subject: [PATCH] ssl_key_cert not available in all configurations
---
library/ssl_tls.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 6d7b0c8a7..8613b8d0e 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -3270,8 +3270,7 @@ int ssl_parse_finished( ssl_context *ssl )
return( 0 );
}
-static void ssl_handshake_params_init( ssl_handshake_params *handshake,
- ssl_key_cert *key_cert )
+static void ssl_handshake_params_init( ssl_handshake_params *handshake )
{
memset( handshake, 0, sizeof( ssl_handshake_params ) );
@@ -3302,10 +3301,6 @@ static void ssl_handshake_params_init( ssl_handshake_params *handshake,
#if defined(POLARSSL_ECDH_C)
ecdh_init( &handshake->ecdh_ctx );
#endif
-
-#if defined(POLARSSL_X509_CRT_PARSE_C)
- handshake->key_cert = key_cert;
-#endif
}
static void ssl_transform_init( ssl_transform *transform )
@@ -3377,7 +3372,11 @@ static int ssl_handshake_init( ssl_context *ssl )
/* Initialize structures */
ssl_session_init( ssl->session_negotiate );
ssl_transform_init( ssl->transform_negotiate );
- ssl_handshake_params_init( ssl->handshake, ssl->key_cert );
+ ssl_handshake_params_init( ssl->handshake );
+
+#if defined(POLARSSL_X509_CRT_PARSE_C)
+ ssl->handshake->key_cert = ssl->key_cert;
+#endif
return( 0 );
}