[mbedtls] call mbedtls_ssl_set_hostname on setup (#11416)

Due to CVE-2025-27809, on newer versions of mbedtls, handshake
will fail unless hostname is set earlier.

TLS clients are not affected if they operate in a closed ecosystem
where the trusted certificate authority only issues certificates
to trusted hosts.

In this case, `mbedtls_ssl_set_hostname` with nullptr should
be called to avoid failures.

Signed-off-by: Maciej Baczmanski <[email protected]>
This commit is contained in:
Maciej Baczmański
2025-04-16 08:40:55 -06:00
committed by GitHub
parent ad2c33c16c
commit b4282a82f2
+7
View File
@@ -311,6 +311,13 @@ Error SecureSession::Setup(void)
VerifyOrExit(rval == 0);
}
#if defined(MBEDTLS_X509_CRT_PARSE_C)
if (!mIsServer)
{
mbedtls_ssl_set_hostname(&mSsl, nullptr);
}
#endif
mReceiveMessage = nullptr;
mMessageSubType = Message::kSubTypeNone;