From 2910cf9660d4e6a3791289286d364ea1a22d343c Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Thu, 10 Feb 2011 11:58:17 -0800 Subject: [PATCH] crypt32: Allow updating data messages with no content. --- dlls/crypt32/msg.c | 21 ++++++++------------- dlls/crypt32/tests/msg.c | 1 - 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index ee80f1a3e03..97860e503ab 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -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; diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index 95a0a29b1cd..de55d6b967d 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -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) { -- 2.11.4.GIT