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
03e94320
Commit
03e94320
authored
Dec 01, 2010
by
Alexander Morozov
Committed by
Alexandre Julliard
Dec 02, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement updating enveloped messages.
parent
c3a2f7a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
16 deletions
+64
-16
msg.c
dlls/crypt32/msg.c
+64
-2
msg.c
dlls/crypt32/tests/msg.c
+0
-14
No files found.
dlls/crypt32/msg.c
View file @
03e94320
...
...
@@ -1793,8 +1793,70 @@ static BOOL CEnvelopedEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
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
;
CEnvelopedEncodeMsg
*
msg
=
hCryptMsg
;
BOOL
ret
=
FALSE
;
if
(
msg
->
base
.
state
==
MsgStateFinalized
)
SetLastError
(
CRYPT_E_MSG_ERROR
);
else
if
(
msg
->
base
.
streamed
)
{
FIXME
(
"streamed stub
\n
"
);
msg
->
base
.
state
=
fFinal
?
MsgStateFinalized
:
MsgStateUpdated
;
ret
=
TRUE
;
}
else
{
if
(
!
fFinal
)
{
if
(
msg
->
base
.
open_flags
&
CMSG_DETACHED_FLAG
)
SetLastError
(
E_INVALIDARG
);
else
SetLastError
(
CRYPT_E_MSG_ERROR
);
}
else
{
if
(
cbData
)
{
DWORD
dataLen
=
cbData
;
msg
->
data
.
cbData
=
cbData
;
msg
->
data
.
pbData
=
CryptMemAlloc
(
cbData
);
if
(
msg
->
data
.
pbData
)
{
memcpy
(
msg
->
data
.
pbData
,
pbData
,
cbData
);
ret
=
CryptEncrypt
(
msg
->
key
,
0
,
TRUE
,
0
,
msg
->
data
.
pbData
,
&
dataLen
,
msg
->
data
.
cbData
);
msg
->
data
.
cbData
=
dataLen
;
if
(
dataLen
>
cbData
)
{
msg
->
data
.
pbData
=
CryptMemRealloc
(
msg
->
data
.
pbData
,
dataLen
);
if
(
msg
->
data
.
pbData
)
{
dataLen
=
cbData
;
ret
=
CryptEncrypt
(
msg
->
key
,
0
,
TRUE
,
0
,
msg
->
data
.
pbData
,
&
dataLen
,
msg
->
data
.
cbData
);
}
else
ret
=
FALSE
;
}
if
(
!
ret
)
CryptMemFree
(
msg
->
data
.
pbData
);
}
else
ret
=
FALSE
;
if
(
!
ret
)
{
msg
->
data
.
cbData
=
0
;
msg
->
data
.
pbData
=
NULL
;
}
}
else
ret
=
TRUE
;
msg
->
base
.
state
=
MsgStateFinalized
;
}
}
return
ret
;
}
static
HCRYPTMSG
CEnvelopedEncodeMsg_Open
(
DWORD
dwFlags
,
...
...
dlls/crypt32/tests/msg.c
View file @
03e94320
...
...
@@ -2118,16 +2118,13 @@ static void test_enveloped_msg_update(void)
{
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
FALSE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_MSG_ERROR
,
"expected CRYPT_E_MSG_ERROR, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_MSG_ERROR
,
"expected CRYPT_E_MSG_ERROR, got %08x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
...
...
@@ -2142,18 +2139,15 @@ static void test_enveloped_msg_update(void)
{
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
FALSE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_MSG_ERROR
,
"expected CRYPT_E_MSG_ERROR, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
TRUE
);
todo_wine
ok
(
ret
||
broken
(
!
ret
&&
GetLastError
()
==
NTE_PERM
),
/* some NT4 */
"CryptMsgUpdate failed: %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_MSG_ERROR
,
"expected CRYPT_E_MSG_ERROR, got %08x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
...
...
@@ -2168,12 +2162,10 @@ static void test_enveloped_msg_update(void)
{
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
FALSE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %08x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
}
...
...
@@ -2187,12 +2179,10 @@ static void test_enveloped_msg_update(void)
{
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
FALSE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
TRUE
);
todo_wine
ok
(
ret
||
broken
(
!
ret
&&
GetLastError
()
==
NTE_PERM
),
/* some NT4 */
"CryptMsgUpdate failed: %08x
\n
"
,
GetLastError
());
...
...
@@ -2208,11 +2198,9 @@ static void test_enveloped_msg_update(void)
{
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
FALSE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %08x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
}
...
...
@@ -2226,11 +2214,9 @@ static void test_enveloped_msg_update(void)
{
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
FALSE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
TRUE
);
todo_wine
ok
(
ret
||
broken
(
!
ret
&&
GetLastError
()
==
NTE_PERM
),
/* some NT4 */
"CryptMsgUpdate failed: %08x
\n
"
,
GetLastError
());
...
...
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