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
0a8d14c2
Commit
0a8d14c2
authored
Aug 20, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Aug 21, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Rewrite CDecodeMsg_Update for better detached data handling.
parent
d3c8b59e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
29 deletions
+40
-29
msg.c
dlls/crypt32/msg.c
+40
-28
msg.c
dlls/crypt32/tests/msg.c
+0
-1
No files found.
dlls/crypt32/msg.c
View file @
0a8d14c2
...
...
@@ -1491,6 +1491,7 @@ typedef struct _CDecodeMsg
CSignedMsgData
signed_data
;
}
u
;
CRYPT_DATA_BLOB
msg_data
;
CRYPT_DATA_BLOB
detached_data
;
PCONTEXT_PROPERTY_LIST
properties
;
}
CDecodeMsg
;
...
...
@@ -1515,6 +1516,7 @@ static void CDecodeMsg_Close(HCRYPTMSG hCryptMsg)
break
;
}
CryptMemFree
(
msg
->
msg_data
.
pbData
);
CryptMemFree
(
msg
->
detached_data
.
pbData
);
ContextPropertyList_Free
(
msg
->
properties
);
}
...
...
@@ -1763,30 +1765,38 @@ static BOOL CDecodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
{
FIXME
(
"(%p, %p, %d, %d): streamed update stub
\n
"
,
hCryptMsg
,
pbData
,
cbData
,
fFinal
);
if
(
fFinal
)
switch
(
msg
->
base
.
state
)
{
if
(
msg
->
base
.
open_flags
&
CMSG_DETACHED_FLAG
&&
msg
->
base
.
state
!=
MsgStateDataFinalized
)
case
MsgStateInit
:
ret
=
CDecodeMsg_CopyData
(
&
msg
->
msg_data
,
pbData
,
cbData
);
if
(
fFinal
)
{
ret
=
CDecodeMsg_CopyData
(
&
msg
->
msg_data
,
pbData
,
cbData
);
msg
->
base
.
state
=
MsgStateDataFinalized
;
if
(
ret
)
ret
=
CDecodeMsg_DecodeContent
(
msg
,
&
msg
->
msg_data
,
msg
->
type
);
if
(
msg
->
base
.
open_flags
&
CMSG_DETACHED_FLAG
)
msg
->
base
.
state
=
MsgStateDataFinalized
;
else
msg
->
base
.
state
=
MsgStateFinalized
;
}
else
msg
->
base
.
state
=
MsgStateUpdated
;
break
;
case
MsgStateUpdated
:
ret
=
CDecodeMsg_CopyData
(
&
msg
->
msg_data
,
pbData
,
cbData
);
if
(
fFinal
)
{
FIXME
(
"(%p, %p, %d, %d): detached update stub
\n
"
,
hCryptMsg
,
pbData
,
cbData
,
fFinal
)
;
ret
=
TRUE
;
msg
->
base
.
state
=
MsgStateFinalized
;
if
(
msg
->
base
.
open_flags
&
CMSG_DETACHED_FLAG
)
msg
->
base
.
state
=
MsgStateDataFinalized
;
else
msg
->
base
.
state
=
MsgStateFinalized
;
}
}
else
{
ret
=
CDecodeMsg_CopyData
(
&
msg
->
msg_data
,
pbData
,
cbData
);
if
(
msg
->
base
.
state
==
MsgStateInit
)
msg
->
base
.
state
=
MsgStateUpdated
;
break
;
case
MsgStateDataFinalized
:
ret
=
CDecodeMsg_CopyData
(
&
msg
->
detached_data
,
pbData
,
cbData
);
if
(
fFinal
)
msg
->
base
.
state
=
MsgStateFinalized
;
break
;
default:
SetLastError
(
CRYPT_E_MSG_ERROR
);
break
;
}
}
else
...
...
@@ -1795,26 +1805,26 @@ static BOOL CDecodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
SetLastError
(
CRYPT_E_MSG_ERROR
);
else
{
if
(
msg
->
base
.
state
==
MsgStateInit
)
switch
(
msg
->
base
.
state
)
{
case
MsgStateInit
:
ret
=
CDecodeMsg_CopyData
(
&
msg
->
msg_data
,
pbData
,
cbData
);
if
(
ret
)
ret
=
CDecodeMsg_DecodeContent
(
msg
,
&
msg
->
msg_data
,
msg
->
type
);
if
(
msg
->
base
.
open_flags
&
CMSG_DETACHED_FLAG
)
msg
->
base
.
state
=
MsgStateDataFinalized
;
else
msg
->
base
.
state
=
MsgStateFinalized
;
}
else
if
(
msg
->
base
.
state
==
MsgStateDataFinalized
)
{
FIXME
(
"(%p, %p, %d, %d): detached update stub
\n
"
,
hCryptMsg
,
pbData
,
cbData
,
fFinal
);
ret
=
TRUE
;
break
;
case
MsgStateDataFinalized
:
ret
=
CDecodeMsg_CopyData
(
&
msg
->
detached_data
,
pbData
,
cbData
);
msg
->
base
.
state
=
MsgStateFinalized
;
break
;
default:
SetLastError
(
CRYPT_E_MSG_ERROR
);
}
}
}
if
(
ret
&&
msg
->
base
.
state
==
MsgStateFinalized
)
ret
=
CDecodeMsg_DecodeContent
(
msg
,
&
msg
->
msg_data
,
msg
->
type
);
return
ret
;
}
...
...
@@ -2648,6 +2658,8 @@ HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags,
memset
(
&
msg
->
u
,
0
,
sizeof
(
msg
->
u
));
msg
->
msg_data
.
cbData
=
0
;
msg
->
msg_data
.
pbData
=
NULL
;
msg
->
detached_data
.
cbData
=
0
;
msg
->
detached_data
.
pbData
=
NULL
;
msg
->
properties
=
ContextPropertyList_Create
();
}
return
msg
;
...
...
dlls/crypt32/tests/msg.c
View file @
0a8d14c2
...
...
@@ -2080,7 +2080,6 @@ static void test_decode_msg_update(void)
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
0
,
0
,
NULL
,
&
streamInfo
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
TRUE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
,
"Expected CRYPT_E_ASN1_BADTAG, got %x
\n
"
,
GetLastError
());
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