[CRYPT32_WINETEST] Sync with Wine Staging 3.3. CORE-14434
authorAmine Khaldi <amine.khaldi@reactos.org>
Fri, 9 Mar 2018 12:00:36 +0000 (13:00 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Fri, 9 Mar 2018 12:00:36 +0000 (13:00 +0100)
16 files changed:
modules/rostests/winetests/crypt32/base64.c
modules/rostests/winetests/crypt32/cert.c
modules/rostests/winetests/crypt32/chain.c
modules/rostests/winetests/crypt32/crl.c
modules/rostests/winetests/crypt32/ctl.c
modules/rostests/winetests/crypt32/encode.c
modules/rostests/winetests/crypt32/main.c
modules/rostests/winetests/crypt32/message.c
modules/rostests/winetests/crypt32/msg.c
modules/rostests/winetests/crypt32/object.c
modules/rostests/winetests/crypt32/oid.c
modules/rostests/winetests/crypt32/precomp.h
modules/rostests/winetests/crypt32/protectdata.c
modules/rostests/winetests/crypt32/sip.c
modules/rostests/winetests/crypt32/store.c
modules/rostests/winetests/crypt32/str.c

index 4898d38..e127fc3 100644 (file)
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
+#include <stdio.h>
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winerror.h>
+#include <wincrypt.h>
 
 
-#include "precomp.h"
+#include "wine/test.h"
 
 #define CERT_HEADER               "-----BEGIN CERTIFICATE-----\r\n"
 #define ALT_CERT_HEADER           "-----BEGIN This is some arbitrary text that goes on and on-----\r\n"
 
 #define CERT_HEADER               "-----BEGIN CERTIFICATE-----\r\n"
 #define ALT_CERT_HEADER           "-----BEGIN This is some arbitrary text that goes on and on-----\r\n"
 #define X509_HEADER_NOCR          "-----BEGIN X509 CRL-----\n"
 #define X509_TRAILER_NOCR         "-----END X509 CRL-----\n"
 
 #define X509_HEADER_NOCR          "-----BEGIN X509 CRL-----\n"
 #define X509_TRAILER_NOCR         "-----END X509 CRL-----\n"
 
-static BOOL (WINAPI *pCryptBinaryToStringA)(const BYTE *pbBinary,
- DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString);
-static BOOL (WINAPI *pCryptStringToBinaryA)(LPCSTR pszString,
- DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary,
- DWORD *pdwSkip, DWORD *pdwFlags);
-static BOOL (WINAPI *pCryptStringToBinaryW)(LPCWSTR pszString,
- DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary,
- DWORD *pdwSkip, DWORD *pdwFlags);
-
 struct BinTests
 {
     const BYTE *toEncode;
 struct BinTests
 {
     const BYTE *toEncode;
@@ -91,7 +88,7 @@ static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen,
     LPSTR str = NULL;
     BOOL ret;
 
     LPSTR str = NULL;
     BOOL ret;
 
-    ret = pCryptBinaryToStringA(toEncode, toEncodeLen, format, NULL, &strLen);
+    ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, NULL, &strLen);
     ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
     str = HeapAlloc(GetProcessHeap(), 0, strLen);
     if (str)
     ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
     str = HeapAlloc(GetProcessHeap(), 0, strLen);
     if (str)
@@ -99,7 +96,7 @@ static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen,
         DWORD strLen2 = strLen;
         LPCSTR ptr = str;
 
         DWORD strLen2 = strLen;
         LPCSTR ptr = str;
 
-        ret = pCryptBinaryToStringA(toEncode, toEncodeLen, format, str,
+        ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, str,
          &strLen2);
         ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
         ok(strLen2 == strLen - 1, "Expected length %d, got %d\n",
          &strLen2);
         ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
         ok(strLen2 == strLen - 1, "Expected length %d, got %d\n",
@@ -125,10 +122,10 @@ static void testBinaryToStringA(void)
     BOOL ret;
     DWORD strLen = 0, i;
 
     BOOL ret;
     DWORD strLen = 0, i;
 
-    ret = pCryptBinaryToStringA(NULL, 0, 0, NULL, NULL);
+    ret = CryptBinaryToStringA(NULL, 0, 0, NULL, NULL);
     ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
      "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
     ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
      "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
-    ret = pCryptBinaryToStringA(NULL, 0, 0, NULL, &strLen);
+    ret = CryptBinaryToStringA(NULL, 0, 0, NULL, &strLen);
     ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
      "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
     for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
     ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
      "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
     for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
@@ -137,7 +134,7 @@ static void testBinaryToStringA(void)
         LPSTR str = NULL;
         BOOL ret;
 
         LPSTR str = NULL;
         BOOL ret;
 
-        ret = pCryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen,
+        ret = CryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen,
          CRYPT_STRING_BINARY, NULL, &strLen);
         ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
         str = HeapAlloc(GetProcessHeap(), 0, strLen);
          CRYPT_STRING_BINARY, NULL, &strLen);
         ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
         str = HeapAlloc(GetProcessHeap(), 0, strLen);
@@ -145,7 +142,7 @@ static void testBinaryToStringA(void)
         {
             DWORD strLen2 = strLen;
 
         {
             DWORD strLen2 = strLen;
 
-            ret = pCryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen,
+            ret = CryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen,
              CRYPT_STRING_BINARY, str, &strLen2);
             ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
             ok(strLen == strLen2, "Expected length %d, got %d\n", strLen,
              CRYPT_STRING_BINARY, str, &strLen2);
             ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
             ok(strLen == strLen2, "Expected length %d, got %d\n", strLen,
@@ -172,7 +169,7 @@ static void testBinaryToStringA(void)
         LPSTR str = NULL;
         BOOL ret;
 
         LPSTR str = NULL;
         BOOL ret;
 
-        ret = pCryptBinaryToStringA(testsNoCR[i].toEncode,
+        ret = CryptBinaryToStringA(testsNoCR[i].toEncode,
          testsNoCR[i].toEncodeLen, CRYPT_STRING_BINARY | CRYPT_STRING_NOCR,
          NULL, &strLen);
         ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
          testsNoCR[i].toEncodeLen, CRYPT_STRING_BINARY | CRYPT_STRING_NOCR,
          NULL, &strLen);
         ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
@@ -181,7 +178,7 @@ static void testBinaryToStringA(void)
         {
             DWORD strLen2 = strLen;
 
         {
             DWORD strLen2 = strLen;
 
-            ret = pCryptBinaryToStringA(testsNoCR[i].toEncode,
+            ret = CryptBinaryToStringA(testsNoCR[i].toEncode,
              testsNoCR[i].toEncodeLen, CRYPT_STRING_BINARY | CRYPT_STRING_NOCR,
              str, &strLen2);
             ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
              testsNoCR[i].toEncodeLen, CRYPT_STRING_BINARY | CRYPT_STRING_NOCR,
              str, &strLen2);
             ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
@@ -236,7 +233,7 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
         strcat(str, toDecode);
         if (trailer)
             strcat(str, trailer);
         strcat(str, toDecode);
         if (trailer)
             strcat(str, trailer);
-        ret = pCryptStringToBinaryA(str, 0, useFormat, NULL, &bufLen, NULL,
+        ret = CryptStringToBinaryA(str, 0, useFormat, NULL, &bufLen, NULL,
          NULL);
         ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
         buf = HeapAlloc(GetProcessHeap(), 0, bufLen);
          NULL);
         ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
         buf = HeapAlloc(GetProcessHeap(), 0, bufLen);
@@ -245,14 +242,14 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
             DWORD skipped, usedFormat;
 
             /* check as normal, make sure last two parameters are optional */
             DWORD skipped, usedFormat;
 
             /* check as normal, make sure last two parameters are optional */
-            ret = pCryptStringToBinaryA(str, 0, useFormat, buf, &bufLen, NULL,
+            ret = CryptStringToBinaryA(str, 0, useFormat, buf, &bufLen, NULL,
              NULL);
             ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
             ok(bufLen == expectedLen,
              "Expected length %d, got %d\n", expectedLen, bufLen);
             ok(!memcmp(buf, expected, bufLen), "Unexpected value\n");
             /* check last two params */
              NULL);
             ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
             ok(bufLen == expectedLen,
              "Expected length %d, got %d\n", expectedLen, bufLen);
             ok(!memcmp(buf, expected, bufLen), "Unexpected value\n");
             /* check last two params */
-            ret = pCryptStringToBinaryA(str, 0, useFormat, buf, &bufLen,
+            ret = CryptStringToBinaryA(str, 0, useFormat, buf, &bufLen,
              &skipped, &usedFormat);
             ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
             ok(skipped == 0, "Expected skipped 0, got %d\n", skipped);
              &skipped, &usedFormat);
             ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
             ok(skipped == 0, "Expected skipped 0, got %d\n", skipped);
@@ -268,7 +265,7 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
         strcat(str, toDecode);
         if (trailer)
             strcat(str, trailer);
         strcat(str, toDecode);
         if (trailer)
             strcat(str, trailer);
-        ret = pCryptStringToBinaryA(str, 0, useFormat, NULL, &bufLen, NULL,
+        ret = CryptStringToBinaryA(str, 0, useFormat, NULL, &bufLen, NULL,
          NULL);
         /* expect failure with no header, and success with one */
         if (header)
          NULL);
         /* expect failure with no header, and success with one */
         if (header)
@@ -283,7 +280,7 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
             {
                 DWORD skipped, usedFormat;
 
             {
                 DWORD skipped, usedFormat;
 
-                ret = pCryptStringToBinaryA(str, 0, useFormat, buf, &bufLen,
+                ret = CryptStringToBinaryA(str, 0, useFormat, buf, &bufLen,
                  &skipped, &usedFormat);
                 ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
                 ok(skipped == strlen(garbage),
                  &skipped, &usedFormat);
                 ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
                 ok(skipped == strlen(garbage),
@@ -305,7 +302,7 @@ static void decodeBase64WithLenFmtW(LPCSTR strA, int len, DWORD fmt, BOOL retA,
     WCHAR strW[64];
     int i;
     for (i = 0; (strW[i] = strA[i]) != 0; ++i);
     WCHAR strW[64];
     int i;
     for (i = 0; (strW[i] = strA[i]) != 0; ++i);
-    ret = pCryptStringToBinaryW(strW, len, fmt, buf, &bufLen, NULL, &fmtUsed);
+    ret = CryptStringToBinaryW(strW, len, fmt, buf, &bufLen, NULL, &fmtUsed);
     ok(ret == retA && bufLen == bufLenA && memcmp(bufA, buf, bufLen) == 0
      && fmtUsed == fmtUsedA, "base64 \"%s\" len %d: W and A differ\n", strA, len);
 }
     ok(ret == retA && bufLen == bufLenA && memcmp(bufA, buf, bufLen) == 0
      && fmtUsed == fmtUsedA, "base64 \"%s\" len %d: W and A differ\n", strA, len);
 }
@@ -316,7 +313,7 @@ static void decodeBase64WithLenFmt(LPCSTR str, int len, DWORD fmt, LPCSTR expect
     DWORD bufLen = sizeof(buf)-1, fmtUsed = 0xdeadbeef;
     BOOL ret;
     SetLastError(0xdeadbeef);
     DWORD bufLen = sizeof(buf)-1, fmtUsed = 0xdeadbeef;
     BOOL ret;
     SetLastError(0xdeadbeef);
-    ret = pCryptStringToBinaryA(str, len, fmt, buf, &bufLen, NULL, &fmtUsed);
+    ret = CryptStringToBinaryA(str, len, fmt, buf, &bufLen, NULL, &fmtUsed);
     buf[bufLen] = 0;
     if (expected) {
         BOOL correct = ret && strcmp(expected, (char*)buf) == 0;
     buf[bufLen] = 0;
     if (expected) {
         BOOL correct = ret && strcmp(expected, (char*)buf) == 0;
@@ -331,8 +328,8 @@ static void decodeBase64WithLenFmt(LPCSTR str, int len, DWORD fmt, LPCSTR expect
          "base64 \"%s\" len %d: expected failure, got \"%s\" (ret %d, le %d)\n",
          str, len, (char*)buf, ret, GetLastError());
     }
          "base64 \"%s\" len %d: expected failure, got \"%s\" (ret %d, le %d)\n",
          str, len, (char*)buf, ret, GetLastError());
     }
-    if (pCryptStringToBinaryW)
-        decodeBase64WithLenFmtW(str, len, fmt, ret, buf, bufLen, fmtUsed);
+
+    decodeBase64WithLenFmtW(str, len, fmt, ret, buf, bufLen, fmtUsed);
 }
 
 static void decodeBase64WithLenBroken(LPCSTR str, int len, LPCSTR expected, int le)
 }
 
 static void decodeBase64WithLenBroken(LPCSTR str, int len, LPCSTR expected, int le)
@@ -366,19 +363,19 @@ static void testStringToBinaryA(void)
     DWORD bufLen = 0, i;
     BYTE buf[8];
 
     DWORD bufLen = 0, i;
     BYTE buf[8];
 
-    ret = pCryptStringToBinaryA(NULL, 0, 0, NULL, NULL, NULL, NULL);
+    ret = CryptStringToBinaryA(NULL, 0, 0, NULL, NULL, NULL, NULL);
     ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
      "Expected ERROR_INVALID_PARAMETER, got ret=%d le=%u\n", ret, GetLastError());
     ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
      "Expected ERROR_INVALID_PARAMETER, got ret=%d le=%u\n", ret, GetLastError());
-    ret = pCryptStringToBinaryA(NULL, 0, 0, NULL, &bufLen, NULL, NULL);
+    ret = CryptStringToBinaryA(NULL, 0, 0, NULL, &bufLen, NULL, NULL);
     ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
      "Expected ERROR_INVALID_PARAMETER, got ret=%d le=%u\n", ret, GetLastError());
     /* Bogus format */
     ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
      "Expected ERROR_INVALID_PARAMETER, got ret=%d le=%u\n", ret, GetLastError());
     /* Bogus format */
-    ret = pCryptStringToBinaryA(tests[0].base64, 0, 0, NULL, &bufLen, NULL,
+    ret = CryptStringToBinaryA(tests[0].base64, 0, 0, NULL, &bufLen, NULL,
      NULL);
     ok(!ret && GetLastError() == ERROR_INVALID_DATA,
      "Expected ERROR_INVALID_DATA, got ret=%d le=%u\n", ret, GetLastError());
     /* Decoding doesn't expect the NOCR flag to be specified */
      NULL);
     ok(!ret && GetLastError() == ERROR_INVALID_DATA,
      "Expected ERROR_INVALID_DATA, got ret=%d le=%u\n", ret, GetLastError());
     /* Decoding doesn't expect the NOCR flag to be specified */
-    ret = pCryptStringToBinaryA(tests[0].base64, 1,
+    ret = CryptStringToBinaryA(tests[0].base64, 1,
      CRYPT_STRING_BASE64 | CRYPT_STRING_NOCR, NULL, &bufLen, NULL, NULL);
     ok(!ret && GetLastError() == ERROR_INVALID_DATA,
      "Expected ERROR_INVALID_DATA, got ret=%d le=%u\n", ret, GetLastError());
      CRYPT_STRING_BASE64 | CRYPT_STRING_NOCR, NULL, &bufLen, NULL, NULL);
     ok(!ret && GetLastError() == ERROR_INVALID_DATA,
      "Expected ERROR_INVALID_DATA, got ret=%d le=%u\n", ret, GetLastError());
@@ -386,7 +383,7 @@ static void testStringToBinaryA(void)
     for (i = 0; i < sizeof(badStrings) / sizeof(badStrings[0]); i++)
     {
         bufLen = 0;
     for (i = 0; i < sizeof(badStrings) / sizeof(badStrings[0]); i++)
     {
         bufLen = 0;
-        ret = pCryptStringToBinaryA(badStrings[i].str, 0, badStrings[i].format,
+        ret = CryptStringToBinaryA(badStrings[i].str, 0, badStrings[i].format,
          NULL, &bufLen, NULL, NULL);
         ok(!ret && GetLastError() == ERROR_INVALID_DATA,
            "%d: Expected ERROR_INVALID_DATA, got ret=%d le=%u\n", i, ret, GetLastError());
          NULL, &bufLen, NULL, NULL);
         ok(!ret && GetLastError() == ERROR_INVALID_DATA,
            "%d: Expected ERROR_INVALID_DATA, got ret=%d le=%u\n", i, ret, GetLastError());
@@ -444,7 +441,7 @@ static void testStringToBinaryA(void)
     /* Too small buffer */
     buf[0] = 0;
     bufLen = 4;
     /* Too small buffer */
     buf[0] = 0;
     bufLen = 4;
-    ret = pCryptStringToBinaryA("VVVVVVVV", 8, CRYPT_STRING_BASE64, (BYTE*)buf, &bufLen, NULL, NULL);
+    ret = CryptStringToBinaryA("VVVVVVVV", 8, CRYPT_STRING_BASE64, (BYTE*)buf, &bufLen, NULL, NULL);
     ok(!ret && bufLen == 4 && buf[0] == 0,
      "Expected ret 0, bufLen 4, buf[0] '\\0', got ret %d, bufLen %d, buf[0] '%c'\n",
      ret, bufLen, buf[0]);
     ok(!ret && bufLen == 4 && buf[0] == 0,
      "Expected ret 0, bufLen 4, buf[0] '\\0', got ret %d, bufLen %d, buf[0] '%c'\n",
      ret, bufLen, buf[0]);
@@ -456,7 +453,7 @@ static void testStringToBinaryA(void)
         /* Bogus length--oddly enough, that succeeds, even though it's not
          * properly padded.
          */
         /* Bogus length--oddly enough, that succeeds, even though it's not
          * properly padded.
          */
-        ret = pCryptStringToBinaryA(tests[i].base64, 1, CRYPT_STRING_BASE64,
+        ret = CryptStringToBinaryA(tests[i].base64, 1, CRYPT_STRING_BASE64,
          NULL, &bufLen, NULL, NULL);
         ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
         /* Check with the precise format */
          NULL, &bufLen, NULL, NULL);
         ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
         /* Check with the precise format */
@@ -513,7 +510,7 @@ static void testStringToBinaryA(void)
         /* Bogus length--oddly enough, that succeeds, even though it's not
          * properly padded.
          */
         /* Bogus length--oddly enough, that succeeds, even though it's not
          * properly padded.
          */
-        ret = pCryptStringToBinaryA(testsNoCR[i].base64, 1, CRYPT_STRING_BASE64,
+        ret = CryptStringToBinaryA(testsNoCR[i].base64, 1, CRYPT_STRING_BASE64,
          NULL, &bufLen, NULL, NULL);
         ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
         /* Check with the precise format */
          NULL, &bufLen, NULL, NULL);
         ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
         /* Check with the precise format */
@@ -548,19 +545,6 @@ static void testStringToBinaryA(void)
 
 START_TEST(base64)
 {
 
 START_TEST(base64)
 {
-    HMODULE lib = GetModuleHandleA("crypt32");
-
-    pCryptBinaryToStringA = (void *)GetProcAddress(lib, "CryptBinaryToStringA");
-    pCryptStringToBinaryA = (void *)GetProcAddress(lib, "CryptStringToBinaryA");
-    pCryptStringToBinaryW = (void *)GetProcAddress(lib, "CryptStringToBinaryW");
-
-    if (pCryptBinaryToStringA)
-        testBinaryToStringA();
-    else
-        win_skip("CryptBinaryToStringA is not available\n");
-
-    if (pCryptStringToBinaryA)
-        testStringToBinaryA();
-    else
-        win_skip("CryptStringToBinaryA is not available\n");
+    testBinaryToStringA();
+    testStringToBinaryA();
 }
 }
index 8a8d36b..e49b2a9 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <windef.h>
+#include <winbase.h>
+#include <winreg.h>
+#include <winerror.h>
+#include <wincrypt.h>
+
+#include "wine/test.h"
 
 static PCCERT_CONTEXT (WINAPI *pCertCreateSelfSignCertificate)(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE,PCERT_NAME_BLOB,DWORD,PCRYPT_KEY_PROV_INFO,PCRYPT_ALGORITHM_IDENTIFIER,PSYSTEMTIME,PSYSTEMTIME,PCERT_EXTENSIONS);
 static BOOL (WINAPI *pCertGetValidUsages)(DWORD,PCCERT_CONTEXT*,int*,LPSTR*,DWORD*);
 
 static PCCERT_CONTEXT (WINAPI *pCertCreateSelfSignCertificate)(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE,PCERT_NAME_BLOB,DWORD,PCRYPT_KEY_PROV_INFO,PCRYPT_ALGORITHM_IDENTIFIER,PSYSTEMTIME,PSYSTEMTIME,PCERT_EXTENSIONS);
 static BOOL (WINAPI *pCertGetValidUsages)(DWORD,PCCERT_CONTEXT*,int*,LPSTR*,DWORD*);
index e9e8634..e3b280b 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdio.h>
+#include <stdarg.h>
 
 
+#include <windef.h>
+#include <winbase.h>
+#include <winerror.h>
+#include <wincrypt.h>
 #include <wininet.h>
 
 #include <wininet.h>
 
+#include "wine/test.h"
+
 static const BYTE selfSignedCert[] = {
  0x30, 0x82, 0x01, 0x1f, 0x30, 0x81, 0xce, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02,
  0x10, 0xeb, 0x0d, 0x57, 0x2a, 0x9c, 0x09, 0xba, 0xa4, 0x4a, 0xb7, 0x25, 0x49,
 static const BYTE selfSignedCert[] = {
  0x30, 0x82, 0x01, 0x1f, 0x30, 0x81, 0xce, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02,
  0x10, 0xeb, 0x0d, 0x57, 0x2a, 0x9c, 0x09, 0xba, 0xa4, 0x4a, 0xb7, 0x25, 0x49,
@@ -2882,6 +2889,59 @@ static const BYTE chain31_1[] = {
 0x43,0x08,0xe5,0x78,0x2b,0x95,0xf3,0x75,0xb6,0x88,0xf0,0x6b,0x5c,0x5b,0x50,
 0x04,0x91,0x3b,0x89,0x5a,0x60,0x1f,0xfc,0x36,0x53,0x32,0x36,0x0a,0x4d,0x03,
 0x2c,0xd7 };
 0x43,0x08,0xe5,0x78,0x2b,0x95,0xf3,0x75,0xb6,0x88,0xf0,0x6b,0x5c,0x5b,0x50,
 0x04,0x91,0x3b,0x89,0x5a,0x60,0x1f,0xfc,0x36,0x53,0x32,0x36,0x0a,0x4d,0x03,
 0x2c,0xd7 };
+static const BYTE ecc_crt[] = {
+0x30,0x82,0x01,0x46,0x30,0x81,0xec,0x02,0x09,0x00,0xe7,0x6b,0x26,0x86,0x0a,
+0x82,0xff,0xe9,0x30,0x0a,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x04,0x03,0x02,
+0x30,0x2b,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x44,0x45,
+0x31,0x0d,0x30,0x0b,0x06,0x03,0x55,0x04,0x0a,0x0c,0x04,0x57,0x69,0x6e,0x65,
+0x31,0x0d,0x30,0x0b,0x06,0x03,0x55,0x04,0x03,0x0c,0x04,0x57,0x69,0x6e,0x65,
+0x30,0x1e,0x17,0x0d,0x31,0x37,0x30,0x39,0x32,0x37,0x31,0x33,0x34,0x31,0x30,
+0x34,0x5a,0x17,0x0d,0x32,0x37,0x30,0x39,0x32,0x35,0x31,0x33,0x34,0x31,0x30,
+0x34,0x5a,0x30,0x2b,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,
+0x44,0x45,0x31,0x0d,0x30,0x0b,0x06,0x03,0x55,0x04,0x0a,0x0c,0x04,0x54,0x65,
+0x73,0x74,0x31,0x0d,0x30,0x0b,0x06,0x03,0x55,0x04,0x03,0x0c,0x04,0x54,0x65,
+0x73,0x74,0x30,0x59,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,
+0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x03,0x42,0x00,0x04,0xed,
+0xfc,0x77,0xd8,0xb9,0xe7,0xf3,0xf8,0xce,0x13,0xb8,0x7f,0x0f,0x78,0xea,0x73,
+0x87,0x29,0x10,0xe1,0x6d,0x10,0xce,0x57,0x60,0x3b,0x3e,0xb4,0x5f,0x0d,0x20,
+0xc1,0xeb,0x6d,0x74,0xe9,0x7b,0x11,0x51,0x9a,0x00,0xe8,0xe9,0x12,0x84,0xb9,
+0x07,0x7e,0x7b,0x62,0x67,0x12,0x67,0x08,0xe5,0x2e,0x27,0xce,0xa2,0x57,0x15,
+0xad,0xc5,0x1f,0x30,0x0a,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x04,0x03,0x02,
+0x03,0x49,0x00,0x30,0x46,0x02,0x21,0x00,0xd7,0x29,0xce,0x5a,0xef,0x74,0x85,
+0xd1,0x18,0x5f,0x6e,0xf1,0xba,0x53,0xd4,0xcd,0xdd,0xe0,0x5d,0xf1,0x5e,0x48,
+0x51,0xea,0x63,0xc0,0xe8,0xe2,0xf6,0xfa,0x4c,0xaf,0x02,0x21,0x00,0xe3,0x94,
+0x15,0x3b,0x6c,0x71,0x6e,0x44,0x22,0xcb,0xa0,0x88,0xcd,0x0a,0x5a,0x50,0x29,
+0x7c,0x5c,0xd6,0x6c,0xd2,0xe0,0x7f,0xcd,0x02,0x92,0x21,0x4c,0x2c,0x92,0xee };
+static const BYTE ecc_ca[] = {
+0x30,0x82,0x01,0x9f,0x30,0x82,0x01,0x46,0xa0,0x03,0x02,0x01,0x02,0x02,0x09,
+0x00,0xf1,0x54,0xae,0x21,0x2e,0x4d,0x31,0x9f,0x30,0x0a,0x06,0x08,0x2a,0x86,
+0x48,0xce,0x3d,0x04,0x03,0x02,0x30,0x2b,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,
+0x04,0x06,0x13,0x02,0x44,0x45,0x31,0x0d,0x30,0x0b,0x06,0x03,0x55,0x04,0x0a,
+0x0c,0x04,0x57,0x69,0x6e,0x65,0x31,0x0d,0x30,0x0b,0x06,0x03,0x55,0x04,0x03,
+0x0c,0x04,0x57,0x69,0x6e,0x65,0x30,0x1e,0x17,0x0d,0x31,0x37,0x30,0x39,0x32,
+0x37,0x31,0x33,0x33,0x39,0x31,0x35,0x5a,0x17,0x0d,0x32,0x37,0x30,0x39,0x32,
+0x35,0x31,0x33,0x33,0x39,0x31,0x35,0x5a,0x30,0x2b,0x31,0x0b,0x30,0x09,0x06,
+0x03,0x55,0x04,0x06,0x13,0x02,0x44,0x45,0x31,0x0d,0x30,0x0b,0x06,0x03,0x55,
+0x04,0x0a,0x0c,0x04,0x57,0x69,0x6e,0x65,0x31,0x0d,0x30,0x0b,0x06,0x03,0x55,
+0x04,0x03,0x0c,0x04,0x57,0x69,0x6e,0x65,0x30,0x59,0x30,0x13,0x06,0x07,0x2a,
+0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,
+0x07,0x03,0x42,0x00,0x04,0x3b,0x3c,0x34,0xc8,0x3f,0x15,0xea,0x02,0x68,0x46,
+0x69,0xdf,0x0c,0xa6,0xee,0x7a,0xd9,0x82,0x08,0x9b,0x37,0x53,0x42,0xf3,0x13,
+0x63,0xda,0x65,0x79,0xe8,0x04,0x9e,0x8c,0x77,0xc4,0x33,0x77,0xd9,0x5a,0x7f,
+0x60,0x7b,0x98,0xce,0xf3,0x96,0x56,0xd6,0xb5,0x8d,0x87,0x7a,0x00,0x2b,0xf3,
+0x70,0xb3,0x90,0x73,0xa0,0x56,0x06,0x3b,0x22,0xa3,0x53,0x30,0x51,0x30,0x1d,
+0x06,0x03,0x55,0x1d,0x0e,0x04,0x16,0x04,0x14,0x26,0xef,0x6f,0xe4,0xb5,0x24,
+0x2f,0x68,0x49,0x84,0xd9,0x89,0xa6,0xab,0x0c,0xf8,0x6d,0xf5,0xe5,0x0c,0x30,
+0x1f,0x06,0x03,0x55,0x1d,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x26,0xef,0x6f,
+0xe4,0xb5,0x24,0x2f,0x68,0x49,0x84,0xd9,0x89,0xa6,0xab,0x0c,0xf8,0x6d,0xf5,
+0xe5,0x0c,0x30,0x0f,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x05,0x30,
+0x03,0x01,0x01,0xff,0x30,0x0a,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x04,0x03,
+0x02,0x03,0x47,0x00,0x30,0x44,0x02,0x20,0x2b,0x6b,0x23,0x42,0x32,0xf2,0xcb,
+0x71,0xd7,0x5c,0xfa,0x5e,0x6c,0x19,0x31,0xd6,0x74,0xf7,0xc0,0xf8,0xc6,0x39,
+0x38,0xe9,0x79,0x4d,0x84,0x44,0x40,0x13,0x8e,0x43,0x02,0x20,0x34,0xc7,0x61,
+0xbb,0x18,0x1c,0x85,0x34,0xe3,0x4c,0x30,0x28,0x42,0x0e,0x06,0x65,0x68,0x1d,
+0x76,0x53,0x24,0xa0,0x27,0xa5,0x84,0x3b,0x2d,0xf3,0xec,0x27,0x60,0xb2 };
+
 
 typedef struct _CONST_DATA_BLOB
 {
 
 typedef struct _CONST_DATA_BLOB
 {
@@ -3079,6 +3139,8 @@ static SYSTEMTIME jun2013 = { 2013, 6, 5, 6, 0, 0, 0, 0 };
 static SYSTEMTIME oct2016 = { 2016, 10, 6, 1, 0, 0, 0, 0 };
 /* Wednesday, Nov 17, 2016 */
 static SYSTEMTIME nov2016 = { 2016, 11, 3, 17, 0, 0, 0, 0 };
 static SYSTEMTIME oct2016 = { 2016, 10, 6, 1, 0, 0, 0, 0 };
 /* Wednesday, Nov 17, 2016 */
 static SYSTEMTIME nov2016 = { 2016, 11, 3, 17, 0, 0, 0, 0 };
+/* Wednesday, Nov 17, 2017 */
+static SYSTEMTIME nov2017 = { 2017, 11, 3, 17, 0, 0, 0, 0 };
 
 typedef struct _ChainCheck
 {
 
 typedef struct _ChainCheck
 {
@@ -3866,6 +3928,25 @@ static ChainCheck chainCheckEmbeddedNullBroken = {
      CERT_TRUST_HAS_VALID_NAME_CONSTRAINTS },
    1, simpleStatus27Broken },
  0 };
      CERT_TRUST_HAS_VALID_NAME_CONSTRAINTS },
    1, simpleStatus27Broken },
  0 };
+static CONST_DATA_BLOB chainECDSA[] = {
+ { sizeof(ecc_ca), ecc_ca },
+ { sizeof(ecc_crt), ecc_crt },
+};
+static const CERT_TRUST_STATUS elementStatusECDSA[] = {
+ { CERT_TRUST_NO_ERROR, CERT_TRUST_HAS_NAME_MATCH_ISSUER },
+ { CERT_TRUST_IS_UNTRUSTED_ROOT, CERT_TRUST_HAS_KEY_MATCH_ISSUER | CERT_TRUST_IS_SELF_SIGNED },
+};
+static const SimpleChainStatusCheck simpleStatusECDSA[] = {
+ { sizeof(elementStatusECDSA) / sizeof(elementStatusECDSA[0]), elementStatusECDSA },
+};
+static ChainCheck chainCheckECDSA = {
+ { sizeof(chainECDSA) / sizeof(chainECDSA[0]), chainECDSA },
+ {
+   { CERT_TRUST_IS_UNTRUSTED_ROOT, CERT_TRUST_HAS_PREFERRED_ISSUER },
+   { CERT_TRUST_IS_UNTRUSTED_ROOT, 0 },
+   1, simpleStatusECDSA
+ }, 0
+};
 
 #define test_name_blob(a,b) _test_name_blob(__LINE__,a,b)
 static void _test_name_blob(unsigned line, CERT_NAME_BLOB *blob, const char *exdata)
 
 #define test_name_blob(a,b) _test_name_blob(__LINE__,a,b)
 static void _test_name_blob(unsigned line, CERT_NAME_BLOB *blob, const char *exdata)
@@ -4141,6 +4222,16 @@ static void testGetCertChain(void)
 
     pCertFreeCertificateChain(chain);
 
 
     pCertFreeCertificateChain(chain);
 
+    /* Test with ECDSA certificate */
+    chain = getChain(NULL, &chainCheckECDSA.certs, 0, TRUE, &nov2017, FALSE, 0);
+    if (chain)
+    {
+        ok(chain->TrustStatus.dwErrorStatus == CERT_TRUST_IS_UNTRUSTED_ROOT,
+           "unexpected chain error status %08x\n", chain->TrustStatus.dwErrorStatus);
+        checkChainStatus(chain, &chainCheckECDSA.status, chainCheckECDSA.todo, "chainCheckECDSA", 0);
+        pCertFreeCertificateChain(chain);
+    }
+
     /* Test HCCE_LOCAL_MACHINE */
     ret = CertGetCertificateChain(HCCE_LOCAL_MACHINE, cert, &fileTime, store, &para, 0, NULL, &chain);
     ok(ret, "CertGetCertificateChain failed: %u\n", GetLastError());
     /* Test HCCE_LOCAL_MACHINE */
     ret = CertGetCertificateChain(HCCE_LOCAL_MACHINE, cert, &fileTime, store, &para, 0, NULL, &chain);
     ok(ret, "CertGetCertificateChain failed: %u\n", GetLastError());
index 32460e3..c350b20 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <windef.h>
+#include <winbase.h>
+#include <winreg.h>
+#include <winerror.h>
+#include <wincrypt.h>
+
+#include "wine/test.h"
+
 
 static const BYTE bigCert[] = { 0x30, 0x7a, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06,
  0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
 
 static const BYTE bigCert[] = { 0x30, 0x7a, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06,
  0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
index 18993c0..79a60f8 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <windef.h>
+#include <winbase.h>
+#include <winerror.h>
+#include <wincrypt.h>
+
+#include "wine/test.h"
 
 static const BYTE emptyCTL[] = {
 0x30,0x17,0x30,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,
 
 static const BYTE emptyCTL[] = {
 0x30,0x17,0x30,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,
index 97cedb1..ad39a35 100644 (file)
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
+#include <stdio.h>
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winerror.h>
+#include <wincrypt.h>
+#include <snmp.h>
+
+#include "wine/test.h"
 
 
-#include "precomp.h"
 
 static BOOL (WINAPI *pCryptDecodeObjectEx)(DWORD,LPCSTR,const BYTE*,DWORD,DWORD,PCRYPT_DECODE_PARA,void*,DWORD*);
 static BOOL (WINAPI *pCryptEncodeObjectEx)(DWORD,LPCSTR,const void*,DWORD,PCRYPT_ENCODE_PARA,void*,DWORD*);
 
 static BOOL (WINAPI *pCryptDecodeObjectEx)(DWORD,LPCSTR,const BYTE*,DWORD,DWORD,PCRYPT_DECODE_PARA,void*,DWORD*);
 static BOOL (WINAPI *pCryptEncodeObjectEx)(DWORD,LPCSTR,const void*,DWORD,PCRYPT_ENCODE_PARA,void*,DWORD*);
@@ -1952,80 +1960,138 @@ static void test_decodeUnicodeNameValue(DWORD dwEncoding)
     }
 }
 
     }
 }
 
-struct encodedOctets
-{
-    const BYTE *val;
-    const BYTE *encoded;
-};
-
-static const unsigned char bin46[] = { 'h','i',0 };
-static const unsigned char bin47[] = { 0x04,0x02,'h','i',0 };
-static const unsigned char bin48[] = {
-     's','o','m','e','l','o','n','g',0xff,'s','t','r','i','n','g',0 };
-static const unsigned char bin49[] = {
-     0x04,0x0f,'s','o','m','e','l','o','n','g',0xff,'s','t','r','i','n','g',0 };
-static const unsigned char bin50[] = { 0 };
-static const unsigned char bin51[] = { 0x04,0x00,0 };
-
-static const struct encodedOctets octets[] = {
-    { bin46, bin47 },
-    { bin48, bin49 },
-    { bin50, bin51 },
-};
+static const unsigned char decoded_hi_octet[] = { 'h','i' };
+static const unsigned char encoded_hi_octet[] = { ASN_OCTETSTRING,2,'h','i' };
+static const unsigned char decoded_something_long_octet[] = {
+     's','o','m','e','l','o','n','g',0xff,'s','t','r','i','n','g' };
+static const unsigned char encoded_something_long_octet[] = {
+     ASN_OCTETSTRING,15,'s','o','m','e','l','o','n','g',0xff,'s','t','r','i','n','g' };
+static const unsigned char encoded_empty_octet[] = { ASN_OCTETSTRING,0 };
 
 static void test_encodeOctets(DWORD dwEncoding)
 {
     CRYPT_DATA_BLOB blob;
     DWORD i;
 
 
 static void test_encodeOctets(DWORD dwEncoding)
 {
     CRYPT_DATA_BLOB blob;
     DWORD i;
 
-    for (i = 0; i < sizeof(octets) / sizeof(octets[0]); i++)
+    static const struct {
+        const BYTE *decoded;
+        UINT decoded_size;
+        const BYTE *encoded;
+        UINT encoded_size;
+    } tests[] = {
+        {
+            decoded_hi_octet, sizeof(decoded_hi_octet),
+            encoded_hi_octet, sizeof(encoded_hi_octet)
+        },{
+            decoded_something_long_octet, sizeof(decoded_something_long_octet),
+            encoded_something_long_octet, sizeof(encoded_something_long_octet)
+        },{
+            encoded_empty_octet, 0,
+            encoded_empty_octet, sizeof(encoded_empty_octet)
+        }
+    };
+
+    for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
     {
         BYTE *buf = NULL;
         BOOL ret;
         DWORD bufSize = 0;
 
     {
         BYTE *buf = NULL;
         BOOL ret;
         DWORD bufSize = 0;
 
-        blob.cbData = strlen((const char*)octets[i].val);
-        blob.pbData = (BYTE*)octets[i].val;
+        blob.cbData = tests[i].decoded_size;
+        blob.pbData = (BYTE*)tests[i].decoded;
         ret = pCryptEncodeObjectEx(dwEncoding, X509_OCTET_STRING, &blob,
          CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
         ok(ret, "CryptEncodeObjectEx failed: %d\n", GetLastError());
         if (ret)
         {
         ret = pCryptEncodeObjectEx(dwEncoding, X509_OCTET_STRING, &blob,
          CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
         ok(ret, "CryptEncodeObjectEx failed: %d\n", GetLastError());
         if (ret)
         {
-            ok(buf[0] == 4,
-             "Got unexpected type %d for octet string (expected 4)\n", buf[0]);
-            ok(buf[1] == octets[i].encoded[1], "Got length %d, expected %d\n",
-             buf[1], octets[i].encoded[1]);
-            ok(!memcmp(buf + 1, octets[i].encoded + 1,
-             octets[i].encoded[1] + 1), "Got unexpected value\n");
+            ok(bufSize == tests[i].encoded_size, "[%u] buf size %u expected %u\n",
+               i, bufSize, tests[i].encoded_size);
+            ok(buf[0] == 4, "Got unexpected type %d for octet string (expected 4)\n", buf[0]);
+            ok(buf[1] == tests[i].decoded_size, "[%u] Got length %d, expected %d\n",
+               i, buf[1], tests[i].decoded_size);
+            ok(!memcmp(buf, tests[i].encoded, tests[i].encoded_size), "[%u] Got unexpected value\n", i);
             LocalFree(buf);
         }
     }
 }
 
             LocalFree(buf);
         }
     }
 }
 
+static const unsigned char encoded_constructed_hi_octet[] =
+    { ASN_CONSTRUCTOR|ASN_OCTETSTRING,0x80, ASN_OCTETSTRING,2,'h','i', 0,0 };
+static const unsigned char encoded_constructed_hi_octet2[] =
+    { ASN_CONSTRUCTOR|ASN_OCTETSTRING,4, ASN_OCTETSTRING,2,'h','i', 1,2,3 };
+static const unsigned char encoded_constructed_hi_octet3[] =
+    { ASN_CONSTRUCTOR|ASN_OCTETSTRING,8, ASN_CONSTRUCTOR|ASN_OCTETSTRING,0x80, ASN_OCTETSTRING,2,'h','i', 0,0, 0,0 };
+static const unsigned char encoded_constructed_hi_octet_invalid_end[] =
+    { ASN_CONSTRUCTOR|ASN_OCTETSTRING,0x80, ASN_OCTETSTRING,2,'h','i', 0,1 };
+
 static void test_decodeOctets(DWORD dwEncoding)
 {
     DWORD i;
 
 static void test_decodeOctets(DWORD dwEncoding)
 {
     DWORD i;
 
-    for (i = 0; i < sizeof(octets) / sizeof(octets[0]); i++)
+    static const struct {
+        const BYTE *encoded;
+        UINT encoded_size;
+        const BYTE *decoded;
+        UINT decoded_size;
+        DWORD error;
+    } tests[] = {
+        {
+            encoded_hi_octet, sizeof(encoded_hi_octet),
+            decoded_hi_octet, sizeof(decoded_hi_octet)
+        },{
+            encoded_something_long_octet, sizeof(encoded_something_long_octet),
+            decoded_something_long_octet, sizeof(decoded_something_long_octet)
+        },{
+            encoded_constructed_hi_octet, sizeof(encoded_constructed_hi_octet),
+            decoded_hi_octet, sizeof(decoded_hi_octet)
+        },{
+            encoded_constructed_hi_octet2, sizeof(encoded_constructed_hi_octet2),
+            decoded_hi_octet, sizeof(decoded_hi_octet)
+        },{
+            encoded_constructed_hi_octet3, sizeof(encoded_constructed_hi_octet3),
+            decoded_hi_octet, sizeof(decoded_hi_octet)
+        },{
+            encoded_empty_octet, sizeof(encoded_empty_octet),
+            encoded_empty_octet, 0
+        },{
+            encoded_hi_octet, sizeof(encoded_hi_octet) - 1,
+            NULL, 0, CRYPT_E_ASN1_EOD
+        },{
+            encoded_constructed_hi_octet, sizeof(encoded_constructed_hi_octet) - 1,
+            NULL, 0, CRYPT_E_ASN1_EOD
+        },{
+            encoded_constructed_hi_octet_invalid_end, sizeof(encoded_constructed_hi_octet_invalid_end),
+            NULL, 0, CRYPT_E_ASN1_CORRUPT
+        }
+    };
+
+    for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
     {
         BYTE *buf = NULL;
         BOOL ret;
         DWORD bufSize = 0;
 
         ret = pCryptDecodeObjectEx(dwEncoding, X509_OCTET_STRING,
     {
         BYTE *buf = NULL;
         BOOL ret;
         DWORD bufSize = 0;
 
         ret = pCryptDecodeObjectEx(dwEncoding, X509_OCTET_STRING,
-         octets[i].encoded, octets[i].encoded[1] + 2,
+         tests[i].encoded, tests[i].encoded_size,
          CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &bufSize);
          CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &bufSize);
-        ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
-        ok(bufSize >= sizeof(CRYPT_DATA_BLOB) + octets[i].encoded[1],
-         "Expected size >= %d, got %d\n",
-           (int)sizeof(CRYPT_DATA_BLOB) + octets[i].encoded[1], bufSize);
+        if (tests[i].error)
+        {
+            ok(!ret && GetLastError() == tests[i].error,
+               "[%u] CryptDecodeObjectEx returned %x(%x)\n", i, ret, GetLastError());
+            continue;
+        }
+        ok(ret, "[%u] CryptDecodeObjectEx failed: %08x\n", i, GetLastError());
+        ok(bufSize >= sizeof(CRYPT_DATA_BLOB) + tests[i].decoded_size,
+           "[%u] Expected size >= %d, got %d\n", i,
+           (int)sizeof(CRYPT_DATA_BLOB) + tests[i].decoded_size, bufSize);
         ok(buf != NULL, "Expected allocated buffer\n");
         if (ret)
         {
             CRYPT_DATA_BLOB *blob = (CRYPT_DATA_BLOB *)buf;
 
         ok(buf != NULL, "Expected allocated buffer\n");
         if (ret)
         {
             CRYPT_DATA_BLOB *blob = (CRYPT_DATA_BLOB *)buf;
 
+            ok (blob->cbData == tests[i].decoded_size, "[%u] cbData = %u\n", i, blob->cbData);
             if (blob->cbData)
             if (blob->cbData)
-                ok(!memcmp(blob->pbData, octets[i].val, blob->cbData),
+                ok(!memcmp(blob->pbData, tests[i].decoded, blob->cbData),
                  "Unexpected value\n");
             LocalFree(buf);
         }
                  "Unexpected value\n");
             LocalFree(buf);
         }
@@ -3302,18 +3368,76 @@ static const BYTE hash[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd,
  0xe, 0xf };
 
 static const BYTE signedBigCert[] = {
  0xe, 0xf };
 
 static const BYTE signedBigCert[] = {
- 0x30, 0x81, 0x93, 0x30, 0x7a, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06, 0x00, 0x30,
- 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0a, 0x4a,
- 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x22, 0x18, 0x0f,
- 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30,
- 0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30,
- 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06,
- 0x03, 0x55, 0x04, 0x03, 0x13, 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61,
- 0x6e, 0x67, 0x00, 0x30, 0x07, 0x30, 0x02, 0x06, 0x00, 0x03, 0x01, 0x00, 0xa3,
- 0x16, 0x30, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff,
- 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06,
- 0x00, 0x03, 0x11, 0x00, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
- 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 };
+ ASN_SEQUENCE,0x81,147,
+   ASN_SEQUENCE,122,
+     ASN_INTEGER,1, 0x01,
+     ASN_SEQUENCE,2,
+       ASN_OBJECTIDENTIFIER,0,
+     ASN_SEQUENCE,21,
+       0x31,19,
+         ASN_SEQUENCE,17,
+           ASN_OBJECTIDENTIFIER,3, 0x55,0x04,0x03,
+           0x13,10, 0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,
+     ASN_SEQUENCE,34,
+       0x18,15, 0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,
+       0x18,15, 0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,
+     ASN_SEQUENCE,21,
+       0x31,19,
+         ASN_SEQUENCE,17,
+           ASN_OBJECTIDENTIFIER,3, 0x55,0x04,0x03,
+           0x13,10, 0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,
+     ASN_SEQUENCE,7,
+       ASN_SEQUENCE,2,
+         ASN_OBJECTIDENTIFIER,0,
+       ASN_BITS,1, 0x00,
+   0xa3,22,
+     ASN_SEQUENCE,20,
+       ASN_SEQUENCE,18,
+         ASN_OBJECTIDENTIFIER,3, 0x55,0x1d,0x13,
+         0x01,1, 0xff,
+         ASN_OCTETSTRING,8, 0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01,
+     ASN_SEQUENCE,2,
+       ASN_OBJECTIDENTIFIER,0,
+ ASN_BITS,17, 0x00,0x0f,0x0e,0x0d,0x0c,0x0b,0x0a,0x09,0x08,
+              0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00
+};
+
+static const BYTE signedBigCertWithIndefiniteSeq[] = {
+ ASN_SEQUENCE,0x81,151,
+   ASN_SEQUENCE,126,
+     ASN_INTEGER,1, 0x01,
+     ASN_SEQUENCE,2,
+       ASN_OBJECTIDENTIFIER,0,
+     ASN_SEQUENCE,21,
+       0x31,19,
+         ASN_SEQUENCE,17,
+           ASN_OBJECTIDENTIFIER,3, 0x55,0x04,0x03,
+           0x13,10, 0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,
+     ASN_SEQUENCE,0x80,
+       0x18,15, 0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,
+       0x18,15, 0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,
+     0,0,
+     ASN_SEQUENCE,21,
+       0x31,19,
+         ASN_SEQUENCE,17,
+           ASN_OBJECTIDENTIFIER,3, 0x55,0x04,0x03,
+           0x13,10, 0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,
+     ASN_SEQUENCE,0x80,
+       ASN_SEQUENCE,2,
+         ASN_OBJECTIDENTIFIER,0,
+       ASN_BITS,1, 0x00,
+     0,0,
+   0xa3,22,
+     ASN_SEQUENCE,20,
+       ASN_SEQUENCE,18,
+         ASN_OBJECTIDENTIFIER,3, 0x55,0x1d,0x13,
+         0x01,1, 0xff,
+         ASN_OCTETSTRING,8, 0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01,
+     ASN_SEQUENCE,2,
+       ASN_OBJECTIDENTIFIER,0,
+ ASN_BITS,17, 0x00,0x0f,0x0e,0x0d,0x0c,0x0b,0x0a,0x09,0x08,
+              0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00
+};
 
 static void test_encodeCert(DWORD dwEncoding)
 {
 
 static void test_encodeCert(DWORD dwEncoding)
 {
@@ -3369,6 +3493,29 @@ static void test_decodeCert(DWORD dwEncoding)
     {
         CERT_INFO *info = (CERT_INFO *)buf;
 
     {
         CERT_INFO *info = (CERT_INFO *)buf;
 
+        ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
+        ok(info->SerialNumber.cbData == 1,
+         "Expected serial number size 1, got %d\n", info->SerialNumber.cbData);
+        ok(*info->SerialNumber.pbData == *serialNum,
+         "Expected serial number %d, got %d\n", *serialNum,
+         *info->SerialNumber.pbData);
+        ok(info->Issuer.cbData == sizeof(encodedCommonName),
+         "Wrong size %d\n", info->Issuer.cbData);
+        ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
+         "Unexpected issuer\n");
+        ok(info->Subject.cbData == sizeof(encodedCommonName),
+         "Wrong size %d\n", info->Subject.cbData);
+        ok(!memcmp(info->Subject.pbData, encodedCommonName,
+         info->Subject.cbData), "Unexpected subject\n");
+        LocalFree(buf);
+    }
+    ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, signedBigCertWithIndefiniteSeq,
+     sizeof(signedBigCertWithIndefiniteSeq), CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
+    ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+    if (ret)
+    {
+        CERT_INFO *info = (CERT_INFO *)buf;
+
         ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
         ok(info->SerialNumber.cbData == 1,
          "Expected serial number size 1, got %d\n", info->SerialNumber.cbData);
         ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
         ok(info->SerialNumber.cbData == 1,
          "Expected serial number size 1, got %d\n", info->SerialNumber.cbData);
@@ -5909,32 +6056,79 @@ static const BYTE indefiniteSignedPKCSContent[] = {
 0xe3,0x55,0x71,0x91,0xf9,0x2a,0xd1,0xb8,0xaa,0x52,0xb8,0x22,0x3a,0xeb,0x61,
 0x00,0x00,0x00,0x00,0x00,0x00 };
 
 0xe3,0x55,0x71,0x91,0xf9,0x2a,0xd1,0xb8,0xaa,0x52,0xb8,0x22,0x3a,0xeb,0x61,
 0x00,0x00,0x00,0x00,0x00,0x00 };
 
+static const BYTE content_abcd[] = {
+    ASN_SEQUENCE, 0x80,
+        ASN_OBJECTIDENTIFIER, 2, 42,3,
+        ASN_CONTEXT|ASN_CONSTRUCTOR, 0x80,
+            ASN_OCTETSTRING, 4, 'a','b','c','d',
+        0,0,
+    0,0,
+};
+
+static const BYTE encoded_abcd[] = {
+    ASN_OCTETSTRING, 4, 'a','b','c','d',
+};
+
+static const BYTE content_constructed_abcd[] = {
+    ASN_SEQUENCE, 0x80,
+        ASN_OBJECTIDENTIFIER, 2, 42,3,
+        ASN_CONTEXT|ASN_CONSTRUCTOR, 0x80,
+            ASN_CONSTRUCTOR|ASN_OCTETSTRING,0x80,
+                ASN_OCTETSTRING, 4, 'a','b','0','0',
+            0,0,
+        0,0,
+    0,0,
+    1,2,3,4,5,6,7 /* extra garbage */
+};
+
 static void test_decodePKCSContentInfo(DWORD dwEncoding)
 {
     BOOL ret;
     LPBYTE buf = NULL;
 static void test_decodePKCSContentInfo(DWORD dwEncoding)
 {
     BOOL ret;
     LPBYTE buf = NULL;
-    DWORD size = 0;
+    DWORD size = 0, i;
     CRYPT_CONTENT_INFO *info;
 
     CRYPT_CONTENT_INFO *info;
 
-    ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO,
-     emptyPKCSContentInfo, sizeof(emptyPKCSContentInfo),
-     CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
-    ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
-    if (ret)
+    const struct {
+        const BYTE *encoded;
+        UINT encoded_size;
+        const char *obj_id;
+        const BYTE *content;
+        UINT content_size;
+    } tests[] = {
+        { emptyPKCSContentInfo, sizeof(emptyPKCSContentInfo),
+          "1.2.3", NULL, 0 },
+        { emptyPKCSContentInfoExtraBytes, sizeof(emptyPKCSContentInfoExtraBytes),
+          "1.2.3", NULL, 0 },
+        { intPKCSContentInfo, sizeof(intPKCSContentInfo),
+          "1.2.3", ints[0].encoded, ints[0].encoded[1] + 2 },
+        { indefiniteSignedPKCSContent, sizeof(indefiniteSignedPKCSContent),
+          "1.2.840.113549.1.7.2", NULL, 392 },
+        { content_abcd, sizeof(content_abcd),
+          "1.2.3", encoded_abcd, 6 },
+        { content_constructed_abcd, sizeof(content_constructed_abcd),
+          "1.2.3", content_constructed_abcd + 8, 10 }
+    };
+
+    for (i = 0; i < sizeof(tests)/sizeof(*tests); i++)
     {
     {
+        ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO, tests[i].encoded,
+            tests[i].encoded_size, CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
+        ok(ret, "[%u] CryptDecodeObjectEx failed: %x\n", i, GetLastError());
+        if (!ret) continue;
+
         info = (CRYPT_CONTENT_INFO *)buf;
 
         info = (CRYPT_CONTENT_INFO *)buf;
 
-        ok(!strcmp(info->pszObjId, "1.2.3"), "Expected 1.2.3, got %s\n",
-         info->pszObjId);
-        ok(info->Content.cbData == 0, "Expected no data, got %d\n",
-         info->Content.cbData);
+        ok(!strcmp(info->pszObjId, tests[i].obj_id), "[%u] Expected %s, got %s\n",
+           i, tests[i].obj_id, info->pszObjId);
+        ok(info->Content.cbData == tests[i].content_size,
+           "[%u] Unexpected size %d expected %d\n", i, info->Content.cbData,
+           tests[i].content_size);
+        if (tests[i].content)
+            ok(!memcmp(info->Content.pbData, tests[i].content, tests[i].content_size),
+               "[%u] Unexpected value\n", i);
         LocalFree(buf);
     }
         LocalFree(buf);
     }
-    ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO,
-     emptyPKCSContentInfoExtraBytes, sizeof(emptyPKCSContentInfoExtraBytes),
-     0, NULL, NULL, &size);
-    ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
-    SetLastError(0xdeadbeef);
+
     ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO,
      bogusPKCSContentInfo, sizeof(bogusPKCSContentInfo),
      CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
     ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO,
      bogusPKCSContentInfo, sizeof(bogusPKCSContentInfo),
      CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
@@ -5945,36 +6139,6 @@ static void test_decodePKCSContentInfo(DWORD dwEncoding)
      GetLastError() == CRYPT_E_ASN1_CORRUPT)) || broken(ret),
      "Expected CRYPT_E_ASN1_EOD or CRYPT_E_ASN1_CORRUPT, got %x\n",
      GetLastError());
      GetLastError() == CRYPT_E_ASN1_CORRUPT)) || broken(ret),
      "Expected CRYPT_E_ASN1_EOD or CRYPT_E_ASN1_CORRUPT, got %x\n",
      GetLastError());
-    ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO,
-     intPKCSContentInfo, sizeof(intPKCSContentInfo),
-     CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
-    ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
-    if (ret)
-    {
-        info = (CRYPT_CONTENT_INFO *)buf;
-
-        ok(!strcmp(info->pszObjId, "1.2.3"), "Expected 1.2.3, got %s\n",
-         info->pszObjId);
-        ok(info->Content.cbData == ints[0].encoded[1] + 2,
-         "Unexpected size %d\n", info->Content.cbData);
-        ok(!memcmp(info->Content.pbData, ints[0].encoded,
-         info->Content.cbData), "Unexpected value\n");
-        LocalFree(buf);
-    }
-    ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO,
-     indefiniteSignedPKCSContent, sizeof(indefiniteSignedPKCSContent),
-     CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
-    ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
-    if (ret)
-    {
-        info = (CRYPT_CONTENT_INFO *)buf;
-
-        ok(!strcmp(info->pszObjId, szOID_RSA_signedData),
-         "Expected %s, got %s\n", szOID_RSA_signedData, info->pszObjId);
-        ok(info->Content.cbData == 392, "Expected 392, got %d\n",
-         info->Content.cbData);
-        LocalFree(buf);
-    }
 }
 
 static const BYTE emptyPKCSAttr[] = { 0x30,0x06,0x06,0x02,0x2a,0x03,0x31,
 }
 
 static const BYTE emptyPKCSAttr[] = { 0x30,0x06,0x06,0x02,0x2a,0x03,0x31,
@@ -8345,6 +8509,173 @@ static void testPortPublicKeyInfo(void)
     ok(ret,"CryptAcquireContextA failed\n");
 }
 
     ok(ret,"CryptAcquireContextA failed\n");
 }
 
+static const BYTE eccCert[] = {
+0x30,0x82,0x01,0x46,0x30,0x81,0xec,0x02,0x09,0x00,0xe7,0x6b,
+0x26,0x86,0x0a,0x82,0xff,0xe9,0x30,0x0a,0x06,0x08,0x2a,0x86,
+0x48,0xce,0x3d,0x04,0x03,0x02,0x30,0x2b,0x31,0x0b,0x30,0x09,
+0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x44,0x45,0x31,0x0d,0x30,
+0x0b,0x06,0x03,0x55,0x04,0x0a,0x0c,0x04,0x57,0x69,0x6e,0x65,
+0x31,0x0d,0x30,0x0b,0x06,0x03,0x55,0x04,0x03,0x0c,0x04,0x57,
+0x69,0x6e,0x65,0x30,0x1e,0x17,0x0d,0x31,0x37,0x30,0x39,0x32,
+0x37,0x31,0x33,0x34,0x31,0x30,0x34,0x5a,0x17,0x0d,0x32,0x37,
+0x30,0x39,0x32,0x35,0x31,0x33,0x34,0x31,0x30,0x34,0x5a,0x30,
+0x2b,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,
+0x44,0x45,0x31,0x0d,0x30,0x0b,0x06,0x03,0x55,0x04,0x0a,0x0c,
+0x04,0x54,0x65,0x73,0x74,0x31,0x0d,0x30,0x0b,0x06,0x03,0x55,
+0x04,0x03,0x0c,0x04,0x54,0x65,0x73,0x74,0x30,0x59,0x30,0x13,
+0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,
+0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x03,0x42,0x00,0x04,0xed,
+0xfc,0x77,0xd8,0xb9,0xe7,0xf3,0xf8,0xce,0x13,0xb8,0x7f,0x0f,
+0x78,0xea,0x73,0x87,0x29,0x10,0xe1,0x6d,0x10,0xce,0x57,0x60,
+0x3b,0x3e,0xb4,0x5f,0x0d,0x20,0xc1,0xeb,0x6d,0x74,0xe9,0x7b,
+0x11,0x51,0x9a,0x00,0xe8,0xe9,0x12,0x84,0xb9,0x07,0x7e,0x7b,
+0x62,0x67,0x12,0x67,0x08,0xe5,0x2e,0x27,0xce,0xa2,0x57,0x15,
+0xad,0xc5,0x1f,0x30,0x0a,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,
+0x04,0x03,0x02,0x03,0x49,0x00,0x30,0x46,0x02,0x21,0x00,0xd7,
+0x29,0xce,0x5a,0xef,0x74,0x85,0xd1,0x18,0x5f,0x6e,0xf1,0xba,
+0x53,0xd4,0xcd,0xdd,0xe0,0x5d,0xf1,0x5e,0x48,0x51,0xea,0x63,
+0xc0,0xe8,0xe2,0xf6,0xfa,0x4c,0xaf,0x02,0x21,0x00,0xe3,0x94,
+0x15,0x3b,0x6c,0x71,0x6e,0x44,0x22,0xcb,0xa0,0x88,0xcd,0x0a,
+0x5a,0x50,0x29,0x7c,0x5c,0xd6,0x6c,0xd2,0xe0,0x7f,0xcd,0x02,
+0x92,0x21,0x4c,0x2c,0x92,0xee };
+static const BYTE ecdsaSig[] = {
+0x30,0x46,0x02,0x21,0x00,0xd7,0x29,0xce,0x5a,0xef,0x74,0x85,
+0xd1,0x18,0x5f,0x6e,0xf1,0xba,0x53,0xd4,0xcd,0xdd,0xe0,0x5d,
+0xf1,0x5e,0x48,0x51,0xea,0x63,0xc0,0xe8,0xe2,0xf6,0xfa,0x4c,
+0xaf,0x02,0x21,0x00,0xe3,0x94,0x15,0x3b,0x6c,0x71,0x6e,0x44,
+0x22,0xcb,0xa0,0x88,0xcd,0x0a,0x5a,0x50,0x29,0x7c,0x5c,0xd6,
+0x6c,0xd2,0xe0,0x7f,0xcd,0x02,0x92,0x21,0x4c,0x2c,0x92,0xee };
+static const BYTE eccPubKey[] = {
+0x30,0x59,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,
+0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x03,
+0x42,0x00,0x04,0xed,0xfc,0x77,0xd8,0xb9,0xe7,0xf3,0xf8,0xce,
+0x13,0xb8,0x7f,0x0f,0x78,0xea,0x73,0x87,0x29,0x10,0xe1,0x6d,
+0x10,0xce,0x57,0x60,0x3b,0x3e,0xb4,0x5f,0x0d,0x20,0xc1,0xeb,
+0x6d,0x74,0xe9,0x7b,0x11,0x51,0x9a,0x00,0xe8,0xe9,0x12,0x84,
+0xb9,0x07,0x7e,0x7b,0x62,0x67,0x12,0x67,0x08,0xe5,0x2e,0x27,
+0xce,0xa2,0x57,0x15,0xad,0xc5,0x1f };
+
+static void testECDSACert(void)
+{
+    DWORD decode_flags = CRYPT_DECODE_ALLOC_FLAG | CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG;
+    CERT_SIGNED_CONTENT_INFO *info;
+    CERT_PUBLIC_KEY_INFO *pubkey;
+    CERT_ECC_SIGNATURE *ecc_sig;
+    LPSTR *ecc_curve;
+    DWORD size;
+    BOOL ret;
+    int i;
+
+    info = NULL;
+    ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, X509_CERT, eccCert, sizeof(eccCert), decode_flags,
+                               NULL, &info, &size);
+    ok(ret, "CryptDecodeObjectEx failed with %d\n", GetLastError());
+
+    ok(!strcmp(info->SignatureAlgorithm.pszObjId, szOID_ECDSA_SHA256),
+       "Expected 1.2.840.10045.4.3.2, got %s\n", info->SignatureAlgorithm.pszObjId);
+    ok(!info->SignatureAlgorithm.Parameters.cbData,
+       "Expected no parameter data, got %d bytes\n", info->SignatureAlgorithm.Parameters.cbData);
+    ok(!info->SignatureAlgorithm.Parameters.pbData,
+       "Expected no parameter data, got %p pointer\n", info->SignatureAlgorithm.Parameters.pbData);
+
+    ok(info->Signature.cbData == sizeof(ecdsaSig),
+       "Expected %d bytes, got %d\n", (int)sizeof(ecdsaSig), info->Signature.cbData);
+    ok(info->Signature.pbData != NULL, "Got NULL pointer\n");
+    ok(!info->Signature.cUnusedBits, "Expected no unused bytes, got %d\n", info->Signature.cUnusedBits);
+    for (i = 0; i < info->Signature.cbData; i++)
+    {
+        ok(ecdsaSig[i] == info->Signature.pbData[i], "Expected %02x, got %02x at offset %d\n",
+           ecdsaSig[i], info->Signature.pbData[i], i);
+    }
+
+    ecc_sig = NULL;
+    ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, X509_ECC_SIGNATURE, info->Signature.pbData,
+                               info->Signature.cbData, decode_flags, NULL, &ecc_sig, &size);
+    ok(ret, "CryptDecodeObjectEx failed with %d\n", GetLastError());
+    if (ret)
+    {
+        ok(ecc_sig->r.cbData == 32, "Expected 32 bytes, got %d\n", ecc_sig->r.cbData);
+        ok(ecc_sig->r.pbData != NULL, "Got NULL pointer\n");
+        ok(ecc_sig->s.cbData == 32, "Expected 32 bytes, got %d\n", ecc_sig->s.cbData);
+        ok(ecc_sig->s.pbData != NULL, "Got NULL pointer\n");
+        for (i = 0; i < ecc_sig->r.cbData; i++)
+        {
+            ok(ecdsaSig[4+32-i] == ecc_sig->r.pbData[i], "Expected %02x, got %02x at offset %d\n",
+               ecdsaSig[4+32-i], ecc_sig->r.pbData[i], i);
+        }
+        for (i = 0; i < ecc_sig->s.cbData; i++)
+        {
+            ok(ecdsaSig[4+35+32-i] == ecc_sig->s.pbData[i], "Expected %02x, got %02x at offset %d\n",
+               ecdsaSig[4+35+32-i], ecc_sig->s.pbData[i], i);
+        }
+        LocalFree(ecc_sig);
+    }
+
+    LocalFree(info);
+
+    info = NULL;
+    decode_flags &= ~CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG;
+    ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, X509_CERT, eccCert, sizeof(eccCert), decode_flags,
+                               NULL, &info, &size);
+    ok(ret, "CryptDecodeObjectEx failed with %d\n", GetLastError());
+
+    ok(info->Signature.cbData == sizeof(ecdsaSig),
+       "Expected %d bytes, got %d\n", (int)sizeof(ecdsaSig), info->Signature.cbData);
+    ok(info->Signature.pbData != NULL, "Got NULL pointer\n");
+    ok(!info->Signature.cUnusedBits, "Expected no unused bytes, got %d\n", info->Signature.cUnusedBits);
+    for (i = 0; i < info->Signature.cbData; i++)
+    {
+        ok(ecdsaSig[sizeof(ecdsaSig)-i-1] == info->Signature.pbData[i], "Expected %02x, got %02x at offset %d\n",
+           ecdsaSig[sizeof(ecdsaSig)-i-1], info->Signature.pbData[i], i);
+    }
+
+    LocalFree(info);
+
+    pubkey = NULL;
+    ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, X509_PUBLIC_KEY_INFO, eccPubKey, sizeof(eccPubKey),
+                               decode_flags, NULL, &pubkey, &size);
+    ok(ret, "CryptDecodeObjectEx failed with %d\n", GetLastError());
+
+    ok(!strcmp(pubkey->Algorithm.pszObjId, szOID_ECC_PUBLIC_KEY),
+       "Expected 1.2.840.10045.2.1, got %s\n", pubkey->Algorithm.pszObjId);
+    ok(pubkey->Algorithm.Parameters.cbData == 10,
+       "Expected 10 bytes parameters, got %d bytes\n", pubkey->Algorithm.Parameters.cbData);
+    ok(pubkey->Algorithm.Parameters.pbData != NULL,
+       "Expected pointer to parameters, got NULL\n");
+
+    ecc_curve = NULL;
+    ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, X509_OBJECT_IDENTIFIER, pubkey->Algorithm.Parameters.pbData,
+                               pubkey->Algorithm.Parameters.cbData, decode_flags, NULL, &ecc_curve, &size);
+    ok(ret || broken(GetLastError() == ERROR_FILE_NOT_FOUND /* < Vista */),
+       "CryptDecodeObjectEx failed with %d\n", GetLastError());
+    if (ret)
+    {
+        ok(!strcmp(*ecc_curve, szOID_ECC_CURVE_P256), "Expected 1.2.840.10045.3.1.7, got %s\n", *ecc_curve);
+        LocalFree(ecc_curve);
+    }
+
+    ecc_curve = NULL;
+    ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, szOID_ECC_PUBLIC_KEY, pubkey->Algorithm.Parameters.pbData,
+                               pubkey->Algorithm.Parameters.cbData, decode_flags, NULL, &ecc_curve, &size);
+    ok(ret || broken(GetLastError() == ERROR_FILE_NOT_FOUND /* < Vista */),
+       "CryptDecodeObjectEx failed with %d\n", GetLastError());
+    if (ret)
+    {
+        ok(!strcmp(*ecc_curve, szOID_ECC_CURVE_P256), "Expected 1.2.840.10045.3.1.7, got %s\n", *ecc_curve);
+        LocalFree(ecc_curve);
+    }
+
+    ok(pubkey->PublicKey.cbData == 65, "Expected 32 bytes parameters, got %d bytes\n", pubkey->PublicKey.cbData);
+    ok(pubkey->PublicKey.pbData != NULL, "Expected pointer to parameters, got NULL\n");
+    for (i = 0; i < pubkey->PublicKey.cbData; i++)
+    {
+        ok(eccPubKey[26+i] == pubkey->PublicKey.pbData[i], "Expected %02x, got %02x at offset %d\n",
+           eccPubKey[26+i], pubkey->PublicKey.pbData[i], i);
+    }
+
+    LocalFree(pubkey);
+}
+
 START_TEST(encode)
 {
     static const DWORD encodings[] = { X509_ASN_ENCODING, PKCS_7_ASN_ENCODING,
 START_TEST(encode)
 {
     static const DWORD encodings[] = { X509_ASN_ENCODING, PKCS_7_ASN_ENCODING,
@@ -8438,4 +8769,5 @@ START_TEST(encode)
         test_decodeRsaPrivateKey(encodings[i]);
     }
     testPortPublicKeyInfo();
         test_decodeRsaPrivateKey(encodings[i]);
     }
     testPortPublicKeyInfo();
+    testECDSACert();
 }
 }
