Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3e88838b
Commit
3e88838b
authored
Aug 20, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Aug 21, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement verifying the hash of a decoded hash message.
parent
e7ce5ae2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
msg.c
dlls/crypt32/msg.c
+33
-1
msg.c
dlls/crypt32/tests/msg.c
+1
-1
No files found.
dlls/crypt32/msg.c
View file @
3e88838b
...
@@ -1926,6 +1926,38 @@ static BOOL CDecodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
...
@@ -1926,6 +1926,38 @@ static BOOL CDecodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
return
ret
;
return
ret
;
}
}
static
BOOL
CDecodeHashMsg_VerifyHash
(
CDecodeMsg
*
msg
)
{
BOOL
ret
;
CRYPT_DATA_BLOB
hashBlob
;
ret
=
ContextPropertyList_FindProperty
(
msg
->
properties
,
CMSG_HASH_DATA_PARAM
,
&
hashBlob
);
if
(
ret
)
{
DWORD
computedHashSize
=
0
;
ret
=
CDecodeHashMsg_GetParam
(
msg
,
CMSG_COMPUTED_HASH_PARAM
,
0
,
NULL
,
&
computedHashSize
);
if
(
hashBlob
.
cbData
==
computedHashSize
)
{
LPBYTE
computedHash
=
CryptMemAlloc
(
computedHashSize
);
if
(
computedHash
)
{
ret
=
CDecodeHashMsg_GetParam
(
msg
,
CMSG_COMPUTED_HASH_PARAM
,
0
,
computedHash
,
&
computedHashSize
);
if
(
ret
)
ret
=
!
memcmp
(
hashBlob
.
pbData
,
computedHash
,
hashBlob
.
cbData
);
}
else
ret
=
FALSE
;
}
}
return
ret
;
}
static
BOOL
CDecodeMsg_Control
(
HCRYPTMSG
hCryptMsg
,
DWORD
dwFlags
,
static
BOOL
CDecodeMsg_Control
(
HCRYPTMSG
hCryptMsg
,
DWORD
dwFlags
,
DWORD
dwCtrlType
,
const
void
*
pvCtrlPara
)
DWORD
dwCtrlType
,
const
void
*
pvCtrlPara
)
{
{
...
@@ -1955,7 +1987,7 @@ static BOOL CDecodeMsg_Control(HCRYPTMSG hCryptMsg, DWORD dwFlags,
...
@@ -1955,7 +1987,7 @@ static BOOL CDecodeMsg_Control(HCRYPTMSG hCryptMsg, DWORD dwFlags,
switch
(
msg
->
type
)
switch
(
msg
->
type
)
{
{
case
CMSG_HASHED
:
case
CMSG_HASHED
:
FIXME
(
"CMSG_CTRL_VERIFY_HASH: stub
\n
"
);
ret
=
CDecodeHashMsg_VerifyHash
(
msg
);
break
;
break
;
default:
default:
SetLastError
(
CRYPT_E_INVALID_MSG_TYPE
);
SetLastError
(
CRYPT_E_INVALID_MSG_TYPE
);
...
...
dlls/crypt32/tests/msg.c
View file @
3e88838b
...
@@ -2246,13 +2246,13 @@ static void test_msg_control(void)
...
@@ -2246,13 +2246,13 @@ static void test_msg_control(void)
TRUE
);
TRUE
);
/* Oddly enough, this fails */
/* Oddly enough, this fails */
ret
=
CryptMsgControl
(
msg
,
0
,
CMSG_CTRL_VERIFY_HASH
,
NULL
);
ret
=
CryptMsgControl
(
msg
,
0
,
CMSG_CTRL_VERIFY_HASH
,
NULL
);
todo_wine
ok
(
!
ret
,
"Expected failure
\n
"
);
ok
(
!
ret
,
"Expected failure
\n
"
);
CryptMsgClose
(
msg
);
CryptMsgClose
(
msg
);
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
0
,
NULL
,
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
0
,
NULL
,
NULL
);
NULL
);
CryptMsgUpdate
(
msg
,
hashBareContent
,
sizeof
(
hashBareContent
),
TRUE
);
CryptMsgUpdate
(
msg
,
hashBareContent
,
sizeof
(
hashBareContent
),
TRUE
);
ret
=
CryptMsgControl
(
msg
,
0
,
CMSG_CTRL_VERIFY_HASH
,
NULL
);
ret
=
CryptMsgControl
(
msg
,
0
,
CMSG_CTRL_VERIFY_HASH
,
NULL
);
todo_wine
ok
(
ret
,
"CryptMsgControl failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptMsgControl failed: %08x
\n
"
,
GetLastError
());
/* Can't decrypt an indeterminate-type message */
/* Can't decrypt an indeterminate-type message */
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment