crypt32(6/6): Initialize key spec correctly. (take 2)

Juan Lang juan.lang at gmail.com
Wed May 30 16:27:50 CDT 2012


Sorry, just noticed I'd forgotten to remove a redundant initialization
in this patch.
--Juan
-------------- next part --------------
From 314e880d179f831a96d0a5a43664c9eaeea04119 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Wed, 30 May 2012 14:26:56 -0700
Subject: [PATCH 7/7] 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);
-- 
1.7.7.3


More information about the wine-patches mailing list