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
d11ddebc
Commit
d11ddebc
authored
Jul 23, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Jul 24, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add a partial stub for updating a signed encoded message.
parent
014f282b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
11 deletions
+38
-11
msg.c
dlls/crypt32/msg.c
+38
-4
msg.c
dlls/crypt32/tests/msg.c
+0
-7
No files found.
dlls/crypt32/msg.c
View file @
d11ddebc
...
...
@@ -592,12 +592,15 @@ static BOOL CRYPT_IsValidSigner(CMSG_SIGNER_ENCODE_INFO_WITH_CMS *signer)
typedef
struct
_CSignedEncodeMsg
{
CryptMsgBase
base
;
CryptMsgBase
base
;
CRYPT_DATA_BLOB
data
;
}
CSignedEncodeMsg
;
static
void
CSignedEncodeMsg_Close
(
HCRYPTMSG
hCryptMsg
)
{
FIXME
(
"(%p)
\n
"
,
hCryptMsg
);
CSignedEncodeMsg
*
msg
=
(
CSignedEncodeMsg
*
)
hCryptMsg
;
CryptMemFree
(
msg
->
data
.
pbData
);
}
static
BOOL
CSignedEncodeMsg_GetParam
(
HCRYPTMSG
hCryptMsg
,
DWORD
dwParamType
,
...
...
@@ -611,8 +614,37 @@ static BOOL CSignedEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
static
BOOL
CSignedEncodeMsg_Update
(
HCRYPTMSG
hCryptMsg
,
const
BYTE
*
pbData
,
DWORD
cbData
,
BOOL
fFinal
)
{
FIXME
(
"(%p, %p, %d, %d)
\n
"
,
hCryptMsg
,
pbData
,
cbData
,
fFinal
);
return
FALSE
;
CSignedEncodeMsg
*
msg
=
(
CSignedEncodeMsg
*
)
hCryptMsg
;
BOOL
ret
=
FALSE
;
if
(
msg
->
base
.
streamed
||
(
msg
->
base
.
open_flags
&
CMSG_DETACHED_FLAG
))
{
FIXME
(
"streamed / detached update unimplemented
\n
"
);
ret
=
TRUE
;
}
else
{
if
(
!
fFinal
)
SetLastError
(
CRYPT_E_MSG_ERROR
);
else
{
if
(
cbData
)
{
msg
->
data
.
pbData
=
CryptMemAlloc
(
cbData
);
if
(
msg
->
data
.
pbData
)
{
memcpy
(
msg
->
data
.
pbData
,
pbData
,
cbData
);
msg
->
data
.
cbData
=
cbData
;
ret
=
TRUE
;
}
}
else
ret
=
TRUE
;
if
(
ret
)
FIXME
(
"non-streamed final update: partial stub
\n
"
);
}
}
return
ret
;
}
static
HCRYPTMSG
CSignedEncodeMsg_Open
(
DWORD
dwFlags
,
...
...
@@ -644,6 +676,8 @@ static HCRYPTMSG CSignedEncodeMsg_Open(DWORD dwFlags,
CryptMsgBase_Init
((
CryptMsgBase
*
)
msg
,
dwFlags
,
pStreamInfo
,
CSignedEncodeMsg_Close
,
CSignedEncodeMsg_GetParam
,
CSignedEncodeMsg_Update
);
msg
->
data
.
cbData
=
0
;
msg
->
data
.
pbData
=
NULL
;
}
return
msg
;
}
...
...
dlls/crypt32/tests/msg.c
View file @
d11ddebc
...
...
@@ -1112,11 +1112,9 @@ static void test_signed_msg_update(void)
ok
(
msg
!=
NULL
,
"CryptMsgOpenToEncode failed: %x
\n
"
,
GetLastError
());
/* CMSG_SIGNED allows non-final updates. */
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
FALSE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
/* CMSG_SIGNED also allows non-final updates with no data. */
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
FALSE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
/* The final update requires a private key in the hCryptProv, in order to
* generate the signature.
...
...
@@ -1143,17 +1141,14 @@ static void test_signed_msg_update(void)
ok
(
msg
!=
NULL
,
"CryptMsgOpenToEncode failed: %x
\n
"
,
GetLastError
());
/* CMSG_SIGNED allows non-final updates. */
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
FALSE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
/* CMSG_SIGNED also allows non-final updates with no data. */
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
FALSE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
/* Now that the private key exists, the final update can succeed (even
* with no data.)
*/
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
/* But no updates are allowed after the final update. */
SetLastError
(
0xdeadbeef
);
...
...
@@ -1282,7 +1277,6 @@ static void test_signed_msg_encoding(void)
check_param
(
"detached signed empty content"
,
msg
,
CMSG_CONTENT_PARAM
,
signedEmptyContent
,
sizeof
(
signedEmptyContent
));
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
TRUE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
todo_wine
check_param
(
"detached signed hash"
,
msg
,
CMSG_COMPUTED_HASH_PARAM
,
...
...
@@ -1312,7 +1306,6 @@ static void test_signed_msg_encoding(void)
check_param
(
"signed empty content"
,
msg
,
CMSG_CONTENT_PARAM
,
signedEmptyContent
,
sizeof
(
signedEmptyContent
));
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
TRUE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
todo_wine
check_param
(
"signed bare content"
,
msg
,
CMSG_BARE_CONTENT_PARAM
,
...
...
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