index d6ef8dd..a0019b5 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdio.h>
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winerror.h>
+#include <wincrypt.h>
+#include <winreg.h>
+
+#include "wine/test.h"
 
 static HMODULE hCrypt;
 
 
 static HMODULE hCrypt;
 
index 11f3ff0..7e2e8aa 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdio.h>
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winerror.h>
+#include <wincrypt.h>
+
+#include "wine/test.h"
 
 static BOOL (WINAPI * pCryptAcquireContextA)
                         (HCRYPTPROV *, LPCSTR, LPCSTR, DWORD, DWORD);
 
 static BOOL (WINAPI * pCryptAcquireContextA)
                         (HCRYPTPROV *, LPCSTR, LPCSTR, DWORD, DWORD);
index 45a012a..c240533 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdio.h>
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winerror.h>
+#define CMSG_SIGNER_ENCODE_INFO_HAS_CMS_FIELDS
+#define CMSG_SIGNED_ENCODE_INFO_HAS_CMS_FIELDS
+#include <wincrypt.h>
+
+#include "wine/test.h"
 
 static BOOL have_nt = TRUE;
 static BOOL old_crypt32 = FALSE;
 
 static BOOL have_nt = TRUE;
 static BOOL old_crypt32 = FALSE;
@@ -2848,7 +2857,7 @@ static void test_decode_msg_get_param(void)
     HCRYPTPROV hCryptProv;
     HCRYPTKEY key = 0;
     BOOL ret;
     HCRYPTPROV hCryptProv;
     HCRYPTKEY key = 0;
     BOOL ret;
