From b2e23de0f3c63e8cd7e49836c2e3f1243e95996f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bence=20Sz=C3=A9pk=C3=BAti?= Date: Mon, 21 Jun 2021 15:53:07 +0200 Subject: [PATCH] Make config version symbols optional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also remove them from the example configs, but keep the one in mbedtls_config.h. Signed-off-by: Bence Szépkúti --- configs/config-ccm-psk-tls1_2.h | 2 -- configs/config-no-entropy.h | 2 -- configs/config-suite-b.h | 2 -- configs/config-symmetric-only.h | 2 -- configs/config-thread.h | 2 -- include/mbedtls/build_info.h | 11 +++++++---- 6 files changed, 7 insertions(+), 14 deletions(-) diff --git a/configs/config-ccm-psk-tls1_2.h b/configs/config-ccm-psk-tls1_2.h index cd74d86ca..51bb96291 100644 --- a/configs/config-ccm-psk-tls1_2.h +++ b/configs/config-ccm-psk-tls1_2.h @@ -30,8 +30,6 @@ * See README.txt for usage instructions. */ -#define MBEDTLS_CONFIG_VERSION 1 - /* System support */ //#define MBEDTLS_HAVE_TIME /* Optionally used in Hello messages */ /* Other MBEDTLS_HAVE_XXX flags irrelevant for this configuration */ diff --git a/configs/config-no-entropy.h b/configs/config-no-entropy.h index acfad388d..edba4a078 100644 --- a/configs/config-no-entropy.h +++ b/configs/config-no-entropy.h @@ -29,8 +29,6 @@ * See README.txt for usage instructions. */ -#define MBEDTLS_CONFIG_VERSION 1 - /* System support */ #define MBEDTLS_HAVE_ASM #define MBEDTLS_HAVE_TIME diff --git a/configs/config-suite-b.h b/configs/config-suite-b.h index 264826d47..c70773d63 100644 --- a/configs/config-suite-b.h +++ b/configs/config-suite-b.h @@ -33,8 +33,6 @@ * See README.txt for usage instructions. */ -#define MBEDTLS_CONFIG_VERSION 1 - /* System support */ #define MBEDTLS_HAVE_ASM #define MBEDTLS_HAVE_TIME diff --git a/configs/config-symmetric-only.h b/configs/config-symmetric-only.h index 6b22cba3c..6aff42f1c 100644 --- a/configs/config-symmetric-only.h +++ b/configs/config-symmetric-only.h @@ -20,8 +20,6 @@ * limitations under the License. */ -#define MBEDTLS_CONFIG_VERSION 1 - /* System support */ //#define MBEDTLS_HAVE_ASM #define MBEDTLS_HAVE_TIME diff --git a/configs/config-thread.h b/configs/config-thread.h index d8ee1c8d7..be889a187 100644 --- a/configs/config-thread.h +++ b/configs/config-thread.h @@ -32,8 +32,6 @@ * See README.txt for usage instructions. */ -#define MBEDTLS_CONFIG_VERSION 1 - /* System support */ #define MBEDTLS_HAVE_ASM diff --git a/include/mbedtls/build_info.h b/include/mbedtls/build_info.h index 2f34365e2..6ccbc0095 100644 --- a/include/mbedtls/build_info.h +++ b/include/mbedtls/build_info.h @@ -49,6 +49,8 @@ #define MBEDTLS_VERSION_STRING "2.26.0" #define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.26.0" +#define MBEDTLS_CONFIG_VERSION_LATEST 1 + #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) #define _CRT_SECURE_NO_DEPRECATE 1 #endif @@ -59,9 +61,10 @@ #include MBEDTLS_CONFIG_FILE #endif -#if !defined(MBEDTLS_CONFIG_VERSION) || \ - MBEDTLS_CONFIG_VERSION != 1 -#error "Invalid config version, MBEDTLS_CONFIG_VERSION != 1" +#if !defined(MBEDTLS_CONFIG_VERSION) +#define MBEDTLS_CONFIG_VERSION MBEDTLS_CONFIG_VERSION_LATEST +#elif MBEDTLS_CONFIG_VERSION != MBEDTLS_CONFIG_VERSION_LATEST +#error "Invalid config version, defined value of MBEDTLS_CONFIG_VERSION is unsupported" #endif #if defined(MBEDTLS_USER_CONFIG_VERSION) @@ -75,7 +78,7 @@ */ #if defined(MBEDTLS_USER_CONFIG_FILE) #include MBEDTLS_USER_CONFIG_FILE -#if !defined(MBEDTLS_USER_CONFIG_VERSION) || \ +#if defined(MBEDTLS_USER_CONFIG_VERSION) && \ MBEDTLS_USER_CONFIG_VERSION != MBEDTLS_CONFIG_VERSION #error "Version mismatch between config file and MBEDTLS_USER_CONFIG_FILE" #endif