Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schannel: Work around typo in macro from classic MinGW include #7580

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/vtls/schannel.c
Expand Up @@ -141,6 +141,12 @@
# define CALG_SHA_256 0x0000800c
#endif

/* Work around typo in classic MinGW's w32api up to version 5.0,
see https://osdn.net/projects/mingw/ticket/38391 */
#if !defined(ALG_CLASS_DHASH) && defined(ALG_CLASS_HASH)
#define ALG_CLASS_DHASH ALG_CLASS_HASH
#endif

#define BACKEND connssl->backend

static Curl_recv schannel_recv;
Expand Down Expand Up @@ -279,13 +285,7 @@ get_alg_id_by_name(char *name)
#ifdef CALG_HMAC
CIPHEROPTION(CALG_HMAC);
#endif
#if !defined(__W32API_MAJOR_VERSION) || \
!defined(__W32API_MINOR_VERSION) || \
defined(__MINGW64_VERSION_MAJOR) || \
(__W32API_MAJOR_VERSION > 5) || \
((__W32API_MAJOR_VERSION == 5) && (__W32API_MINOR_VERSION > 0))
/* CALG_TLS1PRF has a syntax error in MinGW's w32api up to version 5.0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. What was the build error? The preprocessor condition here was meant to avoid build errors. Or was the problem the lack of this CIPHEROPTION? Then this preprocessor condition should be deleted.

Copy link
Member Author

@jay jay Aug 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same build error as described in the bug. The current fix in schannel does not work here because __W32API_MAJOR_VERSION is undefined. It is defined in w32api.h but that is not included by any other mingw include. I could get it working with:

#ifdef __MINGW32__
#include <w32api.h>
#endif

However rather than do that to fix the version check the latest iteration of my patch removes it and compensates for the typo instead.

see https://osdn.net/projects/mingw/ticket/38391 */
#ifdef CALG_TLS1PRF
CIPHEROPTION(CALG_TLS1PRF);
#endif
#ifdef CALG_HASH_REPLACE_OWF
Expand Down