-    DWORD size = 0, value;
+    DWORD size = 0, value, req_size;
     LPBYTE buf;
     CMSG_CTRL_DECRYPT_PARA decryptPara = { sizeof(decryptPara), 0 };
 
     LPBYTE buf;
     CMSG_CTRL_DECRYPT_PARA decryptPara = { sizeof(decryptPara), 0 };
 
@@ -2938,7 +2947,10 @@ static void test_decode_msg_get_param(void)
         signer.SerialNumber.cbData = sizeof(serialNum);
         signer.SerialNumber.pbData = serialNum;
         signer.HashAlgorithm.pszObjId = oid_rsa_md5;
         signer.SerialNumber.cbData = sizeof(serialNum);
         signer.SerialNumber.pbData = serialNum;
         signer.HashAlgorithm.pszObjId = oid_rsa_md5;
+        req_size = size;
+        size += 10;
         CryptMsgGetParam(msg, CMSG_SIGNER_INFO_PARAM, 0, buf, &size);
         CryptMsgGetParam(msg, CMSG_SIGNER_INFO_PARAM, 0, buf, &size);
+        ok(size == req_size, "size = %u, expected %u\n", size, req_size);
         compare_signer_info((CMSG_SIGNER_INFO *)buf, &signer);
         CryptMemFree(buf);
     }
         compare_signer_info((CMSG_SIGNER_INFO *)buf, &signer);
         CryptMemFree(buf);
     }
