Commit f1f8e87b authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Make constructing handles a member of signed msg data.

parent 07ba16c2
...@@ -790,20 +790,23 @@ typedef struct _CSignedEncodeMsg ...@@ -790,20 +790,23 @@ typedef struct _CSignedEncodeMsg
CSignedMsgData msg_data; CSignedMsgData msg_data;
} CSignedEncodeMsg; } CSignedEncodeMsg;
/* Constructs a CSignerHandles with a hash handle based on HashAlgorithm, and /* Constructs the signer handles for the signerIndex'th signer of msg_data.
* an authenticated attributes hash handle if hasAuthAttrs is TRUE. * Assumes signerIndex is a valid idnex, and that msg_data's info has already
* been constructed.
*/ */
static BOOL CSignerHandles_Construct(CSignerHandles *handles, static BOOL CSignedMsgData_ConstructSignerHandles(CSignedMsgData *msg_data,
HCRYPTPROV crypt_prov, CRYPT_ALGORITHM_IDENTIFIER *HashAlgorithm, DWORD signerIndex, HCRYPTPROV crypt_prov)
BOOL hasAuthAttrs)
{ {
ALG_ID algID; ALG_ID algID;
BOOL ret; BOOL ret;
algID = CertOIDToAlgId(HashAlgorithm->pszObjId); algID = CertOIDToAlgId(
ret = CryptCreateHash(crypt_prov, algID, 0, 0, &handles->contentHash); msg_data->info->rgSignerInfo[signerIndex].HashAlgorithm.pszObjId);
if (ret && hasAuthAttrs) ret = CryptCreateHash(crypt_prov, algID, 0, 0,
ret = CryptCreateHash(crypt_prov, algID, 0, 0, &handles->authAttrHash); &msg_data->signerHandles->contentHash);
if (ret && msg_data->info->rgSignerInfo[signerIndex].AuthAttrs.cAttr > 0)
ret = CryptCreateHash(crypt_prov, algID, 0, 0,
&msg_data->signerHandles->authAttrHash);
return ret; return ret;
} }
...@@ -1222,11 +1225,8 @@ static HCRYPTMSG CSignedEncodeMsg_Open(DWORD dwFlags, ...@@ -1222,11 +1225,8 @@ static HCRYPTMSG CSignedEncodeMsg_Open(DWORD dwFlags,
&info->rgSigners[i]); &info->rgSigners[i]);
if (ret) if (ret)
{ {
ret = CSignerHandles_Construct( ret = CSignedMsgData_ConstructSignerHandles(
&msg->msg_data.signerHandles[i], &msg->msg_data, i, info->rgSigners[i].hCryptProv);
info->rgSigners[i].hCryptProv,
&info->rgSigners[i].HashAlgorithm,
info->rgSigners[i].cAuthAttr > 0);
if (dwFlags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG) if (dwFlags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG)
CryptReleaseContext(info->rgSigners[i].hCryptProv, CryptReleaseContext(info->rgSigners[i].hCryptProv,
0); 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment