crypt32(12/17): Add special case for certificates with no signature
algorithm
Juan Lang
juan.lang at gmail.com
Thu Sep 6 12:08:53 CDT 2007
--Juan
-------------- next part --------------
From dc0445d2ff9af56ee988c0fe14bdc7109241e4c7 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Thu, 6 Sep 2007 10:00:59 -0700
Subject: [PATCH] Add special case for certificates with no signature algorithm
---
dlls/crypt32/chain.c | 5 +++++
dlls/crypt32/tests/chain.c | 8 ++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/crypt32/chain.c b/dlls/crypt32/chain.c
index 3759877..5af49e6 100644
--- a/dlls/crypt32/chain.c
+++ b/dlls/crypt32/chain.c
@@ -651,6 +651,11 @@ BOOL WINAPI CertGetCertificateChain(HCER
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? */
diff --git a/dlls/crypt32/tests/chain.c b/dlls/crypt32/tests/chain.c
index bf8a1c5..f713c1d 100644
--- a/dlls/crypt32/tests/chain.c
+++ b/dlls/crypt32/tests/chain.c
@@ -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, ¶, 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, ¶, 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++)
--
1.4.1
More information about the wine-patches
mailing list