crypt32: Allow updating data messages with no content.

This commit is contained in:
Juan Lang 2011-02-10 11:58:17 -08:00 committed by Alexandre Julliard
parent 07297ea9d0
commit 2910cf9660
2 changed files with 8 additions and 14 deletions

View file

@ -277,20 +277,15 @@ static BOOL CDataEncodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
}
else
{
msg->base.state = MsgStateFinalized;
if (!cbData)
SetLastError(E_INVALIDARG);
else
{
CRYPT_DATA_BLOB blob = { cbData, (LPBYTE)pbData };
CRYPT_DATA_BLOB blob = { cbData, (LPBYTE)pbData };
/* non-streamed data messages don't allow non-final updates,
* don't bother checking whether data already exist, they can't.
*/
ret = CryptEncodeObjectEx(X509_ASN_ENCODING, X509_OCTET_STRING,
&blob, CRYPT_ENCODE_ALLOC_FLAG, NULL, &msg->bare_content,
&msg->bare_content_len);
}
msg->base.state = MsgStateFinalized;
/* non-streamed data messages don't allow non-final updates,
* don't bother checking whether data already exist, they can't.
*/
ret = CryptEncodeObjectEx(X509_ASN_ENCODING, X509_OCTET_STRING,
&blob, CRYPT_ENCODE_ALLOC_FLAG, NULL, &msg->bare_content,
&msg->bare_content_len);
}
}
return ret;

View file

@ -394,7 +394,6 @@ static void test_data_msg_update(void)
NULL);
/* Starting with Vista, can update a message with no data. */
ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
todo_wine
ok(ret || broken(!ret), "CryptMsgUpdate failed: %08x\n", GetLastError());
if (ret)
{