Commit 09765f7d authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Reduce indent level of tests.

parent 581c24ef
......@@ -132,15 +132,15 @@ static const BYTE certWithUsage[] = { 0x30, 0x81, 0x93, 0x02, 0x01, 0x01, 0x30,
static void testAddCert(void)
{
HCERTSTORE store;
HCERTSTORE collection;
PCCERT_CONTEXT context;
BOOL ret;
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed: %ld\n", GetLastError());
if (store != NULL)
{
HCERTSTORE collection;
PCCERT_CONTEXT context;
BOOL ret;
if (!store)
return;
/* Weird--bad add disposition leads to an access violation in Windows.
*/
......@@ -287,7 +287,6 @@ static void testAddCert(void)
}
CertCloseStore(store, 0);
}
}
static void checkHash(const BYTE *data, DWORD dataLen, ALG_ID algID,
......@@ -317,11 +316,6 @@ static void testCertProperties(void)
{
PCCERT_CONTEXT context = CertCreateCertificateContext(X509_ASN_ENCODING,
bigCert, sizeof(bigCert));
ok(context != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
if (context)
{
DWORD propID, numProps, access, size;
BOOL ret;
BYTE hash[20] = { 0 }, hashProperty[20];
......@@ -329,6 +323,11 @@ static void testCertProperties(void)
CERT_KEY_CONTEXT keyContext;
HCRYPTPROV csp;
ok(context != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
if (!context)
return;
/* This crashes
propID = CertEnumCertificateContextProperties(NULL, 0);
*/
......@@ -497,20 +496,19 @@ static void testCertProperties(void)
CryptReleaseContext(csp, 0);
CertFreeCertificateContext(context);
}
}
static void testDupCert(void)
{
HCERTSTORE store;
PCCERT_CONTEXT context, dupContext;
BOOL ret;
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed: %ld\n", GetLastError());
if (store != NULL)
{
PCCERT_CONTEXT context, dupContext;
BOOL ret;
if (!store)
return;
ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, &context);
......@@ -535,23 +533,22 @@ static void testDupCert(void)
CertFreeCertificateContext(context);
}
CertCloseStore(store, 0);
}
}
static void testFindCert(void)
{
HCERTSTORE store;
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed: %ld\n", GetLastError());
if (store)
{
PCCERT_CONTEXT context = NULL;
BOOL ret;
CERT_INFO certInfo = { 0 };
CRYPT_HASH_BLOB blob;
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed: %ld\n", GetLastError());
if (!store)
return;
ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
bigCert, sizeof(bigCert), CERT_STORE_ADD_NEW, NULL);
ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n",
......@@ -602,7 +599,7 @@ static void testFindCert(void)
if (context)
{
context = CertFindCertificateInStore(store, X509_ASN_ENCODING, 0,
CERT_FIND_ISSUER_NAME, &certInfo.Subject, context);
CERT_FIND_SUBJECT_NAME, &certInfo.Subject, context);
ok(context == NULL, "Expected one cert only\n");
}
......@@ -623,7 +620,7 @@ static void testFindCert(void)
if (context)
{
context = CertFindCertificateInStore(store, X509_ASN_ENCODING, 0,
CERT_FIND_ISSUER_NAME, &certInfo.Subject, context);
CERT_FIND_SUBJECT_CERT, &certInfo.Subject, context);
ok(context == NULL, "Expected one cert only\n");
}
......@@ -637,26 +634,25 @@ static void testFindCert(void)
if (context)
{
context = CertFindCertificateInStore(store, X509_ASN_ENCODING, 0,
CERT_FIND_ISSUER_NAME, &certInfo.Subject, context);
CERT_FIND_SHA1_HASH, &certInfo.Subject, context);
ok(context == NULL, "Expected one cert only\n");
}
CertCloseStore(store, 0);
}
}
static void testGetSubjectCert(void)
{
HCERTSTORE store;
PCCERT_CONTEXT context1, context2;
CERT_INFO info = { 0 };
BOOL ret;
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed: %ld\n", GetLastError());
if (store != NULL)
{
PCCERT_CONTEXT context1, context2;
CERT_INFO info = { 0 };
BOOL ret;
if (!store)
return;
ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, NULL);
......@@ -700,7 +696,6 @@ static void testGetSubjectCert(void)
CertFreeCertificateContext(context1);
CertCloseStore(store, 0);
}
}
/* This expires in 1970 or so */
......
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