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
c097a7a6
Commit
c097a7a6
authored
Sep 08, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Sep 09, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add tests for CryptVerifyMessageHash.
parent
3cef67d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
message.c
dlls/crypt32/tests/message.c
+68
-0
No files found.
dlls/crypt32/tests/message.c
View file @
c097a7a6
...
...
@@ -190,6 +190,73 @@ static void test_verify_detached_message_hash(void)
ok
(
ret
,
"CryptVerifyDetachedMessageHash failed: %08x
\n
"
,
GetLastError
());
}
static
BYTE
hashContent
[]
=
{
0x30
,
0x47
,
0x06
,
0x09
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x01
,
0x07
,
0x05
,
0xa0
,
0x3a
,
0x30
,
0x38
,
0x02
,
0x01
,
0x00
,
0x30
,
0x0c
,
0x06
,
0x08
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x02
,
0x05
,
0x05
,
0x00
,
0x30
,
0x13
,
0x06
,
0x09
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x01
,
0x07
,
0x01
,
0xa0
,
0x06
,
0x04
,
0x04
,
0x01
,
0x02
,
0x03
,
0x04
,
0x04
,
0x10
,
0x08
,
0xd6
,
0xc0
,
0x5a
,
0x21
,
0x51
,
0x2a
,
0x79
,
0xa1
,
0xdf
,
0xeb
,
0x9d
,
0x2a
,
0x8f
,
0x26
,
0x2f
};
static
void
test_verify_message_hash
(
void
)
{
BOOL
ret
;
CRYPT_HASH_MESSAGE_PARA
para
;
DWORD
size
;
BYTE
*
buf
=
NULL
;
memset
(
&
para
,
0
,
sizeof
(
para
));
/* Crash */
if
(
0
)
ret
=
CryptVerifyMessageHash
(
NULL
,
NULL
,
0
,
NULL
,
NULL
,
NULL
,
NULL
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptVerifyMessageHash
(
&
para
,
NULL
,
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
=
CryptVerifyMessageHash
(
&
para
,
NULL
,
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
=
CryptVerifyMessageHash
(
&
para
,
NULL
,
0
,
NULL
,
NULL
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_EOD
,
"expected CRYPT_E_ASN1_EOD, got %08x
\n
"
,
GetLastError
());
/* Verifying the hash of a detached message succeeds? */
ret
=
CryptVerifyMessageHash
(
&
para
,
detachedHashContent
,
sizeof
(
detachedHashContent
),
NULL
,
NULL
,
NULL
,
NULL
);
todo_wine
ok
(
ret
,
"CryptVerifyMessageHash failed: %08x
\n
"
,
GetLastError
());
/* As does verifying the hash of a regular message. */
ret
=
CryptVerifyMessageHash
(
&
para
,
hashContent
,
sizeof
(
hashContent
),
NULL
,
NULL
,
NULL
,
NULL
);
todo_wine
ok
(
ret
,
"CryptVerifyMessageHash failed: %08x
\n
"
,
GetLastError
());
ret
=
CryptVerifyMessageHash
(
&
para
,
hashContent
,
sizeof
(
hashContent
),
NULL
,
&
size
,
NULL
,
NULL
);
todo_wine
ok
(
ret
,
"CryptVerifyMessageHash failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
buf
=
CryptMemAlloc
(
size
);
if
(
buf
)
{
size
=
1
;
ret
=
CryptVerifyMessageHash
(
&
para
,
hashContent
,
sizeof
(
hashContent
),
buf
,
&
size
,
NULL
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_MORE_DATA
,
"expected ERROR_MORE_DATA, got %08x
\n
"
,
GetLastError
());
ret
=
CryptVerifyMessageHash
(
&
para
,
hashContent
,
sizeof
(
hashContent
),
buf
,
&
size
,
NULL
,
NULL
);
ok
(
ret
,
"CryptVerifyMessageHash failed: %08x
\n
"
,
GetLastError
());
ok
(
size
==
sizeof
(
msgData
),
"unexpected size %d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
msgData
,
size
),
"unexpected value
\n
"
);
CryptMemFree
(
buf
);
}
}
static
const
BYTE
signedContent
[]
=
{
0x30
,
0x81
,
0xb2
,
0x06
,
0x09
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x01
,
0x07
,
0x02
,
0xa0
,
0x81
,
0xa4
,
0x30
,
0x81
,
0xa1
,
0x02
,
0x01
,
0x01
,
0x31
,
0x0e
,
0x30
,
0x0c
,
0x06
,
0x08
,
0x2a
,
...
...
@@ -522,6 +589,7 @@ START_TEST(message)
{
test_msg_get_signer_count
();
test_verify_detached_message_hash
();
test_verify_message_hash
();
test_verify_message_signature
();
test_hash_message
();
}
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