index 61e6444..211b542 100644 (file)
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
+#include <stdio.h>
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winerror.h>
+#include <wincrypt.h>
 
 
-#include "precomp.h"
+#include "wine/test.h"
 
 static BOOL (WINAPI * pCryptQueryObject)(DWORD, const void *, DWORD, DWORD,
  DWORD, DWORD *, DWORD *, DWORD *, HCERTSTORE *, HCRYPTMSG *, const void **);
 
 static BOOL (WINAPI * pCryptQueryObject)(DWORD, const void *, DWORD, DWORD,
  DWORD, DWORD *, DWORD *, DWORD *, HCERTSTORE *, HCRYPTMSG *, const void **);
index 9a3dbe1..89d58b7 100644 (file)
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
+#include <stdio.h>
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winerror.h>
+#define CRYPT_OID_INFO_HAS_EXTRA_FIELDS
+#include <wincrypt.h>
+#include <winreg.h>
+
+#include "wine/test.h"
 
 
-#include "precomp.h"
 
 static BOOL (WINAPI *pCryptEnumOIDInfo)(DWORD,DWORD,void*,PFN_CRYPT_ENUM_OID_INFO);
 
 
 static BOOL (WINAPI *pCryptEnumOIDInfo)(DWORD,DWORD,void*,PFN_CRYPT_ENUM_OID_INFO);
 
