diff --git a/library/mbedtls_platform_requirements.h b/library/mbedtls_platform_requirements.h index c4f959191f..ad27fef450 100644 --- a/library/mbedtls_platform_requirements.h +++ b/library/mbedtls_platform_requirements.h @@ -43,4 +43,13 @@ #define __USE_MINGW_ANSI_STDIO 1 #endif +/* Tell MSVC that we're ok with using classic C functions even + * when an `_s` variant exist. For most functions, the improvements + * of the `_s` variants are of limited usefulness and not worth + * the portability headaches. + */ +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif + #endif /* MBEDTLS_MBEDTLS_PLATFORM_REQUIREMENTS_H */ diff --git a/programs/ssl/ssl_test_lib.h b/programs/ssl/ssl_test_lib.h index 491da1dd5f..a9384d16df 100644 --- a/programs/ssl/ssl_test_lib.h +++ b/programs/ssl/ssl_test_lib.h @@ -17,6 +17,15 @@ #define __USE_MINGW_ANSI_STDIO 1 #endif +/* Tell MSVC that we're ok with using classic C functions even + * when an `_s` variant exist. For most functions, the improvements + * of the `_s` variants are of limited usefulness and not worth + * the portability headaches. + */ +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif + #define MBEDTLS_ALLOW_PRIVATE_ACCESS #include "mbedtls/private/pk_private.h" diff --git a/programs/util/pem2der.c b/programs/util/pem2der.c index 177365b87c..191988082f 100644 --- a/programs/util/pem2der.c +++ b/programs/util/pem2der.c @@ -5,6 +5,15 @@ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ +/* Tell MSVC that we're ok with using classic C functions even + * when an `_s` variant exist. For most functions, the improvements + * of the `_s` variants are of limited usefulness and not worth + * the portability headaches. + */ +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif + #include "mbedtls/build_info.h" #include "mbedtls/platform.h" diff --git a/programs/x509/cert_req.c b/programs/x509/cert_req.c index 0d7b5a1e6e..d6e22aaf8c 100644 --- a/programs/x509/cert_req.c +++ b/programs/x509/cert_req.c @@ -5,6 +5,15 @@ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ +/* Tell MSVC that we're ok with using classic C functions even + * when an `_s` variant exist. For most functions, the improvements + * of the `_s` variants are of limited usefulness and not worth + * the portability headaches. + */ +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif + #define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS #include "mbedtls/build_info.h" diff --git a/programs/x509/cert_write.c b/programs/x509/cert_write.c index eb090fd051..8ff35f0c2f 100644 --- a/programs/x509/cert_write.c +++ b/programs/x509/cert_write.c @@ -5,6 +5,15 @@ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ +/* Tell MSVC that we're ok with using classic C functions even + * when an `_s` variant exist. For most functions, the improvements + * of the `_s` variants are of limited usefulness and not worth + * the portability headaches. + */ +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif + #define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS #include "mbedtls/build_info.h"