Make config version symbols optional

Also remove them from the example configs, but keep the one in
mbedtls_config.h.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
diff --git a/configs/config-ccm-psk-tls1_2.h b/configs/config-ccm-psk-tls1_2.h
index cd74d86..51bb962 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 acfad38..edba4a0 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 264826d..c70773d 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 6b22cba..6aff42f 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 d8ee1c8..be889a1 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 2f34365..6ccbc00 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