crypt32(13/25): Implement getting hash message version

Juan Lang juan.lang at gmail.com
Thu Jul 12 17:20:45 CDT 2007


--Juan
-------------- next part --------------
From 7b40b84996cbcc2fd844aaaba9bc69847dac41cc Mon Sep 17 00:00:00 2001
From: Juan Lang <juanlang at juan.corp.google.com>
Date: Thu, 12 Jul 2007 14:51:03 -0700
Subject: [PATCH] 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(HCRY
         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
-- 
1.4.1


More information about the wine-patches mailing list