0.2.0-dev Download ZIP
55 lines ·1.7 KB Raw
| 1 | /** |
| 2 | * \file mbedtls_platform_requirements.h |
| 3 | * |
| 4 | * \brief Declare macros that tell system headers what we expect of them. |
| 5 | * |
| 6 | * This file must be included before any system header, and so in particular |
| 7 | * before build_info.h (which includes the user config, which may include |
| 8 | * system headers). |
| 9 | */ |
| 10 | /* |
| 11 | * Copyright The Mbed TLS Contributors |
| 12 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
| 13 | */ |
| 14 | |
| 15 | #ifndef MBEDTLS_MBEDTLS_PLATFORM_REQUIREMENTS_H |
| 16 | #define MBEDTLS_MBEDTLS_PLATFORM_REQUIREMENTS_H |
| 17 | |
| 18 | #if !defined(_POSIX_C_SOURCE) |
| 19 | /* For standards-compliant access to |
| 20 | * getaddrinfo(), |
| 21 | * ... */ |
| 22 | #define _POSIX_C_SOURCE 200112L |
| 23 | #endif |
| 24 | |
| 25 | #if !defined(_XOPEN_SOURCE) |
| 26 | /* For standards-compliant access to |
| 27 | * sockaddr_storage, |
| 28 | * ... */ |
| 29 | #define _XOPEN_SOURCE 600 |
| 30 | #endif |
| 31 | |
| 32 | /* On Mingw-w64, force the use of a C99-compliant printf() and friends. |
| 33 | * This is necessary on older versions of Mingw and/or Windows runtimes |
| 34 | * where snprintf does not always zero-terminate the buffer, and does |
| 35 | * not support formats such as "%zu" for size_t and "%lld" for long long. |
| 36 | * |
| 37 | * Defining __USE_MINGW_ANSI_STDIO=0 may work and provide a small code size |
| 38 | * and performance benefit for some combinations of older Mingw and Windows |
| 39 | * versions. Do this at your own risk and make sure that least |
| 40 | * test_suite_debug passes. |
| 41 | */ |
| 42 | #if !defined(__USE_MINGW_ANSI_STDIO) |
| 43 | #define __USE_MINGW_ANSI_STDIO 1 |
| 44 | #endif |
| 45 | |
| 46 | /* Tell MSVC that we're ok with using classic C functions even |
| 47 | * when an `_s` variant exist. For most functions, the improvements |
| 48 | * of the `_s` variants are of limited usefulness and not worth |
| 49 | * the portability headaches. |
| 50 | */ |
| 51 | #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) |
| 52 | #define _CRT_SECURE_NO_DEPRECATE 1 |
| 53 | #endif |
| 54 | |
| 55 | #endif /* MBEDTLS_MBEDTLS_PLATFORM_REQUIREMENTS_H */ |