@@ -28,6 +37,7 @@ struct OIDToAlgID
     LPCSTR oid;
     LPCSTR altOid;
     DWORD algID;
     LPCSTR oid;
     LPCSTR altOid;
     DWORD algID;
+    DWORD altAlgID;
 };
 
 static const struct OIDToAlgID oidToAlgID[] = {
 };
 
 static const struct OIDToAlgID oidToAlgID[] = {
@@ -64,6 +74,9 @@ static const struct OIDToAlgID oidToAlgID[] = {
  { szOID_OIWDIR_md2RSA, NULL, CALG_MD2 },
  { szOID_INFOSEC_mosaicUpdatedSig, NULL, CALG_SHA },
  { szOID_INFOSEC_mosaicKMandUpdSig, NULL, CALG_DSS_SIGN },
  { szOID_OIWDIR_md2RSA, NULL, CALG_MD2 },
  { szOID_INFOSEC_mosaicUpdatedSig, NULL, CALG_SHA },
  { szOID_INFOSEC_mosaicKMandUpdSig, NULL, CALG_DSS_SIGN },
+ { szOID_NIST_sha256, NULL, CALG_SHA_256, -1 },
+ { szOID_NIST_sha384, NULL, CALG_SHA_384, -1 },
+ { szOID_NIST_sha512, NULL, CALG_SHA_512, -1 }
 };
 
 static const struct OIDToAlgID algIDToOID[] = {
 };
 
 static const struct OIDToAlgID algIDToOID[] = {
@@ -96,10 +109,7 @@ static void testOIDToAlgID(void)
     for (i = 0; i < sizeof(oidToAlgID) / sizeof(oidToAlgID[0]); i++)
     {
         alg = CertOIDToAlgId(oidToAlgID[i].oid);
     for (i = 0; i < sizeof(oidToAlgID) / sizeof(oidToAlgID[0]); i++)
     {
         alg = CertOIDToAlgId(oidToAlgID[i].oid);
-        /* Not all Windows installations support all these, so make sure it's
-         * at least not the wrong one.
-         */
-        ok(alg == 0 || alg == oidToAlgID[i].algID,
+        ok(alg == oidToAlgID[i].algID || (oidToAlgID[i].altAlgID && alg == oidToAlgID[i].altAlgID),
          "Expected %d, got %d\n", oidToAlgID[i].algID, alg);
     }
 }
          "Expected %d, got %d\n", oidToAlgID[i].algID, alg);
     }
 }
@@ -118,6 +128,7 @@ static void testAlgIDToOID(void)
     {
         oid = CertAlgIdToOID(algIDToOID[i].algID);
         /* Allow failure, not every version of Windows supports every algo */
     {
         oid = CertAlgIdToOID(algIDToOID[i].algID);
         /* Allow failure, not every version of Windows supports every algo */
+        ok(oid != NULL || broken(!oid), "CertAlgIdToOID failed, expected %s\n", algIDToOID[i].oid);
         if (oid)
         {
             if (strcmp(oid, algIDToOID[i].oid))
         if (oid)
         {
             if (strcmp(oid, algIDToOID[i].oid))
@@ -533,12 +544,16 @@ static void test_enumOIDInfo(void)
 
 static void test_findOIDInfo(void)
 {
 
 static void test_findOIDInfo(void)
 {
+    static WCHAR sha256ECDSA[] = { 's','h','a','2','5','6','E','C','D','S','A',0 };
     static WCHAR sha1[] = { 's','h','a','1',0 };
     static WCHAR sha1[] = { 's','h','a','1',0 };
-    static CHAR oid_rsa_md5[] = szOID_RSA_MD5;
+    static CHAR oid_rsa_md5[] = szOID_RSA_MD5, oid_sha256[] = szOID_NIST_sha256;
+    static CHAR oid_ecda_sha25[] = szOID_ECDSA_SHA256;
     ALG_ID alg = CALG_SHA1;
     ALG_ID algs[2] = { CALG_MD5, CALG_RSA_SIGN };
     PCCRYPT_OID_INFO info;
 
     ALG_ID alg = CALG_SHA1;
     ALG_ID algs[2] = { CALG_MD5, CALG_RSA_SIGN };
     PCCRYPT_OID_INFO info;
 
+    static const WCHAR sha256W[] = {'s','h','a','2','5','6',0};
+
     info = CryptFindOIDInfo(0, NULL, 0);
     ok(info == NULL, "Expected NULL\n");
     info = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, oid_rsa_md5, 0);
     info = CryptFindOIDInfo(0, NULL, 0);
     ok(info == NULL, "Expected NULL\n");
     info = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, oid_rsa_md5, 0);
@@ -577,6 +592,49 @@ static void test_findOIDInfo(void)
         ok(U(*info).Algid == CALG_MD5, "Expected CALG_MD5, got %d\n",
            U(*info).Algid);
     }
         ok(U(*info).Algid == CALG_MD5, "Expected CALG_MD5, got %d\n",
            U(*info).Algid);
     }
+
+    info = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, oid_sha256, 0);
+    ok(info != NULL, "Expected to find szOID_RSA_MD5\n");
+    if (info)
+    {
+        ok(!strcmp(info->pszOID, szOID_NIST_sha256), "Expected %s, got %s\n",
+         szOID_NIST_sha256, info->pszOID);
+        ok(!lstrcmpW(info->pwszName, sha256W), "pwszName = %s\n", wine_dbgstr_w(info->pwszName));
+        ok(U(*info).Algid == CALG_SHA_256 || U(*info).Algid == -1,
+           "Expected CALG_MD5 or -1, got %d\n", U(*info).Algid);
+    }
+
+    info = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, oid_ecda_sha25, 0);
+    if (info)
+    {
+        DWORD *data;
+
+        ok(info->cbSize == sizeof(*info),
+           "Expected %d, got %d\n", (int)sizeof(*info), info->cbSize);
+        ok(!strcmp(info->pszOID, oid_ecda_sha25),
+           "Expected %s, got %s\n", oid_ecda_sha25, info->pszOID);
+        ok(!lstrcmpW(info->pwszName, sha256ECDSA),
+           "Expected %s, got %s\n", wine_dbgstr_w(sha256ECDSA), wine_dbgstr_w(info->pwszName));
+        ok(info->dwGroupId == CRYPT_SIGN_ALG_OID_GROUP_ID,
+           "Expected CRYPT_SIGN_ALG_OID_GROUP_ID, got %u\n", info->dwGroupId);
+        ok(U(*info).Algid == CALG_OID_INFO_CNG_ONLY,
+           "Expected CALG_OID_INFO_CNG_ONLY, got %d\n", U(*info).Algid);
+
+        data = (DWORD *)info->ExtraInfo.pbData;
+        ok(info->ExtraInfo.cbData == 8,
+           "Expected 8, got %d\n", info->ExtraInfo.cbData);
+        ok(data[0] == CALG_OID_INFO_PARAMETERS,
+           "Expected CALG_OID_INFO_PARAMETERS, got %x\n", data[0]);
+        ok(data[1] == CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG,
+           "Expected CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG, got %x\n", data[1]);
+
+        ok(!lstrcmpW(info->pwszCNGAlgid, BCRYPT_SHA256_ALGORITHM), "Expected %s, got %s\n",
+           wine_dbgstr_w(BCRYPT_SHA256_ALGORITHM), wine_dbgstr_w(info->pwszCNGAlgid));
+        ok(!lstrcmpW(info->pwszCNGExtraAlgid, CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM), "Expected %s, got %s\n",
+           wine_dbgstr_w(CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM), wine_dbgstr_w(info->pwszCNGExtraAlgid));
+    }
+    else
+        win_skip("Host does not support ECDSA_SHA256, skipping test\n");
 }
 
 START_TEST(oid)
 }
 
 START_TEST(oid)
index 81c3376..247edf5 100644 (file)
@@ -1,3 +1,4 @@
+
 #ifndef _CRYPT32_WINETEST_PRECOMP_H_
 #define _CRYPT32_WINETEST_PRECOMP_H_
 
 #ifndef _CRYPT32_WINETEST_PRECOMP_H_
 #define _CRYPT32_WINETEST_PRECOMP_H_
 
@@ -5,12 +6,16 @@
 
 #define _INC_WINDOWS
 #define COM_NO_WINDOWS_H
 
 #define _INC_WINDOWS
 #define COM_NO_WINDOWS_H
+
 #include <ntstatus.h>
 #define WIN32_NO_STATUS
 #include <ntstatus.h>
 #define WIN32_NO_STATUS
+
 #include <wine/test.h>
 #include <winreg.h>
 #include <wine/test.h>
 #include <winreg.h>
+
 #define CMSG_SIGNER_ENCODE_INFO_HAS_CMS_FIELDS
 #define CMSG_SIGNED_ENCODE_INFO_HAS_CMS_FIELDS
 #define CMSG_SIGNER_ENCODE_INFO_HAS_CMS_FIELDS
 #define CMSG_SIGNED_ENCODE_INFO_HAS_CMS_FIELDS
+#define CRYPT_OID_INFO_HAS_EXTRA_FIELDS
 #include <wincrypt.h>
 
 #endif /* !_CRYPT32_WINETEST_PRECOMP_H_ */
 #include <wincrypt.h>
 
 #endif /* !_CRYPT32_WINETEST_PRECOMP_H_ */
