From bc3fa39f0e47641fb7ea3ca55415ee47d9222815 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Thu, 7 Sep 2017 16:58:41 +0300 Subject: [PATCH 1/2] Backport 1.3:Add configuration file in md.h include *`config.h`* in md.h as MACROS in the header file get ignored.Backport to Backport of #1055 to mbedtls-1.3 --- ChangeLog | 6 ++++++ include/polarssl/md.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index a3171d7eb..cd7fc4187 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ mbed TLS ChangeLog (Sorted per branch, date) += mbed TLS x.x.xx branch released xxxx-xx-xx + +Bugfix + * Include configuration file in md.h, to fix compilation warnings. + Reported by aaronmdjones in #1001 + = mbed TLS 1.3.21 branch released 2017-08-10 Security diff --git a/include/polarssl/md.h b/include/polarssl/md.h index fc7482a4b..e3958702f 100644 --- a/include/polarssl/md.h +++ b/include/polarssl/md.h @@ -33,6 +33,12 @@ #define inline __inline #endif +#if !defined(POLARSSL_CONFIG_FILE) +#include "config.h" +#else +#include POLARSSL_CONFIG_FILE +#endif + #define POLARSSL_ERR_MD_FEATURE_UNAVAILABLE -0x5080 /**< The selected feature is not available. */ #define POLARSSL_ERR_MD_BAD_INPUT_DATA -0x5100 /**< Bad input parameters to function. */ #define POLARSSL_ERR_MD_ALLOC_FAILED -0x5180 /**< Failed to allocate memory. */ From 3216c1a82a30eb752faa294d6ca572c426c1012b Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Thu, 7 Sep 2017 17:15:47 +0300 Subject: [PATCH 2/2] Fix after Andres comments Move the include of the configuration file to the begninnig --- include/polarssl/md.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/polarssl/md.h b/include/polarssl/md.h index e3958702f..9be55a989 100644 --- a/include/polarssl/md.h +++ b/include/polarssl/md.h @@ -27,18 +27,17 @@ #define POLARSSL_MD_H #include - -#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \ - !defined(inline) && !defined(__cplusplus) -#define inline __inline -#endif - #if !defined(POLARSSL_CONFIG_FILE) #include "config.h" #else #include POLARSSL_CONFIG_FILE #endif +#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \ + !defined(inline) && !defined(__cplusplus) +#define inline __inline +#endif + #define POLARSSL_ERR_MD_FEATURE_UNAVAILABLE -0x5080 /**< The selected feature is not available. */ #define POLARSSL_ERR_MD_BAD_INPUT_DATA -0x5100 /**< Bad input parameters to function. */ #define POLARSSL_ERR_MD_ALLOC_FAILED -0x5180 /**< Failed to allocate memory. */