mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-02 10:53:16 +03:00
libssh2 uses `wincrypt.h` aka the `crypt32` Windows system library for the function `CryptDecodeObjectEx()` [1]. This function has been available for Win32 (and UWP/WinRT apps) for a long while. Even old MinGW supports it, and also Watcom 1.9, of the rare/old compilers I checked. CMake had it permanently enabled, while it also did an extra check for the header to add the lib to the lib list. Autotools did the detection proper. Other builds had it permanently enabled. It seems safe to assume this function/header/lib is available in all environments we support. In this patch we simplify by deleting these detections and feature flags from all build tools. Keep the feature flag internal to `wincng.h`, and for extra safety add the new macro `LIBSSH2_WINCNG_DISABLE_WINCRYPT` do disable it via custom `CPPFLAGS`. WinCNG's other requirement is `bcrypt`. That also has been universally available for a long time. Here the only known outlier is old/legacy MinGW, which is missing support. [1] https://learn.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptdecodeobjectex Closes #916
40 lines
704 B
C
40 lines
704 B
C
#ifndef LIBSSH2_CONFIG_H
|
|
#define LIBSSH2_CONFIG_H
|
|
|
|
#ifndef WIN32
|
|
#define WIN32
|
|
#endif
|
|
|
|
#ifndef _CRT_SECURE_NO_DEPRECATE
|
|
#define _CRT_SECURE_NO_DEPRECATE 1
|
|
#endif
|
|
|
|
#define HAVE_IOCTLSOCKET
|
|
#define HAVE_SELECT
|
|
#define HAVE_SNPRINTF
|
|
|
|
#ifdef __MINGW32__
|
|
# define HAVE_UNISTD_H
|
|
# define HAVE_INTTYPES_H
|
|
# define HAVE_SYS_TIME_H
|
|
# define HAVE_GETTIMEOFDAY
|
|
# define HAVE_LONGLONG
|
|
# define HAVE_STRTOLL
|
|
#elif defined(_MSC_VER)
|
|
# if _MSC_VER >= 1310
|
|
# define HAVE_LONGLONG
|
|
# endif
|
|
# if _MSC_VER >= 1800
|
|
# define HAVE_STRTOLL
|
|
# endif
|
|
# if _MSC_VER < 1900
|
|
# undef HAVE_SNPRINTF
|
|
# if _MSC_VER < 1500
|
|
# define vsnprintf _vsnprintf
|
|
# endif
|
|
# define strdup _strdup
|
|
# endif
|
|
#endif
|
|
|
|
#endif /* LIBSSH2_CONFIG_H */
|