Skip to content

Commit

Permalink
config: only define USE_WIN32_CRYPTO internally
Browse files Browse the repository at this point in the history
Move the definition of USE_WIN32_CRYPTO from config-win32.h
to general curl_setup.h to make it work with configure builds.

Move the detection of the restricted Windows App environment
before the definition of USE_WIN32_CRYPTO and USE_NTLM for SMB.

Remove USE_WIN32_CRYPTO from CMake as it is defined internally.

Part of curl#6277
  • Loading branch information
mback2k committed Mar 1, 2021
1 parent cc9bf97 commit 8d152d0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
5 changes: 0 additions & 5 deletions lib/config-win32.h
Expand Up @@ -711,11 +711,6 @@ Vista
# define CURL_DISABLE_LDAP 1
#endif

/* Define to use the Windows crypto library. */
#if !defined(CURL_WINDOWS_APP)
#define USE_WIN32_CRYPTO
#endif

/* On MinGW the ADDRESS_FAMILY typedef was committed alongside LUP_SECURE,
so we use it to check for the presence of the typedef. */
#include <ws2tcpip.h>
Expand Down
3 changes: 0 additions & 3 deletions lib/curl_config.h.cmake
Expand Up @@ -97,9 +97,6 @@
#define CURL_EXTERN_SYMBOL
#endif

/* Allow SMB to work on Windows */
#cmakedefine USE_WIN32_CRYPTO

/* Use Windows LDAP implementation */
#cmakedefine USE_WIN32_LDAP 1

Expand Down
27 changes: 16 additions & 11 deletions lib/curl_setup.h
Expand Up @@ -632,6 +632,22 @@ int netware_init(void);
#define USE_KERBEROS5
#endif

/* Detect Windows App environment which has a restricted access
* to the Win32 APIs. */
# if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)) || \
defined(WINAPI_FAMILY)
# include <winapifamily.h>
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
# define CURL_WINDOWS_APP
# endif
# endif

/* Define to use the Windows crypto library. */
#if defined(WIN32) && !defined(CURL_WINDOWS_APP) && !defined(USE_WIN32_CRYPTO)
#define USE_WIN32_CRYPTO
#endif

/* Single point where USE_NTLM definition might be defined */
#if !defined(CURL_DISABLE_NTLM) && !defined(CURL_DISABLE_CRYPTO_AUTH)
#if defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
Expand Down Expand Up @@ -764,17 +780,6 @@ endings either CRLF or LF so 't' is appropriate.
# endif
#endif /* DONT_USE_RECV_BEFORE_SEND_WORKAROUND */

/* Detect Windows App environment which has a restricted access
* to the Win32 APIs. */
# if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)) || \
defined(WINAPI_FAMILY)
# include <winapifamily.h>
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
# define CURL_WINDOWS_APP
# endif
# endif

/* for systems that don't detect this in configure, use a sensible default */
#ifndef CURL_SA_FAMILY_T
#define CURL_SA_FAMILY_T unsigned short
Expand Down

0 comments on commit 8d152d0

Please sign in to comment.