Fix build warning related to DTLS connect ID

Between mbedtls version 3.6.2 and 3.6.3, some header files inclusion
scheme have changed (P-R [1] and specifically [2]) leading to the build
warning shown below when building libmbedtls as a user TA library
in OP-TEE OS package [3]:

In file included from lib/libmbedtls/mbedtls/library/ssl_misc.h:18,
                 from lib/libmbedtls/mbedtls/library/ssl_debug_helpers_generated.c:14:
lib/libmbedtls/mbedtls/include/mbedtls/ssl.h:659:5: warning: "MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT" is not defined, evaluates to 0 [-Wundef]
  659 | #if MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT == 0
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix this by considering MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT only
when MBEDTLS_SSL_DTLS_CONNECTION_ID is defined. The build warning is
related to the definition of MBEDTLS_TLS_EXT_CID that is meaningful only
when MBEDTLS_SSL_DTLS_CONNECTION_ID is defined which is relevant only
when MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT is defined.

Fixes #10207.

Link: https://github.com/Mbed-TLS/mbedtls/pull/9671 [1]
Link: b81cd1af64 [2]
Link: https://github.com/OP-TEE/optee_os/pull/7337 [3]
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
This commit is contained in:
Etienne Carriere 2025-03-28 18:07:19 +01:00
parent 3623414113
commit df620dae43
2 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1,3 @@
Bugfix
* Fix a compilation warning in ssl.h when MBEDTLS_SSL_DTLS_CONNECTION_ID
and MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT are not defined. Fixes #10207.

View File

@ -656,11 +656,17 @@
#define MBEDTLS_TLS_EXT_SIG_ALG_CERT 50 /* RFC 8446 TLS 1.3 */
#define MBEDTLS_TLS_EXT_KEY_SHARE 51 /* RFC 8446 TLS 1.3 */
/*
* MBEDTLS_TLS_EXT_CID is required only when
* MBEDTLS_SSL_DTLS_CONNECTION_ID is defined.
*/
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
#if MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT == 0
#define MBEDTLS_TLS_EXT_CID 54 /* RFC 9146 DTLS 1.2 CID */
#else
#define MBEDTLS_TLS_EXT_CID 254 /* Pre-RFC 9146 DTLS 1.2 CID */
#endif
#endif
#define MBEDTLS_TLS_EXT_ECJPAKE_KKPP 256 /* experimental */