Juan Lang : crypt32: Implement getting hash message version.

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


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

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

crypt32: Implement getting hash message version.

---

 dlls/crypt32/msg.c       |   21 +++++++++++++++++++++
 dlls/crypt32/tests/msg.c |    3 ---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index dac881c..4668d2f 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -344,6 +344,27 @@ static BOOL CHashEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
         ret = CryptGetHashParam(msg->hash, HP_HASHVAL, (BYTE *)pvData, pcbData,
          0);
         break;
+    case CMSG_VERSION_PARAM:
+        if (!msg->base.finalized)
+            SetLastError(CRYPT_E_MSG_ERROR);
+        else if (!pvData)
+        {
+            *pcbData = sizeof(DWORD);
+            ret = TRUE;
+        }
+        else if (*pcbData < sizeof(DWORD))
+        {
+            SetLastError(ERROR_MORE_DATA);
+            *pcbData = sizeof(DWORD);
+        }
+        else
+        {
+            /* FIXME: under what circumstances is this CMSG_HASHED_DATA_V2? */
+            *(DWORD *)pvData = CMSG_HASHED_DATA_PKCS_1_5_VERSION;
+            *pcbData = sizeof(DWORD);
+            ret = TRUE;
+        }
+        break;
     default:
         FIXME("%d: stub\n", dwParamType);
         ret = FALSE;
diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index c41a4bf..1205a02 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -790,14 +790,11 @@ static void test_hash_msg_get_param(void)
     /* The version is also available, and should be zero for this message. */
     size = 0;
     ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, NULL, &size);
-    todo_wine
     ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
     size = sizeof(value);
     ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, (LPBYTE)&value, &size);
-    todo_wine {
     ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
     ok(value == 0, "Expected version 0, got %d\n", value);
-    }
     /* As usual, the type isn't available. */
     ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, NULL, &size);
     todo_wine




More information about the wine-cvs mailing list