Juan Lang : crypt32: Correct CryptVerifyMessageSignature' s use of pcbDecoded.

Alexandre Julliard julliard at winehq.org
Mon Aug 23 10:50:15 CDT 2010


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Fri Aug 20 16:26:35 2010 -0700

crypt32: Correct CryptVerifyMessageSignature's use of pcbDecoded.

---

 dlls/crypt32/message.c       |   17 ++++++++++++++---
 dlls/crypt32/tests/message.c |    1 -
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/dlls/crypt32/message.c b/dlls/crypt32/message.c
index 779959a..f06af0e 100644
--- a/dlls/crypt32/message.c
+++ b/dlls/crypt32/message.c
@@ -210,9 +210,6 @@ BOOL WINAPI CryptVerifyMessageSignature(PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
     if (msg)
     {
         ret = CryptMsgUpdate(msg, pbSignedBlob, cbSignedBlob, TRUE);
-        if (ret && pcbDecoded)
-            ret = CryptMsgGetParam(msg, CMSG_CONTENT_PARAM, 0, pbDecoded,
-             pcbDecoded);
         if (ret)
         {
             CERT_INFO *certInfo = CRYPT_GetSignerCertInfoFromMsg(msg,
@@ -244,6 +241,20 @@ BOOL WINAPI CryptVerifyMessageSignature(PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
             }
             CryptMemFree(certInfo);
         }
+        if (ret)
+        {
+            /* The caller is expected to pass a valid pointer to pcbDecoded
+             * when the message verifies successfully.
+             */
+            if (pcbDecoded)
+                ret = CryptMsgGetParam(msg, CMSG_CONTENT_PARAM, 0, pbDecoded,
+                 pcbDecoded);
+            else
+            {
+                SetLastError(CRYPT_E_NOT_FOUND);
+                ret = FALSE;
+            }
+        }
         CryptMsgClose(msg);
     }
     if(!ret && pcbDecoded)
diff --git a/dlls/crypt32/tests/message.c b/dlls/crypt32/tests/message.c
index b18e78c..26b8030 100644
--- a/dlls/crypt32/tests/message.c
+++ b/dlls/crypt32/tests/message.c
@@ -580,7 +580,6 @@ static void test_verify_message_signature(void)
     ret = CryptVerifyMessageSignature(&para, 0,
      signedWithCertWithValidPubKeyContent,
      sizeof(signedWithCertWithValidPubKeyContent), NULL, 0, NULL);
-    todo_wine
     ok(!ret, "Expected failure\n");
     /* Finally, a message signed with a valid public key verifies successfully
      */




More information about the wine-cvs mailing list