Juan Lang : crypt32: Don'
t keep an unneeded copy of the crypto provider for each signer.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Aug 21 15:22:25 CDT 2007
Module: wine
Branch: master
Commit: 1f9d9be7625fca4917916fdd334a254dd78ffb85
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1f9d9be7625fca4917916fdd334a254dd78ffb85
Author: Juan Lang <juan.lang at gmail.com>
Date: Mon Aug 20 17:48:02 2007 -0700
crypt32: Don't keep an unneeded copy of the crypto provider for each signer.
---
dlls/crypt32/msg.c | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index 2d0299c..a50fc3f 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -772,7 +772,6 @@ static void CSignerInfo_Free(CMSG_SIGNER_INFO *info)
typedef struct _CSignerHandles
{
- HCRYPTPROV prov;
HCRYPTHASH contentHash;
HCRYPTHASH authAttrHash;
HCRYPTKEY key;
@@ -791,8 +790,7 @@ typedef struct _CSignedEncodeMsg
CSignedMsgData msg_data;
} CSignedEncodeMsg;
-/* Constructs a CSignerHandles with a copy of crypt_prov (not add-ref'ed - the
- * caller must do this if necessary), a hash handle based on HashAlgorithm, and
+/* Constructs a CSignerHandles with a hash handle based on HashAlgorithm, and
* an authenticated attributes hash handle if hasAuthAttrs is TRUE.
*/
static BOOL CSignerHandles_Construct(CSignerHandles *handles,
@@ -802,12 +800,10 @@ static BOOL CSignerHandles_Construct(CSignerHandles *handles,
ALG_ID algID;
BOOL ret;
- handles->prov = crypt_prov;
algID = CertOIDToAlgId(HashAlgorithm->pszObjId);
- ret = CryptCreateHash(handles->prov, algID, 0, 0, &handles->contentHash);
+ ret = CryptCreateHash(crypt_prov, algID, 0, 0, &handles->contentHash);
if (ret && hasAuthAttrs)
- ret = CryptCreateHash(handles->prov, algID, 0, 0,
- &handles->authAttrHash);
+ ret = CryptCreateHash(crypt_prov, algID, 0, 0, &handles->authAttrHash);
return ret;
}
@@ -820,7 +816,6 @@ static void CSignedMsgData_CloseHandles(CSignedMsgData *msg_data)
CryptDestroyKey(msg_data->signerHandles[i].key);
CryptDestroyHash(msg_data->signerHandles[i].contentHash);
CryptDestroyHash(msg_data->signerHandles[i].authAttrHash);
- CryptReleaseContext(msg_data->signerHandles[i].prov, 0);
}
CryptMemFree(msg_data->signerHandles);
}
@@ -1214,14 +1209,14 @@ static HCRYPTMSG CSignedEncodeMsg_Open(DWORD dwFlags,
&info->rgSigners[i]);
if (ret)
{
- if (!(dwFlags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG))
- CryptContextAddRef(info->rgSigners[i].hCryptProv,
- NULL, 0);
ret = CSignerHandles_Construct(
&msg->msg_data.signerHandles[i],
info->rgSigners[i].hCryptProv,
&info->rgSigners[i].HashAlgorithm,
info->rgSigners[i].cAuthAttr > 0);
+ if (dwFlags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG)
+ CryptReleaseContext(info->rgSigners[i].hCryptProv,
+ 0);
}
}
}
More information about the wine-cvs
mailing list