From 954553f5b18cb5a69cd73ffa5c272ad0ad4c05ce Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 16 Jun 2023 13:41:48 +0200 Subject: [PATCH] Don't call wincrypt on builds older than Windows XP On runtime it will attempt to get CryptAcquireContext() from advapi32.dll but it's not there and the DLL/program containing mbedtls will not load. Signed-off-by: Steve Lhomme --- library/entropy_poll.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/entropy_poll.c b/library/entropy_poll.c index b5024c83fa..8b60ee5364 100644 --- a/library/entropy_poll.c +++ b/library/entropy_poll.c @@ -52,6 +52,7 @@ #define _WIN32_WINNT 0x0400 #endif #include +#if _WIN32_WINNT >= 0x0501 /* _WIN32_WINNT_WINXP */ #include int mbedtls_platform_entropy_poll(void *data, unsigned char *output, size_t len, @@ -76,6 +77,9 @@ int mbedtls_platform_entropy_poll(void *data, unsigned char *output, size_t len, return 0; } +#else /* !_WIN32_WINNT_WINXP */ +#error Entropy not available before Windows XP, use MBEDTLS_NO_PLATFORM_ENTROPY +#endif /* !_WIN32_WINNT_WINXP */ #else /* _WIN32 && !EFIX64 && !EFI32 */ /*