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
6f35ae25
Commit
6f35ae25
authored
Nov 17, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Nov 18, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Use helper function to compare a subject alternate name with name constraints.
parent
a98dad4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
39 deletions
+44
-39
chain.c
dlls/crypt32/chain.c
+44
-39
No files found.
dlls/crypt32/chain.c
View file @
6f35ae25
...
...
@@ -823,53 +823,58 @@ static inline PCERT_EXTENSION get_subject_alt_name_ext(const CERT_INFO *cert)
return
ext
;
}
static
void
CRYPT_CheckNameConstraints
(
const
CERT_NAME_CONSTRAINTS_INFO
*
nameConstraints
,
const
CERT_INFO
*
cert
,
DWORD
*
trustErrorStatus
)
static
void
compare_alt_name_with_constraints
(
const
CERT_EXTENSION
*
altNameExt
,
const
CERT_NAME_CONSTRAINTS_INFO
*
nameConstraints
,
DWORD
*
trustErrorStatus
)
{
CERT_EXTENSION
*
ext
=
get_subject_alt_name_ext
(
cert
);
CERT_ALT_NAME_INFO
*
subjectAltName
;
DWORD
size
;
if
(
ext
)
if
(
CryptDecodeObjectEx
(
X509_ASN_ENCODING
,
X509_ALTERNATE_NAME
,
altNameExt
->
Value
.
pbData
,
altNameExt
->
Value
.
cbData
,
CRYPT_DECODE_ALLOC_FLAG
|
CRYPT_DECODE_NOCOPY_FLAG
,
NULL
,
&
subjectAltName
,
&
size
))
{
CERT_ALT_NAME_INFO
*
subjectName
;
DWORD
size
;
DWORD
i
;
if
(
CryptDecodeObjectEx
(
X509_ASN_ENCODING
,
X509_ALTERNATE_NAME
,
ext
->
Value
.
pbData
,
ext
->
Value
.
cbData
,
CRYPT_DECODE_ALLOC_FLAG
|
CRYPT_DECODE_NOCOPY_FLAG
,
NULL
,
&
subjectName
,
&
size
))
for
(
i
=
0
;
i
<
subjectAltName
->
cAltEntry
;
i
++
)
{
DWORD
i
;
for
(
i
=
0
;
i
<
subjectName
->
cAltEntry
;
i
++
)
{
BOOL
nameFormPresent
;
/* A name constraint only applies if the name form is present.
* From RFC 5280, section 4.2.1.10:
* "Restrictions apply only when the specified name form is
* present. If no name of the type is in the certificate,
* the certificate is acceptable."
*/
if
(
alt_name_matches_excluded_name
(
&
subjectName
->
rgAltEntry
[
i
],
nameConstraints
,
trustErrorStatus
))
*
trustErrorStatus
|=
CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT
;
nameFormPresent
=
FALSE
;
if
(
!
alt_name_matches_permitted_name
(
&
subjectName
->
rgAltEntry
[
i
],
nameConstraints
,
trustErrorStatus
,
&
nameFormPresent
)
&&
nameFormPresent
)
*
trustErrorStatus
|=
CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT
;
}
LocalFree
(
subjectName
);
BOOL
nameFormPresent
;
/* A name constraint only applies if the name form is present.
* From RFC 5280, section 4.2.1.10:
* "Restrictions apply only when the specified name form is
* present. If no name of the type is in the certificate,
* the certificate is acceptable."
*/
if
(
alt_name_matches_excluded_name
(
&
subjectAltName
->
rgAltEntry
[
i
],
nameConstraints
,
trustErrorStatus
))
*
trustErrorStatus
|=
CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT
;
nameFormPresent
=
FALSE
;
if
(
!
alt_name_matches_permitted_name
(
&
subjectAltName
->
rgAltEntry
[
i
],
nameConstraints
,
trustErrorStatus
,
&
nameFormPresent
)
&&
nameFormPresent
)
*
trustErrorStatus
|=
CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT
;
}
else
*
trustErrorStatus
|=
CERT_TRUST_INVALID_EXTENSION
|
CERT_TRUST_INVALID_NAME_CONSTRAINTS
;
LocalFree
(
subjectAltName
);
}
else
*
trustErrorStatus
|=
CERT_TRUST_INVALID_EXTENSION
|
CERT_TRUST_INVALID_NAME_CONSTRAINTS
;
}
static
void
CRYPT_CheckNameConstraints
(
const
CERT_NAME_CONSTRAINTS_INFO
*
nameConstraints
,
const
CERT_INFO
*
cert
,
DWORD
*
trustErrorStatus
)
{
CERT_EXTENSION
*
ext
=
get_subject_alt_name_ext
(
cert
);
if
(
ext
)
compare_alt_name_with_constraints
(
ext
,
nameConstraints
,
trustErrorStatus
);
else
{
if
(
nameConstraints
->
cPermittedSubtree
)
*
trustErrorStatus
|=
...
...
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