diff --git a/include/mbedtls/check_config.h b/include/mbedtls/check_config.h index 24450319d..87054c707 100644 --- a/include/mbedtls/check_config.h +++ b/include/mbedtls/check_config.h @@ -39,10 +39,19 @@ #error "mbed TLS requires a platform with 8-bit chars" #endif -#if defined(_WIN32) && !defined(MBEDTLS_PLATFORM_C) +#if defined(_WIN32) +#if !defined(MBEDTLS_PLATFORM_C) #error "MBEDTLS_PLATFORM_C is required on Windows" #endif +/* Fix the config here. Not convenient to put an #ifdef _WIN32 in config.h as + * it would confuse config.pl. */ +#if !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && \ + !defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) +#define MBEDTLS_PLATFORM_SNPRINTF_ALT +#endif +#endif /* _WIN32 */ + #if defined(MBEDTLS_DEPRECATED_WARNING) && \ !defined(__GNUC__) && !defined(__clang__) #error "MBEDTLS_DEPRECATED_WARNING only works with GCC and Clang" @@ -286,11 +295,6 @@ #error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites" #endif -#if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && ( defined(_WIN32)\ - && !defined(EFIX64) && !defined(EFI32) ) -#error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined but not available on Windows" -#endif - #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C) #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites" #endif diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h index 685baf2e3..27c139b37 100644 --- a/include/mbedtls/config.h +++ b/include/mbedtls/config.h @@ -142,6 +142,9 @@ * * All these define require MBEDTLS_PLATFORM_C to be defined! * + * \note MBEDTLS_PLATFORM_SNPRINTF_ALT is required on Windows; + * it will be enabled automatically by check_config.h + * * \warning MBEDTLS_PLATFORM_XXX_ALT cannot be defined at the same time as * MBEDTLS_PLATFORM_XXX_MACRO! *