Fix misplaced initialisation
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index e636f9d..6dd5cc0 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -3277,6 +3277,10 @@
     ecdh_init( &ssl->handshake->ecdh_ctx );
 #endif
 
+#if defined(POLARSSL_X509_CRT_PARSE_C)
+    ssl->handshake->key_cert = ssl->key_cert;
+#endif
+
     return( 0 );
 }
 
@@ -3951,10 +3955,6 @@
 
     SSL_DEBUG_MSG( 2, ( "=> handshake" ) );
 
-#if defined(POLARSSL_X509_CRT_PARSE_C)
-    ssl->handshake->key_cert = ssl->key_cert;
-#endif
-
     while( ssl->state != SSL_HANDSHAKE_OVER )
     {
         ret = ssl_handshake_step( ssl );