任务单 #38391

CALG_TLS1PRF in wincrypt.h unusable

开放日期: 2018-07-10 16:32 最后更新: 2018-07-12 20:17

报告人:
属主:
类型:
状态:
关闭
组件:
里程碑:
(无)
优先:
5 - Medium
严重性:
5 - Medium
处理结果:
Fixed
文件:
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;
         ^

任务单历史 (3/9 Histories)

2018-07-10 16:32 Updated by: marcelraad
  • New Ticket "CALG_TLS1PRF in wincrypt.h unusable" created
2018-07-11 03:12 Updated by: marcelraad
  • Details Updated
2018-07-11 05:55 Updated by: earnie
  • 属主 Update from (无) to keith
评论

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 Updated by: keith)
2018-07-12 00:15 Updated by: keith
评论

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 Updated by: keith
  • 状态 Update from 开启 to 关闭
  • 处理结果 Update from to Fixed
评论

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 Updated by: keith)
2018-07-12 20:17 Updated by: marcelraad
评论

Great, thanks for the fast fix!

Attachment File List

编辑

Please login to add comment to this ticket » 登录名