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
7b029776
Commit
7b029776
authored
Oct 28, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Oct 30, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Use a helper function to find an existing cert by hash.
parent
77472187
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
24 deletions
+21
-24
chain.c
dlls/crypt32/chain.c
+21
-24
No files found.
dlls/crypt32/chain.c
View file @
7b029776
...
@@ -69,6 +69,24 @@ static inline void CRYPT_CloseStores(DWORD cStores, HCERTSTORE *stores)
...
@@ -69,6 +69,24 @@ static inline void CRYPT_CloseStores(DWORD cStores, HCERTSTORE *stores)
static
const
WCHAR
rootW
[]
=
{
'R'
,
'o'
,
'o'
,
't'
,
0
};
static
const
WCHAR
rootW
[]
=
{
'R'
,
'o'
,
'o'
,
't'
,
0
};
/* Finds cert in store by comparing the cert's hashes. */
static
PCCERT_CONTEXT
CRYPT_FindCertInStore
(
HCERTSTORE
store
,
PCCERT_CONTEXT
cert
)
{
PCCERT_CONTEXT
matching
=
NULL
;
BYTE
hash
[
20
];
DWORD
size
=
sizeof
(
hash
);
if
(
CertGetCertificateContextProperty
(
cert
,
CERT_HASH_PROP_ID
,
hash
,
&
size
))
{
CRYPT_HASH_BLOB
blob
=
{
sizeof
(
hash
),
hash
};
matching
=
CertFindCertificateInStore
(
store
,
cert
->
dwCertEncodingType
,
0
,
CERT_FIND_SHA1_HASH
,
&
blob
,
NULL
);
}
return
matching
;
}
static
BOOL
CRYPT_CheckRestrictedRoot
(
HCERTSTORE
store
)
static
BOOL
CRYPT_CheckRestrictedRoot
(
HCERTSTORE
store
)
{
{
BOOL
ret
=
TRUE
;
BOOL
ret
=
TRUE
;
...
@@ -77,30 +95,16 @@ static BOOL CRYPT_CheckRestrictedRoot(HCERTSTORE store)
...
@@ -77,30 +95,16 @@ static BOOL CRYPT_CheckRestrictedRoot(HCERTSTORE store)
{
{
HCERTSTORE
rootStore
=
CertOpenSystemStoreW
(
0
,
rootW
);
HCERTSTORE
rootStore
=
CertOpenSystemStoreW
(
0
,
rootW
);
PCCERT_CONTEXT
cert
=
NULL
,
check
;
PCCERT_CONTEXT
cert
=
NULL
,
check
;
BYTE
hash
[
20
];
DWORD
size
;
do
{
do
{
cert
=
CertEnumCertificatesInStore
(
store
,
cert
);
cert
=
CertEnumCertificatesInStore
(
store
,
cert
);
if
(
cert
)
if
(
cert
)
{
{
size
=
sizeof
(
hash
);
if
(
!
(
check
=
CRYPT_FindCertInStore
(
rootStore
,
cert
)))
ret
=
CertGetCertificateContextProperty
(
cert
,
CERT_HASH_PROP_ID
,
hash
,
&
size
);
if
(
ret
)
{
CRYPT_HASH_BLOB
blob
=
{
sizeof
(
hash
),
hash
};
check
=
CertFindCertificateInStore
(
rootStore
,
cert
->
dwCertEncodingType
,
0
,
CERT_FIND_SHA1_HASH
,
&
blob
,
NULL
);
if
(
!
check
)
ret
=
FALSE
;
ret
=
FALSE
;
else
else
CertFreeCertificateContext
(
check
);
CertFreeCertificateContext
(
check
);
}
}
}
}
while
(
ret
&&
cert
);
}
while
(
ret
&&
cert
);
if
(
cert
)
if
(
cert
)
CertFreeCertificateContext
(
cert
);
CertFreeCertificateContext
(
cert
);
...
@@ -336,16 +340,9 @@ static void CRYPT_FreeSimpleChain(PCERT_SIMPLE_CHAIN chain)
...
@@ -336,16 +340,9 @@ static void CRYPT_FreeSimpleChain(PCERT_SIMPLE_CHAIN chain)
static
void
CRYPT_CheckTrustedStatus
(
HCERTSTORE
hRoot
,
static
void
CRYPT_CheckTrustedStatus
(
HCERTSTORE
hRoot
,
PCERT_CHAIN_ELEMENT
rootElement
)
PCERT_CHAIN_ELEMENT
rootElement
)
{
{
BYTE
hash
[
20
];
PCCERT_CONTEXT
trustedRoot
=
CRYPT_FindCertInStore
(
hRoot
,
DWORD
size
=
sizeof
(
hash
);
rootElement
->
pCertContext
);
CRYPT_HASH_BLOB
blob
=
{
sizeof
(
hash
),
hash
};
PCCERT_CONTEXT
trustedRoot
;
CertGetCertificateContextProperty
(
rootElement
->
pCertContext
,
CERT_HASH_PROP_ID
,
hash
,
&
size
);
trustedRoot
=
CertFindCertificateInStore
(
hRoot
,
rootElement
->
pCertContext
->
dwCertEncodingType
,
0
,
CERT_FIND_SHA1_HASH
,
&
blob
,
NULL
);
if
(
!
trustedRoot
)
if
(
!
trustedRoot
)
rootElement
->
TrustStatus
.
dwErrorStatus
|=
rootElement
->
TrustStatus
.
dwErrorStatus
|=
CERT_TRUST_IS_UNTRUSTED_ROOT
;
CERT_TRUST_IS_UNTRUSTED_ROOT
;
...
...
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