Juan Lang : crypt32: Detached hash messages don't contain the content, so don't make a copy of it.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jul 13 08:30:27 CDT 2007


Module: wine
Branch: master
Commit: 3ffb4b1c4871011631a1d580fd77aa0e5fc7cbb8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3ffb4b1c4871011631a1d580fd77aa0e5fc7cbb8

Author: Juan Lang <juan.lang at gmail.com>
Date:   Thu Jul 12 14:56:30 2007 -0700

crypt32: Detached hash messages don't contain the content, so don't make a copy of it.

---

 dlls/crypt32/msg.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index 0bc3d0b..36194a3 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -387,27 +387,23 @@ static BOOL CHashEncodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
     {
         if (fFinal)
             msg->base.finalized = TRUE;
-        if (msg->base.streamed)
+        if (msg->base.streamed || (msg->base.open_flags & CMSG_DETACHED_FLAG))
         {
-            /* Doesn't do anything, as stream output is never called, and you
+            /* Doesn't do much, as stream output is never called, and you
              * can't get the content.
              */
             ret = CryptHashData(msg->hash, pbData, cbData, 0);
         }
         else
         {
-            if (!(msg->base.open_flags & CMSG_DETACHED_FLAG) && !fFinal)
+            if (!fFinal)
                 SetLastError(CRYPT_E_MSG_ERROR);
             else
             {
                 ret = CryptHashData(msg->hash, pbData, cbData, 0);
                 if (ret)
                 {
-                    if (msg->data.pbData)
-                        msg->data.pbData = CryptMemRealloc(msg->data.pbData,
-                         msg->data.cbData + cbData);
-                    else
-                        msg->data.pbData = CryptMemAlloc(cbData);
+                    msg->data.pbData = CryptMemAlloc(cbData);
                     if (msg->data.pbData)
                     {
                         memcpy(msg->data.pbData + msg->data.cbData, pbData,




More information about the wine-cvs mailing list