Juan Lang : crypt32: Initialize key spec correctly.

Alexandre Julliard julliard at winehq.org
Thu May 31 13:30:40 CDT 2012


Module: wine
Branch: master
Commit: f86ab49be2a3f8ce778fb6ed5fa3e91e9ccfad75
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f86ab49be2a3f8ce778fb6ed5fa3e91e9ccfad75

Author: Juan Lang <juan.lang at gmail.com>
Date:   Wed May 30 14:26:56 2012 -0700

crypt32: Initialize key spec correctly.

---

 dlls/crypt32/cert.c       |    4 ++--
 dlls/crypt32/tests/cert.c |    2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index 2d6697c..478fff3 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -3139,7 +3139,7 @@ PCCERT_CONTEXT WINAPI CertCreateSelfSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HAN
     PCCERT_CONTEXT context = NULL;
     BOOL ret, releaseContext = FALSE;
     PCERT_PUBLIC_KEY_INFO pubKey = NULL;
-    DWORD pubKeySize = 0,dwKeySpec = AT_SIGNATURE;
+    DWORD pubKeySize = 0, dwKeySpec;
 
     TRACE("(%08lx, %p, %08x, %p, %p, %p, %p, %p)\n", hProv,
      pSubjectIssuerBlob, dwFlags, pKeyProvInfo, pSignatureAlgorithm, pStartTime,
@@ -3151,6 +3151,7 @@ PCCERT_CONTEXT WINAPI CertCreateSelfSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HAN
         return NULL;
     }
 
+    dwKeySpec = pKeyProvInfo ? pKeyProvInfo->dwKeySpec : AT_SIGNATURE;
     if (!hProv)
     {
         if (!pKeyProvInfo)
@@ -3181,7 +3182,6 @@ PCCERT_CONTEXT WINAPI CertCreateSelfSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HAN
                 if (!ret)
                     return NULL;
 	    }
-            dwKeySpec = pKeyProvInfo->dwKeySpec;
             /* check if the key is here */
             ret = CryptGetUserKey(hProv,dwKeySpec,&hKey);
             if(!ret)
diff --git a/dlls/crypt32/tests/cert.c b/dlls/crypt32/tests/cert.c
index 5d95711..f31236a 100644
--- a/dlls/crypt32/tests/cert.c
+++ b/dlls/crypt32/tests/cert.c
@@ -2156,7 +2156,6 @@ static void testCreateSelfSignCert(void)
     SetLastError(0xdeadbeef);
     context = pCertCreateSelfSignCertificate(csp, &name, 0, &info, NULL, NULL,
         NULL, NULL);
-    todo_wine
     ok(context == NULL, "expected failure\n");
     if (context != NULL)
         CertFreeCertificateContext(context);
@@ -2278,7 +2277,6 @@ static void testCreateSelfSignCert(void)
     SetLastError(0xdeadbeef);
     context = pCertCreateSelfSignCertificate(csp, &name, 0, &info, NULL, NULL,
         NULL, NULL);
-    todo_wine
     ok(context == NULL, "expected failure\n");
     if (context != NULL)
         CertFreeCertificateContext(context);




More information about the wine-cvs mailing list