Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4e6515e0
Commit
4e6515e0
authored
Aug 26, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Aug 27, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement CryptVerifyDetachedMessageHash.
parent
10975136
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
16 deletions
+48
-16
message.c
dlls/crypt32/message.c
+48
-4
message.c
dlls/crypt32/tests/message.c
+0
-12
No files found.
dlls/crypt32/message.c
View file @
4e6515e0
...
...
@@ -269,8 +269,52 @@ BOOL WINAPI CryptVerifyDetachedMessageHash(PCRYPT_HASH_MESSAGE_PARA pHashPara,
const
BYTE
*
rgpbToBeHashed
[],
DWORD
rgcbToBeHashed
[],
BYTE
*
pbComputedHash
,
DWORD
*
pcbComputedHash
)
{
FIXME
(
"(%p, %p, %d, %d, %p, %p, %p, %p): stub
\n
"
,
pHashPara
,
pbDetachedHashBlob
,
cbDetachedHashBlob
,
cToBeHashed
,
rgpbToBeHashed
,
rgcbToBeHashed
,
pbComputedHash
,
pcbComputedHash
);
return
FALSE
;
HCRYPTMSG
msg
;
BOOL
ret
=
FALSE
;
TRACE
(
"(%p, %p, %d, %d, %p, %p, %p, %p)
\n
"
,
pHashPara
,
pbDetachedHashBlob
,
cbDetachedHashBlob
,
cToBeHashed
,
rgpbToBeHashed
,
rgcbToBeHashed
,
pbComputedHash
,
pcbComputedHash
);
if
(
pHashPara
->
cbSize
!=
sizeof
(
CRYPT_HASH_MESSAGE_PARA
))
{
SetLastError
(
E_INVALIDARG
);
return
FALSE
;
}
if
(
GET_CMSG_ENCODING_TYPE
(
pHashPara
->
dwMsgEncodingType
)
!=
PKCS_7_ASN_ENCODING
)
{
SetLastError
(
E_INVALIDARG
);
return
FALSE
;
}
msg
=
CryptMsgOpenToDecode
(
pHashPara
->
dwMsgEncodingType
,
CMSG_DETACHED_FLAG
,
0
,
pHashPara
->
hCryptProv
,
NULL
,
NULL
);
if
(
msg
)
{
DWORD
i
;
ret
=
CryptMsgUpdate
(
msg
,
pbDetachedHashBlob
,
cbDetachedHashBlob
,
TRUE
);
if
(
ret
)
{
if
(
cToBeHashed
)
{
for
(
i
=
0
;
ret
&&
i
<
cToBeHashed
;
i
++
)
{
ret
=
CryptMsgUpdate
(
msg
,
rgpbToBeHashed
[
i
],
rgcbToBeHashed
[
i
],
i
==
cToBeHashed
-
1
?
TRUE
:
FALSE
);
}
}
else
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
}
if
(
ret
)
{
ret
=
CryptMsgControl
(
msg
,
0
,
CMSG_CTRL_VERIFY_HASH
,
NULL
);
if
(
ret
&&
pcbComputedHash
)
ret
=
CryptMsgGetParam
(
msg
,
CMSG_COMPUTED_HASH_PARAM
,
0
,
pbComputedHash
,
pcbComputedHash
);
}
CryptMsgClose
(
msg
);
}
return
ret
;
}
dlls/crypt32/tests/message.c
View file @
4e6515e0
...
...
@@ -109,35 +109,30 @@ static void test_verify_detached_message_hash(void)
SetLastError
(
0xdeadbeef
);
ret
=
CryptVerifyDetachedMessageHash
(
&
para
,
NULL
,
0
,
0
,
NULL
,
NULL
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
para
.
cbSize
=
sizeof
(
para
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptVerifyDetachedMessageHash
(
&
para
,
NULL
,
0
,
0
,
NULL
,
NULL
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
para
.
dwMsgEncodingType
=
PKCS_7_ASN_ENCODING
;
SetLastError
(
0xdeadbeef
);
ret
=
CryptVerifyDetachedMessageHash
(
&
para
,
NULL
,
0
,
0
,
NULL
,
NULL
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_EOD
,
"expected CRYPT_E_ASN1_EOD, got %08x
\n
"
,
GetLastError
());
para
.
dwMsgEncodingType
=
X509_ASN_ENCODING
;
SetLastError
(
0xdeadbeef
);
ret
=
CryptVerifyDetachedMessageHash
(
&
para
,
NULL
,
0
,
0
,
NULL
,
NULL
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
para
.
dwMsgEncodingType
=
X509_ASN_ENCODING
|
PKCS_7_ASN_ENCODING
;
SetLastError
(
0xdeadbeef
);
ret
=
CryptVerifyDetachedMessageHash
(
&
para
,
NULL
,
0
,
0
,
NULL
,
NULL
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_EOD
,
"expected CRYPT_E_ASN1_EOD, got %08x
\n
"
,
GetLastError
());
/* Curiously, passing no data to hash succeeds.. */
...
...
@@ -150,7 +145,6 @@ static void test_verify_detached_message_hash(void)
pMsgData
=
msgData
;
ret
=
CryptVerifyDetachedMessageHash
(
&
para
,
detachedHashContent
,
sizeof
(
detachedHashContent
),
1
,
&
pMsgData
,
&
size
,
NULL
,
NULL
);
todo_wine
ok
(
ret
,
"CryptVerifyDetachedMessageHash failed: %08x
\n
"
,
GetLastError
());
/* while passing data to hash that isn't the content of the message fails.
*/
...
...
@@ -159,7 +153,6 @@ static void test_verify_detached_message_hash(void)
SetLastError
(
0xdeadbeef
);
ret
=
CryptVerifyDetachedMessageHash
(
&
para
,
detachedHashContent
,
sizeof
(
detachedHashContent
),
1
,
&
pMsgData
,
&
size
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_HASH_VALUE
,
"expected CRYPT_E_HASH_VALUE, got %08x
\n
"
,
GetLastError
());
/* Getting the size of the hash while passing no hash data causes the
...
...
@@ -168,28 +161,23 @@ static void test_verify_detached_message_hash(void)
SetLastError
(
0xdeadbeef
);
ret
=
CryptVerifyDetachedMessageHash
(
&
para
,
detachedHashContent
,
sizeof
(
detachedHashContent
),
0
,
NULL
,
NULL
,
NULL
,
&
hashSize
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_HASH_VALUE
,
"expected CRYPT_E_HASH_VALUE, got %08x
\n
"
,
GetLastError
());
size
=
sizeof
(
msgData
);
pMsgData
=
msgData
;
ret
=
CryptVerifyDetachedMessageHash
(
&
para
,
detachedHashContent
,
sizeof
(
detachedHashContent
),
1
,
&
pMsgData
,
&
size
,
NULL
,
&
hashSize
);
todo_wine
{
ok
(
ret
,
"CryptVerifyDetachedMessageHash failed: %08x
\n
"
,
GetLastError
());
ok
(
hashSize
==
sizeof
(
hash
),
"unexpected size %d
\n
"
,
hashSize
);
}
hashSize
=
1
;
SetLastError
(
0xdeadbeef
);
ret
=
CryptVerifyDetachedMessageHash
(
&
para
,
detachedHashContent
,
sizeof
(
detachedHashContent
),
1
,
&
pMsgData
,
&
size
,
hash
,
&
hashSize
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_MORE_DATA
,
"expected ERROR_MORE_DATA, got %08x
\n
"
,
GetLastError
());
hashSize
=
sizeof
(
hash
);
ret
=
CryptVerifyDetachedMessageHash
(
&
para
,
detachedHashContent
,
sizeof
(
detachedHashContent
),
1
,
&
pMsgData
,
&
size
,
hash
,
&
hashSize
);
todo_wine
ok
(
ret
,
"CryptVerifyDetachedMessageHash failed: %08x
\n
"
,
GetLastError
());
}
...
...
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