From 1cafe5ce20c54e68a4de0f85bd4bc844e3798198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bence=20Sz=C3=A9pk=C3=BAti?= Date: Tue, 22 Jun 2021 09:30:08 +0200 Subject: [PATCH] Base config compat check on MBETLS_VERSION_NUMBER MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Any config with a version older than 3.0.0 or newer than MBETLS_VERSION_NUMBER will be rejected. This does mean that the current development version doesn'T accept *any* value of MBETLS_CONFIG_VERSION, but this will be fixed when we bump the version during our normal release process. Signed-off-by: Bence Szépkúti --- include/mbedtls/build_info.h | 11 +++-------- include/mbedtls/mbedtls_config.h | 4 +++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/mbedtls/build_info.h b/include/mbedtls/build_info.h index d07f6ac0d..0ff328679 100644 --- a/include/mbedtls/build_info.h +++ b/include/mbedtls/build_info.h @@ -49,12 +49,6 @@ #define MBEDTLS_VERSION_STRING "2.26.0" #define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.26.0" -/** - * Equal to the #MBEDTLS_VERSION_NUMBER of the mbedtls version that introduced - * the most recent config version - */ -#define MBEDTLS_CONFIG_VERSION_LATEST 0x03000000 - #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) #define _CRT_SECURE_NO_DEPRECATE 1 #endif @@ -65,8 +59,9 @@ #include MBEDTLS_CONFIG_FILE #endif -#if defined(MBEDTLS_CONFIG_VERSION) && \ - MBEDTLS_CONFIG_VERSION != MBEDTLS_CONFIG_VERSION_LATEST +#if defined(MBEDTLS_CONFIG_VERSION) && ( \ + MBEDTLS_CONFIG_VERSION < 0x03000000 || \ + MBEDLTS_CONFIG_VERSION > MBEDTLS_VERSION_NUMBER ) #error "Invalid config version, defined value of MBEDTLS_CONFIG_VERSION is unsupported" #endif diff --git a/include/mbedtls/mbedtls_config.h b/include/mbedtls/mbedtls_config.h index 8aa88b0d6..80bbebddf 100644 --- a/include/mbedtls/mbedtls_config.h +++ b/include/mbedtls/mbedtls_config.h @@ -25,13 +25,15 @@ */ /** + * \def MBEDTLS_CONFIG_VERSION + * * This is an optional version symbol that enables comatibility handling of * config files. * * It is equal to the #MBEDTLS_VERSION_NUMBER of the mbedtls version that * introduced the config format we want to be compatible with. */ -#define MBEDTLS_CONFIG_VERSION 0x03000000 +//#define MBEDTLS_CONFIG_VERSION 0x03000000 /** * \name SECTION: System support