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
d1f37934
Commit
d1f37934
authored
Jun 28, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Jun 29, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add tests for data message encoding.
parent
0546cf1a
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 @
d1f37934
...
...
@@ -280,6 +280,26 @@ static void test_msg_close(void)
ok
(
ret
,
"CryptMsgClose failed: %x
\n
"
,
GetLastError
());
}
static
void
check_param
(
LPCSTR
test
,
HCRYPTMSG
msg
,
DWORD
param
,
const
BYTE
*
expected
,
DWORD
expectedSize
)
{
DWORD
size
;
LPBYTE
buf
;
BOOL
ret
;
size
=
0
;
ret
=
CryptMsgGetParam
(
msg
,
param
,
0
,
NULL
,
&
size
);
ok
(
ret
,
"%s: CryptMsgGetParam failed: %08x
\n
"
,
test
,
GetLastError
());
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
ret
=
CryptMsgGetParam
(
msg
,
param
,
0
,
buf
,
&
size
);
ok
(
ret
,
"%s: CryptMsgGetParam failed: %08x
\n
"
,
test
,
GetLastError
());
ok
(
size
==
expectedSize
,
"%s: expected size %d, got %d
\n
"
,
test
,
expectedSize
,
size
);
if
(
size
)
ok
(
!
memcmp
(
buf
,
expected
,
size
),
"%s: unexpected data
\n
"
,
test
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
static
void
test_data_msg_open
(
void
)
{
HCRYPTMSG
msg
;
...
...
@@ -389,11 +409,63 @@ static void test_data_msg_get_param(void)
CryptMsgClose
(
msg
);
}
static
const
BYTE
dataEmptyBareContent
[]
=
{
0x04
,
0x00
};
static
const
BYTE
dataEmptyContent
[]
=
{
0x30
,
0x0f
,
0x06
,
0x09
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x01
,
0x07
,
0x01
,
0xa0
,
0x02
,
0x04
,
0x00
};
static
const
BYTE
dataBareContent
[]
=
{
0x04
,
0x04
,
0x01
,
0x02
,
0x03
,
0x04
};
static
const
BYTE
dataContent
[]
=
{
0x30
,
0x13
,
0x06
,
0x09
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x01
,
0x07
,
0x01
,
0xa0
,
0x06
,
0x04
,
0x04
,
0x01
,
0x02
,
0x03
,
0x04
};
static
void
test_data_msg_encoding
(
void
)
{
HCRYPTMSG
msg
;
BOOL
ret
;
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_DATA
,
NULL
,
NULL
,
NULL
);
todo_wine
{
check_param
(
"data empty bare content"
,
msg
,
CMSG_BARE_CONTENT_PARAM
,
dataEmptyBareContent
,
sizeof
(
dataEmptyBareContent
));
check_param
(
"data empty content"
,
msg
,
CMSG_CONTENT_PARAM
,
dataEmptyContent
,
sizeof
(
dataEmptyContent
));
}
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
TRUE
);
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
todo_wine
{
check_param
(
"data bare content"
,
msg
,
CMSG_BARE_CONTENT_PARAM
,
dataBareContent
,
sizeof
(
dataBareContent
));
check_param
(
"data content"
,
msg
,
CMSG_CONTENT_PARAM
,
dataContent
,
sizeof
(
dataContent
));
}
CryptMsgClose
(
msg
);
/* Same test, but with CMSG_BARE_CONTENT_FLAG set */
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
CMSG_BARE_CONTENT_FLAG
,
CMSG_DATA
,
NULL
,
NULL
,
NULL
);
todo_wine
{
check_param
(
"data empty bare content"
,
msg
,
CMSG_BARE_CONTENT_PARAM
,
dataEmptyBareContent
,
sizeof
(
dataEmptyBareContent
));
check_param
(
"data empty content"
,
msg
,
CMSG_CONTENT_PARAM
,
dataEmptyContent
,
sizeof
(
dataEmptyContent
));
}
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
TRUE
);
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
todo_wine
{
check_param
(
"data bare content"
,
msg
,
CMSG_BARE_CONTENT_PARAM
,
dataBareContent
,
sizeof
(
dataBareContent
));
check_param
(
"data content"
,
msg
,
CMSG_CONTENT_PARAM
,
dataContent
,
sizeof
(
dataContent
));
}
CryptMsgClose
(
msg
);
}
static
void
test_data_msg
(
void
)
{
test_data_msg_open
();
test_data_msg_update
();
test_data_msg_get_param
();
test_data_msg_encoding
();
}
START_TEST
(
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