Merge pull request #1699 from valeriosetti/issue1585-backport3.6-only-fix

[3.6] [minimal] Stale DTLS- SRTP negotiation state after session_reset() (ARM-RZ7EMQAA)
This commit is contained in:
Ronald Cron 2026-06-26 12:17:27 +02:00 committed by GitHub
commit 4259a7aa63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 6 deletions

View File

@ -0,0 +1,3 @@
Bugfix
* Fixed documentation of mbedtls_ssl_set_cid(): the set CID configuration
is applied to all subsequent handshakes, not just to the next one.

View File

@ -0,0 +1,6 @@
Security
* Ensure 'dtls_srtp_info' field from 'mbedtls_ssl_context'
is properly zeroized when mbedtls_ssl_session_reset() is called. This
could cause incorrect DTLS-SRTP parameter inheritance for applications
reusing an SSL context.
Reported by jjfz123. CVE-2026-50585.

View File

@ -2344,7 +2344,7 @@ void mbedtls_ssl_set_bio(mbedtls_ssl_context *ssl,
/**
* \brief Configure the use of the Connection ID (CID)
* extension in the next handshake.
* extension in subsequent handshakes.
*
* Reference: RFC 9146 (or draft-ietf-tls-dtls-connection-id-05
* https://tools.ietf.org/html/draft-ietf-tls-dtls-connection-id-05
@ -2365,7 +2365,7 @@ void mbedtls_ssl_set_bio(mbedtls_ssl_context *ssl,
* headers of outgoing messages.
*
* This API enables or disables the use of the CID extension
* in the next handshake and sets the value of the CID to
* in subsequent handshakes and sets the value of the CID to
* be used for incoming messages.
*
* \param ssl The SSL context to configure. This must be initialized.
@ -2396,11 +2396,11 @@ void mbedtls_ssl_set_bio(mbedtls_ssl_context *ssl,
* successful call to this function to run the handshake.
*
* \note This call cannot guarantee that the use of the CID
* will be successfully negotiated in the next handshake,
* will be successfully negotiated in subsequent handshakes,
* because the peer might not support it. Specifically:
* - On the Client, enabling the use of the CID through
* this call implies that the `ClientHello` in the next
* handshake will include the CID extension, thereby
* this call implies that the `ClientHello` in subsequent
* handshakes will include the CID extension, thereby
* offering the use of the CID to the server. Only if
* the `ServerHello` contains the CID extension, too,
* the CID extension will actually be put to use.
@ -2423,7 +2423,7 @@ void mbedtls_ssl_set_bio(mbedtls_ssl_context *ssl,
* Mbed TLS.
*
* \return \c 0 on success. In this case, the CID configuration
* applies to the next handshake.
* applies to subsequent handshakes.
* \return A negative error code on failure.
*/
int mbedtls_ssl_set_cid(mbedtls_ssl_context *ssl,

View File

@ -1518,6 +1518,8 @@ void mbedtls_ssl_session_reset_msg_layer(mbedtls_ssl_context *ssl,
}
ssl->send_alert = 0;
ssl->alert_reason = 0;
ssl->alert_type = 0;
/* Reset outgoing message writing */
ssl->out_msgtype = 0;
@ -1591,6 +1593,10 @@ int mbedtls_ssl_session_reset_int(mbedtls_ssl_context *ssl, int partial)
ssl->alpn_chosen = NULL;
#endif
#if defined(MBEDTLS_SSL_DTLS_SRTP)
memset(&ssl->dtls_srtp_info, 0, sizeof(ssl->dtls_srtp_info));
#endif /* MBEDTLS_SSL_DTLS_SRTP */
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
int free_cli_id = 1;
#if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE)