Ticket #38391

CALG_TLS1PRF in wincrypt.h unusable

Eröffnet am: 2018-07-10 16:32 Letztes Update: 2018-07-12 20:17

Auswertung:
Verantwortlicher:
Typ:
Status:
Geschlossen
Komponente:
Meilenstein:
(Keine)
Priorität:
5 - Mittel
Schweregrad:
5 - Mittel
Lösung:
Gefixt
Datei:
3
Vote
Score: 1
100.0% (1/1)
0.0% (0/1)

Details

I'm using w32api 5.0.2, but the issue is also in the trunk and experimental branches.

CALG_TLS1PRF is defined as (ALG_CLASS_DHASH | ALG_TYPE_ANY | ALG_SID_TLS1PRF) in https://osdn.net/projects/mingw/scm/git/mingw-org-wsl/blobs/5.1-trunk/w32api/include/wincrypt.h. This doesn't compile as ALG_CLASS_DHASH is not defined. The Microsoft Windows SDK uses ALG_CLASS_HASH instead.

#include <windows.h>
#include <wincrypt.h>

int i = CALG_TLS1PRF;

results in

$ gcc test_wincrypt.c
In file included from test_wincrypt.c:2:0:
test_wincrypt.c:4:9: error: 'ALG_CLASS_DHASH' undeclared here (not in a function)
 int i = CALG_TLS1PRF;
         ^

Ticket-Verlauf (3/9 Historien)

2018-07-10 16:32 Aktualisiert von: marcelraad
  • New Ticket "CALG_TLS1PRF in wincrypt.h unusable" created
2018-07-11 03:12 Aktualisiert von: marcelraad
  • Details Updated
2018-07-11 05:55 Aktualisiert von: earnie
  • Verantwortlicher Update from (Keine) to keith
Kommentar

Reply To marcelraad

I'm using w32api 5.0.2, but the issue is also in the trunk and experimental branches. CALG_TLS1PRF is defined as (ALG_CLASS_DHASH | ALG_TYPE_ANY | ALG_SID_TLS1PRF) in https://osdn.net/projects/mingw/scm/git/mingw-org-wsl/blobs/5.1-trunk/w32api/include/wincrypt.h. This doesn't compile as ALG_CLASS_DHASH is not defined. The Microsoft Windows SDK uses ALG_CLASS_HASH instead.

#include <windows.h>
#include <wincrypt.h>

int i = CALG_TLS1PRF;
results in
$ gcc test_wincrypt.c
In file included from test_wincrypt.c:2:0:
test_wincrypt.c:4:9: error: 'ALG_CLASS_DHASH' undeclared here (not in a function)
 int i = CALG_TLS1PRF;
         ^

The ALG_CLASS_DHASH appears to be a typo and ALG_CLASS_HASH should have been used. I've assigned to Keith but he may want to reassign elsewhere.

(Edited, 2018-07-12 00:31 Aktualisiert von: keith)
2018-07-12 00:15 Aktualisiert von: keith
Kommentar

I agree with Earnie -- this looks like a typo; what's more, it's been this way since Danny Smith committed the update, (per attached w32api-r247.diff), which added the CALG_TLS1PRF manifest constant definition, in August 2002.

FWIW, Danny's ChangeLog entry is a classical example of how not to write ChangeLogs -- a malaise which afflicted both CygWin and MinGW at that time, and may well still afflict CygWin today. Had Danny written the ChangeLog properly -- enumerating, in full, all of the definitions he added -- he might well have noticed the typo, at the time, (and I could simply have searched the ChangLog, rather than resorting to hg archaeology on an old, converted CVS repository, to locate the offending commit). But, that's water under the bridge -- I'll fix it.

2018-07-12 20:02 Aktualisiert von: keith
  • Status Update from Offen to Geschlossen
  • Lösung Update from Keine to Gefixt
Kommentar

My own (local) patch queue has a further issue to resolve, in <wincrypt.h> — two extraneous typedef keywords preceding struct definitions, with no directly associated type name, in either case. I've folded the removal of these extraneous typedefs into the patch to correct the bogus reference to ALG_CLASS_DHASH.

I also have a trivial patch to make <wincrypt.h> effectively self-contained. (Microsoft may not care about such niceties, but it is better software engineering, and thus right and proper, that we do so).

I've gone ahead, and committed both of the attached patches, as commit #73aedcc, and commit #7b0f1f2, respectively.

(Edited, 2018-07-12 20:03 Aktualisiert von: keith)
2018-07-12 20:17 Aktualisiert von: marcelraad
Kommentar

Great, thanks for the fast fix!

Dateianhangliste

Bearbeiten

Please login to add comment to this ticket » Anmelden