mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-03-20 19:21:09 +01:00
Temporarily force standard *printf functions on MingW
On MingW, temporarily force the use of the standard versions of `snprintf()` and `vsnprintf()` (since we set `__USE_MINGW_ANSI_STDIO` in `mbedtls_platform_requirements.h`). Do not honor `platform.h` configuration, because with the current TF-PSA-Crypto, `MBEDTLS_PLATFORM_VSNPRINTF_ALT and `MBEDTLS_PLATFORM_SNPRINTF_ALT` are always enabled on MinGW, so what matters is the setting of `__USE_MINGW_ANSI_STDIO` when `platform.c` is built, and until https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/694, the legacy printf functions are used there. Revert this commit once the `tf-psa-crypto` module is updated with the merge of https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/694. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -21,6 +21,20 @@
|
||||
/* DEBUG_BUF_SIZE must be at least 2 */
|
||||
#define DEBUG_BUF_SIZE 512
|
||||
|
||||
/* Temporary hack: on MingW, do not honor the platform.h configuration
|
||||
* for snprintf and vsnprintf. Instead, force the native functions,
|
||||
* which are the standard ones, not the Windows legacy ones.
|
||||
*
|
||||
* This hack should be removed once TF-PSA-Crypto has been updated to
|
||||
* use the standard printf family.
|
||||
*/
|
||||
#if defined(__MINGW32__)
|
||||
#undef mbedtls_snprintf
|
||||
#define mbedtls_snprintf snprintf
|
||||
#undef mbedtls_vsnprintf
|
||||
#define mbedtls_vsnprintf vsnprintf
|
||||
#endif
|
||||
|
||||
int mbedtls_debug_snprintf(char *dest, size_t maxlen,
|
||||
const char *format, ...)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user