crypt32: Make updating a hash a member of signed message data, not signed message.

This commit is contained in:
Juan Lang 2007-08-20 17:44:12 -07:00 committed by Alexandre Julliard
parent 0080d3d691
commit bfde05d8b6
1 changed files with 14 additions and 16 deletions

View File

@ -819,6 +819,18 @@ static void CSignedMsgData_CloseHandles(CSignedMsgData *msg_data)
CryptMemFree(msg_data->signerHandles);
}
static BOOL CSignedMsgData_UpdateHash(CSignedMsgData *msg_data,
const BYTE *pbData, DWORD cbData)
{
DWORD i;
BOOL ret = TRUE;
for (i = 0; ret && i < msg_data->info->cSignerInfo; i++)
ret = CryptHashData(msg_data->signerHandles[i].contentHash, pbData,
cbData, 0);
return ret;
}
static void CSignedEncodeMsg_Close(HCRYPTMSG hCryptMsg)
{
CSignedEncodeMsg *msg = (CSignedEncodeMsg *)hCryptMsg;
@ -928,20 +940,6 @@ static BOOL CSignedEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
return ret;
}
static BOOL CSignedEncodeMsg_UpdateHash(CSignedEncodeMsg *msg,
const BYTE *pbData, DWORD cbData)
{
DWORD i;
BOOL ret = TRUE;
TRACE("(%p, %p, %d)\n", msg, pbData, cbData);
for (i = 0; ret && i < msg->msg_data.info->cSignerInfo; i++)
ret = CryptHashData(msg->msg_data.signerHandles[i].contentHash, pbData,
cbData, 0);
return ret;
}
static BOOL CRYPT_AppendAttribute(CRYPT_ATTRIBUTES *out,
const CRYPT_ATTRIBUTE *in)
{
@ -1099,7 +1097,7 @@ static BOOL CSignedEncodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
if (msg->base.streamed || (msg->base.open_flags & CMSG_DETACHED_FLAG))
{
ret = CSignedEncodeMsg_UpdateHash(msg, pbData, cbData);
ret = CSignedMsgData_UpdateHash(&msg->msg_data, pbData, cbData);
if (ret && fFinal)
{
ret = CSignedEncodeMsg_UpdateAuthenticatedAttributes(msg);
@ -1128,7 +1126,7 @@ static BOOL CSignedEncodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
else
ret = TRUE;
if (ret)
ret = CSignedEncodeMsg_UpdateHash(msg, pbData, cbData);
ret = CSignedMsgData_UpdateHash(&msg->msg_data, pbData, cbData);
if (ret)
ret = CSignedEncodeMsg_UpdateAuthenticatedAttributes(msg);
if (ret)