crypt32(2/11): Implement getting inner content of a decoded signed message

Juan Lang juan.lang at gmail.com
Mon Jul 30 14:17:48 CDT 2007


--Juan
-------------- next part --------------
From a44f0874302031107763459f42467ac239b09cc3 Mon Sep 17 00:00:00 2001
From: Juan Lang <juanlang at juan.corp.google.com>
Date: Mon, 30 Jul 2007 12:00:23 -0700
Subject: [PATCH] Implement getting inner content of a decoded signed message
---
 dlls/crypt32/msg.c       |   21 +++++++++++++++++++++
 dlls/crypt32/tests/msg.c |    1 -
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index f554c78..0f33382 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -1570,6 +1570,27 @@ static BOOL CDecodeSignedMsg_GetParam(CD
     case CMSG_TYPE_PARAM:
         ret = CRYPT_CopyParam(pvData, pcbData, &msg->type, sizeof(msg->type));
         break;
+    case CMSG_CONTENT_PARAM:
+        if (msg->u.signedInfo)
+        {
+            CRYPT_DATA_BLOB *blob;
+            DWORD size;
+
+            /* FIXME: does this depend on inner content type? */
+            ret = CryptDecodeObjectEx(X509_ASN_ENCODING, X509_OCTET_STRING,
+             msg->u.signedInfo->content.Content.pbData,
+             msg->u.signedInfo->content.Content.cbData, CRYPT_DECODE_ALLOC_FLAG,
+             NULL, (LPBYTE)&blob, &size);
+            if (ret)
+            {
+                ret = CRYPT_CopyParam(pvData, pcbData, blob->pbData,
+                 blob->cbData);
+                LocalFree(blob);
+            }
+        }
+        else
+            SetLastError(CRYPT_E_INVALID_MSG_TYPE);
+        break;
     case CMSG_SIGNER_COUNT_PARAM:
         if (msg->u.signedInfo)
             ret = CRYPT_CopyParam(pvData, pcbData,
diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index 327fc43..0e863f0 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -1976,7 +1976,6 @@ static void test_decode_msg_get_param(vo
     msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL);
     ret = CryptMsgUpdate(msg, signedContent, sizeof(signedContent), TRUE);
     ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
-    todo_wine
     check_param("signed content", msg, CMSG_CONTENT_PARAM, msgData,
      sizeof(msgData));
     todo_wine
-- 
1.4.1


More information about the wine-patches mailing list