crypt32(1/4): Pass crypto provider and appropriate flags when opening PKCS messages, and don't store a redundant copy of the crypto provider in message stores

Juan Lang juan.lang at gmail.com
Fri Aug 17 14:03:05 CDT 2007


Heh, I think the commit msg is longer than the patch.
--Juan
-------------- next part --------------
From dd9145ce1052925eabdbdd4c77bd457b9dcfedc2 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Fri, 17 Aug 2007 11:57:48 -0700
Subject: [PATCH] Pass crypto provider and appropriate flags when opening PKCS messages, and
don't store a redundant copy of the crypto provider in message stores
---
 dlls/crypt32/store.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c
index 43e724f..28c8433 100644
--- a/dlls/crypt32/store.c
+++ b/dlls/crypt32/store.c
@@ -96,7 +96,6 @@ typedef struct _WINE_MEMSTORE
 typedef struct _WINE_MSGSTOREINFO
 {
     DWORD      dwOpenFlags;
-    HCRYPTPROV cryptProv;
     HCERTSTORE memStore;
     HCRYPTMSG  msg;
 } WINE_MSGSTOREINFO, *PWINE_MSGSTOREINFO;
@@ -603,7 +602,6 @@ static PWINECRYPT_CERTSTORE CRYPT_MsgOpe
                 CERT_STORE_PROV_INFO provInfo = { 0 };
 
                 info->dwOpenFlags = dwFlags;
-                info->cryptProv = hCryptProv;
                 info->memStore = memStore;
                 info->msg = CryptMsgDuplicate(msg);
                 provInfo.cbSize = sizeof(provInfo);
@@ -631,16 +629,19 @@ static PWINECRYPT_CERTSTORE CRYPT_PKCSOp
     PWINECRYPT_CERTSTORE store = NULL;
     const CRYPT_DATA_BLOB *data = (const CRYPT_DATA_BLOB *)pvPara;
     BOOL ret;
+    DWORD msgOpenFlags = dwFlags & CERT_STORE_NO_CRYPT_RELEASE_FLAG ? 0 :
+     CMSG_CRYPT_RELEASE_CONTEXT_FLAG;
 
     TRACE("(%ld, %08x, %p)\n", hCryptProv, dwFlags, pvPara);
 
-    msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_SIGNED, 0, NULL,
-     NULL);
+    msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, msgOpenFlags, CMSG_SIGNED,
+     hCryptProv, NULL, NULL);
     ret = CryptMsgUpdate(msg, data->pbData, data->cbData, TRUE);
     if (!ret)
     {
         CryptMsgClose(msg);
-        msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL);
+        msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, msgOpenFlags, 0,
+         hCryptProv, NULL, NULL);
         ret = CryptMsgUpdate(msg, data->pbData, data->cbData, TRUE);
         if (ret)
         {
-- 
1.4.1


More information about the wine-patches mailing list