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
6fcca28b
Commit
6fcca28b
authored
Dec 01, 2010
by
Alexander Morozov
Committed by
Alexandre Julliard
Dec 01, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add a stub enveloped message implementation.
parent
ec00d6dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
14 deletions
+99
-14
msg.c
dlls/crypt32/msg.c
+97
-1
msg.c
dlls/crypt32/tests/msg.c
+2
-13
No files found.
dlls/crypt32/msg.c
View file @
6fcca28b
...
...
@@ -1461,6 +1461,101 @@ static HCRYPTMSG CSignedEncodeMsg_Open(DWORD dwFlags,
return
msg
;
}
typedef
struct
_CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS
{
DWORD
cbSize
;
HCRYPTPROV_LEGACY
hCryptProv
;
CRYPT_ALGORITHM_IDENTIFIER
ContentEncryptionAlgorithm
;
void
*
pvEncryptionAuxInfo
;
DWORD
cRecipients
;
PCERT_INFO
*
rgpRecipientCert
;
PCMSG_RECIPIENT_ENCODE_INFO
rgCmsRecipients
;
DWORD
cCertEncoded
;
PCERT_BLOB
rgCertEncoded
;
DWORD
cCrlEncoded
;
PCRL_BLOB
rgCrlEncoded
;
DWORD
cAttrCertEncoded
;
PCERT_BLOB
rgAttrCertEncoded
;
DWORD
cUnprotectedAttr
;
PCRYPT_ATTRIBUTE
rgUnprotectedAttr
;
}
CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS
,
*
PCMSG_ENVELOPED_ENCODE_INFO_WITH_CMS
;
typedef
struct
_CEnvelopedEncodeMsg
{
CryptMsgBase
base
;
HCRYPTPROV
prov
;
}
CEnvelopedEncodeMsg
;
static
void
CEnvelopedEncodeMsg_Close
(
HCRYPTMSG
hCryptMsg
)
{
CEnvelopedEncodeMsg
*
msg
=
hCryptMsg
;
if
(
msg
->
base
.
open_flags
&
CMSG_CRYPT_RELEASE_CONTEXT_FLAG
)
CryptReleaseContext
(
msg
->
prov
,
0
);
}
static
BOOL
CEnvelopedEncodeMsg_GetParam
(
HCRYPTMSG
hCryptMsg
,
DWORD
dwParamType
,
DWORD
dwIndex
,
void
*
pvData
,
DWORD
*
pcbData
)
{
FIXME
(
"(%p, %d, %d, %p, %p): stub
\n
"
,
hCryptMsg
,
dwParamType
,
dwIndex
,
pvData
,
pcbData
);
return
FALSE
;
}
static
BOOL
CEnvelopedEncodeMsg_Update
(
HCRYPTMSG
hCryptMsg
,
const
BYTE
*
pbData
,
DWORD
cbData
,
BOOL
fFinal
)
{
FIXME
(
"(%p, %p, %d, %d): stub
\n
"
,
hCryptMsg
,
pbData
,
cbData
,
fFinal
);
return
FALSE
;
}
static
HCRYPTMSG
CEnvelopedEncodeMsg_Open
(
DWORD
dwFlags
,
const
void
*
pvMsgEncodeInfo
,
LPCSTR
pszInnerContentObjID
,
PCMSG_STREAM_INFO
pStreamInfo
)
{
CEnvelopedEncodeMsg
*
msg
;
const
CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS
*
info
=
pvMsgEncodeInfo
;
HCRYPTPROV
prov
;
ALG_ID
algID
;
if
(
info
->
cbSize
!=
sizeof
(
CMSG_ENVELOPED_ENCODE_INFO
)
&&
info
->
cbSize
!=
sizeof
(
CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS
))
{
SetLastError
(
E_INVALIDARG
);
return
NULL
;
}
if
(
info
->
cbSize
==
sizeof
(
CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS
))
FIXME
(
"CMS fields unsupported
\n
"
);
if
(
!
(
algID
=
CertOIDToAlgId
(
info
->
ContentEncryptionAlgorithm
.
pszObjId
)))
{
SetLastError
(
CRYPT_E_UNKNOWN_ALGO
);
return
NULL
;
}
if
(
info
->
cRecipients
&&
!
info
->
rgpRecipientCert
)
{
SetLastError
(
E_INVALIDARG
);
return
NULL
;
}
if
(
info
->
hCryptProv
)
prov
=
info
->
hCryptProv
;
else
{
prov
=
CRYPT_GetDefaultProvider
();
dwFlags
&=
~
CMSG_CRYPT_RELEASE_CONTEXT_FLAG
;
}
msg
=
CryptMemAlloc
(
sizeof
(
CEnvelopedEncodeMsg
));
if
(
msg
)
{
CryptMsgBase_Init
((
CryptMsgBase
*
)
msg
,
dwFlags
,
pStreamInfo
,
CEnvelopedEncodeMsg_Close
,
CEnvelopedEncodeMsg_GetParam
,
CEnvelopedEncodeMsg_Update
,
CRYPT_DefaultMsgControl
);
msg
->
prov
=
prov
;
}
if
(
!
msg
&&
(
dwFlags
&
CMSG_CRYPT_RELEASE_CONTEXT_FLAG
))
CryptReleaseContext
(
prov
,
0
);
return
msg
;
}
HCRYPTMSG
WINAPI
CryptMsgOpenToEncode
(
DWORD
dwMsgEncodingType
,
DWORD
dwFlags
,
DWORD
dwMsgType
,
const
void
*
pvMsgEncodeInfo
,
LPSTR
pszInnerContentObjID
,
PCMSG_STREAM_INFO
pStreamInfo
)
...
...
@@ -1490,7 +1585,8 @@ HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags,
pszInnerContentObjID
,
pStreamInfo
);
break
;
case
CMSG_ENVELOPED
:
FIXME
(
"unimplemented for type CMSG_ENVELOPED
\n
"
);
msg
=
CEnvelopedEncodeMsg_Open
(
dwFlags
,
pvMsgEncodeInfo
,
pszInnerContentObjID
,
pStreamInfo
);
break
;
case
CMSG_SIGNED_AND_ENVELOPED
:
case
CMSG_ENCRYPTED
:
...
...
dlls/crypt32/tests/msg.c
View file @
6fcca28b
...
...
@@ -2043,7 +2043,6 @@ static void test_enveloped_msg_open(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENVELOPED
,
&
envelopedInfo
,
NULL
,
NULL
);
todo_wine
ok
(
!
msg
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
...
...
@@ -2051,7 +2050,6 @@ static void test_enveloped_msg_open(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENVELOPED
,
&
envelopedInfo
,
NULL
,
NULL
);
todo_wine
ok
(
!
msg
&&
(
GetLastError
()
==
CRYPT_E_UNKNOWN_ALGO
||
GetLastError
()
==
E_INVALIDARG
),
/* Win9x */
...
...
@@ -2061,7 +2059,6 @@ static void test_enveloped_msg_open(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENVELOPED
,
&
envelopedInfo
,
NULL
,
NULL
);
todo_wine
ok
(
msg
!=
NULL
||
broken
(
!
msg
),
/* Win9x */
"CryptMsgOpenToEncode failed: %08x
\n
"
,
GetLastError
());
...
...
@@ -2073,7 +2070,6 @@ static void test_enveloped_msg_open(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENVELOPED
,
&
envelopedInfo
,
NULL
,
NULL
);
todo_wine
ok
(
!
msg
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
}
...
...
@@ -2086,7 +2082,6 @@ static void test_enveloped_msg_open(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENVELOPED
,
&
envelopedInfo
,
NULL
,
NULL
);
todo_wine
ok
(
msg
!=
NULL
,
"CryptMsgOpenToEncode failed: %08x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
SetLastError
(
0xdeadbeef
);
...
...
@@ -2096,7 +2091,6 @@ static void test_enveloped_msg_open(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENVELOPED
,
&
envelopedInfo
,
NULL
,
NULL
);
todo_wine
ok
(
msg
!=
NULL
,
"CryptMsgOpenToEncode failed: %08x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
CryptReleaseContext
(
envelopedInfo
.
hCryptProv
,
0
);
...
...
@@ -2117,7 +2111,6 @@ static void test_enveloped_msg_update(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENVELOPED
,
&
envelopedInfo
,
NULL
,
NULL
);
todo_wine
ok
(
msg
!=
NULL
||
broken
(
!
msg
),
/* Win9x */
"CryptMsgOpenToEncode failed: %08x
\n
"
,
GetLastError
());
...
...
@@ -2142,7 +2135,6 @@ static void test_enveloped_msg_update(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENVELOPED
,
&
envelopedInfo
,
NULL
,
NULL
);
todo_wine
ok
(
msg
!=
NULL
||
broken
(
!
msg
),
/* Win9x */
"CryptMsgOpenToEncode failed: %08x
\n
"
,
GetLastError
());
...
...
@@ -2169,7 +2161,6 @@ static void test_enveloped_msg_update(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
CMSG_DETACHED_FLAG
,
CMSG_ENVELOPED
,
&
envelopedInfo
,
NULL
,
NULL
);
todo_wine
ok
(
msg
!=
NULL
||
broken
(
!
msg
),
/* Win9x */
"CryptMsgOpenToEncode failed: %08x
\n
"
,
GetLastError
());
...
...
@@ -2189,7 +2180,6 @@ static void test_enveloped_msg_update(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
CMSG_DETACHED_FLAG
,
CMSG_ENVELOPED
,
&
envelopedInfo
,
NULL
,
NULL
);
todo_wine
ok
(
msg
!=
NULL
||
broken
(
!
msg
),
/* Win9x */
"CryptMsgOpenToEncode failed: %08x
\n
"
,
GetLastError
());
...
...
@@ -2211,7 +2201,6 @@ static void test_enveloped_msg_update(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENVELOPED
,
&
envelopedInfo
,
NULL
,
&
streamInfo
);
todo_wine
ok
(
msg
!=
NULL
||
broken
(
!
msg
),
/* Win9x */
"CryptMsgOpenToEncode failed: %08x
\n
"
,
GetLastError
());
...
...
@@ -2230,7 +2219,6 @@ static void test_enveloped_msg_update(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENVELOPED
,
&
envelopedInfo
,
NULL
,
&
streamInfo
);
todo_wine
ok
(
msg
!=
NULL
||
broken
(
!
msg
),
/* Win9x */
"CryptMsgOpenToEncode failed: %08x
\n
"
,
GetLastError
());
...
...
@@ -2269,15 +2257,16 @@ static void test_enveloped_msg_encoding(void)
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENVELOPED
,
&
envelopedInfo
,
NULL
,
NULL
);
todo_wine
ok
(
msg
!=
NULL
||
broken
(
!
msg
),
/* Win9x */
"CryptMsgOpenToEncode failed: %08x
\n
"
,
GetLastError
());
if
(
msg
)
{
todo_wine
check_param
(
"enveloped empty bare content"
,
msg
,
CMSG_BARE_CONTENT_PARAM
,
envelopedEmptyBareContent
,
sizeof
(
envelopedEmptyBareContent
));
todo_wine
check_param
(
"enveloped empty content"
,
msg
,
CMSG_CONTENT_PARAM
,
envelopedEmptyContent
,
sizeof
(
envelopedEmptyContent
));
CryptMsgClose
(
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