index 3cde714..70a8ba8 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdio.h>
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winerror.h>
+#include <wincrypt.h>
+
+#include "wine/test.h"
 
 static BOOL (WINAPI *pCryptProtectData)(DATA_BLOB*,LPCWSTR,DATA_BLOB*,PVOID,CRYPTPROTECT_PROMPTSTRUCT*,DWORD,DATA_BLOB*);
 static BOOL (WINAPI *pCryptUnprotectData)(DATA_BLOB*,LPWSTR*,DATA_BLOB*,PVOID,CRYPTPROTECT_PROMPTSTRUCT*,DWORD,DATA_BLOB*);
 
 static BOOL (WINAPI *pCryptProtectData)(DATA_BLOB*,LPCWSTR,DATA_BLOB*,PVOID,CRYPTPROTECT_PROMPTSTRUCT*,DWORD,DATA_BLOB*);
 static BOOL (WINAPI *pCryptUnprotectData)(DATA_BLOB*,LPWSTR*,DATA_BLOB*,PVOID,CRYPTPROTECT_PROMPTSTRUCT*,DWORD,DATA_BLOB*);
index 512146e..e2ec2f4 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
-
+#include <stdio.h>
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winerror.h>
 #include <winnls.h>
 #include <winnls.h>
+#include <wincrypt.h>
 #include <mssip.h>
 
 #include <mssip.h>
 
+#include "wine/test.h"
+
 static BOOL (WINAPI * funcCryptSIPGetSignedDataMsg)(SIP_SUBJECTINFO *,DWORD *,DWORD,DWORD *,BYTE *);
 static BOOL (WINAPI * funcCryptSIPPutSignedDataMsg)(SIP_SUBJECTINFO *,DWORD,DWORD *,DWORD,BYTE *);
 static BOOL (WINAPI * funcCryptSIPCreateIndirectData)(SIP_SUBJECTINFO *,DWORD *,SIP_INDIRECT_DATA *);
 static BOOL (WINAPI * funcCryptSIPGetSignedDataMsg)(SIP_SUBJECTINFO *,DWORD *,DWORD,DWORD *,BYTE *);
 static BOOL (WINAPI * funcCryptSIPPutSignedDataMsg)(SIP_SUBJECTINFO *,DWORD,DWORD *,DWORD,BYTE *);
 static BOOL (WINAPI * funcCryptSIPCreateIndirectData)(SIP_SUBJECTINFO *,DWORD *,SIP_INDIRECT_DATA *);
index 226ffc0..47cd0b3 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdio.h>
+#include <stdarg.h>
 
 
+#include <windef.h>
+#include <winbase.h>
+#include <winuser.h>
 #include <shlobj.h>
 #include <shlwapi.h>
 #include <shlobj.h>
 #include <shlwapi.h>
+#include <winreg.h>
+#include <winerror.h>
+#include <wincrypt.h>
+
+#include "wine/test.h"
 
 /* The following aren't defined in wincrypt.h, as they're "reserved" */
 #define CERT_CERT_PROP_ID 32
 
 /* The following aren't defined in wincrypt.h, as they're "reserved" */
 #define CERT_CERT_PROP_ID 32
@@ -108,16 +117,6 @@ static const BYTE signedCTLWithCTLInnerContent[] = {
 0x8e,0xe7,0x5f,0x76,0x2b,0xd1,0x6a,0x82,0xb3,0x30,0x25,0x61,0xf6,0x25,0x23,
 0x57,0x6c,0x0b,0x47,0xb8 };
 
 0x8e,0xe7,0x5f,0x76,0x2b,0xd1,0x6a,0x82,0xb3,0x30,0x25,0x61,0xf6,0x25,0x23,
 0x57,0x6c,0x0b,0x47,0xb8 };
 
-static BOOL (WINAPI *pCertControlStore)(HCERTSTORE,DWORD,DWORD,void const*);
-static PCCRL_CONTEXT (WINAPI *pCertEnumCRLsInStore)(HCERTSTORE,PCCRL_CONTEXT);
-static BOOL (WINAPI *pCertEnumSystemStore)(DWORD,void*,void*,PFN_CERT_ENUM_SYSTEM_STORE);
-static BOOL (WINAPI *pCertGetStoreProperty)(HCERTSTORE,DWORD,void*,DWORD*);
-static void (WINAPI *pCertRemoveStoreFromCollection)(HCERTSTORE,HCERTSTORE);
-static BOOL (WINAPI *pCertSetStoreProperty)(HCERTSTORE,DWORD,DWORD,const void*);
-static BOOL (WINAPI *pCertAddCertificateLinkToStore)(HCERTSTORE,PCCERT_CONTEXT,DWORD,PCCERT_CONTEXT*);
-static BOOL (WINAPI *pCertRegisterSystemStore)(const void*,DWORD,void*,void*);
-static BOOL (WINAPI *pCertUnregisterSystemStore)(const void*,DWORD);
-
 #define test_store_is_empty(store) _test_store_is_empty(__LINE__,store)
 static void _test_store_is_empty(unsigned line, HCERTSTORE store)
 {
 #define test_store_is_empty(store) _test_store_is_empty(__LINE__,store)
 static void _test_store_is_empty(unsigned line, HCERTSTORE store)
 {
@@ -882,32 +881,25 @@ static void testCollectionStore(void)
         ok(context == NULL, "Unexpected cert\n");
     }
 
         ok(context == NULL, "Unexpected cert\n");
     }
 
-    if (!pCertRemoveStoreFromCollection)
-    {
-        win_skip("CertRemoveStoreFromCollection() is not available\n");
-    }
-    else
-    {
-        /* Finally, test removing stores from the collection.  No return
-         *  value, so it's a bit funny to test.
-         */
-        /* This crashes
-         * pCertRemoveStoreFromCollection(NULL, NULL);
-         */
-        /* This "succeeds," no crash, no last error set */
-        SetLastError(0xdeadbeef);
-        pCertRemoveStoreFromCollection(store2, collection);
-        ok(GetLastError() == 0xdeadbeef,
-           "Didn't expect an error to be set: %08x\n", GetLastError());
-
-        /* After removing store2, the collection should be empty */
-        SetLastError(0xdeadbeef);
-        pCertRemoveStoreFromCollection(collection, store2);
-        ok(GetLastError() == 0xdeadbeef,
-           "Didn't expect an error to be set: %08x\n", GetLastError());
-        context = CertEnumCertificatesInStore(collection, NULL);
-        ok(!context, "Unexpected cert\n");
-    }
+    /* Finally, test removing stores from the collection.  No return
+     *  value, so it's a bit funny to test.
+     */
+    /* This crashes
+     * CertRemoveStoreFromCollection(NULL, NULL);
+     */
+    /* This "succeeds," no crash, no last error set */
+    SetLastError(0xdeadbeef);
+    CertRemoveStoreFromCollection(store2, collection);
+    ok(GetLastError() == 0xdeadbeef,
+       "Didn't expect an error to be set: %08x\n", GetLastError());
+
+    /* After removing store2, the collection should be empty */
+    SetLastError(0xdeadbeef);
+    CertRemoveStoreFromCollection(collection, store2);
+    ok(GetLastError() == 0xdeadbeef,
+       "Didn't expect an error to be set: %08x\n", GetLastError());
+    context = CertEnumCertificatesInStore(collection, NULL);
+    ok(!context, "Unexpected cert\n");
 
     CertCloseStore(collection, 0);
     CertCloseStore(store2, 0);
 
     CertCloseStore(collection, 0);
     CertCloseStore(store2, 0);
@@ -935,16 +927,11 @@ static void testCollectionStore(void)
     CertCloseStore(store1, 0);
 
     /* Test whether a collection store can be committed */
     CertCloseStore(store1, 0);
 
     /* Test whether a collection store can be committed */
-    if (!pCertControlStore)
-    {
-        win_skip("CertControlStore() is not available\n");
-        return;
-    }
     collection = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
 
     SetLastError(0xdeadbeef);
     collection = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
 
     SetLastError(0xdeadbeef);
-    ret = pCertControlStore(collection, 0, CERT_STORE_CTRL_COMMIT, NULL);
+    ret = CertControlStore(collection, 0, CERT_STORE_CTRL_COMMIT, NULL);
     ok(ret, "CertControlStore failed: %08x\n", GetLastError());
 
     /* Adding a mem store that can't be committed prevents a successful commit.
     ok(ret, "CertControlStore failed: %08x\n", GetLastError());
 
     /* Adding a mem store that can't be committed prevents a successful commit.
@@ -953,10 +940,10 @@ static void testCollectionStore(void)
      CERT_STORE_CREATE_NEW_FLAG, NULL);
     CertAddStoreToCollection(collection, store1, 0, 0);
     SetLastError(0xdeadbeef);
      CERT_STORE_CREATE_NEW_FLAG, NULL);
     CertAddStoreToCollection(collection, store1, 0, 0);
     SetLastError(0xdeadbeef);
-    ret = pCertControlStore(collection, 0, CERT_STORE_CTRL_COMMIT, NULL);
+    ret = CertControlStore(collection, 0, CERT_STORE_CTRL_COMMIT, NULL);
     ok(!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
      "expected ERROR_CALL_NOT_IMPLEMENTED, got %d\n", GetLastError());
     ok(!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
      "expected ERROR_CALL_NOT_IMPLEMENTED, got %d\n", GetLastError());
-    pCertRemoveStoreFromCollection(collection, store1);
+    CertRemoveStoreFromCollection(collection, store1);
     CertCloseStore(store1, 0);
 
     /* Test adding a cert to a collection with a file store, committing the
     CertCloseStore(store1, 0);
 
     /* Test adding a cert to a collection with a file store, committing the
@@ -982,7 +969,7 @@ static void testCollectionStore(void)
      bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, NULL);
     ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n",
      GetLastError());
      bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, NULL);
     ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n",
      GetLastError());
-    ret = pCertControlStore(collection, 0, CERT_STORE_CTRL_COMMIT, NULL);
+    ret = CertControlStore(collection, 0, CERT_STORE_CTRL_COMMIT, NULL);
     ok(ret, "CertControlStore failed: %d\n", ret);
     compareStore(collection, "serialized store with cert",
      serializedStoreWithCert, sizeof(serializedStoreWithCert), FALSE);
     ok(ret, "CertControlStore failed: %d\n", ret);
     compareStore(collection, "serialized store with cert",
      serializedStoreWithCert, sizeof(serializedStoreWithCert), FALSE);
@@ -1050,13 +1037,6 @@ static void testRegStore(void)
     todo_wine ok(store != 0, "CertOpenStore failed: %08x\n", GetLastError());
     CertCloseStore(store, 0);
 
     todo_wine ok(store != 0, "CertOpenStore failed: %08x\n", GetLastError());
     CertCloseStore(store, 0);
 
-    /* It looks like the remainder pretty much needs CertControlStore() */
-    if (!pCertControlStore)
-    {
-        win_skip("CertControlStore() is not available\n");
-        return;
-    }
-
     rc = RegCreateKeyExA(HKEY_CURRENT_USER, tempKey, 0, NULL, 0, KEY_ALL_ACCESS,
      NULL, &key, NULL);
     ok(!rc, "RegCreateKeyExA failed: %d\n", rc);
     rc = RegCreateKeyExA(HKEY_CURRENT_USER, tempKey, 0, NULL, 0, KEY_ALL_ACCESS,
      NULL, &key, NULL);
     ok(!rc, "RegCreateKeyExA failed: %d\n", rc);
@@ -1080,7 +1060,7 @@ static void testRegStore(void)
         ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n",
          GetLastError());
         /* so flush the cache to force a commit.. */
         ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n",
          GetLastError());
         /* so flush the cache to force a commit.. */
-        ret = pCertControlStore(store, 0, CERT_STORE_CTRL_COMMIT, NULL);
+        ret = CertControlStore(store, 0, CERT_STORE_CTRL_COMMIT, NULL);
         ok(ret, "CertControlStore failed: %08x\n", GetLastError());
         /* and check that the expected subkey was written. */
         size = sizeof(hash);
         ok(ret, "CertControlStore failed: %08x\n", GetLastError());
         /* and check that the expected subkey was written. */
         size = sizeof(hash);
@@ -1139,7 +1119,7 @@ static void testRegStore(void)
         ok(context != NULL, "Expected a cert context\n");
         if (context)
             CertDeleteCertificateFromStore(context);
         ok(context != NULL, "Expected a cert context\n");
         if (context)
             CertDeleteCertificateFromStore(context);
-        ret = pCertControlStore(store, 0, CERT_STORE_CTRL_COMMIT, NULL);
+        ret = CertControlStore(store, 0, CERT_STORE_CTRL_COMMIT, NULL);
         ok(ret, "CertControlStore failed: %08x\n", GetLastError());
 
         /* Add a serialized cert with a bogus hash directly to the registry */
         ok(ret, "CertControlStore failed: %08x\n", GetLastError());
 
         /* Add a serialized cert with a bogus hash directly to the registry */
@@ -1176,7 +1156,7 @@ static void testRegStore(void)
              sizeof(buf));
             ok(!rc, "RegSetValueExA failed: %d\n", rc);
 
              sizeof(buf));
             ok(!rc, "RegSetValueExA failed: %d\n", rc);
 
-            ret = pCertControlStore(store, 0, CERT_STORE_CTRL_RESYNC, NULL);
+            ret = CertControlStore(store, 0, CERT_STORE_CTRL_RESYNC, NULL);
             ok(ret, "CertControlStore failed: %08x\n", GetLastError());
 
             /* Make sure the bogus hash cert gets loaded. */
             ok(ret, "CertControlStore failed: %08x\n", GetLastError());
 
             /* Make sure the bogus hash cert gets loaded. */
@@ -1233,7 +1213,7 @@ static void testRegStore(void)
              sizeof(buf));
             ok(!rc, "RegSetValueExA failed: %d\n", rc);
 
              sizeof(buf));
             ok(!rc, "RegSetValueExA failed: %d\n", rc);
 
-            ret = pCertControlStore(store, 0, CERT_STORE_CTRL_RESYNC, NULL);
+            ret = CertControlStore(store, 0, CERT_STORE_CTRL_RESYNC, NULL);
             ok(ret, "CertControlStore failed: %08x\n", GetLastError());
 
             /* and make sure just one cert still gets loaded. */
             ok(ret, "CertControlStore failed: %08x\n", GetLastError());
 
             /* and make sure just one cert still gets loaded. */
@@ -1244,9 +1224,7 @@ static void testRegStore(void)
                 if (context)
                     certCount++;
             } while (context != NULL);
                 if (context)
                     certCount++;
             } while (context != NULL);
-            ok(certCount == 1 ||
-               broken(certCount == 2) /* NT4 */ ,
-               "Expected 1 certificates, got %d\n", certCount);
+            ok(certCount == 1, "Expected 1 certificate, got %d\n", certCount);
 
             /* Try again with the correct hash... */
             ptr = buf + sizeof(*hdr);
 
             /* Try again with the correct hash... */
             ptr = buf + sizeof(*hdr);
@@ -1256,7 +1234,7 @@ static void testRegStore(void)
              sizeof(buf));
             ok(!rc, "RegSetValueExA failed: %d\n", rc);
 
              sizeof(buf));
             ok(!rc, "RegSetValueExA failed: %d\n", rc);
 
-            ret = pCertControlStore(store, 0, CERT_STORE_CTRL_RESYNC, NULL);
+            ret = CertControlStore(store, 0, CERT_STORE_CTRL_RESYNC, NULL);
             ok(ret, "CertControlStore failed: %08x\n", GetLastError());
 
             /* and make sure two certs get loaded. */
             ok(ret, "CertControlStore failed: %08x\n", GetLastError());
 
             /* and make sure two certs get loaded. */
@@ -1295,20 +1273,10 @@ static void testRegStore(void)
         rc = RegDeleteKeyA(HKEY_CURRENT_USER, tempKey);
         if (rc)
         {
         rc = RegDeleteKeyA(HKEY_CURRENT_USER, tempKey);
         if (rc)
         {
-            HMODULE shlwapi = LoadLibraryA("shlwapi");
-
             /* Use shlwapi's SHDeleteKeyA to _really_ blow away the key,
              * otherwise subsequent tests will fail.
              */
             /* Use shlwapi's SHDeleteKeyA to _really_ blow away the key,
              * otherwise subsequent tests will fail.
              */
-            if (shlwapi)
-            {
-                DWORD (WINAPI *pSHDeleteKeyA)(HKEY, LPCSTR);
-
-                pSHDeleteKeyA = (void*)GetProcAddress(shlwapi, "SHDeleteKeyA");
-                if (pSHDeleteKeyA)
-                    pSHDeleteKeyA(HKEY_CURRENT_USER, tempKey);
-                FreeLibrary(shlwapi);
-            }
+            SHDeleteKeyA(HKEY_CURRENT_USER, tempKey);
         }
     }
 }
         }
     }
 }
