Juan Lang : crypt32: Test and implement getting the computed hash from a decoded signed message .

Alexandre Julliard julliard at wine.codeweavers.com
Tue Aug 21 15:22:27 CDT 2007


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Tue Aug 21 07:09:24 2007 -0700

crypt32: Test and implement getting the computed hash from a decoded signed message.

---

 dlls/crypt32/msg.c       |   13 +++++++++++++
 dlls/crypt32/tests/msg.c |    7 +++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index 76bb055..ace5e51 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -1975,6 +1975,19 @@ static BOOL CDecodeSignedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType,
         else
             SetLastError(CRYPT_E_INVALID_MSG_TYPE);
         break;
+    case CMSG_COMPUTED_HASH_PARAM:
+        if (msg->u.signed_data.info)
+        {
+            if (dwIndex >= msg->u.signed_data.info->cSignerInfo)
+                SetLastError(CRYPT_E_INVALID_INDEX);
+            else
+                ret = CryptGetHashParam(
+                 msg->u.signed_data.signerHandles[dwIndex].contentHash,
+                 HP_HASHVAL, pvData, pcbData, 0);
+        }
+        else
+            SetLastError(CRYPT_E_INVALID_MSG_TYPE);
+        break;
     case CMSG_ATTR_CERT_COUNT_PARAM:
         if (msg->u.signed_data.info)
         {
diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index 72932fe..f079916 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -1989,6 +1989,10 @@ static void compare_signer_info(const CMSG_SIGNER_INFO *got,
     /* FIXME: check more things */
 }
 
+static const BYTE signedWithCertAndCrlComputedHash[] = {
+0x08,0xd6,0xc0,0x5a,0x21,0x51,0x2a,0x79,0xa1,0xdf,0xeb,0x9d,0x2a,0x8f,0x26,
+0x2f };
+
 static void test_decode_msg_get_param(void)
 {
     HCRYPTMSG msg;
@@ -2099,6 +2103,9 @@ static void test_decode_msg_get_param(void)
     ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
     ok(value == 1, "Expected 1 CRL, got %d\n", value);
     check_param("crl", msg, CMSG_CRL_PARAM, crl, sizeof(crl));
+    check_param("signed with cert and CRL computed hash", msg,
+     CMSG_COMPUTED_HASH_PARAM, signedWithCertAndCrlComputedHash,
+     sizeof(signedWithCertAndCrlComputedHash));
     CryptMsgClose(msg);
 }
 




More information about the wine-cvs mailing list