crypt32: Add special case for certificates with no signature algorithm.
This commit is contained in:
parent
d82f3f37a2
commit
5b02947937
|
@ -651,6 +651,11 @@ BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE hChainEngine,
|
||||||
SetLastError(E_INVALIDARG);
|
SetLastError(E_INVALIDARG);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
if (!pCertContext->pCertInfo->SignatureAlgorithm.pszObjId)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_DATA);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
if (!hChainEngine)
|
if (!hChainEngine)
|
||||||
hChainEngine = CRYPT_GetDefaultChainEngine();
|
hChainEngine = CRYPT_GetDefaultChainEngine();
|
||||||
/* FIXME: what about HCCE_LOCAL_MACHINE? */
|
/* FIXME: what about HCCE_LOCAL_MACHINE? */
|
||||||
|
|
|
@ -1668,13 +1668,17 @@ static void testGetCertChain(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Tests with an invalid cert (one whose signature is bad) */
|
/* Tests with an invalid cert (one whose signature is bad) */
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
ret = CertGetCertificateChain(NULL, cert, NULL, NULL, ¶, 0, NULL,
|
ret = CertGetCertificateChain(NULL, cert, NULL, NULL, ¶, 0, NULL,
|
||||||
&chain);
|
&chain);
|
||||||
ok(!ret, "Expected failure\n");
|
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
|
||||||
|
"Expected ERROR_INVALID_DATA, got %d\n", GetLastError());
|
||||||
para.cbSize = sizeof(para);
|
para.cbSize = sizeof(para);
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
ret = CertGetCertificateChain(NULL, cert, NULL, NULL, ¶, 0, NULL,
|
ret = CertGetCertificateChain(NULL, cert, NULL, NULL, ¶, 0, NULL,
|
||||||
&chain);
|
&chain);
|
||||||
ok(!ret, "Expected failure\n");
|
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
|
||||||
|
"Expected ERROR_INVALID_DATA, got %d\n", GetLastError());
|
||||||
CertFreeCertificateContext(cert);
|
CertFreeCertificateContext(cert);
|
||||||
|
|
||||||
for (i = 0; i < sizeof(chainCheck) / sizeof(chainCheck[0]); i++)
|
for (i = 0; i < sizeof(chainCheck) / sizeof(chainCheck[0]); i++)
|
||||||
|
|
Loading…
Reference in New Issue