diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h index 4cf67044a..88ccb27c4 100644 --- a/include/mbedtls/ssl.h +++ b/include/mbedtls/ssl.h @@ -1188,6 +1188,10 @@ struct mbedtls_ssl_session uint8_t MBEDTLS_PRIVATE(resumption_key_len); /*!< resumption_key length */ unsigned char MBEDTLS_PRIVATE(resumption_key)[MBEDTLS_SSL_TLS1_3_TICKET_RESUMPTION_KEY_LEN]; +#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && defined(MBEDTLS_SSL_CLI_C) + char *MBEDTLS_PRIVATE(hostname); /*!< host name binded with tickets */ +#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION && MBEDTLS_SSL_CLI_C */ + #if defined(MBEDTLS_HAVE_TIME) && defined(MBEDTLS_SSL_CLI_C) mbedtls_time_t MBEDTLS_PRIVATE(ticket_received); /*!< time ticket was received */ #endif /* MBEDTLS_HAVE_TIME && MBEDTLS_SSL_CLI_C */ @@ -1201,10 +1205,6 @@ struct mbedtls_ssl_session #if defined(MBEDTLS_SSL_PROTO_TLS1_3) mbedtls_ssl_tls13_application_secrets MBEDTLS_PRIVATE(app_secrets); -#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \ - defined(MBEDTLS_SSL_SESSION_TICKETS) - char *MBEDTLS_PRIVATE(hostname); /*!< host name binded with tickets */ -#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION && MBEDTLS_SSL_SESSION_TICKETS */ #endif /* MBEDTLS_SSL_PROTO_TLS1_3 */ }; diff --git a/library/ssl_client.c b/library/ssl_client.c index 341e882cc..10566deaa 100644 --- a/library/ssl_client.c +++ b/library/ssl_client.c @@ -880,8 +880,10 @@ static int ssl_prepare_client_hello( mbedtls_ssl_context *ssl ) int hostname_mismatch = ssl->hostname != NULL || ssl->session_negotiate->hostname != NULL; if( ssl->hostname != NULL && ssl->session_negotiate->hostname != NULL ) + { hostname_mismatch = strcmp( ssl->hostname, ssl->session_negotiate->hostname ) != 0; + } if( hostname_mismatch ) { diff --git a/library/ssl_misc.h b/library/ssl_misc.h index 82a0d5c8a..828937c3f 100644 --- a/library/ssl_misc.h +++ b/library/ssl_misc.h @@ -2497,7 +2497,7 @@ int mbedtls_ssl_tls13_write_binders_of_pre_shared_key_ext( #if defined(MBEDTLS_SSL_PROTO_TLS1_3) && \ defined(MBEDTLS_SSL_SESSION_TICKETS) && \ defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \ - defined(MBEDTLS_SSL_TLS_C) + defined(MBEDTLS_SSL_CLI_C) MBEDTLS_CHECK_RETURN_CRITICAL int mbedtls_ssl_session_set_hostname( mbedtls_ssl_session *session, const char *hostname ); diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 521b922b7..c67745513 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -8862,7 +8862,7 @@ int mbedtls_ssl_write_alpn_ext( mbedtls_ssl_context *ssl, #if defined(MBEDTLS_SSL_PROTO_TLS1_3) && \ defined(MBEDTLS_SSL_SESSION_TICKETS) && \ defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \ - defined(MBEDTLS_SSL_TLS_C) + defined(MBEDTLS_SSL_CLI_C) int mbedtls_ssl_session_set_hostname( mbedtls_ssl_session *session, const char *hostname ) { @@ -8907,6 +8907,6 @@ int mbedtls_ssl_session_set_hostname( mbedtls_ssl_session *session, #endif /* MBEDTLS_SSL_PROTO_TLS1_3 && MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SERVER_NAME_INDICATION && - MBEDTLS_SSL_TLS_C */ + MBEDTLS_SSL_CLI_C */ #endif /* MBEDTLS_SSL_TLS_C */