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
57a85f0d
Commit
57a85f0d
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: Implement CMSG_CMS_SIGNER_INFO_PARAM.
parent
6d9fc0f5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
2 deletions
+82
-2
msg.c
dlls/crypt32/msg.c
+82
-0
msg.c
dlls/crypt32/tests/msg.c
+0
-2
No files found.
dlls/crypt32/msg.c
View file @
57a85f0d
...
...
@@ -2047,6 +2047,76 @@ static BOOL CRYPT_CopySignerInfo(void *pvData, DWORD *pcbData,
return
ret
;
}
static
BOOL
CRYPT_CopyCMSSignerInfo
(
void
*
pvData
,
DWORD
*
pcbData
,
const
CMSG_CMS_SIGNER_INFO
*
in
)
{
DWORD
size
=
sizeof
(
CMSG_CMS_SIGNER_INFO
);
BOOL
ret
;
TRACE
(
"(%p, %d, %p)
\n
"
,
pvData
,
pvData
?
*
pcbData
:
0
,
in
);
if
(
in
->
SignerId
.
dwIdChoice
==
CERT_ID_ISSUER_SERIAL_NUMBER
)
{
size
+=
in
->
SignerId
.
IssuerSerialNumber
.
Issuer
.
cbData
;
size
+=
in
->
SignerId
.
IssuerSerialNumber
.
SerialNumber
.
cbData
;
}
else
size
+=
in
->
SignerId
.
KeyId
.
cbData
;
if
(
in
->
HashAlgorithm
.
pszObjId
)
size
+=
strlen
(
in
->
HashAlgorithm
.
pszObjId
)
+
1
;
size
+=
in
->
HashAlgorithm
.
Parameters
.
cbData
;
if
(
in
->
HashEncryptionAlgorithm
.
pszObjId
)
size
+=
strlen
(
in
->
HashEncryptionAlgorithm
.
pszObjId
)
+
1
;
size
+=
in
->
HashEncryptionAlgorithm
.
Parameters
.
cbData
;
size
+=
in
->
EncryptedHash
.
cbData
;
/* align pointer */
if
(
size
%
sizeof
(
DWORD_PTR
))
size
+=
size
%
sizeof
(
DWORD_PTR
);
size
+=
CRYPT_SizeOfAttributes
(
&
in
->
AuthAttrs
);
size
+=
CRYPT_SizeOfAttributes
(
&
in
->
UnauthAttrs
);
if
(
!
pvData
)
{
*
pcbData
=
size
;
ret
=
TRUE
;
}
else
if
(
*
pcbData
<
size
)
{
*
pcbData
=
size
;
SetLastError
(
ERROR_MORE_DATA
);
ret
=
FALSE
;
}
else
{
LPBYTE
nextData
=
(
BYTE
*
)
pvData
+
sizeof
(
CMSG_CMS_SIGNER_INFO
);
CMSG_CMS_SIGNER_INFO
*
out
=
(
CMSG_CMS_SIGNER_INFO
*
)
pvData
;
out
->
dwVersion
=
in
->
dwVersion
;
out
->
SignerId
.
dwIdChoice
=
in
->
SignerId
.
dwIdChoice
;
if
(
in
->
SignerId
.
dwIdChoice
==
CERT_ID_ISSUER_SERIAL_NUMBER
)
{
CRYPT_CopyBlob
(
&
out
->
SignerId
.
IssuerSerialNumber
.
Issuer
,
&
in
->
SignerId
.
IssuerSerialNumber
.
Issuer
,
&
nextData
);
CRYPT_CopyBlob
(
&
out
->
SignerId
.
IssuerSerialNumber
.
SerialNumber
,
&
in
->
SignerId
.
IssuerSerialNumber
.
SerialNumber
,
&
nextData
);
}
else
CRYPT_CopyBlob
(
&
out
->
SignerId
.
KeyId
,
&
in
->
SignerId
.
KeyId
,
&
nextData
);
CRYPT_CopyAlgorithmId
(
&
out
->
HashAlgorithm
,
&
in
->
HashAlgorithm
,
&
nextData
);
CRYPT_CopyAlgorithmId
(
&
out
->
HashEncryptionAlgorithm
,
&
in
->
HashEncryptionAlgorithm
,
&
nextData
);
CRYPT_CopyBlob
(
&
out
->
EncryptedHash
,
&
in
->
EncryptedHash
,
&
nextData
);
/* align pointer */
if
((
nextData
-
(
LPBYTE
)
0
)
%
sizeof
(
DWORD_PTR
))
nextData
+=
(
nextData
-
(
LPBYTE
)
0
)
%
sizeof
(
DWORD_PTR
);
CRYPT_CopyAttributes
(
&
out
->
AuthAttrs
,
&
in
->
AuthAttrs
,
&
nextData
);
CRYPT_CopyAttributes
(
&
out
->
UnauthAttrs
,
&
in
->
UnauthAttrs
,
&
nextData
);
ret
=
TRUE
;
}
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
}
static
BOOL
CRYPT_CopySignerCertInfo
(
void
*
pvData
,
DWORD
*
pcbData
,
const
CMSG_CMS_SIGNER_INFO
*
in
)
{
...
...
@@ -2239,6 +2309,18 @@ static BOOL CDecodeSignedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType,
else
SetLastError
(
CRYPT_E_INVALID_MSG_TYPE
);
break
;
case
CMSG_CMS_SIGNER_INFO_PARAM
:
if
(
msg
->
u
.
signed_data
.
info
)
{
if
(
dwIndex
>=
msg
->
u
.
signed_data
.
info
->
cSignerInfo
)
SetLastError
(
CRYPT_E_INVALID_INDEX
);
else
ret
=
CRYPT_CopyCMSSignerInfo
(
pvData
,
pcbData
,
&
msg
->
u
.
signed_data
.
info
->
rgSignerInfo
[
dwIndex
]);
}
else
SetLastError
(
CRYPT_E_INVALID_MSG_TYPE
);
break
;
default:
FIXME
(
"unimplemented for %d
\n
"
,
dwParamType
);
SetLastError
(
CRYPT_E_INVALID_MSG_TYPE
);
...
...
dlls/crypt32/tests/msg.c
View file @
57a85f0d
...
...
@@ -2404,7 +2404,6 @@ static void test_decode_msg_get_param(void)
/* Getting the CMS signer info of a PKCS7 message is possible. */
size
=
0
;
ret
=
CryptMsgGetParam
(
msg
,
CMSG_CMS_SIGNER_INFO_PARAM
,
0
,
NULL
,
&
size
);
todo_wine
ok
(
ret
,
"CryptMsgGetParam failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
buf
=
CryptMemAlloc
(
size
);
...
...
@@ -2498,7 +2497,6 @@ static void test_decode_msg_get_param(void)
}
size
=
0
;
ret
=
CryptMsgGetParam
(
msg
,
CMSG_CMS_SIGNER_INFO_PARAM
,
0
,
NULL
,
&
size
);
todo_wine
ok
(
ret
,
"CryptMsgGetParam failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
buf
=
CryptMemAlloc
(
size
);
...
...
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