ssl_client.c: Re-order partially extension writing

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2022-03-29 18:57:54 +02:00
parent 42c1cbf1de
commit df823bf39b

View File

@ -411,12 +411,13 @@ static int ssl_write_client_hello_body( mbedtls_ssl_context *ssl,
p_extensions_len = p;
p += 2;
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
ret = mbedtls_ssl_tls13_write_client_hello_exts( ssl, p, end, &output_len );
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
/* Write server name extension */
ret = mbedtls_ssl_write_hostname_ext( ssl, p, end, &output_len );
if( ret != 0 )
return( ret );
p += output_len;
#endif
#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
#if defined(MBEDTLS_SSL_ALPN)
ret = ssl_write_alpn_ext( ssl, p, end, &output_len );
@ -425,6 +426,13 @@ static int ssl_write_client_hello_body( mbedtls_ssl_context *ssl,
p += output_len;
#endif /* MBEDTLS_SSL_ALPN */
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
ret = mbedtls_ssl_tls13_write_client_hello_exts( ssl, p, end, &output_len );
if( ret != 0 )
return( ret );
p += output_len;
#endif
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
if( mbedtls_ssl_conf_tls13_some_ephemeral_enabled( ssl ) )
@ -445,14 +453,6 @@ static int ssl_write_client_hello_body( mbedtls_ssl_context *ssl,
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
/* Write server name extension */
ret = mbedtls_ssl_write_hostname_ext( ssl, p, end, &output_len );
if( ret != 0 )
return( ret );
p += output_len;
#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
/* Add more extensions here */
/* Write the length of the list of extensions. */