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
faa917b5
Commit
faa917b5
authored
Aug 20, 2010
by
Juan Lang
Committed by
Alexandre Julliard
Aug 23, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32/tests: Test pcbDecoded parameter to CryptVerifyMessageSignature more thoroughly.
parent
b85cb1b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
message.c
dlls/crypt32/tests/message.c
+63
-0
No files found.
dlls/crypt32/tests/message.c
View file @
faa917b5
...
...
@@ -453,6 +453,34 @@ static const BYTE signedWithCertWithPubKeyContent[] = {
0x13
,
0x30
,
0x11
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x0a
,
0x4a
,
0x75
,
0x61
,
0x6e
,
0x20
,
0x4c
,
0x61
,
0x6e
,
0x67
,
0x00
,
0x02
,
0x01
,
0x01
,
0x30
,
0x0c
,
0x06
,
0x08
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x02
,
0x05
,
0x05
,
0x00
,
0x30
,
0x04
,
0x06
,
0x00
,
0x05
,
0x00
,
0x04
,
0x00
};
static
const
BYTE
signedWithCertWithValidPubKeyContent
[]
=
{
0x30
,
0x82
,
0x01
,
0x89
,
0x06
,
0x09
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x01
,
0x07
,
0x02
,
0xa0
,
0x82
,
0x01
,
0x7a
,
0x30
,
0x82
,
0x01
,
0x76
,
0x02
,
0x01
,
0x01
,
0x31
,
0x0e
,
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
,
0xa0
,
0x81
,
0xd2
,
0x30
,
0x81
,
0xcf
,
0x02
,
0x01
,
0x01
,
0x30
,
0x02
,
0x06
,
0x00
,
0x30
,
0x15
,
0x31
,
0x13
,
0x30
,
0x11
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x0a
,
0x4a
,
0x75
,
0x61
,
0x6e
,
0x20
,
0x4c
,
0x61
,
0x6e
,
0x67
,
0x00
,
0x30
,
0x22
,
0x18
,
0x0f
,
0x31
,
0x36
,
0x30
,
0x31
,
0x30
,
0x31
,
0x30
,
0x31
,
0x30
,
0x30
,
0x30
,
0x30
,
0x30
,
0x30
,
0x5a
,
0x18
,
0x0f
,
0x31
,
0x36
,
0x30
,
0x31
,
0x30
,
0x31
,
0x30
,
0x31
,
0x30
,
0x30
,
0x30
,
0x30
,
0x30
,
0x30
,
0x5a
,
0x30
,
0x15
,
0x31
,
0x13
,
0x30
,
0x11
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x0a
,
0x4a
,
0x75
,
0x61
,
0x6e
,
0x20
,
0x4c
,
0x61
,
0x6e
,
0x67
,
0x00
,
0x30
,
0x5c
,
0x30
,
0x0d
,
0x06
,
0x09
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x05
,
0x00
,
0x03
,
0x4b
,
0x00
,
0x30
,
0x48
,
0x02
,
0x41
,
0x00
,
0xe2
,
0x54
,
0x3a
,
0xa7
,
0x83
,
0xb1
,
0x27
,
0x14
,
0x3e
,
0x59
,
0xbb
,
0xb4
,
0x53
,
0xe6
,
0x1f
,
0xe7
,
0x5d
,
0xf1
,
0x21
,
0x68
,
0xad
,
0x85
,
0x53
,
0xdb
,
0x6b
,
0x1e
,
0xeb
,
0x65
,
0x97
,
0x03
,
0x86
,
0x60
,
0xde
,
0xf3
,
0x6c
,
0x38
,
0x75
,
0xe0
,
0x4c
,
0x61
,
0xbb
,
0xbc
,
0x62
,
0x17
,
0xa9
,
0xcd
,
0x79
,
0x3f
,
0x21
,
0x4e
,
0x96
,
0xcb
,
0x0e
,
0xdc
,
0x61
,
0x94
,
0x30
,
0x18
,
0x10
,
0x6b
,
0xd0
,
0x1c
,
0x10
,
0x79
,
0x02
,
0x03
,
0x01
,
0x00
,
0x01
,
0xa3
,
0x16
,
0x30
,
0x14
,
0x30
,
0x12
,
0x06
,
0x03
,
0x55
,
0x1d
,
0x13
,
0x01
,
0x01
,
0xff
,
0x04
,
0x08
,
0x30
,
0x06
,
0x01
,
0x01
,
0xff
,
0x02
,
0x01
,
0x01
,
0x31
,
0x77
,
0x30
,
0x75
,
0x02
,
0x01
,
0x01
,
0x30
,
0x1a
,
0x30
,
0x15
,
0x31
,
0x13
,
0x30
,
0x11
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x0a
,
0x4a
,
0x75
,
0x61
,
0x6e
,
0x20
,
0x4c
,
0x61
,
0x6e
,
0x67
,
0x00
,
0x02
,
0x01
,
0x01
,
0x30
,
0x0c
,
0x06
,
0x08
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x02
,
0x05
,
0x05
,
0x00
,
0x30
,
0x04
,
0x06
,
0x00
,
0x05
,
0x00
,
0x04
,
0x40
,
0x81
,
0xa6
,
0x70
,
0xb3
,
0xef
,
0x59
,
0xd1
,
0x66
,
0xd1
,
0x9b
,
0xc0
,
0x9a
,
0xb6
,
0x9a
,
0x5e
,
0x6d
,
0x6f
,
0x6d
,
0x0d
,
0x59
,
0xa9
,
0xaa
,
0x6e
,
0xe9
,
0x2c
,
0xa0
,
0x1e
,
0xee
,
0xc2
,
0x60
,
0xbc
,
0x59
,
0xbe
,
0x3f
,
0x63
,
0x06
,
0x8d
,
0xc9
,
0x11
,
0x1d
,
0x23
,
0x64
,
0x92
,
0xef
,
0x2e
,
0xfc
,
0x57
,
0x29
,
0xa4
,
0xaf
,
0xe0
,
0xee
,
0x93
,
0x19
,
0x39
,
0x51
,
0xe4
,
0x44
,
0xb8
,
0x0b
,
0x28
,
0xf4
,
0xa8
,
0x0d
};
static
void
test_verify_message_signature
(
void
)
{
...
...
@@ -460,11 +488,17 @@ static void test_verify_message_signature(void)
CRYPT_VERIFY_MESSAGE_PARA
para
=
{
0
};
PCCERT_CONTEXT
cert
;
DWORD
cbDecoded
;
BYTE
decoded
[
sizeof
(
msgData
)];
SetLastError
(
0xdeadbeef
);
ret
=
CryptVerifyMessageSignature
(
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
/* Is cbDecoded set when invalid parameters are passed? */
cbDecoded
=
0xdeadbeef
;
ret
=
CryptVerifyMessageSignature
(
NULL
,
0
,
NULL
,
0
,
NULL
,
&
cbDecoded
,
NULL
);
ok
(
cbDecoded
==
0
,
"expected 0, got %08x
\n
"
,
cbDecoded
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptVerifyMessageSignature
(
&
para
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
...
...
@@ -542,6 +576,35 @@ static void test_verify_message_signature(void)
ret
=
CryptVerifyMessageSignature
(
&
para
,
0
,
signedWithCertWithPubKeyContent
,
sizeof
(
signedWithCertWithPubKeyContent
),
NULL
,
0
,
NULL
);
ok
(
!
ret
,
"Expected failure
\n
"
);
/* Apparently, an output pcbDecoded parameter is expected. */
ret
=
CryptVerifyMessageSignature
(
&
para
,
0
,
signedWithCertWithValidPubKeyContent
,
sizeof
(
signedWithCertWithValidPubKeyContent
),
NULL
,
0
,
NULL
);
todo_wine
ok
(
!
ret
,
"Expected failure
\n
"
);
/* Finally, a message signed with a valid public key verifies successfully
*/
cbDecoded
=
0xdeadbeef
;
ret
=
CryptVerifyMessageSignature
(
&
para
,
0
,
signedWithCertWithValidPubKeyContent
,
sizeof
(
signedWithCertWithValidPubKeyContent
),
NULL
,
&
cbDecoded
,
NULL
);
ok
(
ret
,
"CryptVerifyMessageSignature failed: %08x
\n
"
,
GetLastError
());
ok
(
cbDecoded
==
sizeof
(
msgData
),
"expected 4, got %d
\n
"
,
cbDecoded
);
cbDecoded
=
0
;
ret
=
CryptVerifyMessageSignature
(
&
para
,
0
,
signedWithCertWithValidPubKeyContent
,
sizeof
(
signedWithCertWithValidPubKeyContent
),
NULL
,
&
cbDecoded
,
NULL
);
/* Setting cbDecoded to 0 succeeds when a NULL buffer is provided */
ok
(
ret
,
"CryptVerifyMessageSignature failed: %08x
\n
"
,
GetLastError
());
ok
(
cbDecoded
==
sizeof
(
msgData
),
"expected 4, got %d
\n
"
,
cbDecoded
);
cbDecoded
=
0
;
ret
=
CryptVerifyMessageSignature
(
&
para
,
0
,
signedWithCertWithValidPubKeyContent
,
sizeof
(
signedWithCertWithValidPubKeyContent
),
decoded
,
&
cbDecoded
,
NULL
);
/* When a non-NULL buffer is provided, cbDecoded must not be too small */
ok
(
!
ret
&&
GetLastError
()
==
ERROR_MORE_DATA
,
"expected ERROR_MORE_DATA, got %d (%08x)
\n
"
,
GetLastError
(),
GetLastError
());
}
static
const
BYTE
detachedHashBlob
[]
=
{
...
...
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