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
acc0bec4
Commit
acc0bec4
authored
Jul 09, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Jul 10, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add some tests for updating decode messages.
parent
8ca75591
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
0 deletions
+72
-0
msg.c
dlls/crypt32/tests/msg.c
+72
-0
No files found.
dlls/crypt32/tests/msg.c
View file @
acc0bec4
...
...
@@ -632,6 +632,77 @@ static void test_data_msg(void)
test_data_msg_encoding
();
}
static
void
test_decode_msg_update
(
void
)
{
HCRYPTMSG
msg
;
BOOL
ret
;
CMSG_STREAM_INFO
streamInfo
=
{
0
};
DWORD
i
;
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
0
,
0
,
NULL
,
NULL
);
/* Update with a full message in a final update */
ret
=
CryptMsgUpdate
(
msg
,
dataEmptyContent
,
sizeof
(
dataEmptyContent
),
TRUE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
/* Can't update after a final update */
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
dataEmptyContent
,
sizeof
(
dataEmptyContent
),
TRUE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_MSG_ERROR
,
"Expected CRYPT_E_MSG_ERROR, got %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
0
,
0
,
NULL
,
NULL
);
/* Can't send a non-final update without streaming */
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
dataEmptyContent
,
sizeof
(
dataEmptyContent
),
FALSE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_MSG_ERROR
,
"Expected CRYPT_E_MSG_ERROR, got %x
\n
"
,
GetLastError
());
/* A subsequent final update succeeds */
ret
=
CryptMsgUpdate
(
msg
,
dataEmptyContent
,
sizeof
(
dataEmptyContent
),
TRUE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
0
,
0
,
NULL
,
&
streamInfo
);
/* Updating a message that has a NULL stream callback fails */
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
dataEmptyContent
,
sizeof
(
dataEmptyContent
),
FALSE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got %x
\n
"
,
GetLastError
());
/* Changing the callback pointer after the fact yields the same error (so
* the message must copy the stream info, not just store a pointer to it)
*/
streamInfo
.
pfnStreamOutput
=
nop_stream_output
;
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
dataEmptyContent
,
sizeof
(
dataEmptyContent
),
FALSE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
/* Updating the message byte by byte is legal */
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
0
,
0
,
NULL
,
&
streamInfo
);
todo_wine
{
for
(
i
=
0
,
ret
=
TRUE
;
ret
&&
i
<
sizeof
(
dataEmptyContent
);
i
++
)
ret
=
CryptMsgUpdate
(
msg
,
&
dataEmptyContent
[
i
],
1
,
FALSE
);
ok
(
ret
,
"CryptMsgUpdate failed on byte %d: %x
\n
"
,
i
,
GetLastError
());
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
ok
(
ret
,
"CryptMsgUpdate failed on byte %d: %x
\n
"
,
i
,
GetLastError
());
}
CryptMsgClose
(
msg
);
}
static
void
test_decode_msg
(
void
)
{
test_decode_msg_update
();
}
START_TEST
(
msg
)
{
/* Basic parameter checking tests */
...
...
@@ -642,4 +713,5 @@ START_TEST(msg)
/* Message-type specific tests */
test_data_msg
();
test_decode_msg
();
}
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