Commit 5b029479 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Add special case for certificates with no signature algorithm.

parent d82f3f37
......@@ -651,6 +651,11 @@ BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE hChainEngine,
SetLastError(E_INVALIDARG);
return FALSE;
}
if (!pCertContext->pCertInfo->SignatureAlgorithm.pszObjId)
{
SetLastError(ERROR_INVALID_DATA);
return FALSE;
}
if (!hChainEngine)
hChainEngine = CRYPT_GetDefaultChainEngine();
/* FIXME: what about HCCE_LOCAL_MACHINE? */
......
......@@ -1668,13 +1668,17 @@ static void testGetCertChain(void)
*/
/* Tests with an invalid cert (one whose signature is bad) */
SetLastError(0xdeadbeef);
ret = CertGetCertificateChain(NULL, cert, NULL, NULL, &para, 0, NULL,
&chain);
ok(!ret, "Expected failure\n");
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %d\n", GetLastError());
para.cbSize = sizeof(para);
SetLastError(0xdeadbeef);
ret = CertGetCertificateChain(NULL, cert, NULL, NULL, &para, 0, NULL,
&chain);
ok(!ret, "Expected failure\n");
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %d\n", GetLastError());
CertFreeCertificateContext(cert);
for (i = 0; i < sizeof(chainCheck) / sizeof(chainCheck[0]); i++)
......
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