Introduce versioning in the config files

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
This commit is contained in:
Bence Szépkúti 2021-05-31 16:53:56 +02:00
parent dba968f59b
commit ba7248abc4
8 changed files with 26 additions and 1 deletions

View file

@ -30,6 +30,8 @@
* See README.txt for usage instructions. * See README.txt for usage instructions.
*/ */
#define MBEDTLS_CONFIG_VERSION 1
/* System support */ /* System support */
//#define MBEDTLS_HAVE_TIME /* Optionally used in Hello messages */ //#define MBEDTLS_HAVE_TIME /* Optionally used in Hello messages */
/* Other MBEDTLS_HAVE_XXX flags irrelevant for this configuration */ /* Other MBEDTLS_HAVE_XXX flags irrelevant for this configuration */

View file

@ -29,6 +29,8 @@
* See README.txt for usage instructions. * See README.txt for usage instructions.
*/ */
#define MBEDTLS_CONFIG_VERSION 1
/* System support */ /* System support */
#define MBEDTLS_HAVE_ASM #define MBEDTLS_HAVE_ASM
#define MBEDTLS_HAVE_TIME #define MBEDTLS_HAVE_TIME

View file

@ -33,6 +33,8 @@
* See README.txt for usage instructions. * See README.txt for usage instructions.
*/ */
#define MBEDTLS_CONFIG_VERSION 1
/* System support */ /* System support */
#define MBEDTLS_HAVE_ASM #define MBEDTLS_HAVE_ASM
#define MBEDTLS_HAVE_TIME #define MBEDTLS_HAVE_TIME

View file

@ -20,6 +20,8 @@
* limitations under the License. * limitations under the License.
*/ */
#define MBEDTLS_CONFIG_VERSION 1
/* System support */ /* System support */
//#define MBEDTLS_HAVE_ASM //#define MBEDTLS_HAVE_ASM
#define MBEDTLS_HAVE_TIME #define MBEDTLS_HAVE_TIME

View file

@ -32,6 +32,8 @@
* See README.txt for usage instructions. * See README.txt for usage instructions.
*/ */
#define MBEDTLS_CONFIG_VERSION 1
/* System support */ /* System support */
#define MBEDTLS_HAVE_ASM #define MBEDTLS_HAVE_ASM

View file

@ -36,13 +36,26 @@
#include MBEDTLS_CONFIG_FILE #include MBEDTLS_CONFIG_FILE
#endif #endif
#if !defined(MBEDTLS_CONFIG_VERSION) || \
MBEDTLS_CONFIG_VERSION != 1
#error "Invalid config version, MBEDTLS_CONFIG_VERSION != 1"
#endif
/* Target and application specific configurations /* Target and application specific configurations
* *
* Allow user to override any previous default. * Allow user to override any previous default.
* *
*/ */
#if defined(MBEDTLS_USER_CONFIG_VERSION)
#error "MBEDTLS_USER_CONFIG_VERSION defined outside MBEDTLS_USER_CONFIG_FILE"
#endif
#if defined(MBEDTLS_USER_CONFIG_FILE) #if defined(MBEDTLS_USER_CONFIG_FILE)
#include MBEDTLS_USER_CONFIG_FILE #include MBEDTLS_USER_CONFIG_FILE
#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
#endif #endif
#if defined(MBEDTLS_PSA_CRYPTO_CONFIG) #if defined(MBEDTLS_PSA_CRYPTO_CONFIG)

View file

@ -24,6 +24,8 @@
* limitations under the License. * limitations under the License.
*/ */
#define MBEDTLS_CONFIG_VERSION 1
/** /**
* \name SECTION: System support * \name SECTION: System support
* *

View file

@ -102,7 +102,7 @@ cat $HEADERS $LIBRARY \
| sed -n 's/MBED..._[A-Z0-9_]*/\'"$NL"'&\'"$NL"/gp \ | sed -n 's/MBED..._[A-Z0-9_]*/\'"$NL"'&\'"$NL"/gp \
| grep MBEDTLS | sort -u > _MBEDTLS_XXX | grep MBEDTLS | sort -u > _MBEDTLS_XXX
TYPOS=$( diff _caps _MBEDTLS_XXX | sed -n 's/^> //p' \ TYPOS=$( diff _caps _MBEDTLS_XXX | sed -n 's/^> //p' \
| egrep -v 'XXX|__|_$|^MBEDTLS_.*CONFIG_FILE$' || true ) | egrep -v 'XXX|__|_$|^MBEDTLS_.*CONFIG_FILE$|^MBEDTLS_USER_CONFIG_VERSION$' || true )
rm _MBEDTLS_XXX _caps rm _MBEDTLS_XXX _caps
if [ "x$TYPOS" = "x" ]; then if [ "x$TYPOS" = "x" ]; then
echo "PASS" echo "PASS"