1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-10-17 04:51:22 +03:00

Keep track of whether mbedtls_ssl_set_hostname() has been called

Use a special marker as ssl->hostname if mbedtls_ssl_set_hostname() has been
called with NULL. If mbedtls_ssl_set_hostname() has never been called, the
field is NULL, as before.

No behavior change apart from now emitting a different log message depending
on whether mbedtls_ssl_set_hostname() has been called with NULL or not at all.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine
2025-02-12 23:53:25 +01:00
parent 520ceb2726
commit f33c45f84d
3 changed files with 55 additions and 20 deletions

View File

@@ -1409,6 +1409,10 @@ struct mbedtls_ssl_context {
*
* If this is \p NULL, the peer name verification is skipped, and
* the server_name extension is not sent.
*
* This can be a special value to indicate that mbedtls_ssl_set_hostname()
* has been called with \p NULL, as opposed to never having been called.
* See mbedtls_ssl_get_hostname_pointer().
*/
char *hostname;
#endif /* MBEDTLS_X509_CRT_PARSE_C */