crypt32(11/20): Implement getting the hash for each signer of a signed encoded message

Juan Lang juan.lang at gmail.com
Mon Jul 23 20:30:09 CDT 2007


--Juan
-------------- next part --------------
From 0d84f0323938922caa23eebda00ab879f524d2b8 Mon Sep 17 00:00:00 2001
From: Juan Lang <juanlang at juan.corp.google.com>
Date: Mon, 23 Jul 2007 18:09:42 -0700
Subject: [PATCH] Implement getting the hash for each signer of a signed encoded message
---
 dlls/crypt32/msg.c       |   20 +++++++++++++++++---
 dlls/crypt32/tests/msg.c |    2 --
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index 28fb247..226c04b 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -765,9 +765,23 @@ static void CSignedEncodeMsg_Close(HCRYP
 static BOOL CSignedEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
  DWORD dwIndex, void *pvData, DWORD *pcbData)
 {
-    FIXME("(%p, %d, %d, %p, %p)\n", hCryptMsg, dwParamType, dwIndex, pvData,
-     pcbData);
-    return FALSE;
+    CSignedEncodeMsg *msg = (CSignedEncodeMsg *)hCryptMsg;
+    BOOL ret = FALSE;
+
+    switch (dwParamType)
+    {
+    case CMSG_COMPUTED_HASH_PARAM:
+        if (dwIndex >= msg->cSigners)
+            SetLastError(CRYPT_E_INVALID_INDEX);
+        else
+            ret = CryptGetHashParam(msg->signers[dwIndex].hash, HP_HASHVAL,
+             pvData, pcbData, 0);
+        break;
+    default:
+        FIXME("unimplemented for %d\n", dwParamType);
+        SetLastError(CRYPT_E_INVALID_MSG_TYPE);
+    }
+    return ret;
 }
 
 static BOOL CSignedEncodeMsg_UpdateHash(CSignedEncodeMsg *msg,
diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index f9f2ab6..18c758b 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -1298,7 +1298,6 @@ static void test_signed_msg_encoding(voi
      signedEmptyContent, sizeof(signedEmptyContent));
     ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
     ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError());
-    todo_wine
     check_param("detached signed hash", msg, CMSG_COMPUTED_HASH_PARAM,
      signedHash, sizeof(signedHash));
     todo_wine
@@ -1309,7 +1308,6 @@ static void test_signed_msg_encoding(voi
      detachedSignedContent, sizeof(detachedSignedContent));
     SetLastError(0xdeadbeef);
     ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 1, NULL, &size);
-    todo_wine
     ok(!ret && GetLastError() == CRYPT_E_INVALID_INDEX,
      "Expected CRYPT_E_INVALID_INDEX, got %x\n", GetLastError());
 
-- 
1.4.1


More information about the wine-patches mailing list