From 7dd2f504b3ebeda92cdf7e80135db2026b0356bd Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Sat, 24 Apr 2021 13:35:41 +0200 Subject: [PATCH] Allow configuring MBEDTLS_TLS_EXT_CID at compile time The numerical identifier of the CID extension hasn't been settled yet and different implementations use values from different drafts. Allow configuring the value at compile time. Signed-off-by: Gilles Peskine --- ChangeLog.d/tls_ext_cid-config.txt | 3 +++ include/mbedtls/mbedtls_config.h | 11 +++++++++++ include/mbedtls/ssl.h | 8 +++++++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 ChangeLog.d/tls_ext_cid-config.txt diff --git a/ChangeLog.d/tls_ext_cid-config.txt b/ChangeLog.d/tls_ext_cid-config.txt new file mode 100644 index 000000000..b7b1e7244 --- /dev/null +++ b/ChangeLog.d/tls_ext_cid-config.txt @@ -0,0 +1,3 @@ +Features + * The identifier of the CID TLS extension can be configured by defining + MBEDTLS_TLS_EXT_CID at compile time. diff --git a/include/mbedtls/mbedtls_config.h b/include/mbedtls/mbedtls_config.h index a60db7e93..d470c0054 100644 --- a/include/mbedtls/mbedtls_config.h +++ b/include/mbedtls/mbedtls_config.h @@ -3194,6 +3194,17 @@ //#define MBEDTLS_PSK_MAX_LEN 32 /**< Max size of TLS pre-shared keys, in bytes (default 256 bits) */ //#define MBEDTLS_SSL_COOKIE_TIMEOUT 60 /**< Default expiration delay of DTLS cookies, in seconds if HAVE_TIME, or in number of cookies issued */ +/** \def MBEDTLS_TLS_EXT_CID + * + * At the time of writing, the CID extension has not been assigned its + * final value. Set this configuration option to make Mbed TLS use a + * different value. + * + * A future minor revision of Mbed TLS may change the default value of + * this option to match evolving standards and usage. + */ +//#define MBEDTLS_TLS_EXT_CID 254 + /** * Complete list of ciphersuites to use, in order of preference. * diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h index 221cee337..167d741a0 100644 --- a/include/mbedtls/ssl.h +++ b/include/mbedtls/ssl.h @@ -425,8 +425,14 @@ /* The value of the CID extension is still TBD as of * draft-ietf-tls-dtls-connection-id-05 - * (https://tools.ietf.org/html/draft-ietf-tls-dtls-connection-id-05) */ + * (https://tools.ietf.org/html/draft-ietf-tls-dtls-connection-id-05). + * + * A future minor revision of Mbed TLS may change the default value of + * this option to match evolving standards and usage. + */ +#if !defined(MBEDTLS_TLS_EXT_CID) #define MBEDTLS_TLS_EXT_CID 254 /* TBD */ +#endif #define MBEDTLS_TLS_EXT_ECJPAKE_KKPP 256 /* experimental */