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
1c837f16
Commit
1c837f16
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 basic parameter checking to CryptMsgOpenTo*.
parent
3de0e4ac
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
8 deletions
+46
-8
msg.c
dlls/crypt32/msg.c
+46
-1
msg.c
dlls/crypt32/tests/msg.c
+0
-7
No files found.
dlls/crypt32/msg.c
View file @
1c837f16
...
...
@@ -24,13 +24,52 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
crypt
);
static
inline
const
char
*
MSG_TYPE_STR
(
DWORD
type
)
{
switch
(
type
)
{
#define _x(x) case (x): return #x
_x
(
CMSG_DATA
);
_x
(
CMSG_SIGNED
);
_x
(
CMSG_ENVELOPED
);
_x
(
CMSG_SIGNED_AND_ENVELOPED
);
_x
(
CMSG_HASHED
);
_x
(
CMSG_ENCRYPTED
);
#undef _x
default:
return
wine_dbg_sprintf
(
"unknown (%d)"
,
type
);
}
}
HCRYPTMSG
WINAPI
CryptMsgOpenToEncode
(
DWORD
dwMsgEncodingType
,
DWORD
dwFlags
,
DWORD
dwMsgType
,
const
void
*
pvMsgEncodeInfo
,
LPSTR
pszInnerContentObjID
,
PCMSG_STREAM_INFO
pStreamInfo
)
{
FIXME
(
"(%08x, %08x, %08x, %p, %s, %p): stub
\n
"
,
dwMsgEncodingType
,
dwFlags
,
HCRYPTMSG
msg
=
NULL
;
TRACE
(
"(%08x, %08x, %08x, %p, %s, %p)
\n
"
,
dwMsgEncodingType
,
dwFlags
,
dwMsgType
,
pvMsgEncodeInfo
,
debugstr_a
(
pszInnerContentObjID
),
pStreamInfo
);
if
(
GET_CMSG_ENCODING_TYPE
(
dwMsgEncodingType
)
!=
PKCS_7_ASN_ENCODING
)
{
SetLastError
(
E_INVALIDARG
);
return
NULL
;
}
switch
(
dwMsgType
)
{
case
CMSG_DATA
:
case
CMSG_SIGNED
:
case
CMSG_ENVELOPED
:
case
CMSG_HASHED
:
FIXME
(
"unimplemented for type %s
\n
"
,
MSG_TYPE_STR
(
dwMsgType
));
break
;
case
CMSG_SIGNED_AND_ENVELOPED
:
case
CMSG_ENCRYPTED
:
/* defined but invalid, fall through */
default:
SetLastError
(
CRYPT_E_INVALID_MSG_TYPE
);
}
return
msg
;
}
HCRYPTMSG
WINAPI
CryptMsgOpenToDecode
(
DWORD
dwMsgEncodingType
,
DWORD
dwFlags
,
...
...
@@ -39,6 +78,12 @@ HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags,
{
FIXME
(
"(%08x, %08x, %08x, %08lx, %p, %p): stub
\n
"
,
dwMsgEncodingType
,
dwFlags
,
dwMsgType
,
hCryptProv
,
pRecipientInfo
,
pStreamInfo
);
if
(
GET_CMSG_ENCODING_TYPE
(
dwMsgEncodingType
)
!=
PKCS_7_ASN_ENCODING
)
{
SetLastError
(
E_INVALIDARG
);
return
NULL
;
}
return
NULL
;
}
...
...
dlls/crypt32/tests/msg.c
View file @
1c837f16
...
...
@@ -43,19 +43,16 @@ static void test_msg_open_to_encode(void)
/* Bad encodings */
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
0
,
0
,
0
,
NULL
,
NULL
,
NULL
);
todo_wine
{
ok
(
!
msg
&&
GetLastError
()
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
X509_ASN_ENCODING
,
0
,
0
,
NULL
,
NULL
,
NULL
);
ok
(
!
msg
&&
GetLastError
()
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %x
\n
"
,
GetLastError
());
}
/* Bad message types */
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
0
,
NULL
,
NULL
,
NULL
);
todo_wine
{
ok
(
!
msg
&&
GetLastError
()
==
CRYPT_E_INVALID_MSG_TYPE
,
"Expected CRYPT_E_INVALID_MSG_TYPE, got %x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
...
...
@@ -73,7 +70,6 @@ static void test_msg_open_to_encode(void)
NULL
,
NULL
);
ok
(
!
msg
&&
GetLastError
()
==
CRYPT_E_INVALID_MSG_TYPE
,
"Expected CRYPT_E_INVALID_MSG_TYPE, got %x
\n
"
,
GetLastError
());
}
}
static
void
test_msg_open_to_decode
(
void
)
...
...
@@ -83,13 +79,11 @@ static void test_msg_open_to_decode(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToDecode
(
0
,
0
,
0
,
0
,
NULL
,
NULL
);
todo_wine
ok
(
!
msg
&&
GetLastError
()
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %x
\n
"
,
GetLastError
());
/* Bad encodings */
SetLastError
(
0xdeadbeef
);
todo_wine
{
msg
=
CryptMsgOpenToDecode
(
X509_ASN_ENCODING
,
0
,
0
,
0
,
NULL
,
NULL
);
ok
(
!
msg
&&
GetLastError
()
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %x
\n
"
,
GetLastError
());
...
...
@@ -97,7 +91,6 @@ static void test_msg_open_to_decode(void)
msg
=
CryptMsgOpenToDecode
(
X509_ASN_ENCODING
,
0
,
CMSG_DATA
,
0
,
NULL
,
NULL
);
ok
(
!
msg
&&
GetLastError
()
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %x
\n
"
,
GetLastError
());
}
/* The message type can be explicit... */
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_DATA
,
0
,
NULL
,
...
...
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