@@ -1429,7 +1397,6 @@ static void testSystemStore(void)
         if (memStore)
         {
             BOOL ret = CertAddStoreToCollection(store, memStore, 0, 0);
         if (memStore)
         {
             BOOL ret = CertAddStoreToCollection(store, memStore, 0, 0);
-            /* FIXME: this'll fail on NT4, but what error will it give? */
             ok(ret, "CertAddStoreToCollection failed: %08x\n", GetLastError());
             CertCloseStore(memStore, 0);
         }
             ok(ret, "CertAddStoreToCollection failed: %08x\n", GetLastError());
             CertCloseStore(memStore, 0);
         }
@@ -1480,12 +1447,6 @@ static void testFileStore(void)
     PCCERT_CONTEXT cert;
     HANDLE file;
 
     PCCERT_CONTEXT cert;
     HANDLE file;
 
-    if (!pCertControlStore)
-    {
-        win_skip("CertControlStore() is not available\n");
-        return;
-    }
-
     store = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0, 0, NULL);
     ok(!store && GetLastError() == ERROR_INVALID_HANDLE,
      "Expected ERROR_INVALID_HANDLE, got %08x\n", GetLastError());
     store = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0, 0, NULL);
     ok(!store && GetLastError() == ERROR_INVALID_HANDLE,
      "Expected ERROR_INVALID_HANDLE, got %08x\n", GetLastError());
@@ -1521,7 +1482,7 @@ static void testFileStore(void)
         /* apparently allows adding certificates.. */
         ok(ret, "CertAddEncodedCertificateToStore failed: %d\n", ret);
         /* but not commits.. */
         /* apparently allows adding certificates.. */
         ok(ret, "CertAddEncodedCertificateToStore failed: %d\n", ret);
         /* but not commits.. */
-        ret = pCertControlStore(store, 0, CERT_STORE_CTRL_COMMIT, NULL);
+        ret = CertControlStore(store, 0, CERT_STORE_CTRL_COMMIT, NULL);
         ok(!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
          "Expected ERROR_CALL_NOT_IMPLEMENTED, got %08x\n", GetLastError());
         /* It still has certs in memory.. */
         ok(!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
          "Expected ERROR_CALL_NOT_IMPLEMENTED, got %08x\n", GetLastError());
         /* It still has certs in memory.. */
@@ -1545,7 +1506,7 @@ static void testFileStore(void)
         ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
          bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, NULL);
         ok(ret, "CertAddEncodedCertificateToStore failed: %d\n", ret);
         ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
          bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, NULL);
         ok(ret, "CertAddEncodedCertificateToStore failed: %d\n", ret);
-        ret = pCertControlStore(store, 0, CERT_STORE_CTRL_COMMIT, NULL);
+        ret = CertControlStore(store, 0, CERT_STORE_CTRL_COMMIT, NULL);
         ok(!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
          "Expected ERROR_CALL_NOT_IMPLEMENTED, got %08x\n", GetLastError());
         CertCloseStore(store, 0);
         ok(!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
          "Expected ERROR_CALL_NOT_IMPLEMENTED, got %08x\n", GetLastError());
         CertCloseStore(store, 0);
@@ -1560,7 +1521,7 @@ static void testFileStore(void)
         ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
          bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, NULL);
         ok(ret, "CertAddEncodedCertificateToStore failed: %d\n", ret);
         ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
          bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, NULL);
         ok(ret, "CertAddEncodedCertificateToStore failed: %d\n", ret);
-        ret = pCertControlStore(store, 0, CERT_STORE_CTRL_COMMIT, NULL);
+        ret = CertControlStore(store, 0, CERT_STORE_CTRL_COMMIT, NULL);
         ok(!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
          "Expected ERROR_CALL_NOT_IMPLEMENTED, got %08x\n", GetLastError());
         CertCloseStore(store, 0);
         ok(!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
          "Expected ERROR_CALL_NOT_IMPLEMENTED, got %08x\n", GetLastError());
         CertCloseStore(store, 0);
@@ -1576,7 +1537,7 @@ static void testFileStore(void)
         ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n",
          GetLastError());
         /* with commits enabled, commit is allowed */
         ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n",
          GetLastError());
         /* with commits enabled, commit is allowed */
-        ret = pCertControlStore(store, 0, CERT_STORE_CTRL_COMMIT, NULL);
+        ret = CertControlStore(store, 0, CERT_STORE_CTRL_COMMIT, NULL);
         ok(ret, "CertControlStore failed: %d\n", ret);
         compareStore(store, "serialized store with cert",
          serializedStoreWithCert, sizeof(serializedStoreWithCert), FALSE);
         ok(ret, "CertControlStore failed: %d\n", ret);
         compareStore(store, "serialized store with cert",
          serializedStoreWithCert, sizeof(serializedStoreWithCert), FALSE);
@@ -1692,15 +1653,11 @@ static void testFileNameStore(void)
     BOOL ret;
     DWORD GLE;
 
     BOOL ret;
     DWORD GLE;
 
-    if (0)
-    {
-        /* Crashes on NT4 */
-        store = CertOpenStore(CERT_STORE_PROV_FILENAME_W, 0, 0, 0, NULL);
-        GLE = GetLastError();
-        ok(!store && (GLE == ERROR_PATH_NOT_FOUND || GLE == ERROR_INVALID_PARAMETER),
-         "Expected ERROR_PATH_NOT_FOUND or ERROR_INVALID_PARAMETER, got %08x\n",
-         GLE);
-    }
+    store = CertOpenStore(CERT_STORE_PROV_FILENAME_W, 0, 0, 0, NULL);
+    GLE = GetLastError();
+    ok(!store && (GLE == ERROR_PATH_NOT_FOUND || GLE == ERROR_INVALID_PARAMETER),
+     "Expected ERROR_PATH_NOT_FOUND or ERROR_INVALID_PARAMETER, got %08x\n",
+     GLE);
 
     if (!GetTempFileNameW(szDot, szPrefix, 0, filename))
        return;
 
     if (!GetTempFileNameW(szDot, szPrefix, 0, filename))
        return;
@@ -1727,11 +1684,8 @@ static void testFileNameStore(void)
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
-        if (pCertEnumCRLsInStore)
-        {
-            crl = pCertEnumCRLsInStore(store, NULL);
-            ok(!crl, "Expected no CRLs\n");
-        }
+        crl = CertEnumCRLsInStore(store, NULL);
+        ok(!crl, "Expected no CRLs\n");
 
         CertCloseStore(store, 0);
         DeleteFileW(filename);
 
         CertCloseStore(store, 0);
         DeleteFileW(filename);
@@ -1751,11 +1705,8 @@ static void testFileNameStore(void)
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
-        if (pCertEnumCRLsInStore)
-        {
-            crl = pCertEnumCRLsInStore(store, NULL);
-            ok(!crl, "Expected no CRLs\n");
-        }
+        crl = CertEnumCRLsInStore(store, NULL);
+        ok(!crl, "Expected no CRLs\n");
 
         CertCloseStore(store, 0);
         DeleteFileW(filename);
 
         CertCloseStore(store, 0);
         DeleteFileW(filename);
@@ -1775,13 +1726,10 @@ static void testFileNameStore(void)
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
-        if (pCertEnumCRLsInStore)
-        {
-            crl = pCertEnumCRLsInStore(store, NULL);
-            ok(crl != NULL, "CertEnumCRLsInStore failed: %08x\n", GetLastError());
-            crl = pCertEnumCRLsInStore(store, crl);
-            ok(!crl, "Expected only one CRL\n");
-        }
+        crl = CertEnumCRLsInStore(store, NULL);
+        ok(crl != NULL, "CertEnumCRLsInStore failed: %08x\n", GetLastError());
+        crl = CertEnumCRLsInStore(store, crl);
+        ok(!crl, "Expected only one CRL\n");
 
         CertCloseStore(store, 0);
         /* Don't delete it this time, the next test uses it */
 
         CertCloseStore(store, 0);
         /* Don't delete it this time, the next test uses it */
@@ -1839,11 +1787,8 @@ static void testFileNameStore(void)
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
-        if (pCertEnumCRLsInStore)
-        {
-            crl = pCertEnumCRLsInStore(store, NULL);
-            ok(!crl, "Expected no CRLs\n");
-        }
+        crl = CertEnumCRLsInStore(store, NULL);
+        ok(!crl, "Expected no CRLs\n");
 
         CertCloseStore(store, 0);
         DeleteFileW(filename);
 
         CertCloseStore(store, 0);
         DeleteFileW(filename);
@@ -1863,11 +1808,8 @@ static void testFileNameStore(void)
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
-        if (pCertEnumCRLsInStore)
-        {
-            crl = pCertEnumCRLsInStore(store, NULL);
-            ok(!crl, "Expected no CRLs\n");
-        }
+        crl = CertEnumCRLsInStore(store, NULL);
+        ok(!crl, "Expected no CRLs\n");
 
         CertCloseStore(store, 0);
         DeleteFileW(filename);
 
         CertCloseStore(store, 0);
         DeleteFileW(filename);
@@ -1957,16 +1899,13 @@ static void testMessageStore(void)
         } while (cert);
         ok(count == 0, "Expected 0 certificates, got %d\n", count);
 
         } while (cert);
         ok(count == 0, "Expected 0 certificates, got %d\n", count);
 
-        if (pCertEnumCRLsInStore)
-        {
-            count = 0;
-            do {
-                crl = pCertEnumCRLsInStore(store, crl);
-                if (crl)
-                    count++;
-            } while (crl);
-            ok(count == 0, "Expected 0 CRLs, got %d\n", count);
-        }
+        count = 0;
+        do {
+            crl = CertEnumCRLsInStore(store, crl);
+            if (crl)
+                count++;
+        } while (crl);
+        ok(count == 0, "Expected 0 CRLs, got %d\n", count);
 
         /* Can add certs to a message store */
         ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
 
         /* Can add certs to a message store */
         ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
@@ -2008,16 +1947,14 @@ static void testMessageStore(void)
         } while (cert);
         ok(count == 1, "Expected 1 certificate, got %d\n", count);
 
         } while (cert);
         ok(count == 1, "Expected 1 certificate, got %d\n", count);
 
-        if (pCertEnumCRLsInStore)
-        {
-            count = 0;
-            do {
-                crl = pCertEnumCRLsInStore(store, crl);
-                if (crl)
-                    count++;
-            } while (crl);
-            ok(count == 1, "Expected 1 CRL, got %d\n", count);
-        }
+        count = 0;
+        do {
+            crl = CertEnumCRLsInStore(store, crl);
+            if (crl)
+                count++;
+        } while (crl);
+        ok(count == 1, "Expected 1 CRL, got %d\n", count);
+
         CertCloseStore(store, 0);
     }
     /* Encoding appears to be ignored */
         CertCloseStore(store, 0);
     }
     /* Encoding appears to be ignored */
@@ -2037,9 +1974,7 @@ static void testMessageStore(void)
     blob.pbData = (LPBYTE)hashBareContent;
     SetLastError(0xdeadbeef);
     store = CertOpenStore(CERT_STORE_PROV_PKCS7, 0, 0, 0, &blob);
     blob.pbData = (LPBYTE)hashBareContent;
     SetLastError(0xdeadbeef);
     store = CertOpenStore(CERT_STORE_PROV_PKCS7, 0, 0, 0, &blob);
-    ok(!store &&
-     (GetLastError() == CRYPT_E_ASN1_BADTAG ||
-      broken(GetLastError() == OSS_DATA_ERROR)), /* NT4 */
+    ok(!store && GetLastError() == CRYPT_E_ASN1_BADTAG,
      "Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
 }
 
      "Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
 }
 
@@ -2073,11 +2008,9 @@ static void testSerializedStore(void)
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
-        if (pCertEnumCRLsInStore)
-        {
-            crl = pCertEnumCRLsInStore(store, NULL);
-            ok(!crl, "Expected no CRLs\n");
-        }
+        crl = CertEnumCRLsInStore(store, NULL);
+        ok(!crl, "Expected no CRLs\n");
+
         CertCloseStore(store, 0);
     }
     blob.cbData = sizeof(serializedStoreWithCertAndCRL);
         CertCloseStore(store, 0);
     }
     blob.cbData = sizeof(serializedStoreWithCertAndCRL);
@@ -2094,14 +2027,12 @@ static void testSerializedStore(void)
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
          GetLastError());
         cert = CertEnumCertificatesInStore(store, cert);
         ok(!cert, "Expected only one cert\n");
-        if (pCertEnumCRLsInStore)
-        {
-            crl = pCertEnumCRLsInStore(store, NULL);
-            ok(crl != NULL, "CertEnumCRLsInStore failed: %08x\n",
-             GetLastError());
-            crl = pCertEnumCRLsInStore(store, crl);
-            ok(!crl, "Expected only one CRL\n");
-        }
+        crl = CertEnumCRLsInStore(store, NULL);
+        ok(crl != NULL, "CertEnumCRLsInStore failed: %08x\n",
+         GetLastError());
+        crl = CertEnumCRLsInStore(store, crl);
+        ok(!crl, "Expected only one CRL\n");
+
         CertCloseStore(store, 0);
     }
 }
         CertCloseStore(store, 0);
     }
 }
@@ -2150,15 +2081,9 @@ static void testCertRegisterSystemStore(void)
     const CERT_CONTEXT *cert, *cert2;
     unsigned int i;
 
     const CERT_CONTEXT *cert, *cert2;
     unsigned int i;
 
