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>
diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h
index a18edbb..447a293 100644
--- a/include/mbedtls/ssl.h
+++ b/include/mbedtls/ssl.h
@@ -1409,6 +1409,10 @@
*
* 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 */