From 4e1108533b98f0c50519eb7dd2227a9c0c3f214a Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Fri, 17 Aug 2007 11:57:48 -0700 Subject: [PATCH] crypt32: 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 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 43e724fb3b3..28c843395c0 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_MsgOpenStore(HCRYPTPROV hCryptProv, 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_PKCSOpenStore(HCRYPTPROV hCryptProv, 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) {