crypt32(4/14): Move CRL functions to crl.c
Juan Lang
juan.lang at gmail.com
Wed Aug 15 18:47:13 CDT 2007
--Juan
-------------- next part --------------
From befa70f3a9865349ae1a0874400fb5a9a0b3f1c1 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Wed, 15 Aug 2007 16:32:06 -0700
Subject: [PATCH] Move CRL functions to crl.c
---
dlls/crypt32/crl.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++
dlls/crypt32/store.c | 134 --------------------------------------------------
2 files changed, 134 insertions(+), 134 deletions(-)
diff --git a/dlls/crypt32/crl.c b/dlls/crypt32/crl.c
index bc7f73e..e3c5dbf 100644
--- a/dlls/crypt32/crl.c
+++ b/dlls/crypt32/crl.c
@@ -533,3 +533,137 @@ LONG WINAPI CertVerifyCRLTimeValidity(LP
}
return ret;
}
+
+#define CrlContext_CopyProperties(to, from) \
+ Context_CopyProperties((to), (from), sizeof(CRL_CONTEXT))
+
+BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore,
+ PCCRL_CONTEXT pCrlContext, DWORD dwAddDisposition,
+ PCCRL_CONTEXT* ppStoreContext)
+{
+ PWINECRYPT_CERTSTORE store = (PWINECRYPT_CERTSTORE)hCertStore;
+ BOOL ret = TRUE;
+ PCCRL_CONTEXT toAdd = NULL, existing = NULL;
+
+ TRACE("(%p, %p, %08x, %p)\n", hCertStore, pCrlContext,
+ dwAddDisposition, ppStoreContext);
+
+ /* Weird case to pass a test */
+ if (dwAddDisposition == 0)
+ {
+ SetLastError(STATUS_ACCESS_VIOLATION);
+ return FALSE;
+ }
+ if (dwAddDisposition != CERT_STORE_ADD_ALWAYS)
+ {
+ existing = CertFindCRLInStore(hCertStore, 0, 0, CRL_FIND_EXISTING,
+ pCrlContext, NULL);
+ }
+
+ switch (dwAddDisposition)
+ {
+ case CERT_STORE_ADD_ALWAYS:
+ toAdd = CertDuplicateCRLContext(pCrlContext);
+ break;
+ case CERT_STORE_ADD_NEW:
+ if (existing)
+ {
+ TRACE("found matching CRL, not adding\n");
+ SetLastError(CRYPT_E_EXISTS);
+ ret = FALSE;
+ }
+ else
+ toAdd = CertDuplicateCRLContext(pCrlContext);
+ break;
+ case CERT_STORE_ADD_NEWER:
+ if (existing)
+ {
+ LONG newer = CompareFileTime(&existing->pCrlInfo->ThisUpdate,
+ &pCrlContext->pCrlInfo->ThisUpdate);
+
+ if (newer < 0)
+ toAdd = CertDuplicateCRLContext(pCrlContext);
+ else
+ {
+ TRACE("existing CRL is newer, not adding\n");
+ SetLastError(CRYPT_E_EXISTS);
+ ret = FALSE;
+ }
+ }
+ else
+ toAdd = CertDuplicateCRLContext(pCrlContext);
+ break;
+ case CERT_STORE_ADD_REPLACE_EXISTING:
+ toAdd = CertDuplicateCRLContext(pCrlContext);
+ break;
+ case CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES:
+ toAdd = CertDuplicateCRLContext(pCrlContext);
+ if (existing)
+ CrlContext_CopyProperties(toAdd, existing);
+ break;
+ case CERT_STORE_ADD_USE_EXISTING:
+ if (existing)
+ CrlContext_CopyProperties(existing, pCrlContext);
+ break;
+ default:
+ FIXME("Unimplemented add disposition %d\n", dwAddDisposition);
+ ret = FALSE;
+ }
+
+ if (toAdd)
+ {
+ if (store)
+ ret = store->crls.addContext(store, (void *)toAdd,
+ (void *)existing, (const void **)ppStoreContext);
+ else if (ppStoreContext)
+ *ppStoreContext = CertDuplicateCRLContext(toAdd);
+ CertFreeCRLContext(toAdd);
+ }
+ CertFreeCRLContext(existing);
+
+ TRACE("returning %d\n", ret);
+ return ret;
+}
+
+BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext)
+{
+ BOOL ret;
+
+ TRACE("(%p)\n", pCrlContext);
+
+ if (!pCrlContext)
+ ret = TRUE;
+ else if (!pCrlContext->hCertStore)
+ {
+ ret = TRUE;
+ CertFreeCRLContext(pCrlContext);
+ }
+ else
+ {
+ PWINECRYPT_CERTSTORE hcs =
+ (PWINECRYPT_CERTSTORE)pCrlContext->hCertStore;
+
+ if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
+ ret = FALSE;
+ else
+ ret = hcs->crls.deleteContext(hcs, (void *)pCrlContext);
+ CertFreeCRLContext(pCrlContext);
+ }
+ return ret;
+}
+
+PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE hCertStore,
+ PCCRL_CONTEXT pPrev)
+{
+ WINECRYPT_CERTSTORE *hcs = (WINECRYPT_CERTSTORE *)hCertStore;
+ PCCRL_CONTEXT ret;
+
+ TRACE("(%p, %p)\n", hCertStore, pPrev);
+ if (!hCertStore)
+ ret = NULL;
+ else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
+ ret = NULL;
+ else
+ ret = (PCCRL_CONTEXT)hcs->crls.enumContext(hcs, (void *)pPrev);
+ return ret;
+}
diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c
index 595d13c..3a57c06 100644
--- a/dlls/crypt32/store.c
+++ b/dlls/crypt32/store.c
@@ -2150,140 +2150,6 @@ BOOL WINAPI CertSaveStore(HCERTSTORE hCe
return TRUE;
}
-#define CrlContext_CopyProperties(to, from) \
- Context_CopyProperties((to), (from), sizeof(CRL_CONTEXT))
-
-BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore,
- PCCRL_CONTEXT pCrlContext, DWORD dwAddDisposition,
- PCCRL_CONTEXT* ppStoreContext)
-{
- PWINECRYPT_CERTSTORE store = (PWINECRYPT_CERTSTORE)hCertStore;
- BOOL ret = TRUE;
- PCCRL_CONTEXT toAdd = NULL, existing = NULL;
-
- TRACE("(%p, %p, %08x, %p)\n", hCertStore, pCrlContext,
- dwAddDisposition, ppStoreContext);
-
- /* Weird case to pass a test */
- if (dwAddDisposition == 0)
- {
- SetLastError(STATUS_ACCESS_VIOLATION);
- return FALSE;
- }
- if (dwAddDisposition != CERT_STORE_ADD_ALWAYS)
- {
- existing = CertFindCRLInStore(hCertStore, 0, 0, CRL_FIND_EXISTING,
- pCrlContext, NULL);
- }
-
- switch (dwAddDisposition)
- {
- case CERT_STORE_ADD_ALWAYS:
- toAdd = CertDuplicateCRLContext(pCrlContext);
- break;
- case CERT_STORE_ADD_NEW:
- if (existing)
- {
- TRACE("found matching CRL, not adding\n");
- SetLastError(CRYPT_E_EXISTS);
- ret = FALSE;
- }
- else
- toAdd = CertDuplicateCRLContext(pCrlContext);
- break;
- case CERT_STORE_ADD_NEWER:
- if (existing)
- {
- LONG newer = CompareFileTime(&existing->pCrlInfo->ThisUpdate,
- &pCrlContext->pCrlInfo->ThisUpdate);
-
- if (newer < 0)
- toAdd = CertDuplicateCRLContext(pCrlContext);
- else
- {
- TRACE("existing CRL is newer, not adding\n");
- SetLastError(CRYPT_E_EXISTS);
- ret = FALSE;
- }
- }
- else
- toAdd = CertDuplicateCRLContext(pCrlContext);
- break;
- case CERT_STORE_ADD_REPLACE_EXISTING:
- toAdd = CertDuplicateCRLContext(pCrlContext);
- break;
- case CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES:
- toAdd = CertDuplicateCRLContext(pCrlContext);
- if (existing)
- CrlContext_CopyProperties(toAdd, existing);
- break;
- case CERT_STORE_ADD_USE_EXISTING:
- if (existing)
- CrlContext_CopyProperties(existing, pCrlContext);
- break;
- default:
- FIXME("Unimplemented add disposition %d\n", dwAddDisposition);
- ret = FALSE;
- }
-
- if (toAdd)
- {
- if (store)
- ret = store->crls.addContext(store, (void *)toAdd,
- (void *)existing, (const void **)ppStoreContext);
- else if (ppStoreContext)
- *ppStoreContext = CertDuplicateCRLContext(toAdd);
- CertFreeCRLContext(toAdd);
- }
- CertFreeCRLContext(existing);
-
- TRACE("returning %d\n", ret);
- return ret;
-}
-
-BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext)
-{
- BOOL ret;
-
- TRACE("(%p)\n", pCrlContext);
-
- if (!pCrlContext)
- ret = TRUE;
- else if (!pCrlContext->hCertStore)
- {
- ret = TRUE;
- CertFreeCRLContext(pCrlContext);
- }
- else
- {
- PWINECRYPT_CERTSTORE hcs =
- (PWINECRYPT_CERTSTORE)pCrlContext->hCertStore;
-
- if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
- ret = FALSE;
- else
- ret = hcs->crls.deleteContext(hcs, (void *)pCrlContext);
- CertFreeCRLContext(pCrlContext);
- }
- return ret;
-}
-
-PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE hCertStore,
- PCCRL_CONTEXT pPrev)
-{
- WINECRYPT_CERTSTORE *hcs = (WINECRYPT_CERTSTORE *)hCertStore;
- PCCRL_CONTEXT ret;
-
- TRACE("(%p, %p)\n", hCertStore, pPrev);
- if (!hCertStore)
- ret = NULL;
- else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
- ret = NULL;
- else
- ret = (PCCRL_CONTEXT)hcs->crls.enumContext(hcs, (void *)pPrev);
- return ret;
-}
-
PCCTL_CONTEXT WINAPI CertCreateCTLContext(DWORD dwCertEncodingType,
const BYTE* pbCtlEncoded, DWORD cbCtlEncoded)
{
--
1.4.1
More information about the wine-patches
mailing list