-    if (!pCertRegisterSystemStore || !pCertUnregisterSystemStore)
-    {
-        win_skip("CertRegisterSystemStore() or CertUnregisterSystemStore() is not available\n");
-        return;
-    }
-
     for (i = 0; i < sizeof(reg_system_store_test_data) / sizeof(reg_system_store_test_data[0]); i++) {
         cur_flag = reg_system_store_test_data[i].cert_store;
     for (i = 0; i < sizeof(reg_system_store_test_data) / sizeof(reg_system_store_test_data[0]); i++) {
         cur_flag = reg_system_store_test_data[i].cert_store;
-        ret = pCertRegisterSystemStore(WineTestW, cur_flag, NULL, NULL);
+        ret = CertRegisterSystemStore(WineTestW, cur_flag, NULL, NULL);
         if (!ret)
         {
             err = GetLastError();
         if (!ret)
         {
             err = GetLastError();
@@ -2200,7 +2125,7 @@ static void testCertRegisterSystemStore(void)
         ret = CertCloseStore(hstore, 0);
         ok (ret, "CertCloseStore failed at %08x, last error %x\n", cur_flag, GetLastError());
 
         ret = CertCloseStore(hstore, 0);
         ok (ret, "CertCloseStore failed at %08x, last error %x\n", cur_flag, GetLastError());
 
-        ret = pCertUnregisterSystemStore(WineTestW, cur_flag );
+        ret = CertUnregisterSystemStore(WineTestW, cur_flag );
         todo_wine_if (reg_system_store_test_data[i].todo)
             ok( ret == reg_system_store_test_data[i].expected,
                 "Unregistering failed at %08x, last error %d\n", cur_flag, GetLastError());
         todo_wine_if (reg_system_store_test_data[i].todo)
             ok( ret == reg_system_store_test_data[i].expected,
                 "Unregistering failed at %08x, last error %d\n", cur_flag, GetLastError());
@@ -2228,23 +2153,17 @@ static void testCertEnumSystemStore(void)
     BOOL ret;
     struct EnumSystemStoreInfo info = { FALSE, 0 };
 
     BOOL ret;
     struct EnumSystemStoreInfo info = { FALSE, 0 };
 
-    if (!pCertEnumSystemStore)
-    {
-        win_skip("CertEnumSystemStore() is not available\n");
-        return;
-    }
-
     SetLastError(0xdeadbeef);
     SetLastError(0xdeadbeef);
-    ret = pCertEnumSystemStore(0, NULL, NULL, NULL);
+    ret = CertEnumSystemStore(0, NULL, NULL, NULL);
     ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
      "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
     /* Crashes
     ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
      "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
     /* Crashes
-    ret = pCertEnumSystemStore(CERT_SYSTEM_STORE_LOCAL_MACHINE, NULL, NULL,
+    ret = CertEnumSystemStore(CERT_SYSTEM_STORE_LOCAL_MACHINE, NULL, NULL,
      NULL);
      */
 
     SetLastError(0xdeadbeef);
      NULL);
      */
 
     SetLastError(0xdeadbeef);
-    ret = pCertEnumSystemStore(CERT_SYSTEM_STORE_LOCAL_MACHINE, NULL, &info,
+    ret = CertEnumSystemStore(CERT_SYSTEM_STORE_LOCAL_MACHINE, NULL, &info,
      enumSystemStoreCB);
     /* Callback returning FALSE stops enumeration */
     ok(!ret, "Expected CertEnumSystemStore to stop\n");
      enumSystemStoreCB);
     /* Callback returning FALSE stops enumeration */
     ok(!ret, "Expected CertEnumSystemStore to stop\n");
@@ -2253,7 +2172,7 @@ static void testCertEnumSystemStore(void)
 
     info.goOn = TRUE;
     info.storeCount = 0;
 
     info.goOn = TRUE;
     info.storeCount = 0;
-    ret = pCertEnumSystemStore(CERT_SYSTEM_STORE_LOCAL_MACHINE, NULL, &info,
+    ret = CertEnumSystemStore(CERT_SYSTEM_STORE_LOCAL_MACHINE, NULL, &info,
      enumSystemStoreCB);
     ok(ret, "CertEnumSystemStore failed: %08x\n", GetLastError());
     /* There should always be at least My, Root, and CA stores */
      enumSystemStoreCB);
     ok(ret, "CertEnumSystemStore failed: %08x\n", GetLastError());
     /* There should always be at least My, Root, and CA stores */
@@ -2268,58 +2187,52 @@ static void testStoreProperty(void)
     DWORD propID, size = 0, state;
     CRYPT_DATA_BLOB blob;
 
     DWORD propID, size = 0, state;
     CRYPT_DATA_BLOB blob;
 
-    if (!pCertGetStoreProperty || !pCertSetStoreProperty)
-    {
-        win_skip("CertGet/SetStoreProperty() is not available\n");
-        return;
-    }
-
     /* Crash
     /* Crash
-    ret = pCertGetStoreProperty(NULL, 0, NULL, NULL);
-    ret = pCertGetStoreProperty(NULL, 0, NULL, &size);
-    ret = pCertGetStoreProperty(store, 0, NULL, NULL);
+    ret = CertGetStoreProperty(NULL, 0, NULL, NULL);
+    ret = CertGetStoreProperty(NULL, 0, NULL, &size);
+    ret = CertGetStoreProperty(store, 0, NULL, NULL);
      */
 
     store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
     /* Check a missing prop ID */
     SetLastError(0xdeadbeef);
      */
 
     store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
     /* Check a missing prop ID */
     SetLastError(0xdeadbeef);
-    ret = pCertGetStoreProperty(store, 0, NULL, &size);
+    ret = CertGetStoreProperty(store, 0, NULL, &size);
     ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
      "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
     /* Contrary to MSDN, CERT_ACCESS_STATE_PROP_ID is supported for stores.. */
     size = sizeof(state);
     ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
      "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
     /* Contrary to MSDN, CERT_ACCESS_STATE_PROP_ID is supported for stores.. */
     size = sizeof(state);
-    ret = pCertGetStoreProperty(store, CERT_ACCESS_STATE_PROP_ID, &state, &size);
+    ret = CertGetStoreProperty(store, CERT_ACCESS_STATE_PROP_ID, &state, &size);
     ok(ret, "CertGetStoreProperty failed for CERT_ACCESS_STATE_PROP_ID: %08x\n",
      GetLastError());
     ok(!state, "Expected a non-persisted store\n");
     /* and CERT_STORE_LOCALIZED_NAME_PROP_ID isn't supported by default. */
     size = 0;
     ok(ret, "CertGetStoreProperty failed for CERT_ACCESS_STATE_PROP_ID: %08x\n",
      GetLastError());
     ok(!state, "Expected a non-persisted store\n");
     /* and CERT_STORE_LOCALIZED_NAME_PROP_ID isn't supported by default. */
     size = 0;
-    ret = pCertGetStoreProperty(store, CERT_STORE_LOCALIZED_NAME_PROP_ID, NULL,
+    ret = CertGetStoreProperty(store, CERT_STORE_LOCALIZED_NAME_PROP_ID, NULL,
      &size);
     ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
      "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
     /* Delete an arbitrary property on a store */
      &size);
     ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
      "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
     /* Delete an arbitrary property on a store */
-    ret = pCertSetStoreProperty(store, CERT_FIRST_USER_PROP_ID, 0, NULL);
+    ret = CertSetStoreProperty(store, CERT_FIRST_USER_PROP_ID, 0, NULL);
     ok(ret, "CertSetStoreProperty failed: %08x\n", GetLastError());
     /* Set an arbitrary property on a store */
     blob.pbData = (LPBYTE)&state;
     blob.cbData = sizeof(state);
     ok(ret, "CertSetStoreProperty failed: %08x\n", GetLastError());
     /* Set an arbitrary property on a store */
     blob.pbData = (LPBYTE)&state;
     blob.cbData = sizeof(state);
-    ret = pCertSetStoreProperty(store, CERT_FIRST_USER_PROP_ID, 0, &blob);
+    ret = CertSetStoreProperty(store, CERT_FIRST_USER_PROP_ID, 0, &blob);
     ok(ret, "CertSetStoreProperty failed: %08x\n", GetLastError());
     /* Get an arbitrary property that's been set */
     ok(ret, "CertSetStoreProperty failed: %08x\n", GetLastError());
     /* Get an arbitrary property that's been set */
-    ret = pCertGetStoreProperty(store, CERT_FIRST_USER_PROP_ID, NULL, &size);
+    ret = CertGetStoreProperty(store, CERT_FIRST_USER_PROP_ID, NULL, &size);
     ok(ret, "CertGetStoreProperty failed: %08x\n", GetLastError());
     ok(size == sizeof(state), "Unexpected data size %d\n", size);
     ok(ret, "CertGetStoreProperty failed: %08x\n", GetLastError());
     ok(size == sizeof(state), "Unexpected data size %d\n", size);
-    ret = pCertGetStoreProperty(store, CERT_FIRST_USER_PROP_ID, &propID, &size);
+    ret = CertGetStoreProperty(store, CERT_FIRST_USER_PROP_ID, &propID, &size);
     ok(ret, "CertGetStoreProperty failed: %08x\n", GetLastError());
     ok(propID == state, "CertGetStoreProperty got the wrong value\n");
     /* Delete it again */
     ok(ret, "CertGetStoreProperty failed: %08x\n", GetLastError());
     ok(propID == state, "CertGetStoreProperty got the wrong value\n");
     /* Delete it again */
-    ret = pCertSetStoreProperty(store, CERT_FIRST_USER_PROP_ID, 0, NULL);
+    ret = CertSetStoreProperty(store, CERT_FIRST_USER_PROP_ID, 0, NULL);
     ok(ret, "CertSetStoreProperty failed: %08x\n", GetLastError());
     /* And check that it's missing */
     SetLastError(0xdeadbeef);
     ok(ret, "CertSetStoreProperty failed: %08x\n", GetLastError());
     /* And check that it's missing */
     SetLastError(0xdeadbeef);
-    ret = pCertGetStoreProperty(store, CERT_FIRST_USER_PROP_ID, NULL, &size);
+    ret = CertGetStoreProperty(store, CERT_FIRST_USER_PROP_ID, NULL, &size);
     ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
      "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
     CertCloseStore(store, 0);
     ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
      "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
     CertCloseStore(store, 0);
@@ -2327,13 +2240,13 @@ static void testStoreProperty(void)
     /* Recheck on the My store.. */
     store = CertOpenSystemStoreW(0, MyW);
     size = sizeof(state);
     /* Recheck on the My store.. */
     store = CertOpenSystemStoreW(0, MyW);
     size = sizeof(state);
-    ret = pCertGetStoreProperty(store, CERT_ACCESS_STATE_PROP_ID, &state, &size);
+    ret = CertGetStoreProperty(store, CERT_ACCESS_STATE_PROP_ID, &state, &size);
     ok(ret, "CertGetStoreProperty failed for CERT_ACCESS_STATE_PROP_ID: %08x\n",
      GetLastError());
     ok(state, "Expected a persisted store\n");
     SetLastError(0xdeadbeef);
     size = 0;
     ok(ret, "CertGetStoreProperty failed for CERT_ACCESS_STATE_PROP_ID: %08x\n",
      GetLastError());
     ok(state, "Expected a persisted store\n");
     SetLastError(0xdeadbeef);
     size = 0;
-    ret = pCertGetStoreProperty(store, CERT_STORE_LOCALIZED_NAME_PROP_ID, NULL,
+    ret = CertGetStoreProperty(store, CERT_STORE_LOCALIZED_NAME_PROP_ID, NULL,
      &size);
     ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
      "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
      &size);
     ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
      "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
@@ -2579,32 +2492,26 @@ static void testAddCertificateLink(void)
     WCHAR filename1[MAX_PATH], filename2[MAX_PATH];
     HANDLE file;
 
     WCHAR filename1[MAX_PATH], filename2[MAX_PATH];
     HANDLE file;
 
-    if (!pCertAddCertificateLinkToStore)
-    {
-        win_skip("CertAddCertificateLinkToStore not found\n");
-        return;
-    }
-
     if (0)
     {
         /* Crashes, i.e. the store is dereferenced without checking. */
     if (0)
     {
         /* Crashes, i.e. the store is dereferenced without checking. */
-        ret = pCertAddCertificateLinkToStore(NULL, NULL, 0, NULL);
+        ret = CertAddCertificateLinkToStore(NULL, NULL, 0, NULL);
     }
 
     /* Adding a certificate link to a store requires a valid add disposition */
     store1 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
     SetLastError(0xdeadbeef);
     }
 
     /* Adding a certificate link to a store requires a valid add disposition */
     store1 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
     SetLastError(0xdeadbeef);
-    ret = pCertAddCertificateLinkToStore(store1, NULL, 0, NULL);
+    ret = CertAddCertificateLinkToStore(store1, NULL, 0, NULL);
     ok(!ret && GetLastError() == E_INVALIDARG,
      "expected E_INVALIDARG, got %08x\n", GetLastError());
     source = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
      sizeof(bigCert));
     SetLastError(0xdeadbeef);
     ok(!ret && GetLastError() == E_INVALIDARG,
      "expected E_INVALIDARG, got %08x\n", GetLastError());
     source = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
      sizeof(bigCert));
     SetLastError(0xdeadbeef);
-    ret = pCertAddCertificateLinkToStore(store1, source, 0, NULL);
+    ret = CertAddCertificateLinkToStore(store1, source, 0, NULL);
     ok(!ret && GetLastError() == E_INVALIDARG,
      "expected E_INVALIDARG, got %08x\n", GetLastError());
     ok(!ret && GetLastError() == E_INVALIDARG,
      "expected E_INVALIDARG, got %08x\n", GetLastError());
-    ret = pCertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
+    ret = CertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
      NULL);
     ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
     if (0)
      NULL);
     ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
     if (0)
@@ -2612,14 +2519,14 @@ static void testAddCertificateLink(void)
         /* Crashes, i.e. the source certificate is dereferenced without
          * checking when a valid add disposition is given.
          */
         /* Crashes, i.e. the source certificate is dereferenced without
          * checking when a valid add disposition is given.
          */
-        ret = pCertAddCertificateLinkToStore(store1, NULL, CERT_STORE_ADD_ALWAYS,
+        ret = CertAddCertificateLinkToStore(store1, NULL, CERT_STORE_ADD_ALWAYS,
          NULL);
     }
     CertCloseStore(store1, 0);
 
     store1 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
          NULL);
     }
     CertCloseStore(store1, 0);
 
     store1 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
-    ret = pCertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
+    ret = CertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
      &linked);
     ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
     if (ret)
      &linked);
     ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
     if (ret)
@@ -2695,7 +2602,7 @@ static void testAddCertificateLink(void)
     /* Test adding a link to a memory store. */
     store2 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
     /* Test adding a link to a memory store. */
     store2 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
-    ret = pCertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
+    ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
      &linked);
     ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
     if (ret)
      &linked);
     ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
     if (ret)
@@ -2757,7 +2664,7 @@ static void testAddCertificateLink(void)
     ok(store2 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
     CloseHandle(file);
     /* Test adding a link to a file store. */
     ok(store2 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
     CloseHandle(file);
     /* Test adding a link to a file store. */
-    ret = pCertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
+    ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
      &linked);
     ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
     if (ret)
      &linked);
     ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
     if (ret)
@@ -2799,7 +2706,7 @@ static void testAddCertificateLink(void)
     source = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
      sizeof(bigCert));
     SetLastError(0xdeadbeef);
     source = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
      sizeof(bigCert));
     SetLastError(0xdeadbeef);
-    ret = pCertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
+    ret = CertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
      &linked);
     ok(!ret && GetLastError() == E_INVALIDARG,
      "expected E_INVALIDARG, got %08x\n", GetLastError());
      &linked);
     ok(!ret && GetLastError() == E_INVALIDARG,
      "expected E_INVALIDARG, got %08x\n", GetLastError());
@@ -2826,13 +2733,13 @@ static void testAddCertificateLink(void)
     ok(store2 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
     CloseHandle(file);
 
     ok(store2 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
     CloseHandle(file);
 
-    ret = pCertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
+    ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
      &linked);
     ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
     if (ret)
     {
         ok(linked->hCertStore == store2, "unexpected store\n");
      &linked);
     ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
     if (ret)
     {
         ok(linked->hCertStore == store2, "unexpected store\n");
-        ret = pCertControlStore(store2, 0, CERT_STORE_CTRL_COMMIT, NULL);
+        ret = CertControlStore(store2, 0, CERT_STORE_CTRL_COMMIT, NULL);
         ok(ret, "CertControlStore failed: %d\n", ret);
         compareStore(store2, "file store -> system store",
          serializedStoreWithCertAndHash,
         ok(ret, "CertControlStore failed: %d\n", ret);
         compareStore(store2, "file store -> system store",
          serializedStoreWithCertAndHash,
@@ -2849,7 +2756,7 @@ static void testAddCertificateLink(void)
     store2 = CertOpenStore(CERT_STORE_PROV_SYSTEM_REGISTRY, 0, 0,
      CERT_SYSTEM_STORE_CURRENT_USER, WineTestW);
     ok(store2 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
     store2 = CertOpenStore(CERT_STORE_PROV_SYSTEM_REGISTRY, 0, 0,
      CERT_SYSTEM_STORE_CURRENT_USER, WineTestW);
     ok(store2 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
-    ret = pCertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
+    ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
      &linked);
     ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
     if (ret)
      &linked);
     ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
     if (ret)
@@ -2884,7 +2791,7 @@ static DWORD countCRLsInStore(HCERTSTORE store)
     DWORD crls = 0;
 
     do {
     DWORD crls = 0;
 
     do {
-        crl = pCertEnumCRLsInStore(store, crl);
+        crl = CertEnumCRLsInStore(store, crl);
         if (crl)
             crls++;
     } while (crl);
         if (crl)
             crls++;
     } while (crl);
@@ -3112,11 +3019,8 @@ static void test_I_UpdateStore(void)
     ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError());
     certs = countCertsInStore(store1);
     ok(certs == 1, "Expected 1 cert, got %d\n", certs);
     ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError());
     certs = countCertsInStore(store1);
     ok(certs == 1, "Expected 1 cert, got %d\n", certs);
-    if (pCertEnumCRLsInStore)
-    {
-        certs = countCRLsInStore(store1);
-        ok(certs == 1, "Expected 1 CRL, got %d\n", certs);
-    }
+    certs = countCRLsInStore(store1);
+    ok(certs == 1, "Expected 1 CRL, got %d\n", certs);
 
     CertDeleteCertificateFromStore(cert);
     /* If a context is deleted from store2, I_CertUpdateStore deletes it
 
     CertDeleteCertificateFromStore(cert);
     /* If a context is deleted from store2, I_CertUpdateStore deletes it
@@ -3133,19 +3037,6 @@ static void test_I_UpdateStore(void)
 
 START_TEST(store)
 {
 
 START_TEST(store)
 {
-    HMODULE hdll;
-
-    hdll = GetModuleHandleA("Crypt32.dll");
-    pCertControlStore = (void*)GetProcAddress(hdll, "CertControlStore");
-    pCertEnumCRLsInStore = (void*)GetProcAddress(hdll, "CertEnumCRLsInStore");
-    pCertEnumSystemStore = (void*)GetProcAddress(hdll, "CertEnumSystemStore");
-    pCertGetStoreProperty = (void*)GetProcAddress(hdll, "CertGetStoreProperty");
-    pCertRemoveStoreFromCollection = (void*)GetProcAddress(hdll, "CertRemoveStoreFromCollection");
-    pCertSetStoreProperty = (void*)GetProcAddress(hdll, "CertSetStoreProperty");
-    pCertAddCertificateLinkToStore = (void*)GetProcAddress(hdll, "CertAddCertificateLinkToStore");
-    pCertRegisterSystemStore = (void*)GetProcAddress(hdll, "CertRegisterSystemStore");
-    pCertUnregisterSystemStore = (void*)GetProcAddress(hdll, "CertUnregisterSystemStore");
-
     /* various combinations of CertOpenStore */
     testMemStore();
     testCollectionStore();
     /* various combinations of CertOpenStore */
     testMemStore();
     testCollectionStore();
index 5648085..5245885 100644 (file)
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
+#include <stdio.h>
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winerror.h>
+#include <wincrypt.h>
 
 
-#include "precomp.h"
+#include "wine/test.h"
 
 typedef struct _CertRDNAttrEncoding {
     LPCSTR pszObjId;
 
 typedef struct _CertRDNAttrEncoding {
     LPCSTR pszObjId;