Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
51b16fb8
Commit
51b16fb8
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: Support the KeyId type of signer in CMSG_SIGNER_INFO_PARAM.
parent
57a85f0d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
15 deletions
+68
-15
msg.c
dlls/crypt32/msg.c
+68
-14
msg.c
dlls/crypt32/tests/msg.c
+0
-1
No files found.
dlls/crypt32/msg.c
View file @
51b16fb8
...
...
@@ -1977,10 +1977,58 @@ static DWORD CRYPT_SizeOfAttributes(const CRYPT_ATTRIBUTES *attr)
return
size
;
}
static
DWORD
CRYPT_SizeOfKeyIdAsIssuerAndSerial
(
const
CRYPT_DATA_BLOB
*
keyId
)
{
static
char
oid_key_rdn
[]
=
szOID_KEYID_RDN
;
DWORD
size
=
0
;
CERT_RDN_ATTR
attr
;
CERT_RDN
rdn
=
{
1
,
&
attr
};
CERT_NAME_INFO
name
=
{
1
,
&
rdn
};
attr
.
pszObjId
=
oid_key_rdn
;
attr
.
dwValueType
=
CERT_RDN_OCTET_STRING
;
attr
.
Value
.
cbData
=
keyId
->
cbData
;
attr
.
Value
.
pbData
=
keyId
->
pbData
;
if
(
CryptEncodeObject
(
X509_ASN_ENCODING
,
X509_NAME
,
&
name
,
NULL
,
&
size
))
size
++
;
/* Only include size of special zero serial number on success */
return
size
;
}
static
BOOL
CRYPT_CopyKeyIdAsIssuerAndSerial
(
CERT_NAME_BLOB
*
issuer
,
CRYPT_INTEGER_BLOB
*
serialNumber
,
const
CRYPT_DATA_BLOB
*
keyId
,
DWORD
encodedLen
,
LPBYTE
*
nextData
)
{
static
char
oid_key_rdn
[]
=
szOID_KEYID_RDN
;
CERT_RDN_ATTR
attr
;
CERT_RDN
rdn
=
{
1
,
&
attr
};
CERT_NAME_INFO
name
=
{
1
,
&
rdn
};
BOOL
ret
;
/* Encode special zero serial number */
serialNumber
->
cbData
=
1
;
serialNumber
->
pbData
=
*
nextData
;
**
nextData
=
0
;
(
*
nextData
)
++
;
/* Encode issuer */
issuer
->
pbData
=
*
nextData
;
attr
.
pszObjId
=
oid_key_rdn
;
attr
.
dwValueType
=
CERT_RDN_OCTET_STRING
;
attr
.
Value
.
cbData
=
keyId
->
cbData
;
attr
.
Value
.
pbData
=
keyId
->
pbData
;
ret
=
CryptEncodeObject
(
X509_ASN_ENCODING
,
X509_NAME
,
&
name
,
*
nextData
,
&
encodedLen
);
if
(
ret
)
{
*
nextData
+=
encodedLen
;
issuer
->
cbData
=
encodedLen
;
}
return
ret
;
}
static
BOOL
CRYPT_CopySignerInfo
(
void
*
pvData
,
DWORD
*
pcbData
,
const
CMSG_CMS_SIGNER_INFO
*
in
)
{
DWORD
size
=
sizeof
(
CMSG_SIGNER_INFO
);
DWORD
size
=
sizeof
(
CMSG_SIGNER_INFO
)
,
rdnSize
;
BOOL
ret
;
TRACE
(
"(%p, %d, %p)
\n
"
,
pvData
,
pvData
?
*
pcbData
:
0
,
in
);
...
...
@@ -1992,8 +2040,8 @@ static BOOL CRYPT_CopySignerInfo(void *pvData, DWORD *pcbData,
}
else
{
FIXME
(
"unsupported for key id
\n
"
);
return
FALSE
;
rdnSize
=
CRYPT_SizeOfKeyIdAsIssuerAndSerial
(
&
in
->
SignerId
.
KeyId
);
size
+=
rdnSize
;
}
if
(
in
->
HashAlgorithm
.
pszObjId
)
size
+=
strlen
(
in
->
HashAlgorithm
.
pszObjId
)
+
1
;
...
...
@@ -2023,6 +2071,7 @@ static BOOL CRYPT_CopySignerInfo(void *pvData, DWORD *pcbData,
LPBYTE
nextData
=
(
BYTE
*
)
pvData
+
sizeof
(
CMSG_SIGNER_INFO
);
CMSG_SIGNER_INFO
*
out
=
(
CMSG_SIGNER_INFO
*
)
pvData
;
ret
=
TRUE
;
out
->
dwVersion
=
in
->
dwVersion
;
if
(
in
->
SignerId
.
dwIdChoice
==
CERT_ID_ISSUER_SERIAL_NUMBER
)
{
...
...
@@ -2031,17 +2080,22 @@ static BOOL CRYPT_CopySignerInfo(void *pvData, DWORD *pcbData,
CRYPT_CopyBlob
(
&
out
->
SerialNumber
,
&
in
->
SignerId
.
IssuerSerialNumber
.
SerialNumber
,
&
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
;
else
ret
=
CRYPT_CopyKeyIdAsIssuerAndSerial
(
&
out
->
Issuer
,
&
out
->
SerialNumber
,
&
in
->
SignerId
.
KeyId
,
rdnSize
,
&
nextData
);
if
(
ret
)
{
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
);
}
}
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
...
...
dlls/crypt32/tests/msg.c
View file @
51b16fb8
...
...
@@ -2469,7 +2469,6 @@ static void test_decode_msg_get_param(void)
*/
size
=
0
;
ret
=
CryptMsgGetParam
(
msg
,
CMSG_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