Commit 5928c698 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Implement CertVerifyRevocation.

parent 3b85a794
......@@ -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,
......
......@@ -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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment