Commit 2910cf96 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Allow updating data messages with no content.

parent 07297ea9
......@@ -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;
......
......@@ -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)
{
......
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