Juan Lang : crypt32: Implement CertVerifyRevocation.
Alexandre Julliard
julliard at winehq.org
Wed Oct 24 11:04:40 CDT 2007
Module: wine
Branch: master
Commit: 5928c698ae57f6db41b1b0b1bbf3ecf2ac1c5cd4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5928c698ae57f6db41b1b0b1bbf3ecf2ac1c5cd4
Author: Juan Lang <juan.lang at gmail.com>
Date: Tue Oct 23 12:59:43 2007 -0700
crypt32: Implement CertVerifyRevocation.
---
dlls/crypt32/cert.c | 77 +++++++++++++++++++++++++++++++++++++++++++-
dlls/crypt32/tests/cert.c | 6 ---
2 files changed, 75 insertions(+), 8 deletions(-)
diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index a95c2a5..976589b 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -1231,13 +1231,86 @@ PCCERT_CONTEXT WINAPI CertGetIssuerCertificateFromStore(HCERTSTORE hCertStore,
return ret;
}
+typedef struct _OLD_CERT_REVOCATION_STATUS {
+ DWORD cbSize;
+ DWORD dwIndex;
+ DWORD dwError;
+ DWORD dwReason;
+} OLD_CERT_REVOCATION_STATUS, *POLD_CERT_REVOCATION_STATUS;
+
+typedef BOOL (WINAPI *CertVerifyRevocationFunc)(DWORD, DWORD, DWORD,
+ void **, DWORD, PCERT_REVOCATION_PARA, PCERT_REVOCATION_STATUS);
+
BOOL WINAPI CertVerifyRevocation(DWORD dwEncodingType, DWORD dwRevType,
DWORD cContext, void *rgpvContext[], DWORD dwFlags,
PCERT_REVOCATION_PARA pRevPara, PCERT_REVOCATION_STATUS pRevStatus)
{
- FIXME("(%08x, %d, %d, %p, %08x, %p, %p): stub\n", dwEncodingType, dwRevType,
+ BOOL ret;
+
+ TRACE("(%08x, %d, %d, %p, %08x, %p, %p)\n", dwEncodingType, dwRevType,
cContext, rgpvContext, dwFlags, pRevPara, pRevStatus);
- return FALSE;
+
+ if (pRevStatus->cbSize != sizeof(OLD_CERT_REVOCATION_STATUS) &&
+ pRevStatus->cbSize != sizeof(CERT_REVOCATION_STATUS))
+ {
+ SetLastError(E_INVALIDARG);
+ return FALSE;
+ }
+ if (cContext)
+ {
+ static HCRYPTOIDFUNCSET set = NULL;
+ DWORD size;
+
+ if (!set)
+ set = CryptInitOIDFunctionSet(CRYPT_OID_VERIFY_REVOCATION_FUNC, 0);
+ ret = CryptGetDefaultOIDDllList(set, dwEncodingType, NULL, &size);
+ if (ret)
+ {
+ if (size == 1)
+ {
+ /* empty list */
+ SetLastError(CRYPT_E_NO_REVOCATION_DLL);
+ ret = FALSE;
+ }
+ else
+ {
+ LPWSTR dllList = CryptMemAlloc(size * sizeof(WCHAR)), ptr;
+
+ if (dllList)
+ {
+ ret = CryptGetDefaultOIDDllList(set, dwEncodingType,
+ dllList, &size);
+ if (ret)
+ {
+ for (ptr = dllList; ret && *ptr;
+ ptr += lstrlenW(ptr) + 1)
+ {
+ CertVerifyRevocationFunc func;
+ HCRYPTOIDFUNCADDR hFunc;
+
+ ret = CryptGetDefaultOIDFunctionAddress(set,
+ dwEncodingType, ptr, 0, (void **)&func, &hFunc);
+ if (ret)
+ {
+ ret = func(dwEncodingType, dwRevType, cContext,
+ rgpvContext, dwFlags, pRevPara, pRevStatus);
+ CryptFreeOIDFunctionAddress(hFunc, 0);
+ }
+ }
+ }
+ CryptMemFree(dllList);
+ }
+ else
+ {
+ SetLastError(ERROR_OUTOFMEMORY);
+ ret = FALSE;
+ }
+ }
+ }
+ }
+ else
+ ret = TRUE;
+ return ret;
}
PCRYPT_ATTRIBUTE WINAPI CertFindAttribute(LPCSTR pszObjId, DWORD cAttr,
diff --git a/dlls/crypt32/tests/cert.c b/dlls/crypt32/tests/cert.c
index 3bea543..3c6aaa4 100644
--- a/dlls/crypt32/tests/cert.c
+++ b/dlls/crypt32/tests/cert.c
@@ -2587,27 +2587,21 @@ static void testVerifyRevocation(void)
*/
SetLastError(0xdeadbeef);
ret = CertVerifyRevocation(0, 0, 0, NULL, 0, NULL, &status);
- todo_wine
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
status.cbSize = sizeof(status);
ret = CertVerifyRevocation(0, 0, 0, NULL, 0, NULL, &status);
- todo_wine
ok(ret, "CertVerifyRevocation failed: %08x\n", GetLastError());
ret = CertVerifyRevocation(0, 2, 0, NULL, 0, NULL, &status);
- todo_wine
ok(ret, "CertVerifyRevocation failed: %08x\n", GetLastError());
ret = CertVerifyRevocation(2, 0, 0, NULL, 0, NULL, &status);
- todo_wine
ok(ret, "CertVerifyRevocation failed: %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CertVerifyRevocation(0, 0, 1, (void **)&cert, 0, NULL, &status);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_NO_REVOCATION_DLL,
"Expected CRYPT_E_NO_REVOCATION_DLL, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CertVerifyRevocation(0, 2, 1, (void **)&cert, 0, NULL, &status);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_NO_REVOCATION_DLL,
"Expected CRYPT_E_NO_REVOCATION_DLL, got %08x\n", GetLastError());
More information about the wine-cvs
mailing list