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
bf5e4d9b
Commit
bf5e4d9b
authored
Nov 06, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Nov 09, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement encoding cert policy mappings.
parent
fba863dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
2 deletions
+86
-2
encode.c
dlls/crypt32/encode.c
+86
-0
encode.c
dlls/crypt32/tests/encode.c
+0
-2
No files found.
dlls/crypt32/encode.c
View file @
bf5e4d9b
...
...
@@ -2969,6 +2969,85 @@ static BOOL WINAPI CRYPT_AsnEncodeCertPolicies(DWORD dwCertEncodingType,
return
ret
;
}
static
BOOL
CRYPT_AsnEncodeCertPolicyMapping
(
DWORD
dwCertEncodingType
,
const
CERT_POLICY_MAPPING
*
mapping
,
DWORD
dwFlags
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
{
struct
AsnEncodeSequenceItem
items
[]
=
{
{
mapping
->
pszIssuerDomainPolicy
,
CRYPT_AsnEncodeOid
,
0
},
{
mapping
->
pszSubjectDomainPolicy
,
CRYPT_AsnEncodeOid
,
0
},
};
if
(
!
mapping
->
pszIssuerDomainPolicy
||
!
mapping
->
pszSubjectDomainPolicy
)
{
SetLastError
(
E_INVALIDARG
);
return
FALSE
;
}
return
CRYPT_AsnEncodeSequence
(
dwCertEncodingType
,
items
,
sizeof
(
items
)
/
sizeof
(
items
[
0
]),
dwFlags
,
NULL
,
pbEncoded
,
pcbEncoded
);
}
static
BOOL
WINAPI
CRYPT_AsnEncodeCertPolicyMappings
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
DWORD
dwFlags
,
PCRYPT_ENCODE_PARA
pEncodePara
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
{
BOOL
ret
=
FALSE
;
__TRY
{
const
CERT_POLICY_MAPPINGS_INFO
*
info
=
pvStructInfo
;
DWORD
bytesNeeded
=
0
,
lenBytes
,
size
,
i
;
ret
=
TRUE
;
for
(
i
=
0
;
ret
&&
i
<
info
->
cPolicyMapping
;
i
++
)
{
ret
=
CRYPT_AsnEncodeCertPolicyMapping
(
dwCertEncodingType
,
&
info
->
rgPolicyMapping
[
i
],
dwFlags
&
~
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
size
);
if
(
ret
)
bytesNeeded
+=
size
;
}
CRYPT_EncodeLen
(
bytesNeeded
,
NULL
,
&
lenBytes
);
bytesNeeded
+=
1
+
lenBytes
;
if
(
ret
)
{
if
(
!
pbEncoded
)
*
pcbEncoded
=
bytesNeeded
;
else
{
if
((
ret
=
CRYPT_EncodeEnsureSpace
(
dwFlags
,
pEncodePara
,
pbEncoded
,
pcbEncoded
,
bytesNeeded
)))
{
if
(
dwFlags
&
CRYPT_ENCODE_ALLOC_FLAG
)
pbEncoded
=
*
(
BYTE
**
)
pbEncoded
;
*
pbEncoded
++
=
ASN_SEQUENCEOF
;
CRYPT_EncodeLen
(
bytesNeeded
-
lenBytes
-
1
,
pbEncoded
,
&
lenBytes
);
pbEncoded
+=
lenBytes
;
for
(
i
=
0
;
ret
&&
i
<
info
->
cPolicyMapping
;
i
++
)
{
size
=
bytesNeeded
;
ret
=
CRYPT_AsnEncodeCertPolicyMapping
(
dwCertEncodingType
,
&
info
->
rgPolicyMapping
[
i
],
dwFlags
&
~
CRYPT_ENCODE_ALLOC_FLAG
,
pbEncoded
,
&
size
);
if
(
ret
)
{
pbEncoded
+=
size
;
bytesNeeded
-=
size
;
}
}
}
}
}
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
STATUS_ACCESS_VIOLATION
);
}
__ENDTRY
return
ret
;
}
static
BOOL
WINAPI
CRYPT_AsnEncodeRsaPubKey
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
DWORD
dwFlags
,
PCRYPT_ENCODE_PARA
pEncodePara
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
...
...
@@ -4331,6 +4410,9 @@ static CryptEncodeObjectExFunc CRYPT_GetBuiltinEncoder(DWORD dwCertEncodingType,
case
LOWORD
(
X509_NAME_CONSTRAINTS
):
encodeFunc
=
CRYPT_AsnEncodeNameConstraints
;
break
;
case
LOWORD
(
X509_POLICY_MAPPINGS
):
encodeFunc
=
CRYPT_AsnEncodeCertPolicyMappings
;
break
;
case
LOWORD
(
PKCS7_SIGNER_INFO
):
encodeFunc
=
CRYPT_AsnEncodePKCSSignerInfo
;
break
;
...
...
@@ -4347,6 +4429,8 @@ static CryptEncodeObjectExFunc CRYPT_GetBuiltinEncoder(DWORD dwCertEncodingType,
encodeFunc
=
CRYPT_AsnEncodeUtcTime
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_AUTHORITY_KEY_IDENTIFIER
))
encodeFunc
=
CRYPT_AsnEncodeAuthorityKeyId
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_LEGACY_POLICY_MAPPINGS
))
encodeFunc
=
CRYPT_AsnEncodeCertPolicyMappings
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_AUTHORITY_KEY_IDENTIFIER2
))
encodeFunc
=
CRYPT_AsnEncodeAuthorityKeyId2
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_CRL_REASON_CODE
))
...
...
@@ -4373,6 +4457,8 @@ static CryptEncodeObjectExFunc CRYPT_GetBuiltinEncoder(DWORD dwCertEncodingType,
encodeFunc
=
CRYPT_AsnEncodeCRLDistPoints
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_CERT_POLICIES
))
encodeFunc
=
CRYPT_AsnEncodeCertPolicies
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_POLICY_MAPPINGS
))
encodeFunc
=
CRYPT_AsnEncodeCertPolicyMappings
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_ENHANCED_KEY_USAGE
))
encodeFunc
=
CRYPT_AsnEncodeEnhancedKeyUsage
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_ISSUING_DIST_POINT
))
...
...
dlls/crypt32/tests/encode.c
View file @
bf5e4d9b
...
...
@@ -7447,7 +7447,6 @@ static void test_encodeCertPolicyMappings(DWORD dwEncoding)
/* Each of the mapping OIDs is equivalent, so check with all of them */
for
(
i
=
0
;
i
<
sizeof
(
mappingOids
)
/
sizeof
(
mappingOids
[
0
]);
i
++
)
{
todo_wine
{
memset
(
&
info
,
0
,
sizeof
(
info
));
ret
=
pCryptEncodeObjectEx
(
dwEncoding
,
mappingOids
[
i
],
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
...
...
@@ -7495,7 +7494,6 @@ static void test_encodeCertPolicyMappings(DWORD dwEncoding)
"unexpected value
\n
"
);
LocalFree
(
buf
);
}
}
}
}
...
...
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