Juan Lang : crypt32:
Make a helper function to create initial candidate chain.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Sep 10 10:17:58 CDT 2007
Module: wine
Branch: master
Commit: 1a059879bf0d0df531646238c676daedfde329b9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1a059879bf0d0df531646238c676daedfde329b9
Author: Juan Lang <juan.lang at gmail.com>
Date: Thu Sep 6 09:57:29 2007 -0700
crypt32: Make a helper function to create initial candidate chain.
---
dlls/crypt32/chain.c | 64 +++++++++++++++++++++++++++++++------------------
1 files changed, 40 insertions(+), 24 deletions(-)
diff --git a/dlls/crypt32/chain.c b/dlls/crypt32/chain.c
index 7efe0c7..9652d61 100644
--- a/dlls/crypt32/chain.c
+++ b/dlls/crypt32/chain.c
@@ -569,6 +569,42 @@ static BOOL CRYPT_BuildSimpleChain(HCERTCHAINENGINE hChainEngine,
return ret;
}
+static BOOL CRYPT_BuildCandidateChainFromCert(HCERTCHAINENGINE hChainEngine,
+ PCCERT_CONTEXT pCertContext, LPFILETIME pTime, HCERTSTORE hAdditionalStore,
+ PCertificateChain *ppChain)
+{
+ PCERT_SIMPLE_CHAIN simpleChain = NULL;
+ BOOL ret;
+
+ /* FIXME: only simple chains are supported for now, as CTLs aren't
+ * supported yet.
+ */
+ if ((ret = CRYPT_BuildSimpleChain(hChainEngine, pCertContext, pTime,
+ hAdditionalStore, &simpleChain)))
+ {
+ PCertificateChain chain = CryptMemAlloc(sizeof(CertificateChain));
+
+ if (chain)
+ {
+ chain->ref = 1;
+ chain->context.cbSize = sizeof(CERT_CHAIN_CONTEXT);
+ memcpy(&chain->context.TrustStatus, &simpleChain->TrustStatus,
+ sizeof(CERT_TRUST_STATUS));
+ chain->context.cChain = 1;
+ chain->context.rgpChain = CryptMemAlloc(sizeof(PCERT_SIMPLE_CHAIN));
+ chain->context.rgpChain[0] = simpleChain;
+ chain->context.cLowerQualityChainContext = 0;
+ chain->context.rgpLowerQualityChainContext = NULL;
+ chain->context.fHasRevocationFreshnessTime = FALSE;
+ chain->context.dwRevocationFreshnessTime = 0;
+ }
+ else
+ ret = FALSE;
+ *ppChain = chain;
+ }
+ return ret;
+}
+
typedef struct _CERT_CHAIN_PARA_NO_EXTRA_FIELDS {
DWORD cbSize;
CERT_USAGE_MATCH RequestedUsage;
@@ -588,8 +624,8 @@ BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE hChainEngine,
PCERT_CHAIN_PARA pChainPara, DWORD dwFlags, LPVOID pvReserved,
PCCERT_CHAIN_CONTEXT* ppChainContext)
{
- PCERT_SIMPLE_CHAIN simpleChain = NULL;
BOOL ret;
+ PCertificateChain chain;
TRACE("(%p, %p, %p, %p, %p, %08x, %p, %p)\n", hChainEngine, pCertContext,
pTime, hAdditionalStore, pChainPara, dwFlags, pvReserved, ppChainContext);
@@ -605,30 +641,10 @@ BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE hChainEngine,
hChainEngine = CRYPT_GetDefaultChainEngine();
/* FIXME: what about HCCE_LOCAL_MACHINE? */
/* FIXME: pChainPara is for now ignored */
- /* FIXME: only simple chains are supported for now, as CTLs aren't
- * supported yet.
- */
- if ((ret = CRYPT_BuildSimpleChain(hChainEngine, pCertContext, pTime,
- hAdditionalStore, &simpleChain)))
+ ret = CRYPT_BuildCandidateChainFromCert(hChainEngine, pCertContext, pTime,
+ hAdditionalStore, &chain);
+ if (ret)
{
- PCertificateChain chain = CryptMemAlloc(sizeof(CertificateChain));
-
- if (chain)
- {
- chain->ref = 1;
- chain->context.cbSize = sizeof(CERT_CHAIN_CONTEXT);
- memcpy(&chain->context.TrustStatus, &simpleChain->TrustStatus,
- sizeof(CERT_TRUST_STATUS));
- chain->context.cChain = 1;
- chain->context.rgpChain = CryptMemAlloc(sizeof(PCERT_SIMPLE_CHAIN));
- chain->context.rgpChain[0] = simpleChain;
- chain->context.cLowerQualityChainContext = 0;
- chain->context.rgpLowerQualityChainContext = NULL;
- chain->context.fHasRevocationFreshnessTime = FALSE;
- chain->context.dwRevocationFreshnessTime = 0;
- }
- else
- ret = FALSE;
if (ppChainContext)
*ppChainContext = (PCCERT_CHAIN_CONTEXT)chain;
else
More information about the wine-cvs
mailing list