From e068aa7ad54d4ecf92a0809c0c64901e937a9c7d Mon Sep 17 00:00:00 2001 From: Simon Butcher Date: Wed, 14 Mar 2018 15:10:31 +0000 Subject: [PATCH] Fix the build for mingw and CMake + VStudio Changes to the build to add the new Win32 Crypto API's inadvertently broke the build for mingw and Visual Studio builds when generated by CMake. Signed-off-by: Simon Butcher --- library/CMakeLists.txt | 2 +- library/Makefile | 2 +- library/entropy_poll.c | 4 ++-- library/x509_crt.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 83204f35e..62150779c 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -213,7 +213,7 @@ if(CMAKE_COMPILER_IS_MSVC) endif() if(WIN32) - set(libs ${libs} ws2_32) + set(libs ${libs} ws2_32 bcrypt) endif(WIN32) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") diff --git a/library/Makefile b/library/Makefile index 69ccbfd2c..5d645f7b7 100644 --- a/library/Makefile +++ b/library/Makefile @@ -302,7 +302,7 @@ libmbedcrypto.dylib: $(OBJS_CRYPTO) libmbedcrypto.dll: $(OBJS_CRYPTO) echo " LD $@" - $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_CRYPTO) -lws2_32 -lwinmm -lgdi32 -static-libgcc $(LOCAL_LDFLAGS) $(LDFLAGS) + $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_CRYPTO) -lws2_32 -lbcrypt -lwinmm -lgdi32 -static-libgcc $(LOCAL_LDFLAGS) $(LDFLAGS) .c.o: echo " CC $<" diff --git a/library/entropy_poll.c b/library/entropy_poll.c index 0ccc34fdf..1e465af76 100644 --- a/library/entropy_poll.c +++ b/library/entropy_poll.c @@ -51,7 +51,7 @@ #include #if _WIN32_WINNT >= 0x0501 /* _WIN32_WINNT_WINXP */ #include -#if _MSC_VER <= 1600 +#if defined(_MSC_VER) && _MSC_VER <= 1600 /* Visual Studio 2010 and earlier issue a warning when both and are included, as they * redefine a number of _MAX constants. These constants are guaranteed to be the same, though, so * we suppress the warning when including intsafe.h. @@ -60,7 +60,7 @@ #pragma warning( disable : 4005 ) #endif #include -#if _MSC_VER <= 1600 +#if defined(_MSC_VER) && _MSC_VER <= 1600 #pragma warning( pop ) #endif diff --git a/library/x509_crt.c b/library/x509_crt.c index 136f60b4a..8fc8a5273 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -61,7 +61,7 @@ #if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) #define WIN32_LEAN_AND_MEAN #include -#if _MSC_VER <= 1600 +#if defined(_MSC_VER) && _MSC_VER <= 1600 /* Visual Studio 2010 and earlier issue a warning when both and are included, as they * redefine a number of _MAX constants. These constants are guaranteed to be the same, though, so * we suppress the warning when including intsafe.h. @@ -70,7 +70,7 @@ #pragma warning( disable : 4005 ) #endif #include -#if _MSC_VER <= 1600 +#if defined(_MSC_VER) && _MSC_VER <= 1600 #pragma warning( pop ) #endif #else