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
c4e07a5b
Commit
c4e07a5b
authored
Sep 06, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Sep 10, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Separate allocating a simple chain and checking it from building it.
parent
a82b36ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
22 deletions
+36
-22
chain.c
dlls/crypt32/chain.c
+36
-22
No files found.
dlls/crypt32/chain.c
View file @
c4e07a5b
...
...
@@ -515,15 +515,43 @@ static BOOL CRYPT_CheckSimpleChain(PCertificateChainEngine engine,
return
ret
;
}
static
BOOL
CRYPT_BuildSimpleChain
(
HCERTCHAINENGINE
hChainEngine
,
/* Builds a simple chain by finding an issuer for the last cert in the chain,
* until reaching a self-signed cert, or until no issuer can be found.
*/
static
BOOL
CRYPT_BuildSimpleChain
(
PCertificateChainEngine
engine
,
HCERTSTORE
world
,
PCERT_SIMPLE_CHAIN
chain
)
{
BOOL
ret
=
TRUE
;
PCCERT_CONTEXT
cert
=
chain
->
rgpElement
[
chain
->
cElement
-
1
]
->
pCertContext
;
while
(
ret
&&
!
CRYPT_IsSimpleChainCyclic
(
chain
)
&&
!
CRYPT_IsCertificateSelfSigned
(
cert
))
{
DWORD
flags
;
PCCERT_CONTEXT
issuer
=
CRYPT_GetIssuerFromStore
(
world
,
cert
,
&
flags
);
if
(
issuer
)
{
ret
=
CRYPT_AddCertToSimpleChain
(
engine
,
chain
,
issuer
,
flags
);
cert
=
issuer
;
}
else
{
TRACE
(
"Couldn't find issuer, halting chain creation
\n
"
);
break
;
}
}
return
ret
;
}
static
BOOL
CRYPT_GetSimpleChainForCert
(
PCertificateChainEngine
engine
,
HCERTSTORE
world
,
PCCERT_CONTEXT
cert
,
LPFILETIME
pTime
,
PCERT_SIMPLE_CHAIN
*
ppChain
)
{
BOOL
ret
=
FALSE
;
PCertificateChainEngine
engine
=
(
PCertificateChainEngine
)
hChainEngine
;
PCERT_SIMPLE_CHAIN
chain
;
TRACE
(
"(%p, %p, %p, %p)
\n
"
,
hChainE
ngine
,
world
,
cert
,
pTime
);
TRACE
(
"(%p, %p, %p, %p)
\n
"
,
e
ngine
,
world
,
cert
,
pTime
);
chain
=
CryptMemAlloc
(
sizeof
(
CERT_SIMPLE_CHAIN
));
if
(
chain
)
...
...
@@ -531,26 +559,12 @@ static BOOL CRYPT_BuildSimpleChain(HCERTCHAINENGINE hChainEngine,
memset
(
chain
,
0
,
sizeof
(
CERT_SIMPLE_CHAIN
));
chain
->
cbSize
=
sizeof
(
CERT_SIMPLE_CHAIN
);
ret
=
CRYPT_AddCertToSimpleChain
(
engine
,
chain
,
cert
,
0
);
while
(
ret
&&
!
CRYPT_IsSimpleChainCyclic
(
chain
)
&&
!
CRYPT_IsCertificateSelfSigned
(
cert
))
if
(
ret
)
{
DWORD
flags
;
PCCERT_CONTEXT
issuer
=
CRYPT_GetIssuerFromStore
(
world
,
cert
,
&
flags
);
if
(
issuer
)
{
ret
=
CRYPT_AddCertToSimpleChain
(
engine
,
chain
,
issuer
,
flags
);
cert
=
issuer
;
}
else
{
TRACE
(
"Couldn't find issuer, halting chain creation
\n
"
);
break
;
}
ret
=
CRYPT_BuildSimpleChain
(
engine
,
world
,
chain
);
if
(
ret
)
ret
=
CRYPT_CheckSimpleChain
(
engine
,
chain
,
pTime
);
}
if
(
ret
)
ret
=
CRYPT_CheckSimpleChain
(
engine
,
chain
,
pTime
);
if
(
!
ret
)
{
CRYPT_FreeSimpleChain
(
chain
);
...
...
@@ -578,7 +592,7 @@ static BOOL CRYPT_BuildCandidateChainFromCert(HCERTCHAINENGINE hChainEngine,
/* FIXME: only simple chains are supported for now, as CTLs aren't
* supported yet.
*/
if
((
ret
=
CRYPT_
BuildSimpleChain
(
hChainE
ngine
,
world
,
cert
,
pTime
,
if
((
ret
=
CRYPT_
GetSimpleChainForCert
(
e
ngine
,
world
,
cert
,
pTime
,
&
simpleChain
)))
{
PCertificateChain
chain
=
CryptMemAlloc
(
sizeof
(
CertificateChain
));
...
...
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