Alexander Morozov : crypt32/tests: Add some tests for CryptDecodeObjectEx without CRYPT_DECODE_ALLOC_FLAG.
Alexandre Julliard
julliard at winehq.org
Tue Nov 22 13:06:45 CST 2011
Module: wine
Branch: master
Commit: fc78c2242ea1cb92c1bede700066bafd33736995
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fc78c2242ea1cb92c1bede700066bafd33736995
Author: Alexander Morozov <amorozov at etersoft.ru>
Date: Mon Nov 21 19:47:32 2011 +0400
crypt32/tests: Add some tests for CryptDecodeObjectEx without CRYPT_DECODE_ALLOC_FLAG.
---
dlls/crypt32/tests/encode.c | 107 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 107 insertions(+), 0 deletions(-)
diff --git a/dlls/crypt32/tests/encode.c b/dlls/crypt32/tests/encode.c
index b79c34d..d74b1c9 100644
--- a/dlls/crypt32/tests/encode.c
+++ b/dlls/crypt32/tests/encode.c
@@ -2710,6 +2710,21 @@ static void test_decodeExtensions(DWORD dwEncoding)
}
LocalFree(buf);
}
+ ret = pCryptDecodeObjectEx(dwEncoding, X509_EXTENSIONS,
+ exts[i].encoded, exts[i].encoded[1] + 2, 0, NULL, NULL, &bufSize);
+ ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+ buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, bufSize);
+ if (buf)
+ {
+ ret = pCryptDecodeObjectEx(dwEncoding, X509_EXTENSIONS,
+ exts[i].encoded, exts[i].encoded[1] + 2, 0, NULL, buf, &bufSize);
+ if (!i)
+ ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+ else
+ todo_wine
+ ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+ HeapFree(GetProcessHeap(), 0, buf);
+ }
}
}
@@ -3601,6 +3616,20 @@ static void test_decodeCRLDistPoints(DWORD dwEncoding)
ok(!lstrcmpW(U(*entry).pwszURL, url), "Unexpected name\n");
LocalFree(buf);
}
+ ret = pCryptDecodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS,
+ distPointWithUrlAndIssuer, distPointWithUrlAndIssuer[1] + 2, 0,
+ NULL, NULL, &size);
+ ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+ buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
+ if (buf)
+ {
+ ret = pCryptDecodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS,
+ distPointWithUrlAndIssuer, distPointWithUrlAndIssuer[1] + 2, 0,
+ NULL, buf, &size);
+ todo_wine
+ ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+ HeapFree(GetProcessHeap(), 0, buf);
+ }
}
static const BYTE badFlagsIDP[] = { 0x30,0x06,0x81,0x01,0xff,0x82,0x01,0xff };
@@ -4741,6 +4770,18 @@ static void test_decodeEnhancedKeyUsage(DWORD dwEncoding)
usage->rgpszUsageIdentifier[i]);
LocalFree(buf);
}
+ ret = pCryptDecodeObjectEx(dwEncoding, X509_ENHANCED_KEY_USAGE,
+ encodedUsage, sizeof(encodedUsage), 0, NULL, NULL, &size);
+ ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+ buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
+ if (buf)
+ {
+ ret = pCryptDecodeObjectEx(dwEncoding, X509_ENHANCED_KEY_USAGE,
+ encodedUsage, sizeof(encodedUsage), 0, NULL, buf, &size);
+ todo_wine
+ ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+ HeapFree(GetProcessHeap(), 0, buf);
+ }
}
static BYTE keyId[] = { 1,2,3,4 };
@@ -5215,6 +5256,20 @@ static void test_decodeAuthorityInfoAccess(DWORD dwEncoding)
LocalFree(buf);
buf = NULL;
}
+ ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS,
+ authorityInfoAccessWithUrlAndIPAddr,
+ sizeof(authorityInfoAccessWithUrlAndIPAddr), 0, NULL, NULL, &size);
+ ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
+ buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
+ if (buf)
+ {
+ ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS,
+ authorityInfoAccessWithUrlAndIPAddr,
+ sizeof(authorityInfoAccessWithUrlAndIPAddr), 0, NULL, buf, &size);
+ todo_wine
+ ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
+ HeapFree(GetProcessHeap(), 0, buf);
+ }
}
static const BYTE emptyCTL[] = {
@@ -6168,6 +6223,18 @@ static void test_decodePKCSAttributes(DWORD dwEncoding)
attributes->rgAttr[1].rgValue[0].cbData), "Unexpected value\n");
LocalFree(buf);
}
+ ret = pCryptDecodeObjectEx(dwEncoding, PKCS_ATTRIBUTES,
+ doublePKCSAttributes, sizeof(doublePKCSAttributes), 0, NULL, NULL, &size);
+ ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
+ buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
+ if (buf)
+ {
+ ret = pCryptDecodeObjectEx(dwEncoding, PKCS_ATTRIBUTES,
+ doublePKCSAttributes, sizeof(doublePKCSAttributes), 0, NULL, buf, &size);
+ todo_wine
+ ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
+ HeapFree(GetProcessHeap(), 0, buf);
+ }
}
static const BYTE singleCapability[] = {
@@ -6325,6 +6392,20 @@ static void test_decodePKCSSMimeCapabilities(DWORD dwEncoding)
compareSMimeCapabilities("two capabilities", &capabilities, ptr);
LocalFree(ptr);
}
+ SetLastError(0xdeadbeef);
+ ret = pCryptDecodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES,
+ twoCapabilities, sizeof(twoCapabilities), 0, NULL, NULL, &size);
+ ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+ ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
+ if (ptr)
+ {
+ SetLastError(0xdeadbeef);
+ ret = pCryptDecodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES,
+ twoCapabilities, sizeof(twoCapabilities), 0, NULL, ptr, &size);
+ todo_wine
+ ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+ HeapFree(GetProcessHeap(), 0, ptr);
+ }
}
static BYTE encodedCommonNameNoNull[] = { 0x30,0x14,0x31,0x12,0x30,0x10,
@@ -7487,6 +7568,18 @@ static void test_decodeCertPolicies(DWORD dwEncoding)
"unexpected qualifier value\n");
LocalFree(info);
}
+ ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES,
+ twoPolicies, sizeof(twoPolicies), 0, NULL, NULL, &size);
+ ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+ info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
+ if (info)
+ {
+ ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES,
+ twoPolicies, sizeof(twoPolicies), 0, NULL, info, &size);
+ todo_wine
+ ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+ HeapFree(GetProcessHeap(), 0, info);
+ }
}
static const BYTE policyMappingWithOneMapping[] = {
@@ -7630,6 +7723,20 @@ static void test_decodeCertPolicyMappings(DWORD dwEncoding)
info->rgPolicyMapping[1].pszSubjectDomainPolicy);
LocalFree(info);
}
+ ret = pCryptDecodeObjectEx(dwEncoding, mappingOids[i],
+ policyMappingWithTwoMappings, sizeof(policyMappingWithTwoMappings), 0,
+ NULL, NULL, &size);
+ ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+ info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
+ if (info)
+ {
+ ret = pCryptDecodeObjectEx(dwEncoding, mappingOids[i],
+ policyMappingWithTwoMappings, sizeof(policyMappingWithTwoMappings), 0,
+ NULL, info, &size);
+ todo_wine
+ ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+ HeapFree(GetProcessHeap(), 0, info);
+ }
}
}
More information about the wine-cvs
mailing list