Move switching to handshake transform after sending CCS record
@@ -1239,11 +1239,6 @@ static int ssl_tls13_finalize_write_server_hello( mbedtls_ssl_context *ssl )
return( ret );
}
- mbedtls_ssl_set_outbound_transform( ssl,
- ssl->handshake->transform_handshake );
- MBEDTLS_SSL_DEBUG_MSG(
- 3, ( "switching to handshake transform for outbound data" ) );
-
return( ret );
}
@@ -1407,6 +1402,11 @@ static int ssl_tls13_write_encrypted_extensions( mbedtls_ssl_context *ssl )
unsigned char *buf;
size_t buf_len, msg_len;
+ mbedtls_ssl_set_outbound_transform( ssl,
+ ssl->handshake->transform_handshake );
+ MBEDTLS_SSL_DEBUG_MSG(
+ 3, ( "switching to handshake transform for outbound data" ) );
+
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write encrypted extensions" ) );
MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_start_handshake_msg( ssl,
